Home » Author Archives: Tomasz Nurkiewicz (page 2)

Author Archives: Tomasz Nurkiewicz

Java EE developer, Scala enthusiast. Enjoying data analysis and visualization. Strongly believes in the power of testing and automation.

Asynchronous timeouts with CompletableFuture

java-logo

One day I was rewriting poorly implemented multi-threaded code that was blocking at some point on Future.get():                   public void serve() throws InterruptedException, ExecutionException, TimeoutException { final Future<Response> responseFuture = asyncCode(); final Response response = responseFuture.get(1, SECONDS); send(response); } private void send(Response response) { //... } This was actually an Akka application ...

Read More »

Accessing Meetup’s streaming API with RxNetty

java-interview-questions-answers

This article will touch upon multiple subjects: reactive programming, HTTP, parsing JSON and integrating with social API. All in one use case: we will load and process new meetup.com events in real time via non-bloking RxNetty library, combining the power of Netty framework and flexibility of RxJava library. Meetup provides publicly available streaming API that pushes every single Meetup registered ...

Read More »

Hazelcast member discovery using Curator and ZooKeeper

apache-hadoop-logo

At one project I was setting up Hazelcast cluster in a private cloud. Within cluster all nodes must see each other, so during bootstrapping Hazelcast will try to locate other cluster members. There is no server and all nodes are made equal. There are couple techniques of discovering members implemented in Hazelcast; unfortunately it wasn’t AWS so we couldn’t use ...

Read More »

Converting between Completablefuture and Observable

java-logo

CompletableFuture<T> from Java 8 is an advanced abstraction over a promise that value of type T will be available in the future. Observable<T> is quite similar, but it promises arbitrary number of items in the future, from 0 to infinity. These two representations of asynchronous results are quite similar to the point where Observable with just one item can be ...

Read More »

ExecutorService – 10 tips and tricks

java-logo

ExecutorService abstraction has been around since Java 5. We are talking about 2004 here. Just a quick reminder: both Java 5 and 6 are no longer supported, Java 7 won’t be in half a year. The reason I’m bringing this up is that many Java programmers still don’t fully understand how ExecutorService works. There are many places to learn that, ...

Read More »

Batching (collapsing) requests in Hystrix

java-interview-questions-answers

Hystrix has an advanced feature of collapsing (or batching) requests. If two or more commands run similar request at the same time, Hystrix can combine them together, run one batched request and dispatch split results back to all commands. Let’s first see how Hystrix works without collapsing. Imagine we have a service that looks up StockPriceof a given Ticker:   ...

Read More »

Property-based testing with ScalaCheck – custom generators

scala-logo

One of the core data structures provided by Hazelcast is IMap<K, V> extending java.util.concurrent.ConcurrentMap – which is basically a distributed map, often used as cache. You can configure such map to use custom MapLoader<K, V> – piece of Java code that will be asked every time you try to .get()something from that map (by key) which is not yet there. ...

Read More »

Hazelcast’s MapLoader pitfalls

hazelcast-logo

One of the core data structures provided by Hazelcast is IMap<K, V> extendingjava.util.concurrent.ConcurrentMap – which is basically a distributed map, often used as cache. You can configure such map to use custom MapLoader<K, V> – piece of Java code that will be asked every time you try to .get()something from that map (by key) which is not yet there. This ...

Read More »

Property-based testing with Spock

groovy-logo

Property based testing is an alternative approach to testing, complementing example based testing. The latter is what we’ve been doing all our lives: exercising production code against “examples” – inputs we think are representative. Picking these examples is an art on its own: “ordinary” inputs, edge cases, malformed inputs, etc. But why are we limiting ourselves to just few examples? ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close