2015 conference talks

The past 2015 has been very eventful year for me on both professional and private plan. I got married, moved to Sweden, started working for Klarna and did a lot of talks on events around Europe, here are the recordings and summaries of them

JPrime 2015: the core libraries you always wanted

It was a great community event organized by BGJUG. I also got a chance to meet up with some of the friends there. One big highlight of the conf for me was beeing able to meet Bozho, one of the top contributors on StackOveflow. We even got a selfie but after an extensive search I am unable to find it. The team is preparing next year's event and they had few smaller events in the meantime like JProffesionals. In any case here is my talk on goodies from Guava:


Voxxed days Belgrade 2015: Microservice and distributed systems decoupling patterns

A first-time event for the Heap Space community and the best Voxxed event I have been( probably best of them all). Great content, awesome speakers and superb organization. Some photo from the organizers :


Devoxx BE 2015 : Updates to the Java API for JSON Processing for Java EE 8 with Alex Soto

It is one of the best conference in the Java world and I was delighted to have a talk with Alex on the JSR we have been working on. It's the latest additions to the JSON processing for Java EE. One mind blowing thing for me was that in parallel with us there was a talk by Andrew Tanenbaum. And yes it is THE Andrew Tanenbaum. While there were tons of other great stuff during the conference this was my personal highlight.

Same year I also talked on VoxxedDays Istanbul and had a panel on EOUS. I am happy to have taken part in all of these events and hope to have brought value to the folks who listen them. Until next time ...

Published on Feb 29, 2016 by Mite Mitreski
Updated on 2/29/2016 12:01:00 AM

JFokus 2016 : Java Awesomeness in the Heart of Scandinavia

Originally published on Voxxed https://www.voxxed.com/blog/2016/02/jfokus-2016-bringing-awesomeness-heart-scandinavia/
After watching many sessions online, this year I was able to attend Jfokus in person for the first time. This was the 10th edition of the event, bringing over 1800 attendees. One other thing to note is that the conference was sold out 2 weeks in advance, which as JFokus main organiser Mattias Karlsson commented, "hasn't happened in several years". This is testament that the Java community is still alive and kicking after all this time.
 

Amusement park fair party As a prequel to the main conference, there was a JFokus VM Tech Summit chaired by my Klarna colleague Markus Lagergren. Unfortunately, I didn't got visit this part of the event but Simon Ritter has a great write up on the Azul blog. The same day university sessions with 3 hour presentations on topics ranging from Mob Programming to TinkerForge and RXJava. The conference day started off with a great keynote by Brian Goetz on Java's evolution and future evolution.
There were many great talks throughout the day and you can see the speaker lineup as well as some of the presentation slides on the schedule page. I would really like to highlight a few which really got me thinking:
  • 'Git from the Bits Up' by Tim Berglund followed the creation of a git repository and how the information is internally represented by looking at the .git folder.
  • 'From Concurrent to Parallel' by Brian Goetz took me back to the college days of a parallel vs. serial code
  • Making Java more dynamic by Rafael Winterhalter covered the awesome topic of bytecode manipulation and how Byte Buddy can make things more simple.
Throughout the conference, Stephen Chin was live streaming and filming his NightHacking sessions. You can find the recordings on his blog but I would like to recommend the one from Simon Ritter on Struct-Like Performance in Java. The organisation was also excellent - internet at all times and no technical problems. I particularly enjoyed the amusement park-like theme of the party and the Atlassian and Red Hat bars. What followed the conference as a three day speakers (un)conference. Unfortunately this was not open for the general public, but two lucky people were selected to join the speakers in Vemdalen. Having taken part in unconferences before, I do understand the need to keep it small, but I would say that having few more outsiders is always good for the community. Here are few Tweets from behind the scenes:
Last but not least, here is a message from the JFokus team
And a few other images of the event up on the Flickr page,
Published on Feb 26, 2016 by Mite Mitreski
Updated on 2/26/2016 07:51:00 PM

HttpClient 4.x Timeout



HttpClient is one of the most versatile Java libraries. Unfortunately, it comes with a lot of configuration options that may be way too cryptic or difficult. While the API for 4.x series has been significantly improved there are still some sharp edges.

The deprecated or 3.x way of setting the timeout.

This is done using params. Note that this is still 4.x code but a deprecated one.

DefaultHttpClient httpClient = ...;
   
HttpParams httpParams = httpClient.getParams();
httpParams.setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 1000L);
httpParams.setParameter(CoreConnectionPNames.SO_TIMEOUT, 1000L);
httpParams.setParameter(ClientPNames.CONN_MANAGER_TIMEOUT, 1000L);


Now the part httpClient.getParams() is deprecated since obviously this is a nasty API. You need to keep track of parameters with Enums/constants and their type as well.

The right 4.x way aka the builder way


HttpClient 4 is full of builder for everything. While I often love the Builder patterns in some cases the testing part is really difficult but I guess it is always a tradeoff. This would be the "right way".


public RequestConfig requestConfigWithTimeout(int timeoutInMilliseconds) {
        return RequestConfig.copy(RequestConfig.DEFAULT)
                .setSocketTimeout(timeoutInMilliseconds)
                .setConnectTimeout(timeoutInMilliseconds)
                .setConnectionRequestTimeout(timeoutInMilliseconds)
                .build();
}

The meaning of the parameters

Notice that we are actually setting 3 different timeouts.
  • Socket Timeout - this is the time of inactivity to wait for packets to arrive
  • Connection Timeout - the time to establish a connection with the remote host
  • Connection Manager Timeout - the time to fetch a connection from the connection pool
The third one costed me dearly, it wasn't until the client was under a high load that issues started happening. The connection pool I was using had 10 connections per route limitation set and the scenario was quite common. As you can see these settings do not provide a mechanism for making an N millisecond hard timeout.

If we were to setup the timeout to 10 seconds on each of this we could end up with a request that lasts 9(sec to get a connection) + 9( sec to open connection ) + 9( sec of inactivity ) = 27 sec.

More info

A bug when setting the ConnectionRequestTimeout
The RequestConfig Javadoc
Apache HttpClient examples
Published on Feb 4, 2015 by Mite Mitreski
Updated on 2/04/2015 12:51:00 AM