*/
public int topLevelPrepare ()
{
int result = TwoPhaseOutcome.PREPARE_NOTOK;
StateManager sm = super.objectAddr;
LogWriteStateManager lwsm = null;
boolean writeToLog = true;
try
{
lwsm = (LogWriteStateManager) sm;
writeToLog = lwsm.writeOptimisation();
}
catch (ClassCastException ex)
{
writeToLog = false;
}
if ((sm != null) && (store != null))
{
topLevelState = new OutputObjectState(sm.get_uid(), sm.type());
if (writeToLog || (!store.fullCommitNeeded() &&
(sm.save_state(topLevelState, ObjectType.ANDPERSISTENT)) &&
(topLevelState.size() <= PersistenceRecord.MAX_OBJECT_SIZE)))
{
if (PersistenceRecord.classicPrepare)
{
OutputObjectState dummy = new OutputObjectState(Uid.nullUid(), null);
/*
* Write an empty shadow state to the store to indicate
* one exists, and to prevent bogus activation in the case
* where crash recovery hasn't run yet.
*/
try
{
store.write_uncommitted(sm.get_uid(), sm.type(), dummy);
result = TwoPhaseOutcome.PREPARE_OK;
}
catch (ObjectStoreException e)
{
tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_21",e);
}
dummy = null;
}
else
{
result = TwoPhaseOutcome.PREPARE_OK;
}
}
else
{
if (sm.deactivate(store.getStoreName(), false))
{
shadowMade = true;
result = TwoPhaseOutcome.PREPARE_OK;
}