Skip to content

Instantly share code, notes, and snippets.

@gakuzzzz
Created August 22, 2012 16:18
Show Gist options
  • Save gakuzzzz/3427137 to your computer and use it in GitHub Desktop.
Save gakuzzzz/3427137 to your computer and use it in GitHub Desktop.
EntityContext
public interface EntityContext {
Object get();
void set(Object entity);
void remove();
}
public class EntityContextImpl implements EntityContext {
private final ThreadLocal<Object> context = new ThreadLocal<Object>();
public Object get() {
return context.get();
}
public void set(Object entity) {
context.set(entity);
}
public void remove() {
context.remove();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment