mirror of https://github.com/apache/openjpa.git
OPENJPA-2353: Reduce object allocations in DetachManagerLite.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1458026 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1febbf7b16
commit
582cfc504a
|
@ -32,9 +32,11 @@ import org.apache.openjpa.util.Proxy;
|
|||
*/
|
||||
public class DetachManagerLite {
|
||||
private final boolean _detachProxies;
|
||||
private final TransferFieldManager _tsm;
|
||||
|
||||
public DetachManagerLite(OpenJPAConfiguration conf) {
|
||||
public DetachManagerLite(OpenJPAConfiguration conf) {
|
||||
_detachProxies = conf.getDetachStateInstance().getDetachProxyFields();
|
||||
_tsm = new TransferFieldManager();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -44,7 +46,7 @@ public class DetachManagerLite {
|
|||
* The StateManagers to be detached.
|
||||
*/
|
||||
public void detachAll(Collection<StateManagerImpl> states) {
|
||||
TransferFieldManager fm = new TransferFieldManager();
|
||||
|
||||
for (StateManagerImpl sm : states) {
|
||||
ClassMetaData cmd = sm.getMetaData();
|
||||
if (sm.isPersistent() && cmd.isDetachable()) {
|
||||
|
@ -54,7 +56,7 @@ public class DetachManagerLite {
|
|||
BitSet loaded = sm.getLoaded();
|
||||
for (FieldMetaData fmd : cmd.getProxyFields()) {
|
||||
if (loaded.get(fmd.getIndex())) {
|
||||
detachProxyField(fmd, pc, sm, fm);
|
||||
detachProxyField(fmd, pc, sm, _tsm);
|
||||
}
|
||||
}
|
||||
pc.pcReplaceStateManager(null);
|
||||
|
|
Loading…
Reference in New Issue