Java Code Geeks » Tomasz Nurkiewicz http://www.javacodegeeks.com/ Java 2 Java Developers Resource Center Mon, 02 Mar 2015 11:00:09 +0000 en-US hourly 1 http://wordpress.org/?v=4.1.1 Journey to idempotency and temporal decouplinghttp://www.javacodegeeks.com/2015/02/journey-to-idempotency-and-temporal-decoupling.html http://www.javacodegeeks.com/2015/02/journey-to-idempotency-and-temporal-decoupling.html#comments Sat, 28 Feb 2015 13:00:57 +0000 http://www.javacodegeeks.com/?p=37466 Idempotency in HTTP means that the same request can be performed multiple times with the same effect as if it was executed just once. If you replace current state of some resource with new one, no matter how many times you do so, in the end state will be the same as if you did […]

 

]]>
http://www.javacodegeeks.com/2015/02/journey-to-idempotency-and-temporal-decoupling.html/feed/ 0
Retry-After HTTP header in practicehttp://www.javacodegeeks.com/2015/02/retry-http-header-practice.html http://www.javacodegeeks.com/2015/02/retry-http-header-practice.html#comments Fri, 13 Feb 2015 08:00:07 +0000 http://www.javacodegeeks.com/?p=36963 Retry-After is a lesser known HTTP response header. Let me quote relevant part of RFC 2616 (HTTP 1.1 spec): 14.37 Retry-After The Retry-After response-header field can be used with a 503 (Service Unavailable) response to indicate how long the service is expected to be unavailable to the requesting client. This field MAY also be used […]

 

]]>
http://www.javacodegeeks.com/2015/02/retry-http-header-practice.html/feed/ 0
Storing months of historical metrics from Hystrix in Graphitehttp://www.javacodegeeks.com/2015/02/storing-months-historical-metrics-hystrix-graphite.html http://www.javacodegeeks.com/2015/02/storing-months-historical-metrics-hystrix-graphite.html#comments Fri, 06 Feb 2015 14:00:18 +0000 http://www.javacodegeeks.com/?p=36651 One of the killer-features of Hystrix is a low-latency, data-intensive and beautiful dashboard:                     Even though it’s just a side-effect of what Hystrix is really doing (circuit breakers, thread pools, timeouts, etc.), it tends to be the most impressive feature. In order to make it work […]

 

]]>
http://www.javacodegeeks.com/2015/02/storing-months-historical-metrics-hystrix-graphite.html/feed/ 0
Asynchronous timeouts with CompletableFuturehttp://www.javacodegeeks.com/2014/12/asynchronous-timeouts-with-completablefuture.html http://www.javacodegeeks.com/2014/12/asynchronous-timeouts-with-completablefuture.html#comments Tue, 30 Dec 2014 20:00:20 +0000 http://www.javacodegeeks.com/?p=35049 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 […]

 

]]>
http://www.javacodegeeks.com/2014/12/asynchronous-timeouts-with-completablefuture.html/feed/ 0
Accessing Meetup’s streaming API with RxNettyhttp://www.javacodegeeks.com/2014/12/accessing-meetups-streaming-api-with-rxnetty.html http://www.javacodegeeks.com/2014/12/accessing-meetups-streaming-api-with-rxnetty.html#comments Tue, 23 Dec 2014 11:00:17 +0000 http://www.javacodegeeks.com/?p=34439 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 […]

 

]]>
http://www.javacodegeeks.com/2014/12/accessing-meetups-streaming-api-with-rxnetty.html/feed/ 0
Hazelcast member discovery using Curator and ZooKeeperhttp://www.javacodegeeks.com/2014/12/hazelcast-member-discovery-using-curator-and-zookeeper.html http://www.javacodegeeks.com/2014/12/hazelcast-member-discovery-using-curator-and-zookeeper.html#comments Fri, 19 Dec 2014 05:00:13 +0000 http://www.javacodegeeks.com/?p=34648 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 […]

 

]]>
http://www.javacodegeeks.com/2014/12/hazelcast-member-discovery-using-curator-and-zookeeper.html/feed/ 0
Converting between Completablefuture and Observablehttp://www.javacodegeeks.com/2014/12/converting-between-completablefuture-and-observable.html http://www.javacodegeeks.com/2014/12/converting-between-completablefuture-and-observable.html#comments Mon, 01 Dec 2014 11:00:19 +0000 http://www.javacodegeeks.com/?p=33533 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 […]

 

]]>
http://www.javacodegeeks.com/2014/12/converting-between-completablefuture-and-observable.html/feed/ 0
ExecutorService – 10 tips and trickshttp://www.javacodegeeks.com/2014/11/executorservice-10-tips-and-tricks.html http://www.javacodegeeks.com/2014/11/executorservice-10-tips-and-tricks.html#comments Mon, 24 Nov 2014 11:00:04 +0000 http://www.javacodegeeks.com/?p=33430 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 […]

 

]]>
http://www.javacodegeeks.com/2014/11/executorservice-10-tips-and-tricks.html/feed/ 1
Batching (collapsing) requests in Hystrixhttp://www.javacodegeeks.com/2014/11/batching-collapsing-requests-in-hystrix.html http://www.javacodegeeks.com/2014/11/batching-collapsing-requests-in-hystrix.html#comments Tue, 11 Nov 2014 05:00:10 +0000 http://www.javacodegeeks.com/?p=32563 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 […]

 

]]>
http://www.javacodegeeks.com/2014/11/batching-collapsing-requests-in-hystrix.html/feed/ 0
Property-based testing with ScalaCheck – custom generatorshttp://www.javacodegeeks.com/2014/10/property-based-testing-with-scalacheck-custom-generators.html http://www.javacodegeeks.com/2014/10/property-based-testing-with-scalacheck-custom-generators.html#comments Thu, 09 Oct 2014 07:00:24 +0000 http://www.javacodegeeks.com/?p=30607 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) […]

 

]]>
http://www.javacodegeeks.com/2014/10/property-based-testing-with-scalacheck-custom-generators.html/feed/ 0