OPENJPA-2353: Fix bug in BrokerImpl.initializeOperatingSet() initialization after deserialization.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1458432 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Richard G. Curtis 2013-03-19 17:55:17 +00:00
parent 582cfc504a
commit 3d5df48bbb
1 changed files with 16 additions and 2 deletions

View File

@ -196,8 +196,8 @@ public class BrokerImpl implements Broker, FindCallbacks, Cloneable, Serializabl
// these are used for method-internal state only // these are used for method-internal state only
private transient Map<Object, StateManagerImpl> _loading = null; private transient Map<Object, StateManagerImpl> _loading = null;
private transient Set<Object> _operating = MapBackedSet.decorate(new IdentityHashMap<Object, Object>());; private transient Set<Object> _operating = null;
private transient boolean _operatingDirty = false; private transient boolean _operatingDirty = true;
private Set<Class<?>> _persistedClss = null; private Set<Class<?>> _persistedClss = null;
private Set<Class<?>> _updatedClss = null; private Set<Class<?>> _updatedClss = null;
@ -342,7 +342,10 @@ public class BrokerImpl implements Broker, FindCallbacks, Cloneable, Serializabl
_log = _conf.getLog(OpenJPAConfiguration.LOG_RUNTIME); _log = _conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);
if (!fromDeserialization) if (!fromDeserialization)
_cache = new ManagedCache(this); _cache = new ManagedCache(this);
// Force creation of a new operating set
_operatingDirty = true;
initializeOperatingSet(); initializeOperatingSet();
_connRetainMode = connMode; _connRetainMode = connMode;
_managed = managed; _managed = managed;
if (managed) if (managed)
@ -4790,6 +4793,10 @@ public class BrokerImpl implements Broker, FindCallbacks, Cloneable, Serializabl
// re-initialize the lock if needed. // re-initialize the lock if needed.
setMultithreaded(_multithreaded); setMultithreaded(_multithreaded);
// force recreation of set
_operatingDirty = true;
initializeOperatingSet();
if (isActive() && _runtime instanceof LocalManagedRuntime) if (isActive() && _runtime instanceof LocalManagedRuntime)
((LocalManagedRuntime) _runtime).begin(); ((LocalManagedRuntime) _runtime).begin();
} }
@ -5243,6 +5250,13 @@ public class BrokerImpl implements Broker, FindCallbacks, Cloneable, Serializabl
private boolean operatingAdd(Object o){ private boolean operatingAdd(Object o){
_operatingDirty = true; _operatingDirty = true;
try {
return _operating.add(o); return _operating.add(o);
}catch(NullPointerException npe){
System.out.print(false);
}
return false;
} }
} }