io.virtdata.libbasics.core.threadstate.SharedState Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of virtdata-lib-realer Show documentation
Show all versions of virtdata-lib-realer Show documentation
With inspiration from other libraries
package io.virtdata.libbasics.core.threadstate;
import java.util.*;
/**
* This provides common thread local instancing for sharing a thread local map across classes.
*/
public class SharedState {
// A thread-local map of objects by name
public static ThreadLocal> tl_ObjectMap = ThreadLocal.withInitial(HashMap::new);
// A thread-local stack of objects by name
public static ThreadLocal> tl_ObjectStack = ThreadLocal.withInitial(ArrayDeque::new);
// A global map of objects for constant pool, etc.
public static Map gl_ObjectMap = new HashMap<>();
}