Data retrieval service with exponential backoff

Posted on Leave a commentPosted in java

Here we will create Data retrieval service with exponential backoff that we covered in the previous post. Implementation   package;   import java.util.Date; import java.util.Objects; import java.util.concurrent.TimeUnit; import java.util.function.Function; import java.util.function.ObjLongConsumer; import java.util.function.Supplier;   import org.slf4j.Logger; import org.slf4j.LoggerFactory;   public class DataRetrievalWithBackoff implements Runnable { public final Logger LOGGER = LoggerFactory.getLogger(DataRetrievalWithBackoff.class);   private final […]

Exponential backoff

Posted on Leave a commentPosted in Uncategorized

In a variety of computer networks, binary exponential backoff or truncated binary exponential backoff refers to an algorithm used to space out repeated retransmissions of the same block of data, often as part of network congestion avoidance. Wikipedia Exponential backoff Here is an implementation in Java /** * Calculate Exponential backoff * * @param attempt […]

Run MD5 check sum against all files in a directory

Posted on Leave a commentPosted in development

Couple snippets that allow us to run checksum and get unique md5 checksums. This is two step process. First, we obtain our md5 checksum for all files find -type f -exec md5sum "{}" + > /opt/checklist.chkfind -type f -exec md5sum "{}" + > /opt/checklist.chk This produces file with following contents 71cc452a8ac5a27c32a83e6a0909e7ae ./PID_190_7344_0_47710322.tif6712032974632727465.tiff 71cc452a8ac5a27c32a83e6a0909e7ae ./PID_190_7344_0_47710322.tif174464329785828524.tiff 71cc452a8ac5a27c32a83e6a0909e7ae […]

Generate ID from UUID

Posted on 2 CommentsPosted in java

This is a method to generate a long id in the positive space. There are few issues to consider with this method – UUID is 16 bytes / 128 bits – Long is 8 bytes / 64 bits This means that we will loose some information, if we don’t want to lose that we could […]

Configuring Java JDK on Ubuntu

Posted on Leave a commentPosted in Uncategorized

This is an easy way to configure java on a linux box, all this information is available online. First we need to obtain the build. sudo wget Extract from tar sudo tar xzvf jdk-7u75-linux-x64.gz Create symbolic link so we can later update the version sudo ln -s /opt/jdk1.7.0_75/ /opt/java we edit the /etc/profile and […]