Subscribe to this blog

Follow by Email

Search This Blog

Posts

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 testi…

Java Day is an event that jug.mk organizes for the past 5 years. From the small group of enthusiastic presenters in EU-info center in Skopje to a full 7h filled with lectures at a cinema hall JavaDay has grown to be one of the leading technical events in the area.

What has changed over the years and what the future holds
We started out as a small event with only local speakers in 2009 happening each year since then. In 2013, we had 1 person outside of Macedonia. The need for diversity was becoming more apparent. 2014 was the year we went fully international with 6 speakers coming from Switzerland, Serbia, and Bulgaria. We had participants in the audience from all the neighboring countries.
The Bulgarian JUG presence was a great addition and an awesome connection between our JUGS.

The keynote Corsin Decurtins, CTO of Netcetera gave an awesome talk on "how to become a great developer".
To quote the abstract:At the core, the job of a software developer is and has always been t…

The JEP 213 - Milling Project Coin is a follow up to the Project Coin additions to Java 7. Note, as the JEP states, this isn't a Project Coin 2.0. It's more of an attempt at smoothing the "rough edges" that came along with these additions.
Just as a reminder - with the original Project Coin, among other things, we got:
Strings in switchBinary integral literals and underscores in numeric literalsMulti-catch and more precise rethrowImproved type inference for generic instance creation (diamond)Try-with-resources statementSimplified varargs method invocation
Try with resources has been a great simplification, especially when working with I/O code. The addition in JDK 9 is an improvement of the standard try-with-resources way of writing code.
Previously in Java 7 and 8 we had;
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
// Original try-with-resources statement from JDK 7 or 8
try (BufferedReader r1 = reader) {
// use buffered reader
…