Uncategorized

Kryo (missing no-arg constructor): java.nio.HeapByteBuffer

While serializing ByteBuffer using Kryo we will run into the following issue. Class cannot be created (missing no-arg constructor): java.nio.HeapByteBuffer To fix this we can create a custom serializer that will take a ByteBuffer and serialize it to and from Kryo. Serializer is rather simple all we need is two pieces of data, length of …

Kryo (missing no-arg constructor): java.nio.HeapByteBuffer Read More »

Exponential backoff

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 …

Exponential backoff Read More »

Grepping for multiple strings in a file

We will use egrep which accepts a regular expression to grep for multiple strings. tail -f localhost_access_log.txt | egrep “\” 404|\” 500″ Here our example looks at logs to see if we got 404 or 500 request. “GET /favicon.ico HTTP/1.1” 404 973 “GET /login.html HTTP/1.1” 500 1230 “GET /favicon.ico HTTP/1.1” 404 973