static boolean writeDetachedState(StateManagerImpl sm,
ObjectOutput out,
BitSet idxs) throws IOException {
if (!sm.isPersistent()) {
out.writeObject(null); // state
out.writeObject(null); // sm
return false;
}
// dirty state causes flush
flushDirty(sm);
Broker broker = sm.getBroker();
preDetach(broker, sm, idxs);
// write detached state object and state manager
DetachOptions opts = broker.getConfiguration().
getDetachStateInstance();
if (!opts.getDetachedStateManager()
|| !useDetachedStateManager(sm, opts)) {
out.writeObject(getDetachedState(sm, idxs));
out.writeObject(null);
return false;
}
out.writeObject(null);
out.writeObject(new DetachedStateManager(sm.getPersistenceCapable(),
sm, idxs, opts.getAccessUnloaded(), broker.getMultithreaded()));
return true;
}
Used by classes that externalize detached state. |