Skip to content

Instantly share code, notes, and snippets.

@theotherian
theotherian / ByteBuffer side effects
Created August 11, 2013 03:12
Bits.class is scary
Using ByteBuffer instances to allocate memory can be dodgy
@theotherian
theotherian / Jersey 2.0 client with generics
Last active December 20, 2015 22:18
Jersey 2.0 client with generics
It's easy to use Generics with Jersey 2.0 client
@theotherian
theotherian / ClientFactory.java
Last active July 23, 2020 11:21
configuring Jersey 2 client
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import org.apache.http.HttpHost;
import org.apache.http.conn.routing.HttpRoute;
import org.apache.http.impl.conn.PoolingClientConnectionManager;
import org.glassfish.jersey.apache.connector.ApacheClientProperties;
import org.glassfish.jersey.apache.connector.ApacheConnector;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.ClientProperties;
@theotherian
theotherian / Jersey ServerSide connector
Last active February 15, 2017 13:05
In memory request handling on the server side with Jersey
It's possible to handle requests in memory with Jersey client
@theotherian
theotherian / Handlebars Helper Functions with Jersey
Last active December 24, 2015 04:58
A way to map Handlebars helper functions on the server side within a Jersey resource
A way to map Handlebars helper functions on the server side within a Jersey resource
@theotherian
theotherian / Non-Blocking Guava Cache
Last active September 7, 2018 19:46
Blocking on cache reads beyond the first is just plain rude in my opinion, so refresh in the background.
Blocking on cache reads beyond the first is just plain rude in my opinion...
Guava is just better with JMX
@theotherian
theotherian / Binary Serialization Shootout Part 1
Last active January 1, 2016 04:29
A serialization shootout
JSON vs Smile vs Kryo
@theotherian
theotherian / Strong Soft Weak and Phantom References
Last active January 1, 2016 22:19
Different reference types in Java can be confusing
What does it mean?
@theotherian
theotherian / Jersey Client 1.x Example
Last active September 3, 2022 06:08
Setting up a Jersey 1.x client
Setting up a Jersey 1.x client