Skip to content

Instantly share code, notes, and snippets.

@tkfx
Created August 2, 2016 14:02
Show Gist options
  • Select an option

  • Save tkfx/08818456f3aa0c9dece71733719eb2fb to your computer and use it in GitHub Desktop.

Select an option

Save tkfx/08818456f3aa0c9dece71733719eb2fb to your computer and use it in GitHub Desktop.
private static final ThreadLocal<Integer> counter = new ThreadLocal<Integer>() {
@Override protected Integer initialValue() {
return 0;
}
};
private static void handleRequest() {
counter.set(counter.get() + 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment