private Map _fieldsMap; //(class name, String[] of fields)
private Map _threadLocalsMap; //(class name, ThreadLocal_Contents[] for fields)
private final boolean _enabled; //whether event thread enabled
public ThreadLocalListener() {
final WebApp app = Executions.getCurrent().getDesktop().getWebApp();
_fieldsMap = (Map) app.getAttribute("zkplus.util.ThreadLocalListener.fieldsMap");
_enabled = app.getConfiguration().isEventThreadEnabled();
if (_fieldsMap == null) {
_fieldsMap = new HashMap(8);
final String PREF = "zkplus.util.ThreadLocalListener.fieldsMap";
app.setAttribute(PREF, _fieldsMap);
//read preference
String val = app.getConfiguration().getPreference("ThreadLocal", null);
if (val == null)
val = Library.getProperty(PREF);
if (val != null) {
final Collection klassSets = CollectionsX.parse(null, val, ';');
for(Iterator its = klassSets.iterator(); its.hasNext(); ) {