private static boolean[] checkState(ProxyCollection proxy) { boolean[] state = new boolean[2]; DelayedProxy dProxy = (DelayedProxy)proxy; OpenJPAStateManager sm = dProxy.getDelayedOwner(); if (sm != null) { // If the broker assigned to this proxy is null, closed or no longer // manages the pc, produce a new one Broker broker = sm.getContext().getBroker(); if (dProxy.isDetached() || broker == null || broker.isClosed() || (!broker.isClosed() && !broker.isPersistent(sm.getPersistenceCapable()))) { state[0] = true; broker = dProxy.getBroker(); ((StateManagerImpl)sm).setBroker((BrokerImpl)broker); } if (dProxy.isDetached() || sm.getPersistenceCapable().pcGetStateManager() == null) { state[1] = true; if (dProxy.getOwnerStateManager() != null) { sm.getPersistenceCapable().pcReplaceStateManager(dProxy.getOwnerStateManager()); ((StateManagerImpl)dProxy.getOwnerStateManager()).setBroker((BrokerImpl)broker); } else { sm.getPersistenceCapable().pcReplaceStateManager( new DetachedValueStateManager(sm.getPersistenceCapable(), sm.getContext())); } } } return state; }
private static boolean[] checkState(ProxyCollection proxy) { boolean[] state = new boolean[2]; DelayedProxy dProxy = (DelayedProxy)proxy; OpenJPAStateManager sm = dProxy.getDelayedOwner(); if (sm != null) { // If the broker assigned to this proxy is null, closed or no longer // manages the pc, produce a new one Broker broker = sm.getContext().getBroker(); if (dProxy.isDetached() || broker == null || broker.isClosed() || (!broker.isClosed() && !broker.isPersistent(sm.getPersistenceCapable()))) { state[0] = true; broker = dProxy.getBroker(); ((StateManagerImpl)sm).setBroker((BrokerImpl)broker); } if (dProxy.isDetached() || sm.getPersistenceCapable().pcGetStateManager() == null) { state[1] = true; if (dProxy.getOwnerStateManager() != null) { sm.getPersistenceCapable().pcReplaceStateManager(dProxy.getOwnerStateManager()); ((StateManagerImpl)dProxy.getOwnerStateManager()).setBroker((BrokerImpl)broker); } else { sm.getPersistenceCapable().pcReplaceStateManager( new DetachedValueStateManager(sm.getPersistenceCapable(), sm.getContext())); } } } return state; }
private static boolean[] checkState(ProxyCollection proxy) { boolean[] state = new boolean[2]; DelayedProxy dProxy = (DelayedProxy)proxy; OpenJPAStateManager sm = dProxy.getDelayedOwner(); if (sm != null) { // If the broker assigned to this proxy is null, closed or no longer // manages the pc, produce a new one Broker broker = sm.getContext().getBroker(); if (dProxy.isDetached() || broker == null || broker.isClosed() || (!broker.isClosed() && !broker.isPersistent(sm.getPersistenceCapable()))) { state[0] = true; broker = dProxy.getBroker(); ((StateManagerImpl)sm).setBroker((BrokerImpl)broker); } if (dProxy.isDetached() || sm.getPersistenceCapable().pcGetStateManager() == null) { state[1] = true; if (dProxy.getOwnerStateManager() != null) { sm.getPersistenceCapable().pcReplaceStateManager(dProxy.getOwnerStateManager()); ((StateManagerImpl)dProxy.getOwnerStateManager()).setBroker((BrokerImpl)broker); } else { sm.getPersistenceCapable().pcReplaceStateManager( new DetachedValueStateManager(sm.getPersistenceCapable(), sm.getContext())); } } } return state; }
private static boolean[] checkState(ProxyCollection proxy) { boolean[] state = new boolean[2]; DelayedProxy dProxy = (DelayedProxy)proxy; OpenJPAStateManager sm = dProxy.getDelayedOwner(); if (sm != null) { // If the broker assigned to this proxy is null, closed or no longer // manages the pc, produce a new one Broker broker = sm.getContext().getBroker(); if (dProxy.isDetached() || broker == null || broker.isClosed() || (!broker.isClosed() && !broker.isPersistent(sm.getPersistenceCapable()))) { state[0] = true; broker = dProxy.getBroker(); ((StateManagerImpl)sm).setBroker((BrokerImpl)broker); } if (dProxy.isDetached() || sm.getPersistenceCapable().pcGetStateManager() == null) { state[1] = true; if (dProxy.getOwnerStateManager() != null) { sm.getPersistenceCapable().pcReplaceStateManager(dProxy.getOwnerStateManager()); ((StateManagerImpl)dProxy.getOwnerStateManager()).setBroker((BrokerImpl)broker); } else { sm.getPersistenceCapable().pcReplaceStateManager( new DetachedValueStateManager(sm.getPersistenceCapable(), sm.getContext())); } } } return state; }