Skip to content

Instantly share code, notes, and snippets.

@tkfx
Last active July 24, 2016 09:58
Show Gist options
  • Save tkfx/0f69d8fdb8b80ccdf66465f0539e73fb to your computer and use it in GitHub Desktop.
Save tkfx/0f69d8fdb8b80ccdf66465f0539e73fb to your computer and use it in GitHub Desktop.
private static final ThreadLocal<Integer> counter = new ThreadLocal<Integer>();
private static void handleRequest() {
if (counter.get() == null) {
counter.set(0);
}
counter.set(counter.get() + 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment