[jboss-svn-commits] JBL Code SVN: r30059 - in labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats: arjuna/coordinator and 3 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Nov 6 09:18:40 EST 2009
Author: mark.little at jboss.com
Date: 2009-11-06 09:18:39 -0500 (Fri, 06 Nov 2009)
New Revision: 30059
Added:
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/ActivationRecord.java
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/DisposeRecord.java
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/PersistenceRecord.java
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/RecoveryRecord.java
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/StateManagerFriend.java
Removed:
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/ActivationRecord.java
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/DisposeRecord.java
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/PersistenceRecord.java
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/RecoveryRecord.java
Modified:
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/StateManager.java
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/RecordType.java
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/TxLogWritePersistenceRecord.java
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/CadaverActivationRecord.java
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/CadaverRecord.java
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/coordinator/AppendLogTransaction.java
Log:
https://jira.jboss.org/jira/browse/JBTM-639
Deleted: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/ActivationRecord.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/ActivationRecord.java 2009-11-06 14:07:23 UTC (rev 30058)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/ActivationRecord.java 2009-11-06 14:18:39 UTC (rev 30059)
@@ -1,300 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-/*
- * Copyright (C) 1998, 1999, 2000, 2001,
- *
- * Arjuna Solutions Limited,
- * Newcastle upon Tyne,
- * Tyne and Wear,
- * UK.
- *
- * $Id: ActivationRecord.java 2342 2006-03-30 13:06:17Z $
- */
-
-package com.arjuna.ats.arjuna;
-
-import com.arjuna.ats.arjuna.logging.tsLogger;
-import com.arjuna.ats.arjuna.logging.FacilityCode;
-
-import com.arjuna.ats.arjuna.StateManager;
-import com.arjuna.ats.arjuna.coordinator.*;
-import com.arjuna.ats.arjuna.state.*;
-import java.io.PrintWriter;
-
-import com.arjuna.common.util.logging.*;
-
-public class ActivationRecord extends AbstractRecord
-{
-
- /*
- * This constructor is used to create a new instance of an ActivationRecord.
- */
-
- public ActivationRecord(int st, StateManager sm, BasicAction action)
- {
- super(sm.get_uid(), sm.type(), ObjectType.ANDPERSISTENT);
-
- objectAddr = sm;
- actionHandle = action;
- state = st;
-
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.CONSTRUCTORS,
- VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
- "ActivationRecord::ActivationRecord(" + state + ", "
- + sm.get_uid() + ")");
- }
- }
-
- public int typeIs ()
- {
- return RecordType.ACTIVATION;
- }
-
- public Object value ()
- {
- return (Object) new Integer(state);
- }
-
- /**
- * @message com.arjuna.ats.arjuna.ActivationRecord_1
- * [com.arjuna.ats.arjuna.ActivationRecord_1]
- * ActivationRecord::set_value() called illegally
- */
-
- public void setValue (Object v)
- {
- if (tsLogger.arjLoggerI18N.isWarnEnabled())
- tsLogger.arjLoggerI18N
- .warn("com.arjuna.ats.arjuna.ActivationRecord_1");
- }
-
- /**
- * nestedAbort causes the reset_state function of the object to be invoked
- * passing it the saved ObjectStatus.
- */
-
- public int nestedAbort ()
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS,
- VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
- "ActivationRecord::nestedAbort() for " + order());
- }
-
- int outcome = TwoPhaseOutcome.FINISH_ERROR;
-
- if ((objectAddr != null) && (actionHandle != null))
- outcome = (objectAddr.forgetAction(actionHandle, false,
- RecordType.ACTIVATION) ? TwoPhaseOutcome.FINISH_OK
- : TwoPhaseOutcome.FINISH_ERROR);
-
- return outcome;
- }
-
- /**
- * nestedCommit does nothing since the passing of the state up to the parent
- * action is handled by the record list merging system. In fact since
- * nested_prepare returns PREPARE_READONLY this function should never
- * actually be called.
- */
-
- public int nestedCommit ()
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS,
- VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
- "ActivationRecord::nestedCommit() for " + order());
- }
-
- return TwoPhaseOutcome.FINISH_OK;
- }
-
- public int nestedPrepare ()
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS,
- VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
- "ActivationRecord::nestedPrepare() for " + order());
- }
-
- return TwoPhaseOutcome.PREPARE_READONLY;
- }
-
- /**
- * topLevelAbort for Activation records is exactly like a nested abort.
- */
-
- public int topLevelAbort ()
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS,
- VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
- "ActivationRecord::topLevelAbort() for " + order());
- }
-
- return nestedAbort(); /* i.e., same as nested case */
- }
-
- /*
- * topLevelCommit has little to do for ActivationRecords other than to
- * ensure the object is forgotten by the object.
- */
-
- public int topLevelCommit ()
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS,
- VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
- "ActivationRecord::topLevelCommit() for " + order());
- }
-
- if ((objectAddr != null) && (actionHandle != null))
- {
- return (objectAddr.forgetAction(actionHandle, true,
- RecordType.ACTIVATION) ? TwoPhaseOutcome.FINISH_OK
- : TwoPhaseOutcome.FINISH_ERROR);
- }
-
- return TwoPhaseOutcome.FINISH_ERROR;
- }
-
- public int topLevelPrepare ()
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS,
- VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
- "ActivationRecord::topLevelPrepare() for " + order());
- }
-
- if (objectAddr == null)
- return TwoPhaseOutcome.PREPARE_NOTOK;
- else
- return TwoPhaseOutcome.PREPARE_OK;
- }
-
- /**
- * Saving of ActivationRecords is only undertaken during the Prepare phase
- * of the top level 2PC.
- *
- * @message com.arjuna.ats.arjuna.ActivationRecord_2
- * [com.arjuna.ats.arjuna.ActivationRecord_2] Invocation of
- * ActivationRecord::restore_state for {0} inappropriate - ignored
- * for {1}
- */
-
- public boolean restore_state (InputObjectState os, int v)
- {
- if (tsLogger.arjLoggerI18N.isWarnEnabled())
- {
- tsLogger.arjLoggerI18N.warn(
- "com.arjuna.ats.arjuna.ActivationRecord_2", new Object[]
- { type(), order() });
- }
-
- return false;
- }
-
- public boolean save_state (OutputObjectState os, ObjectType v)
- {
- return true;
- }
-
- public void print (PrintWriter strm)
- {
- super.print(strm);
- strm.println("ActivationRecord with state:\n" + state);
- }
-
- public String type ()
- {
- return "/StateManager/AbstractRecord/ActivationRecord";
- }
-
- public void merge (AbstractRecord a)
- {
- }
-
- public void alter (AbstractRecord a)
- {
- }
-
- /*
- * should_merge and should_replace are invoked by the record list manager to
- * determine if two records should be merged togethor or if the 'newer'
- * should replace the older. shouldAdd determines if the new record should
- * be added in addition to the existing record and is currently only invoked
- * if both of should_merge and should_replace return FALSE Default
- * implementations here always return FALSE - ie new records do not override
- * old
- */
-
- public boolean shouldAdd (AbstractRecord a)
- {
- return false;
- }
-
- public boolean shouldAlter (AbstractRecord a)
- {
- return false;
- }
-
- public boolean shouldMerge (AbstractRecord a)
- {
- return false;
- }
-
- public boolean shouldReplace (AbstractRecord a)
- {
- return false;
- }
-
- public ActivationRecord()
- {
- super();
-
- objectAddr = null;
- actionHandle = null;
- state = ObjectStatus.PASSIVE;
-
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.CONSTRUCTORS,
- VisibilityLevel.VIS_PROTECTED,
- FacilityCode.FAC_ABSTRACT_REC,
- "ActivationRecord::ActivationRecord()");
- }
- }
-
- private StateManager objectAddr;
-
- private BasicAction actionHandle;
-
- private int state;
-
-}
Deleted: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/DisposeRecord.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/DisposeRecord.java 2009-11-06 14:07:23 UTC (rev 30058)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/DisposeRecord.java 2009-11-06 14:18:39 UTC (rev 30059)
@@ -1,338 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-/*
- * Copyright (C) 1998, 1999, 2000, 2001,
- *
- * Arjuna Solutions Limited,
- * Newcastle upon Tyne,
- * Tyne and Wear,
- * UK.
- *
- * $Id: DisposeRecord.java 2342 2006-03-30 13:06:17Z $
- */
-
-/*
- *
- * Dipose Record Class.
- *
- */
-
-package com.arjuna.ats.arjuna;
-
-import com.arjuna.ats.arjuna.logging.tsLogger;
-import com.arjuna.ats.arjuna.logging.FacilityCode;
-
-import com.arjuna.ats.arjuna.coordinator.*;
-import com.arjuna.ats.arjuna.objectstore.ObjectStore;
-import com.arjuna.ats.arjuna.common.*;
-import com.arjuna.ats.arjuna.state.*;
-import com.arjuna.ats.arjuna.objectstore.ObjectStoreType;
-import com.arjuna.ats.internal.arjuna.abstractrecords.CadaverRecord;
-import com.arjuna.ats.internal.arjuna.common.UidHelper;
-
-import java.io.PrintWriter;
-
-import java.io.IOException;
-
-import com.arjuna.common.util.logging.*;
-
-public class DisposeRecord extends CadaverRecord
-{
-
- public DisposeRecord (ObjectStore objStore, StateManager sm)
- {
- super(null, objStore, sm);
-
- store = objStore;
-
- if (sm != null)
- {
- objectUid = sm.get_uid();
- typeName = sm.type();
- }
- else
- {
- objectUid = Uid.nullUid();
- typeName = null;
- }
-
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.CONSTRUCTORS, VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_ABSTRACT_REC,
- "DisposeRecord::DisposeRecord("+objStore+", "+objectUid+")");
- }
- }
-
- public boolean propagateOnAbort ()
- {
- return false;
- }
-
- public int typeIs ()
- {
- return RecordType.DISPOSE;
- }
-
- public int nestedAbort ()
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_ABSTRACT_REC, "DisposeRecord::nestedAbort() for "+order());
- }
-
- return TwoPhaseOutcome.FINISH_OK;
- }
-
- public int nestedCommit ()
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_ABSTRACT_REC, "DisposeRecord::nestedCommit() for "+order());
- }
-
- return TwoPhaseOutcome.FINISH_OK;
- }
-
- public int nestedPrepare ()
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_ABSTRACT_REC, "DisposeRecord::nestedPrepare() for "+order());
- }
-
- if ((store != null) && (objectUid.notEquals(Uid.nullUid())))
- return TwoPhaseOutcome.PREPARE_OK;
- else
- return TwoPhaseOutcome.PREPARE_NOTOK;
- }
-
- public int topLevelAbort ()
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_ABSTRACT_REC, "DisposeRecord::topLevelAbort() for "+order());
- }
-
- return TwoPhaseOutcome.FINISH_OK;
- }
-
- /**
- * At topLevelCommit we remove the state from the object store.
- *
- * @message com.arjuna.ats.arjuna.DisposeRecord_5 [com.arjuna.ats.arjuna.DisposeRecord_5] DisposeRecord::topLevelCommit - exception while deleting state {0}
- */
-
- public int topLevelCommit ()
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_ABSTRACT_REC, "DisposeRecord::topLevelCommit() for "+order());
- }
-
- if ((store != null) && (objectUid.notEquals(Uid.nullUid())))
- {
- try
- {
- if (store.remove_committed(objectUid, typeName))
- {
- // only valid if not doing recovery
-
- if (super.objectAddr != null)
- {
- super.objectAddr.destroyed();
- }
-
- return TwoPhaseOutcome.FINISH_OK;
- }
- }
- catch (Exception e)
- {
- if (tsLogger.arjLoggerI18N.isWarnEnabled())
- {
- tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.DisposeRecord_5",
- new Object[]{e});
- }
- }
- }
-
- return TwoPhaseOutcome.FINISH_ERROR;
- }
-
- public int topLevelPrepare ()
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
- "DisposeRecord::topLevelPrepare() for "+order());
- }
-
- if ((store != null) && (objectUid.notEquals(Uid.nullUid())))
- {
- return TwoPhaseOutcome.PREPARE_OK;
- }
- else
- return TwoPhaseOutcome.PREPARE_NOTOK;
- }
-
- public void print (PrintWriter strm)
- {
- strm.println("Dispose for:");
- super.print(strm);
- }
-
- public boolean doSave ()
- {
- return true;
- }
-
- /**
- * @message com.arjuna.ats.arjuna.DisposeRecord_1 [com.arjuna.ats.arjuna.DisposeRecord_1] DisposeRecord::save_state - type of store is unknown
- * @message com.arjuna.ats.arjuna.DisposeRecord_2 [com.arjuna.ats.arjuna.DisposeRecord_2] DisposeRecord::save_state - failed
- * @message com.arjuna.ats.arjuna.DisposeRecord_3 [com.arjuna.ats.arjuna.DisposeRecord_3] DisposeRecord::save_state - no object store defined.
- * @message com.arjuna.ats.arjuna.DisposeRecord_4 [com.arjuna.ats.arjuna.DisposeRecord_4] DisposeRecord::restore_state - invalid store type {0}
- */
-
- public boolean save_state (OutputObjectState os, int ot)
- {
- boolean res = true;
-
- if ((store != null) && (objectUid.notEquals(Uid.nullUid())))
- {
- if (!ObjectStoreType.valid(store.typeIs()))
- {
- if (tsLogger.arjLoggerI18N.isWarnEnabled())
- tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.DisposeRecord_1");
-
- res = false;
- }
- else
- {
- try
- {
- os.packInt(store.typeIs());
- store.pack(os);
-
- UidHelper.packInto(objectUid, os);
- os.packString(typeName);
- }
- catch (IOException e)
- {
- if (tsLogger.arjLoggerI18N.isWarnEnabled())
- tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.DisposeRecord_2");
- res = false;
- }
- }
- }
- else
- {
- if (tsLogger.arjLoggerI18N.isWarnEnabled())
- tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.DisposeRecord_3");
-
- res = false;
- }
-
- return res;
- }
-
- @SuppressWarnings("unchecked")
- public boolean restore_state (InputObjectState os, int ot)
- {
- boolean res = true;
- int objStoreType = 0;
-
- try
- {
- objStoreType = os.unpackInt();
-
- if (ObjectStoreType.valid(objStoreType))
- {
- Class osc = ObjectStoreType.typeToClass(objStoreType);
-
- store = (ObjectStore) osc.newInstance();
- store.unpack(os);
-
- objectUid = UidHelper.unpackFrom(os);
- typeName = os.unpackString();
- }
- else
- {
- if (tsLogger.arjLoggerI18N.isWarnEnabled())
- {
- tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.DisposeRecord_4",
- new Object[]{Integer.toString(objStoreType)});
- }
-
- res = false;
- }
- }
- catch (final Exception e)
- {
- res = false;
- }
-
- return res;
- }
-
- public String type ()
- {
- return "/StateManager/AbstractRecord/RecoveryRecord/PersistenceRecord/CadaverRecord/DisposeRecord";
- }
-
- public boolean shouldAdd (AbstractRecord a)
- {
- return false;
- }
-
- public boolean shouldMerge (AbstractRecord a)
- {
- return false;
- }
-
- public boolean shouldReplace (AbstractRecord a)
- {
- return false;
- }
-
- public boolean shouldAlter (AbstractRecord a)
- {
- return false;
- }
-
- public DisposeRecord ()
- {
- super();
-
- objectUid = new Uid(Uid.nullUid());
- typeName = null;
- store = null;
- }
-
- private Uid objectUid;
- private String typeName;
- private ObjectStore store;
-}
-
Deleted: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/PersistenceRecord.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/PersistenceRecord.java 2009-11-06 14:07:23 UTC (rev 30058)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/PersistenceRecord.java 2009-11-06 14:18:39 UTC (rev 30059)
@@ -1,628 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-/*
- * Copyright (C) 1998, 1999, 2000, 2001,
- *
- * Arjuna Solutions Limited,
- * Newcastle upon Tyne,
- * Tyne and Wear,
- * UK.
- *
- * $Id: PersistenceRecord.java 2342 2006-03-30 13:06:17Z $
- */
-
-package com.arjuna.ats.arjuna;
-
-import com.arjuna.ats.arjuna.logging.tsLogger;
-import com.arjuna.ats.arjuna.logging.FacilityCode;
-
-import com.arjuna.ats.arjuna.coordinator.*;
-import com.arjuna.ats.arjuna.common.arjPropertyManager;
-import com.arjuna.ats.arjuna.objectstore.ObjectStore;
-import com.arjuna.ats.arjuna.common.*;
-import com.arjuna.ats.arjuna.state.*;
-import com.arjuna.ats.arjuna.objectstore.ObjectStoreType;
-import java.io.PrintWriter;
-
-import com.arjuna.common.util.logging.*;
-
-import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
-import java.io.IOException;
-
-/**
- * A PersistenceRecord is created whenever a persistent object is
- * created/read/modified within the scope of a transaction. It is responsible
- * for ensuring that state changes are committed or rolled back on behalf of the
- * object depending upon the outcome of the transaction.
- *
- * @author Mark Little (mark at arjuna.com)
- * @version $Id: PersistenceRecord.java 2342 2006-03-30 13:06:17Z $
- * @since JTS 1.0.
- *
- *
- * @message com.arjuna.ats.arjuna.PersistenceRecord_1
- * [com.arjuna.ats.arjuna.PersistenceRecord_1]
- * PersistenceRecord::topLevelCommit() : About to commit state, uid =
- * {0}, ObjType = {1}
- * @message com.arjuna.ats.arjuna.PersistenceRecord_2
- * [com.arjuna.ats.arjuna.PersistenceRecord_2]
- * PersistenceRecord::topLevelCommit - commit_state call failed for {0}
- * @message com.arjuna.ats.arjuna.PersistenceRecord_3
- * [com.arjuna.ats.arjuna.PersistenceRecord_3]
- * PersistenceRecord::topLevelCommit - no state to commit!
- * @message com.arjuna.ats.arjuna.PersistenceRecord_4
- * [com.arjuna.ats.arjuna.PersistenceRecord_4]
- * PersistenceRecord::topLevelCommit - caught exception: {0}
- * @message com.arjuna.ats.arjuna.PersistenceRecord_5
- * [com.arjuna.ats.arjuna.PersistenceRecord_5]
- * PersistenceRecord::topLevelCommit - no object store specified!
- * @message com.arjuna.ats.arjuna.PersistenceRecord_6
- * [com.arjuna.ats.arjuna.PersistenceRecord_6]
- * PersistenceRecord::topLevelCommit - commit_state error
- * @message com.arjuna.ats.arjuna.PersistenceRecord_7
- * [com.arjuna.ats.arjuna.PersistenceRecord_7] PersistenceRecord
- * deactivate error
- * @message com.arjuna.ats.arjuna.PersistenceRecord_8
- * [com.arjuna.ats.arjuna.PersistenceRecord_8]
- * PersistenceRecord.topLevelPrepare - setup error!
- * @message com.arjuna.ats.arjuna.PersistenceRecord_9
- * [com.arjuna.ats.arjuna.PersistenceRecord_9]
- * PersistenceRecord::restore_state: Just unpacked object store type =
- * {0}
- * @message com.arjuna.ats.arjuna.PersistenceRecord_10
- * [com.arjuna.ats.arjuna.PersistenceRecord_10]
- * PersistenceRecord::restore_state: Failed to unpack object store type
- * @message com.arjuna.ats.arjuna.PersistenceRecord_11
- * [com.arjuna.ats.arjuna.PersistenceRecord_11]
- * PersistenceRecord::save_state - type of store is unknown
- * @message com.arjuna.ats.arjuna.PersistenceRecord_12
- * [com.arjuna.ats.arjuna.PersistenceRecord_12]
- * PersistenceRecord::save_state: Packed object store type = {0}
- * @message com.arjuna.ats.arjuna.PersistenceRecord_13
- * [com.arjuna.ats.arjuna.PersistenceRecord_13]
- * PersistenceRecord::save_state: Packed object store root
- * @message com.arjuna.ats.arjuna.PersistenceRecord_14
- * [com.arjuna.ats.arjuna.PersistenceRecord_14]
- * PersistenceRecord::save_state - packing top level state failed
- * @message com.arjuna.ats.arjuna.PersistenceRecord_15
- * [com.arjuna.ats.arjuna.PersistenceRecord_15]
- * PersistenceRecord::save_state - failed
- * @message com.arjuna.ats.arjuna.PersistenceRecord_16
- * [com.arjuna.ats.arjuna.PersistenceRecord_16]
- * PersistenceRecord::save_state - no object store defined for object
- * @message com.arjuna.ats.arjuna.PersistenceRecord_17
- * [com.arjuna.ats.arjuna.PersistenceRecord_17]
- * PersistenceRecord::PersistenceRecord() - crash recovery constructor
- * @message com.arjuna.ats.arjuna.PersistenceRecord_18
- * [com.arjuna.ats.arjuna.PersistenceRecord_18]
- * PersistenceRecord::topLevelAbort() - Expecting state but found none!
- * @message com.arjuna.ats.arjuna.PersistenceRecord_20
- * [com.arjuna.ats.arjuna.PersistenceRecord_20]
- * PersistenceRecord::topLevelAbort() - Received ObjectStoreException
- * {0}
- * @message com.arjuna.ats.arjuna.PersistenceRecord_21
- * [com.arjuna.ats.arjuna.PersistenceRecord_21]
- * PersistenceRecord.topLevelPrepare - write_uncommitted error
- */
-
-public class PersistenceRecord extends RecoveryRecord
-{
-
- /**
- * This constructor is used to create a new instance of PersistenceRecord.
- */
-
- public PersistenceRecord (OutputObjectState os, ObjectStore objStore, StateManager sm)
- {
- super(os, sm);
-
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.CONSTRUCTORS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC, "PersistenceRecord::PersistenceRecord("
- + os + ", " + sm.get_uid() + ")");
- }
-
- shadowMade = false;
- store = objStore;
- topLevelState = null;
- }
-
- /**
- * Redefintions of abstract functions inherited from RecoveryRecord.
- */
-
- public int typeIs ()
- {
- return RecordType.PERSISTENCE;
- }
-
- /**
- * topLevelAbort may have to remove the persistent state that was written
- * into the object store during the processing of topLevelPrepare. It then
- * does the standard abort processing.
- */
-
- public int topLevelAbort ()
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC, "PersistenceRecord::topLevelAbort() for "
- + order());
- }
-
- Uid uid = null;
- String type = null;
-
- if (shadowMade) // state written by StateManager instance
- {
- uid = order();
- type = getTypeOfObject();
- }
- else
- {
- if (topLevelState == null) // hasn't been prepared, so no state
- {
- return nestedAbort();
- }
- else
- {
- uid = topLevelState.stateUid();
- type = topLevelState.type();
- }
- }
-
- try
- {
- if (!store.remove_uncommitted(uid, type))
- {
- if (tsLogger.arjLoggerI18N.isWarnEnabled())
- {
- tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_19");
- }
-
- return TwoPhaseOutcome.FINISH_ERROR;
- }
- }
- catch (ObjectStoreException e)
- {
- if (tsLogger.arjLoggerI18N.isWarnEnabled())
- {
- tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_20", new Object[] { e }, e);
- }
-
- return TwoPhaseOutcome.FINISH_ERROR;
- }
-
- return nestedAbort();
- }
-
- /**
- * commit the state saved during the prepare phase.
- */
-
- public int topLevelCommit ()
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC, "PersistenceRecord::topLevelCommit() for "
- + order());
- }
-
- if (tsLogger.arjLoggerI18N.isDebugEnabled())
- {
- tsLogger.arjLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC, "com.arjuna.ats.arjuna.PersistenceRecord_1", new Object[]
- { order(), getTypeOfObject() });
- }
-
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- if (store != null)
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC, ", store = "
- + store + "(" + store.typeIs() + ")");
- }
- else
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC, "");
- }
- }
-
- boolean result = false;
-
- if (store != null)
- {
- try
- {
- if (shadowMade)
- {
- result = store.commit_state(order(), super.getTypeOfObject());
-
- if (!result)
- {
- if (tsLogger.arjLoggerI18N.isWarnEnabled())
- {
- tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_2", new Object[]
- { order() });
- }
- }
- }
- else
- {
- if (topLevelState != null)
- {
- result = store.write_committed(order(), super.getTypeOfObject(), topLevelState);
- }
- else
- {
- if (tsLogger.arjLoggerI18N.isWarnEnabled())
- tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_3");
- }
- }
- }
- catch (ObjectStoreException e)
- {
- if (tsLogger.arjLoggerI18N.isWarnEnabled())
- tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_4", new Object[]
- { e });
-
- result = false;
- }
- }
- else
- {
- if (tsLogger.arjLoggerI18N.isWarnEnabled())
- tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_5");
- }
-
- if (!result)
- {
- if (tsLogger.arjLoggerI18N.isWarnEnabled())
- tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_6");
- }
-
- super.forgetAction(true);
-
- return ((result) ? TwoPhaseOutcome.FINISH_OK
- : TwoPhaseOutcome.FINISH_ERROR);
- }
-
- /**
- * topLevelPrepare attempts to save the object. It will either do this in
- * the action intention list or directly in the object store by using the
- * 'deactivate' function of the object depending upon the size of the state.
- * To ensure that objects are correctly hidden while they are in an
- * uncommitted state if we use the abbreviated protocol then we write an
- * EMPTY object state as the shadow state - THIS MUST NOT BE COMMITTED.
- * Instead we write_committed the one saved in the intention list. If the
- * store cannot cope with being given an empty state we revert to the old
- * protocol.
- */
-
- public int topLevelPrepare ()
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC, "PersistenceRecord::topLevelPrepare() for "
- + order());
- }
-
- int result = TwoPhaseOutcome.PREPARE_NOTOK;
- StateManager sm = super.objectAddr;
-
- if ((sm != null) && (store != null))
- {
- topLevelState = new OutputObjectState(sm.get_uid(), sm.type());
-
- if (writeOptimisation
- || (!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;
- }
- else
- {
- if (tsLogger.arjLoggerI18N.isWarnEnabled())
- tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_7");
- }
- }
- }
- else
- {
- if (tsLogger.arjLoggerI18N.isWarnEnabled())
- tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_8");
- }
-
- return result;
- }
-
- /**
- * topLevelCleanup must leave the persistent state that was written in the
- * object store during the processing of topLevelPrepare intact. Crash
- * recovery will take care of its resolution
- */
-
- public int topLevelCleanup ()
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC, "PersistenceRecord::topLevelCleanup() for "
- + order());
- }
-
- return TwoPhaseOutcome.FINISH_OK;
- }
-
- /**
- * @return <code>true</code>
- */
-
- public boolean doSave ()
- {
- return true;
- }
-
- @SuppressWarnings("unchecked")
- public boolean restore_state (InputObjectState os, int ot)
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC, "PersistenceRecord::restore_state() for "
- + order());
- }
-
- boolean res = false;
- int objStoreType = 0;
-
- try
- {
- objStoreType = os.unpackInt();
-
- if (tsLogger.arjLoggerI18N.isDebugEnabled())
- {
- tsLogger.arjLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC, "com.arjuna.ats.arjuna.PersistenceRecord_9", new Object[]
- { Integer.toString(objStoreType) });
- }
-
- if (ObjectStoreType.valid(objStoreType))
- {
- /* discard old store before creating new */
-
- if (store == null)
- {
- Class oc = ObjectStoreType.typeToClass(objStoreType);
-
- store = (ObjectStore) oc.newInstance();
- }
-
- store.unpack(os);
- shadowMade = os.unpackBoolean();
-
- // topLevelState = null;
-
- if (!shadowMade)
- {
- topLevelState = new OutputObjectState(os);
- res = topLevelState.valid();
- }
- else
- res = true;
-
- return (res && super.restore_state(os, ot));
- }
- }
- catch (final Exception e)
- {
- if (tsLogger.arjLoggerI18N.isWarnEnabled())
- tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_10");
- }
-
- return res;
- }
-
- public boolean save_state (OutputObjectState os, int ot)
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC, "PersistenceRecord::save_state() for "
- + order());
- }
-
- boolean res = true;
-
- if (store != null)
- {
- if (!ObjectStoreType.valid(store.typeIs()))
- {
- if (tsLogger.arjLoggerI18N.isWarnEnabled())
- {
- tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_11");
- }
-
- res = false;
- }
- else
- {
- try
- {
- os.packInt(store.typeIs());
-
- if (tsLogger.arjLoggerI18N.isDebugEnabled())
- {
- tsLogger.arjLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC, "com.arjuna.ats.arjuna.PersistenceRecord_12", new Object[]
- { Integer.toString(store.typeIs()) });
- }
-
- store.pack(os);
-
- if (tsLogger.arjLoggerI18N.isDebugEnabled())
- {
- tsLogger.arjLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC, "com.arjuna.ats.arjuna.PersistenceRecord_13");
- }
-
- os.packBoolean(shadowMade);
-
- /*
- * If we haven't written a shadow state, then pack the state
- * into the transaction log.
- */
-
- if (!shadowMade)
- {
- res = (topLevelState != null);
-
- if (res)
- topLevelState.packInto(os);
- else
- {
- if (tsLogger.arjLoggerI18N.isWarnEnabled())
- tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_14");
- }
- }
- }
- catch (IOException e)
- {
- res = false;
-
- if (tsLogger.arjLoggerI18N.isWarnEnabled())
- tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_15");
- }
- }
- }
- else
- {
- if (tsLogger.arjLoggerI18N.isWarnEnabled())
- tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_16");
-
- try
- {
- os.packString(null);
- }
- catch (IOException e)
- {
- res = false;
- }
- }
-
- return res && super.save_state(os, ot);
- }
-
- public void print (PrintWriter strm)
- {
- super.print(strm); /* bypass RecoveryRecord */
-
- strm.println("PersistenceRecord with state:\n" + super.state);
- }
-
- public String type ()
- {
- return "/StateManager/AbstractRecord/RecoveryRecord/PersistenceRecord";
- }
-
- /**
- * Creates a 'blank' persistence record. This is used during crash recovery
- * when recreating the prepared list of a server atomic action.
- */
-
- public PersistenceRecord ()
- {
- super();
-
- if (tsLogger.arjLoggerI18N.isDebugEnabled())
- {
- tsLogger.arjLoggerI18N.debug(DebugLevel.CONSTRUCTORS, VisibilityLevel.VIS_PROTECTED, FacilityCode.FAC_ABSTRACT_REC, "com.arjuna.ats.arjuna.PersistenceRecord_17");
- }
-
- shadowMade = false;
- store = null;
- topLevelState = null;
- }
-
- /**
- * Cadaver records force write shadows. This operation supresses to
- * abbreviated commit This should never return false
- */
-
- protected boolean shadowForced ()
- {
- if (topLevelState == null)
- {
- shadowMade = true;
-
- return true;
- }
-
- /* I've already done the abbreviated protocol so its too late */
-
- return false;
- }
-
- // this value should really come from the object store implementation!
-
- public static final int MAX_OBJECT_SIZE = 4096; // block size
-
- protected boolean shadowMade;
- protected ObjectStore store;
- protected OutputObjectState topLevelState;
- protected static boolean classicPrepare = false;
-
- private static boolean writeOptimisation = false;
-
- static
- {
- classicPrepare = arjPropertyManager.getCoordinatorEnvironmentBean().isClassicPrepare();
-
- writeOptimisation = arjPropertyManager.getCoordinatorEnvironmentBean().isWriteOptimisation();
- }
-}
Deleted: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/RecoveryRecord.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/RecoveryRecord.java 2009-11-06 14:07:23 UTC (rev 30058)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/RecoveryRecord.java 2009-11-06 14:18:39 UTC (rev 30059)
@@ -1,358 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-/*
- * Copyright (C) 1998, 1999, 2000,
- *
- * Arjuna Solutions Limited,
- * Newcastle upon Tyne,
- * Tyne and Wear,
- * UK.
- *
- * $Id: RecoveryRecord.java 2342 2006-03-30 13:06:17Z $
- */
-
-package com.arjuna.ats.arjuna;
-
-import com.arjuna.ats.arjuna.logging.tsLogger;
-import com.arjuna.ats.arjuna.logging.FacilityCode;
-
-import com.arjuna.common.util.logging.*;
-
-import com.arjuna.ats.arjuna.coordinator.*;
-import com.arjuna.ats.arjuna.state.*;
-import java.io.PrintWriter;
-
-public class RecoveryRecord extends AbstractRecord
-{
-
- /**
- * This constructor is used to create a new instance of a RecoveryRecord.
- */
-
- public RecoveryRecord(OutputObjectState os, StateManager sm)
- {
- super(sm.get_uid(), sm.type(), ObjectType.ANDPERSISTENT);
-
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.CONSTRUCTORS,
- VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
- "RecoveryRecord::RecoveryRecord(" + os + ", "
- + sm.get_uid() + ")");
- }
-
- objectAddr = sm;
- state = os;
- actionHandle = BasicAction.Current();
- }
-
- public void finalize () throws Throwable
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.DESTRUCTORS,
- VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
- "RecoveryRecord.finalize() for " + order() + " type "
- + type());
- }
- super.finalize();
- }
-
- public int typeIs ()
- {
- return RecordType.RECOVERY;
- }
-
- public Object value ()
- {
- return state;
- }
-
- /**
- * @message com.arjuna.ats.arjuna.RecoveryRecord_1
- * [com.arjuna.ats.arjuna.RecoveryRecord_1] -
- * RecoveryRecord::setValue not given OutputObjectState.
- */
-
- public void setValue (Object newState)
- {
- if (newState instanceof OutputObjectState)
- state = (OutputObjectState) newState;
- else
- {
- if (tsLogger.arjLoggerI18N.isWarnEnabled())
- tsLogger.arjLoggerI18N
- .warn("com.arjuna.ats.arjuna.RecoveryRecord_1");
- }
- }
-
- /**
- * nestedAbort causes the restore_state function of the object to be invoked
- * passing it the saved ObjectState.
- *
- * @message com.arjuna.ats.arjuna.RecoveryRecord_2
- * [com.arjuna.ats.arjuna.RecoveryRecord_2] -
- * RecoveryRecord::nestedAbort - restore_state on object failed!
- */
-
- public int nestedAbort ()
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS,
- VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
- "RecoveryRecord::nestedAbort() for " + order());
- }
-
- /*
- * First check that we have a state. We won't have for records created
- * by crash recovery.
- */
-
- forgetAction(false);
-
- if (state != null)
- {
- if (state.notempty()) /* anything to restore ? */
- {
- InputObjectState oldState = new InputObjectState(state);
-
- int result = objectAddr.restore_state(oldState,
- ObjectType.RECOVERABLE) ? TwoPhaseOutcome.FINISH_OK
- : TwoPhaseOutcome.FINISH_ERROR;
-
- if (result == TwoPhaseOutcome.FINISH_ERROR)
- {
- if (tsLogger.arjLoggerI18N.isWarnEnabled())
- tsLogger.arjLoggerI18N
- .warn("com.arjuna.ats.arjuna.RecoveryRecord_2");
- }
-
- return result;
- }
- }
-
- return TwoPhaseOutcome.FINISH_OK;
- }
-
- /**
- * nestedCommit does nothing since the passing of the state up to the parent
- * action is handled by the record list merging system. In fact since
- * nestedPrepare returns PREPARE_READONLY this function should never
- * actaully be called
- */
-
- public int nestedCommit ()
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS,
- VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
- "RecoveryRecord::nestedCommit() for " + order());
- }
-
- return TwoPhaseOutcome.FINISH_OK;
- }
-
- public int nestedPrepare ()
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS,
- VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
- "RecoveryRecord::nestedPrepare() for " + order());
- }
-
- forgetAction(true);
-
- return TwoPhaseOutcome.PREPARE_READONLY;
- }
-
- /**
- * topLevelAbort for Recovery records implies the object state should be
- * restored to the saved state exactly like a nested abort.
- */
-
- public int topLevelAbort ()
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS,
- VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
- "RecoveryRecord::topLevelAbort() for " + order());
- }
-
- return nestedAbort(); /* i.e., same as nested case */
- }
-
- /**
- * topLevelCommit has nothing to do for RecoveryRecords as no changes have
- * been made in the object store. In fact since topLevelPrepare returns
- * PREPARE_READONLY this function should never actually be called
- */
-
- public int topLevelCommit ()
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS,
- VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
- "RecoveryRecord::topLevelCommit() for " + order());
- }
-
- forgetAction(true);
-
- return TwoPhaseOutcome.FINISH_OK;
- }
-
- /**
- * topLevelPrepare can return PREPARE_READONLY to avoid topLevelCommit being
- * called in the action commit case
- */
-
- public int topLevelPrepare ()
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS,
- VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
- "RecoveryRecord::topLevelPrepare() for " + order());
- }
-
- return TwoPhaseOutcome.PREPARE_READONLY;
- }
-
- /*
- * Saving of RecoveryRecords is only undertaken during the Prepare phase of
- * the top level 2PC. Since the managed objects are only recoverable (not
- * persistent) there is no need to save any information (or restore any
- * either). However, persistence records (derived from recovery records)
- * need to be saved for crash recovery purposes.
- */
-
- public boolean doSave ()
- {
- return false;
- }
-
- public boolean restore_state (InputObjectState os, int ot)
- {
- return super.restore_state(os, ot);
- }
-
- public boolean save_state (OutputObjectState os, int ot)
- {
- return super.save_state(os, ot);
- }
-
- public void print (PrintWriter strm)
- {
- super.print(strm);
- strm.println("RecoveryRecord with state:\n" + state);
- }
-
- public String type ()
- {
- return "/StateManager/AbstractRecord/RecoveryRecord";
- }
-
- public void merge (AbstractRecord a)
- {
- }
-
- public void alter (AbstractRecord a)
- {
- }
-
- /*
- * should_merge and should_replace are invoked by the record list manager to
- * determine if two records should be merged togethor or if the 'newer'
- * should replace the older. shouldAdd determines if the new record should
- * be added in addition to the existing record and is currently only invoked
- * if both of should_merge and should_replace return false Default
- * implementations here always return false - ie new records do not override
- * old.
- */
-
- public boolean shouldAdd (AbstractRecord a)
- {
- return false;
- }
-
- public boolean shouldAlter (AbstractRecord a)
- {
- return false;
- }
-
- public boolean shouldMerge (AbstractRecord a)
- {
- return false;
- }
-
- public boolean shouldReplace (AbstractRecord a)
- {
- return false;
- }
-
- /*
- * Creates a 'blank' recovery record. This is used during crash recovery
- * when recreating the prepared list of a server atomic action.
- */
-
- public RecoveryRecord()
- {
- super();
-
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.CONSTRUCTORS,
- VisibilityLevel.VIS_PROTECTED,
- FacilityCode.FAC_ABSTRACT_REC,
- "RecoveryRecord::RecoveryRecord()"
- + " - crash recovery constructor");
- }
-
- objectAddr = null;
- state = null;
- actionHandle = null;
- }
-
- /*
- * Can we use this to force our parent to "remember" us when we commit, and
- * prevent the system from creating another record in that action?
- */
-
- protected final void forgetAction (boolean commit)
- {
- if ((actionHandle != null) && (objectAddr != null))
- {
- objectAddr.forgetAction(actionHandle, commit, RecordType.RECOVERY);
- actionHandle = null; // only do this once!
- }
- }
-
- protected StateManager objectAddr;
-
- protected OutputObjectState state;
-
- private BasicAction actionHandle;
-
-}
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/StateManager.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/StateManager.java 2009-11-06 14:07:23 UTC (rev 30058)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/StateManager.java 2009-11-06 14:18:39 UTC (rev 30059)
@@ -46,8 +46,12 @@
import com.arjuna.ats.arjuna.logging.FacilityCode;
import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
+import com.arjuna.ats.internal.arjuna.abstractrecords.ActivationRecord;
import com.arjuna.ats.internal.arjuna.abstractrecords.CadaverActivationRecord;
import com.arjuna.ats.internal.arjuna.abstractrecords.CadaverRecord;
+import com.arjuna.ats.internal.arjuna.abstractrecords.DisposeRecord;
+import com.arjuna.ats.internal.arjuna.abstractrecords.PersistenceRecord;
+import com.arjuna.ats.internal.arjuna.abstractrecords.RecoveryRecord;
import com.arjuna.ats.internal.arjuna.common.UidHelper;
import java.io.IOException;
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/RecordType.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/RecordType.java 2009-11-06 14:07:23 UTC (rev 30058)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/RecordType.java 2009-11-06 14:18:39 UTC (rev 30059)
@@ -34,13 +34,13 @@
import java.io.*;
import com.arjuna.ats.arjuna.coordinator.abstractrecord.RecordTypeManager;
-import com.arjuna.ats.arjuna.ActivationRecord;
-import com.arjuna.ats.arjuna.DisposeRecord;
-import com.arjuna.ats.arjuna.PersistenceRecord;
-import com.arjuna.ats.arjuna.RecoveryRecord;
import com.arjuna.ats.internal.arjuna.TxLogWritePersistenceRecord;
+import com.arjuna.ats.internal.arjuna.abstractrecords.ActivationRecord;
import com.arjuna.ats.internal.arjuna.abstractrecords.CadaverRecord;
+import com.arjuna.ats.internal.arjuna.abstractrecords.DisposeRecord;
import com.arjuna.ats.internal.arjuna.abstractrecords.LastResourceRecord;
+import com.arjuna.ats.internal.arjuna.abstractrecords.PersistenceRecord;
+import com.arjuna.ats.internal.arjuna.abstractrecords.RecoveryRecord;
/**
* The following enumerated type defines the types of record that are derived
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/TxLogWritePersistenceRecord.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/TxLogWritePersistenceRecord.java 2009-11-06 14:07:23 UTC (rev 30058)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/TxLogWritePersistenceRecord.java 2009-11-06 14:18:39 UTC (rev 30059)
@@ -33,7 +33,6 @@
import com.arjuna.ats.arjuna.logging.tsLogger;
-import com.arjuna.ats.arjuna.PersistenceRecord;
import com.arjuna.ats.arjuna.ObjectType;
import com.arjuna.ats.arjuna.StateManager;
import com.arjuna.ats.arjuna.common.Uid;
@@ -42,6 +41,7 @@
import com.arjuna.ats.arjuna.objectstore.*;
import com.arjuna.ats.arjuna.exceptions.*;
import com.arjuna.ats.arjuna.state.*;
+import com.arjuna.ats.internal.arjuna.abstractrecords.PersistenceRecord;
/**
*/
Copied: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/ActivationRecord.java (from rev 30036, labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/ActivationRecord.java)
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/ActivationRecord.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/ActivationRecord.java 2009-11-06 14:18:39 UTC (rev 30059)
@@ -0,0 +1,300 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 1998, 1999, 2000, 2001,
+ *
+ * Arjuna Solutions Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: ActivationRecord.java 2342 2006-03-30 13:06:17Z $
+ */
+
+package com.arjuna.ats.internal.arjuna.abstractrecords;
+
+import com.arjuna.ats.arjuna.logging.tsLogger;
+import com.arjuna.ats.arjuna.logging.FacilityCode;
+
+import com.arjuna.ats.arjuna.ObjectStatus;
+import com.arjuna.ats.arjuna.ObjectType;
+import com.arjuna.ats.arjuna.StateManager;
+import com.arjuna.ats.arjuna.coordinator.*;
+import com.arjuna.ats.arjuna.state.*;
+import java.io.PrintWriter;
+
+import com.arjuna.common.util.logging.*;
+
+public class ActivationRecord extends AbstractRecord
+{
+
+ /*
+ * This constructor is used to create a new instance of an ActivationRecord.
+ */
+
+ public ActivationRecord(int st, StateManager sm, BasicAction action)
+ {
+ super(sm.get_uid(), sm.type(), ObjectType.ANDPERSISTENT);
+
+ objectAddr = sm;
+ actionHandle = action;
+ state = st;
+
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.CONSTRUCTORS,
+ VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
+ "ActivationRecord::ActivationRecord(" + state + ", "
+ + sm.get_uid() + ")");
+ }
+ }
+
+ public int typeIs ()
+ {
+ return RecordType.ACTIVATION;
+ }
+
+ public Object value ()
+ {
+ return (Object) new Integer(state);
+ }
+
+ /**
+ * @message com.arjuna.ats.arjuna.ActivationRecord_1
+ * [com.arjuna.ats.arjuna.ActivationRecord_1]
+ * ActivationRecord::set_value() called illegally
+ */
+
+ public void setValue (Object v)
+ {
+ if (tsLogger.arjLoggerI18N.isWarnEnabled())
+ tsLogger.arjLoggerI18N
+ .warn("com.arjuna.ats.arjuna.ActivationRecord_1");
+ }
+
+ /**
+ * nestedAbort causes the reset_state function of the object to be invoked
+ * passing it the saved ObjectStatus.
+ */
+
+ public int nestedAbort ()
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
+ "ActivationRecord::nestedAbort() for " + order());
+ }
+
+ int outcome = TwoPhaseOutcome.FINISH_ERROR;
+
+ if ((objectAddr != null) && (actionHandle != null))
+ outcome = (StateManagerFriend.forgetAction(objectAddr, actionHandle, false, RecordType.ACTIVATION) ? TwoPhaseOutcome.FINISH_OK
+ : TwoPhaseOutcome.FINISH_ERROR);
+
+ return outcome;
+ }
+
+ /**
+ * nestedCommit does nothing since the passing of the state up to the parent
+ * action is handled by the record list merging system. In fact since
+ * nested_prepare returns PREPARE_READONLY this function should never
+ * actually be called.
+ */
+
+ public int nestedCommit ()
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
+ "ActivationRecord::nestedCommit() for " + order());
+ }
+
+ return TwoPhaseOutcome.FINISH_OK;
+ }
+
+ public int nestedPrepare ()
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
+ "ActivationRecord::nestedPrepare() for " + order());
+ }
+
+ return TwoPhaseOutcome.PREPARE_READONLY;
+ }
+
+ /**
+ * topLevelAbort for Activation records is exactly like a nested abort.
+ */
+
+ public int topLevelAbort ()
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
+ "ActivationRecord::topLevelAbort() for " + order());
+ }
+
+ return nestedAbort(); /* i.e., same as nested case */
+ }
+
+ /*
+ * topLevelCommit has little to do for ActivationRecords other than to
+ * ensure the object is forgotten by the object.
+ */
+
+ public int topLevelCommit ()
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
+ "ActivationRecord::topLevelCommit() for " + order());
+ }
+
+ if ((objectAddr != null) && (actionHandle != null))
+ {
+ return (StateManagerFriend.forgetAction(objectAddr, actionHandle, true, RecordType.ACTIVATION) ? TwoPhaseOutcome.FINISH_OK
+ : TwoPhaseOutcome.FINISH_ERROR);
+ }
+
+ return TwoPhaseOutcome.FINISH_ERROR;
+ }
+
+ public int topLevelPrepare ()
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
+ "ActivationRecord::topLevelPrepare() for " + order());
+ }
+
+ if (objectAddr == null)
+ return TwoPhaseOutcome.PREPARE_NOTOK;
+ else
+ return TwoPhaseOutcome.PREPARE_OK;
+ }
+
+ /**
+ * Saving of ActivationRecords is only undertaken during the Prepare phase
+ * of the top level 2PC.
+ *
+ * @message com.arjuna.ats.arjuna.ActivationRecord_2
+ * [com.arjuna.ats.arjuna.ActivationRecord_2] Invocation of
+ * ActivationRecord::restore_state for {0} inappropriate - ignored
+ * for {1}
+ */
+
+ public boolean restore_state (InputObjectState os, int v)
+ {
+ if (tsLogger.arjLoggerI18N.isWarnEnabled())
+ {
+ tsLogger.arjLoggerI18N.warn(
+ "com.arjuna.ats.arjuna.ActivationRecord_2", new Object[]
+ { type(), order() });
+ }
+
+ return false;
+ }
+
+ public boolean save_state (OutputObjectState os, ObjectType v)
+ {
+ return true;
+ }
+
+ public void print (PrintWriter strm)
+ {
+ super.print(strm);
+ strm.println("ActivationRecord with state:\n" + state);
+ }
+
+ public String type ()
+ {
+ return "/StateManager/AbstractRecord/ActivationRecord";
+ }
+
+ public void merge (AbstractRecord a)
+ {
+ }
+
+ public void alter (AbstractRecord a)
+ {
+ }
+
+ /*
+ * should_merge and should_replace are invoked by the record list manager to
+ * determine if two records should be merged togethor or if the 'newer'
+ * should replace the older. shouldAdd determines if the new record should
+ * be added in addition to the existing record and is currently only invoked
+ * if both of should_merge and should_replace return FALSE Default
+ * implementations here always return FALSE - ie new records do not override
+ * old
+ */
+
+ public boolean shouldAdd (AbstractRecord a)
+ {
+ return false;
+ }
+
+ public boolean shouldAlter (AbstractRecord a)
+ {
+ return false;
+ }
+
+ public boolean shouldMerge (AbstractRecord a)
+ {
+ return false;
+ }
+
+ public boolean shouldReplace (AbstractRecord a)
+ {
+ return false;
+ }
+
+ public ActivationRecord()
+ {
+ super();
+
+ objectAddr = null;
+ actionHandle = null;
+ state = ObjectStatus.PASSIVE;
+
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.CONSTRUCTORS,
+ VisibilityLevel.VIS_PROTECTED,
+ FacilityCode.FAC_ABSTRACT_REC,
+ "ActivationRecord::ActivationRecord()");
+ }
+ }
+
+ private StateManager objectAddr;
+
+ private BasicAction actionHandle;
+
+ private int state;
+
+}
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/CadaverActivationRecord.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/CadaverActivationRecord.java 2009-11-06 14:07:23 UTC (rev 30058)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/CadaverActivationRecord.java 2009-11-06 14:18:39 UTC (rev 30059)
@@ -31,7 +31,6 @@
package com.arjuna.ats.internal.arjuna.abstractrecords;
-import com.arjuna.ats.arjuna.ActivationRecord;
import com.arjuna.ats.arjuna.ObjectStatus;
import com.arjuna.ats.arjuna.StateManager;
import com.arjuna.ats.arjuna.logging.tsLogger;
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/CadaverRecord.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/CadaverRecord.java 2009-11-06 14:07:23 UTC (rev 30058)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/CadaverRecord.java 2009-11-06 14:18:39 UTC (rev 30059)
@@ -31,7 +31,6 @@
package com.arjuna.ats.internal.arjuna.abstractrecords;
-import com.arjuna.ats.arjuna.PersistenceRecord;
import com.arjuna.ats.arjuna.StateManager;
import com.arjuna.ats.arjuna.logging.tsLogger;
import com.arjuna.ats.arjuna.logging.FacilityCode;
Copied: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/DisposeRecord.java (from rev 30036, labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/DisposeRecord.java)
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/DisposeRecord.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/DisposeRecord.java 2009-11-06 14:18:39 UTC (rev 30059)
@@ -0,0 +1,339 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 1998, 1999, 2000, 2001,
+ *
+ * Arjuna Solutions Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: DisposeRecord.java 2342 2006-03-30 13:06:17Z $
+ */
+
+/*
+ *
+ * Dipose Record Class.
+ *
+ */
+
+package com.arjuna.ats.internal.arjuna.abstractrecords;
+
+import com.arjuna.ats.arjuna.StateManager;
+import com.arjuna.ats.arjuna.logging.tsLogger;
+import com.arjuna.ats.arjuna.logging.FacilityCode;
+
+import com.arjuna.ats.arjuna.coordinator.*;
+import com.arjuna.ats.arjuna.objectstore.ObjectStore;
+import com.arjuna.ats.arjuna.common.*;
+import com.arjuna.ats.arjuna.state.*;
+import com.arjuna.ats.arjuna.objectstore.ObjectStoreType;
+import com.arjuna.ats.internal.arjuna.common.UidHelper;
+
+import java.io.PrintWriter;
+
+import java.io.IOException;
+
+import com.arjuna.common.util.logging.*;
+
+public class DisposeRecord extends CadaverRecord
+{
+
+ public DisposeRecord (ObjectStore objStore, StateManager sm)
+ {
+ super(null, objStore, sm);
+
+ store = objStore;
+
+ if (sm != null)
+ {
+ objectUid = sm.get_uid();
+ typeName = sm.type();
+ }
+ else
+ {
+ objectUid = Uid.nullUid();
+ typeName = null;
+ }
+
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.CONSTRUCTORS, VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_ABSTRACT_REC,
+ "DisposeRecord::DisposeRecord("+objStore+", "+objectUid+")");
+ }
+ }
+
+ public boolean propagateOnAbort ()
+ {
+ return false;
+ }
+
+ public int typeIs ()
+ {
+ return RecordType.DISPOSE;
+ }
+
+ public int nestedAbort ()
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_ABSTRACT_REC, "DisposeRecord::nestedAbort() for "+order());
+ }
+
+ return TwoPhaseOutcome.FINISH_OK;
+ }
+
+ public int nestedCommit ()
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_ABSTRACT_REC, "DisposeRecord::nestedCommit() for "+order());
+ }
+
+ return TwoPhaseOutcome.FINISH_OK;
+ }
+
+ public int nestedPrepare ()
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_ABSTRACT_REC, "DisposeRecord::nestedPrepare() for "+order());
+ }
+
+ if ((store != null) && (objectUid.notEquals(Uid.nullUid())))
+ return TwoPhaseOutcome.PREPARE_OK;
+ else
+ return TwoPhaseOutcome.PREPARE_NOTOK;
+ }
+
+ public int topLevelAbort ()
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_ABSTRACT_REC, "DisposeRecord::topLevelAbort() for "+order());
+ }
+
+ return TwoPhaseOutcome.FINISH_OK;
+ }
+
+ /**
+ * At topLevelCommit we remove the state from the object store.
+ *
+ * @message com.arjuna.ats.arjuna.DisposeRecord_5 [com.arjuna.ats.arjuna.DisposeRecord_5] DisposeRecord::topLevelCommit - exception while deleting state {0}
+ */
+
+ public int topLevelCommit ()
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_ABSTRACT_REC, "DisposeRecord::topLevelCommit() for "+order());
+ }
+
+ if ((store != null) && (objectUid.notEquals(Uid.nullUid())))
+ {
+ try
+ {
+ if (store.remove_committed(objectUid, typeName))
+ {
+ // only valid if not doing recovery
+
+ if (super.objectAddr != null)
+ {
+ StateManagerFriend.destroyed(super.objectAddr);
+ //super.objectAddr.destroyed();
+ }
+
+ return TwoPhaseOutcome.FINISH_OK;
+ }
+ }
+ catch (final Throwable e)
+ {
+ if (tsLogger.arjLoggerI18N.isWarnEnabled())
+ {
+ tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.DisposeRecord_5",
+ new Object[]{e});
+ }
+ }
+ }
+
+ return TwoPhaseOutcome.FINISH_ERROR;
+ }
+
+ public int topLevelPrepare ()
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
+ "DisposeRecord::topLevelPrepare() for "+order());
+ }
+
+ if ((store != null) && (objectUid.notEquals(Uid.nullUid())))
+ {
+ return TwoPhaseOutcome.PREPARE_OK;
+ }
+ else
+ return TwoPhaseOutcome.PREPARE_NOTOK;
+ }
+
+ public void print (PrintWriter strm)
+ {
+ strm.println("Dispose for:");
+ super.print(strm);
+ }
+
+ public boolean doSave ()
+ {
+ return true;
+ }
+
+ /**
+ * @message com.arjuna.ats.arjuna.DisposeRecord_1 [com.arjuna.ats.arjuna.DisposeRecord_1] DisposeRecord::save_state - type of store is unknown
+ * @message com.arjuna.ats.arjuna.DisposeRecord_2 [com.arjuna.ats.arjuna.DisposeRecord_2] DisposeRecord::save_state - failed
+ * @message com.arjuna.ats.arjuna.DisposeRecord_3 [com.arjuna.ats.arjuna.DisposeRecord_3] DisposeRecord::save_state - no object store defined.
+ * @message com.arjuna.ats.arjuna.DisposeRecord_4 [com.arjuna.ats.arjuna.DisposeRecord_4] DisposeRecord::restore_state - invalid store type {0}
+ */
+
+ public boolean save_state (OutputObjectState os, int ot)
+ {
+ boolean res = true;
+
+ if ((store != null) && (objectUid.notEquals(Uid.nullUid())))
+ {
+ if (!ObjectStoreType.valid(store.typeIs()))
+ {
+ if (tsLogger.arjLoggerI18N.isWarnEnabled())
+ tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.DisposeRecord_1");
+
+ res = false;
+ }
+ else
+ {
+ try
+ {
+ os.packInt(store.typeIs());
+ store.pack(os);
+
+ UidHelper.packInto(objectUid, os);
+ os.packString(typeName);
+ }
+ catch (IOException e)
+ {
+ if (tsLogger.arjLoggerI18N.isWarnEnabled())
+ tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.DisposeRecord_2");
+ res = false;
+ }
+ }
+ }
+ else
+ {
+ if (tsLogger.arjLoggerI18N.isWarnEnabled())
+ tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.DisposeRecord_3");
+
+ res = false;
+ }
+
+ return res;
+ }
+
+ @SuppressWarnings("unchecked")
+ public boolean restore_state (InputObjectState os, int ot)
+ {
+ boolean res = true;
+ int objStoreType = 0;
+
+ try
+ {
+ objStoreType = os.unpackInt();
+
+ if (ObjectStoreType.valid(objStoreType))
+ {
+ Class osc = ObjectStoreType.typeToClass(objStoreType);
+
+ store = (ObjectStore) osc.newInstance();
+ store.unpack(os);
+
+ objectUid = UidHelper.unpackFrom(os);
+ typeName = os.unpackString();
+ }
+ else
+ {
+ if (tsLogger.arjLoggerI18N.isWarnEnabled())
+ {
+ tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.DisposeRecord_4",
+ new Object[]{Integer.toString(objStoreType)});
+ }
+
+ res = false;
+ }
+ }
+ catch (final Exception e)
+ {
+ res = false;
+ }
+
+ return res;
+ }
+
+ public String type ()
+ {
+ return "/StateManager/AbstractRecord/RecoveryRecord/PersistenceRecord/CadaverRecord/DisposeRecord";
+ }
+
+ public boolean shouldAdd (AbstractRecord a)
+ {
+ return false;
+ }
+
+ public boolean shouldMerge (AbstractRecord a)
+ {
+ return false;
+ }
+
+ public boolean shouldReplace (AbstractRecord a)
+ {
+ return false;
+ }
+
+ public boolean shouldAlter (AbstractRecord a)
+ {
+ return false;
+ }
+
+ public DisposeRecord ()
+ {
+ super();
+
+ objectUid = new Uid(Uid.nullUid());
+ typeName = null;
+ store = null;
+ }
+
+ private Uid objectUid;
+ private String typeName;
+ private ObjectStore store;
+}
+
Copied: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/PersistenceRecord.java (from rev 30034, labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/PersistenceRecord.java)
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/PersistenceRecord.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/PersistenceRecord.java 2009-11-06 14:18:39 UTC (rev 30059)
@@ -0,0 +1,630 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 1998, 1999, 2000, 2001,
+ *
+ * Arjuna Solutions Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: PersistenceRecord.java 2342 2006-03-30 13:06:17Z $
+ */
+
+package com.arjuna.ats.internal.arjuna.abstractrecords;
+
+import com.arjuna.ats.arjuna.ObjectType;
+import com.arjuna.ats.arjuna.StateManager;
+import com.arjuna.ats.arjuna.logging.tsLogger;
+import com.arjuna.ats.arjuna.logging.FacilityCode;
+
+import com.arjuna.ats.arjuna.coordinator.*;
+import com.arjuna.ats.arjuna.common.arjPropertyManager;
+import com.arjuna.ats.arjuna.objectstore.ObjectStore;
+import com.arjuna.ats.arjuna.common.*;
+import com.arjuna.ats.arjuna.state.*;
+import com.arjuna.ats.arjuna.objectstore.ObjectStoreType;
+import java.io.PrintWriter;
+
+import com.arjuna.common.util.logging.*;
+
+import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
+import java.io.IOException;
+
+/**
+ * A PersistenceRecord is created whenever a persistent object is
+ * created/read/modified within the scope of a transaction. It is responsible
+ * for ensuring that state changes are committed or rolled back on behalf of the
+ * object depending upon the outcome of the transaction.
+ *
+ * @author Mark Little (mark at arjuna.com)
+ * @version $Id: PersistenceRecord.java 2342 2006-03-30 13:06:17Z $
+ * @since JTS 1.0.
+ *
+ *
+ * @message com.arjuna.ats.arjuna.PersistenceRecord_1
+ * [com.arjuna.ats.arjuna.PersistenceRecord_1]
+ * PersistenceRecord::topLevelCommit() : About to commit state, uid =
+ * {0}, ObjType = {1}
+ * @message com.arjuna.ats.arjuna.PersistenceRecord_2
+ * [com.arjuna.ats.arjuna.PersistenceRecord_2]
+ * PersistenceRecord::topLevelCommit - commit_state call failed for {0}
+ * @message com.arjuna.ats.arjuna.PersistenceRecord_3
+ * [com.arjuna.ats.arjuna.PersistenceRecord_3]
+ * PersistenceRecord::topLevelCommit - no state to commit!
+ * @message com.arjuna.ats.arjuna.PersistenceRecord_4
+ * [com.arjuna.ats.arjuna.PersistenceRecord_4]
+ * PersistenceRecord::topLevelCommit - caught exception: {0}
+ * @message com.arjuna.ats.arjuna.PersistenceRecord_5
+ * [com.arjuna.ats.arjuna.PersistenceRecord_5]
+ * PersistenceRecord::topLevelCommit - no object store specified!
+ * @message com.arjuna.ats.arjuna.PersistenceRecord_6
+ * [com.arjuna.ats.arjuna.PersistenceRecord_6]
+ * PersistenceRecord::topLevelCommit - commit_state error
+ * @message com.arjuna.ats.arjuna.PersistenceRecord_7
+ * [com.arjuna.ats.arjuna.PersistenceRecord_7] PersistenceRecord
+ * deactivate error
+ * @message com.arjuna.ats.arjuna.PersistenceRecord_8
+ * [com.arjuna.ats.arjuna.PersistenceRecord_8]
+ * PersistenceRecord.topLevelPrepare - setup error!
+ * @message com.arjuna.ats.arjuna.PersistenceRecord_9
+ * [com.arjuna.ats.arjuna.PersistenceRecord_9]
+ * PersistenceRecord::restore_state: Just unpacked object store type =
+ * {0}
+ * @message com.arjuna.ats.arjuna.PersistenceRecord_10
+ * [com.arjuna.ats.arjuna.PersistenceRecord_10]
+ * PersistenceRecord::restore_state: Failed to unpack object store type
+ * @message com.arjuna.ats.arjuna.PersistenceRecord_11
+ * [com.arjuna.ats.arjuna.PersistenceRecord_11]
+ * PersistenceRecord::save_state - type of store is unknown
+ * @message com.arjuna.ats.arjuna.PersistenceRecord_12
+ * [com.arjuna.ats.arjuna.PersistenceRecord_12]
+ * PersistenceRecord::save_state: Packed object store type = {0}
+ * @message com.arjuna.ats.arjuna.PersistenceRecord_13
+ * [com.arjuna.ats.arjuna.PersistenceRecord_13]
+ * PersistenceRecord::save_state: Packed object store root
+ * @message com.arjuna.ats.arjuna.PersistenceRecord_14
+ * [com.arjuna.ats.arjuna.PersistenceRecord_14]
+ * PersistenceRecord::save_state - packing top level state failed
+ * @message com.arjuna.ats.arjuna.PersistenceRecord_15
+ * [com.arjuna.ats.arjuna.PersistenceRecord_15]
+ * PersistenceRecord::save_state - failed
+ * @message com.arjuna.ats.arjuna.PersistenceRecord_16
+ * [com.arjuna.ats.arjuna.PersistenceRecord_16]
+ * PersistenceRecord::save_state - no object store defined for object
+ * @message com.arjuna.ats.arjuna.PersistenceRecord_17
+ * [com.arjuna.ats.arjuna.PersistenceRecord_17]
+ * PersistenceRecord::PersistenceRecord() - crash recovery constructor
+ * @message com.arjuna.ats.arjuna.PersistenceRecord_18
+ * [com.arjuna.ats.arjuna.PersistenceRecord_18]
+ * PersistenceRecord::topLevelAbort() - Expecting state but found none!
+ * @message com.arjuna.ats.arjuna.PersistenceRecord_20
+ * [com.arjuna.ats.arjuna.PersistenceRecord_20]
+ * PersistenceRecord::topLevelAbort() - Received ObjectStoreException
+ * {0}
+ * @message com.arjuna.ats.arjuna.PersistenceRecord_21
+ * [com.arjuna.ats.arjuna.PersistenceRecord_21]
+ * PersistenceRecord.topLevelPrepare - write_uncommitted error
+ */
+
+public class PersistenceRecord extends RecoveryRecord
+{
+
+ /**
+ * This constructor is used to create a new instance of PersistenceRecord.
+ */
+
+ public PersistenceRecord (OutputObjectState os, ObjectStore objStore, StateManager sm)
+ {
+ super(os, sm);
+
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.CONSTRUCTORS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC, "PersistenceRecord::PersistenceRecord("
+ + os + ", " + sm.get_uid() + ")");
+ }
+
+ shadowMade = false;
+ store = objStore;
+ topLevelState = null;
+ }
+
+ /**
+ * Redefintions of abstract functions inherited from RecoveryRecord.
+ */
+
+ public int typeIs ()
+ {
+ return RecordType.PERSISTENCE;
+ }
+
+ /**
+ * topLevelAbort may have to remove the persistent state that was written
+ * into the object store during the processing of topLevelPrepare. It then
+ * does the standard abort processing.
+ */
+
+ public int topLevelAbort ()
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC, "PersistenceRecord::topLevelAbort() for "
+ + order());
+ }
+
+ Uid uid = null;
+ String type = null;
+
+ if (shadowMade) // state written by StateManager instance
+ {
+ uid = order();
+ type = getTypeOfObject();
+ }
+ else
+ {
+ if (topLevelState == null) // hasn't been prepared, so no state
+ {
+ return nestedAbort();
+ }
+ else
+ {
+ uid = topLevelState.stateUid();
+ type = topLevelState.type();
+ }
+ }
+
+ try
+ {
+ if (!store.remove_uncommitted(uid, type))
+ {
+ if (tsLogger.arjLoggerI18N.isWarnEnabled())
+ {
+ tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_19");
+ }
+
+ return TwoPhaseOutcome.FINISH_ERROR;
+ }
+ }
+ catch (ObjectStoreException e)
+ {
+ if (tsLogger.arjLoggerI18N.isWarnEnabled())
+ {
+ tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_20", new Object[] { e }, e);
+ }
+
+ return TwoPhaseOutcome.FINISH_ERROR;
+ }
+
+ return nestedAbort();
+ }
+
+ /**
+ * commit the state saved during the prepare phase.
+ */
+
+ public int topLevelCommit ()
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC, "PersistenceRecord::topLevelCommit() for "
+ + order());
+ }
+
+ if (tsLogger.arjLoggerI18N.isDebugEnabled())
+ {
+ tsLogger.arjLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC, "com.arjuna.ats.arjuna.PersistenceRecord_1", new Object[]
+ { order(), getTypeOfObject() });
+ }
+
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ if (store != null)
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC, ", store = "
+ + store + "(" + store.typeIs() + ")");
+ }
+ else
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC, "");
+ }
+ }
+
+ boolean result = false;
+
+ if (store != null)
+ {
+ try
+ {
+ if (shadowMade)
+ {
+ result = store.commit_state(order(), super.getTypeOfObject());
+
+ if (!result)
+ {
+ if (tsLogger.arjLoggerI18N.isWarnEnabled())
+ {
+ tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_2", new Object[]
+ { order() });
+ }
+ }
+ }
+ else
+ {
+ if (topLevelState != null)
+ {
+ result = store.write_committed(order(), super.getTypeOfObject(), topLevelState);
+ }
+ else
+ {
+ if (tsLogger.arjLoggerI18N.isWarnEnabled())
+ tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_3");
+ }
+ }
+ }
+ catch (ObjectStoreException e)
+ {
+ if (tsLogger.arjLoggerI18N.isWarnEnabled())
+ tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_4", new Object[]
+ { e });
+
+ result = false;
+ }
+ }
+ else
+ {
+ if (tsLogger.arjLoggerI18N.isWarnEnabled())
+ tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_5");
+ }
+
+ if (!result)
+ {
+ if (tsLogger.arjLoggerI18N.isWarnEnabled())
+ tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_6");
+ }
+
+ super.forgetAction(true);
+
+ return ((result) ? TwoPhaseOutcome.FINISH_OK
+ : TwoPhaseOutcome.FINISH_ERROR);
+ }
+
+ /**
+ * topLevelPrepare attempts to save the object. It will either do this in
+ * the action intention list or directly in the object store by using the
+ * 'deactivate' function of the object depending upon the size of the state.
+ * To ensure that objects are correctly hidden while they are in an
+ * uncommitted state if we use the abbreviated protocol then we write an
+ * EMPTY object state as the shadow state - THIS MUST NOT BE COMMITTED.
+ * Instead we write_committed the one saved in the intention list. If the
+ * store cannot cope with being given an empty state we revert to the old
+ * protocol.
+ */
+
+ public int topLevelPrepare ()
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC, "PersistenceRecord::topLevelPrepare() for "
+ + order());
+ }
+
+ int result = TwoPhaseOutcome.PREPARE_NOTOK;
+ StateManager sm = super.objectAddr;
+
+ if ((sm != null) && (store != null))
+ {
+ topLevelState = new OutputObjectState(sm.get_uid(), sm.type());
+
+ if (writeOptimisation
+ || (!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;
+ }
+ else
+ {
+ if (tsLogger.arjLoggerI18N.isWarnEnabled())
+ tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_7");
+ }
+ }
+ }
+ else
+ {
+ if (tsLogger.arjLoggerI18N.isWarnEnabled())
+ tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_8");
+ }
+
+ return result;
+ }
+
+ /**
+ * topLevelCleanup must leave the persistent state that was written in the
+ * object store during the processing of topLevelPrepare intact. Crash
+ * recovery will take care of its resolution
+ */
+
+ public int topLevelCleanup ()
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC, "PersistenceRecord::topLevelCleanup() for "
+ + order());
+ }
+
+ return TwoPhaseOutcome.FINISH_OK;
+ }
+
+ /**
+ * @return <code>true</code>
+ */
+
+ public boolean doSave ()
+ {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ public boolean restore_state (InputObjectState os, int ot)
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC, "PersistenceRecord::restore_state() for "
+ + order());
+ }
+
+ boolean res = false;
+ int objStoreType = 0;
+
+ try
+ {
+ objStoreType = os.unpackInt();
+
+ if (tsLogger.arjLoggerI18N.isDebugEnabled())
+ {
+ tsLogger.arjLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC, "com.arjuna.ats.arjuna.PersistenceRecord_9", new Object[]
+ { Integer.toString(objStoreType) });
+ }
+
+ if (ObjectStoreType.valid(objStoreType))
+ {
+ /* discard old store before creating new */
+
+ if (store == null)
+ {
+ Class oc = ObjectStoreType.typeToClass(objStoreType);
+
+ store = (ObjectStore) oc.newInstance();
+ }
+
+ store.unpack(os);
+ shadowMade = os.unpackBoolean();
+
+ // topLevelState = null;
+
+ if (!shadowMade)
+ {
+ topLevelState = new OutputObjectState(os);
+ res = topLevelState.valid();
+ }
+ else
+ res = true;
+
+ return (res && super.restore_state(os, ot));
+ }
+ }
+ catch (final Exception e)
+ {
+ if (tsLogger.arjLoggerI18N.isWarnEnabled())
+ tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_10");
+ }
+
+ return res;
+ }
+
+ public boolean save_state (OutputObjectState os, int ot)
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC, "PersistenceRecord::save_state() for "
+ + order());
+ }
+
+ boolean res = true;
+
+ if (store != null)
+ {
+ if (!ObjectStoreType.valid(store.typeIs()))
+ {
+ if (tsLogger.arjLoggerI18N.isWarnEnabled())
+ {
+ tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_11");
+ }
+
+ res = false;
+ }
+ else
+ {
+ try
+ {
+ os.packInt(store.typeIs());
+
+ if (tsLogger.arjLoggerI18N.isDebugEnabled())
+ {
+ tsLogger.arjLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC, "com.arjuna.ats.arjuna.PersistenceRecord_12", new Object[]
+ { Integer.toString(store.typeIs()) });
+ }
+
+ store.pack(os);
+
+ if (tsLogger.arjLoggerI18N.isDebugEnabled())
+ {
+ tsLogger.arjLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC, "com.arjuna.ats.arjuna.PersistenceRecord_13");
+ }
+
+ os.packBoolean(shadowMade);
+
+ /*
+ * If we haven't written a shadow state, then pack the state
+ * into the transaction log.
+ */
+
+ if (!shadowMade)
+ {
+ res = (topLevelState != null);
+
+ if (res)
+ topLevelState.packInto(os);
+ else
+ {
+ if (tsLogger.arjLoggerI18N.isWarnEnabled())
+ tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_14");
+ }
+ }
+ }
+ catch (IOException e)
+ {
+ res = false;
+
+ if (tsLogger.arjLoggerI18N.isWarnEnabled())
+ tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_15");
+ }
+ }
+ }
+ else
+ {
+ if (tsLogger.arjLoggerI18N.isWarnEnabled())
+ tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_16");
+
+ try
+ {
+ os.packString(null);
+ }
+ catch (IOException e)
+ {
+ res = false;
+ }
+ }
+
+ return res && super.save_state(os, ot);
+ }
+
+ public void print (PrintWriter strm)
+ {
+ super.print(strm); /* bypass RecoveryRecord */
+
+ strm.println("PersistenceRecord with state:\n" + super.state);
+ }
+
+ public String type ()
+ {
+ return "/StateManager/AbstractRecord/RecoveryRecord/PersistenceRecord";
+ }
+
+ /**
+ * Creates a 'blank' persistence record. This is used during crash recovery
+ * when recreating the prepared list of a server atomic action.
+ */
+
+ public PersistenceRecord ()
+ {
+ super();
+
+ if (tsLogger.arjLoggerI18N.isDebugEnabled())
+ {
+ tsLogger.arjLoggerI18N.debug(DebugLevel.CONSTRUCTORS, VisibilityLevel.VIS_PROTECTED, FacilityCode.FAC_ABSTRACT_REC, "com.arjuna.ats.arjuna.PersistenceRecord_17");
+ }
+
+ shadowMade = false;
+ store = null;
+ topLevelState = null;
+ }
+
+ /**
+ * Cadaver records force write shadows. This operation supresses to
+ * abbreviated commit This should never return false
+ */
+
+ protected boolean shadowForced ()
+ {
+ if (topLevelState == null)
+ {
+ shadowMade = true;
+
+ return true;
+ }
+
+ /* I've already done the abbreviated protocol so its too late */
+
+ return false;
+ }
+
+ // this value should really come from the object store implementation!
+
+ public static final int MAX_OBJECT_SIZE = 4096; // block size
+
+ protected boolean shadowMade;
+ protected ObjectStore store;
+ protected OutputObjectState topLevelState;
+ protected static boolean classicPrepare = false;
+
+ private static boolean writeOptimisation = false;
+
+ static
+ {
+ classicPrepare = arjPropertyManager.getCoordinatorEnvironmentBean().isClassicPrepare();
+
+ writeOptimisation = arjPropertyManager.getCoordinatorEnvironmentBean().isWriteOptimisation();
+ }
+}
Copied: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/RecoveryRecord.java (from rev 30037, labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/RecoveryRecord.java)
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/RecoveryRecord.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/RecoveryRecord.java 2009-11-06 14:18:39 UTC (rev 30059)
@@ -0,0 +1,361 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 1998, 1999, 2000,
+ *
+ * Arjuna Solutions Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: RecoveryRecord.java 2342 2006-03-30 13:06:17Z $
+ */
+
+package com.arjuna.ats.internal.arjuna.abstractrecords;
+
+import com.arjuna.ats.arjuna.ObjectType;
+import com.arjuna.ats.arjuna.StateManager;
+import com.arjuna.ats.arjuna.logging.tsLogger;
+import com.arjuna.ats.arjuna.logging.FacilityCode;
+
+import com.arjuna.common.util.logging.*;
+
+import com.arjuna.ats.arjuna.coordinator.*;
+import com.arjuna.ats.arjuna.state.*;
+
+import java.io.PrintWriter;
+
+public class RecoveryRecord extends AbstractRecord
+{
+
+ /**
+ * This constructor is used to create a new instance of a RecoveryRecord.
+ */
+
+ public RecoveryRecord(OutputObjectState os, StateManager sm)
+ {
+ super(sm.get_uid(), sm.type(), ObjectType.ANDPERSISTENT);
+
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.CONSTRUCTORS,
+ VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
+ "RecoveryRecord::RecoveryRecord(" + os + ", "
+ + sm.get_uid() + ")");
+ }
+
+ objectAddr = sm;
+ state = os;
+ actionHandle = BasicAction.Current();
+ }
+
+ public void finalize () throws Throwable
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.DESTRUCTORS,
+ VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
+ "RecoveryRecord.finalize() for " + order() + " type "
+ + type());
+ }
+ super.finalize();
+ }
+
+ public int typeIs ()
+ {
+ return RecordType.RECOVERY;
+ }
+
+ public Object value ()
+ {
+ return state;
+ }
+
+ /**
+ * @message com.arjuna.ats.arjuna.RecoveryRecord_1
+ * [com.arjuna.ats.arjuna.RecoveryRecord_1] -
+ * RecoveryRecord::setValue not given OutputObjectState.
+ */
+
+ public void setValue (Object newState)
+ {
+ if (newState instanceof OutputObjectState)
+ state = (OutputObjectState) newState;
+ else
+ {
+ if (tsLogger.arjLoggerI18N.isWarnEnabled())
+ tsLogger.arjLoggerI18N
+ .warn("com.arjuna.ats.arjuna.RecoveryRecord_1");
+ }
+ }
+
+ /**
+ * nestedAbort causes the restore_state function of the object to be invoked
+ * passing it the saved ObjectState.
+ *
+ * @message com.arjuna.ats.arjuna.RecoveryRecord_2
+ * [com.arjuna.ats.arjuna.RecoveryRecord_2] -
+ * RecoveryRecord::nestedAbort - restore_state on object failed!
+ */
+
+ public int nestedAbort ()
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
+ "RecoveryRecord::nestedAbort() for " + order());
+ }
+
+ /*
+ * First check that we have a state. We won't have for records created
+ * by crash recovery.
+ */
+
+ forgetAction(false);
+
+ if (state != null)
+ {
+ if (state.notempty()) /* anything to restore ? */
+ {
+ InputObjectState oldState = new InputObjectState(state);
+
+ int result = objectAddr.restore_state(oldState,
+ ObjectType.RECOVERABLE) ? TwoPhaseOutcome.FINISH_OK
+ : TwoPhaseOutcome.FINISH_ERROR;
+
+ if (result == TwoPhaseOutcome.FINISH_ERROR)
+ {
+ if (tsLogger.arjLoggerI18N.isWarnEnabled())
+ tsLogger.arjLoggerI18N
+ .warn("com.arjuna.ats.arjuna.RecoveryRecord_2");
+ }
+
+ return result;
+ }
+ }
+
+ return TwoPhaseOutcome.FINISH_OK;
+ }
+
+ /**
+ * nestedCommit does nothing since the passing of the state up to the parent
+ * action is handled by the record list merging system. In fact since
+ * nestedPrepare returns PREPARE_READONLY this function should never
+ * actaully be called
+ */
+
+ public int nestedCommit ()
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
+ "RecoveryRecord::nestedCommit() for " + order());
+ }
+
+ return TwoPhaseOutcome.FINISH_OK;
+ }
+
+ public int nestedPrepare ()
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
+ "RecoveryRecord::nestedPrepare() for " + order());
+ }
+
+ forgetAction(true);
+
+ return TwoPhaseOutcome.PREPARE_READONLY;
+ }
+
+ /**
+ * topLevelAbort for Recovery records implies the object state should be
+ * restored to the saved state exactly like a nested abort.
+ */
+
+ public int topLevelAbort ()
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
+ "RecoveryRecord::topLevelAbort() for " + order());
+ }
+
+ return nestedAbort(); /* i.e., same as nested case */
+ }
+
+ /**
+ * topLevelCommit has nothing to do for RecoveryRecords as no changes have
+ * been made in the object store. In fact since topLevelPrepare returns
+ * PREPARE_READONLY this function should never actually be called
+ */
+
+ public int topLevelCommit ()
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
+ "RecoveryRecord::topLevelCommit() for " + order());
+ }
+
+ forgetAction(true);
+
+ return TwoPhaseOutcome.FINISH_OK;
+ }
+
+ /**
+ * topLevelPrepare can return PREPARE_READONLY to avoid topLevelCommit being
+ * called in the action commit case
+ */
+
+ public int topLevelPrepare ()
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ABSTRACT_REC,
+ "RecoveryRecord::topLevelPrepare() for " + order());
+ }
+
+ return TwoPhaseOutcome.PREPARE_READONLY;
+ }
+
+ /*
+ * Saving of RecoveryRecords is only undertaken during the Prepare phase of
+ * the top level 2PC. Since the managed objects are only recoverable (not
+ * persistent) there is no need to save any information (or restore any
+ * either). However, persistence records (derived from recovery records)
+ * need to be saved for crash recovery purposes.
+ */
+
+ public boolean doSave ()
+ {
+ return false;
+ }
+
+ public boolean restore_state (InputObjectState os, int ot)
+ {
+ return super.restore_state(os, ot);
+ }
+
+ public boolean save_state (OutputObjectState os, int ot)
+ {
+ return super.save_state(os, ot);
+ }
+
+ public void print (PrintWriter strm)
+ {
+ super.print(strm);
+ strm.println("RecoveryRecord with state:\n" + state);
+ }
+
+ public String type ()
+ {
+ return "/StateManager/AbstractRecord/RecoveryRecord";
+ }
+
+ public void merge (AbstractRecord a)
+ {
+ }
+
+ public void alter (AbstractRecord a)
+ {
+ }
+
+ /*
+ * should_merge and should_replace are invoked by the record list manager to
+ * determine if two records should be merged togethor or if the 'newer'
+ * should replace the older. shouldAdd determines if the new record should
+ * be added in addition to the existing record and is currently only invoked
+ * if both of should_merge and should_replace return false Default
+ * implementations here always return false - ie new records do not override
+ * old.
+ */
+
+ public boolean shouldAdd (AbstractRecord a)
+ {
+ return false;
+ }
+
+ public boolean shouldAlter (AbstractRecord a)
+ {
+ return false;
+ }
+
+ public boolean shouldMerge (AbstractRecord a)
+ {
+ return false;
+ }
+
+ public boolean shouldReplace (AbstractRecord a)
+ {
+ return false;
+ }
+
+ /*
+ * Creates a 'blank' recovery record. This is used during crash recovery
+ * when recreating the prepared list of a server atomic action.
+ */
+
+ public RecoveryRecord()
+ {
+ super();
+
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.CONSTRUCTORS,
+ VisibilityLevel.VIS_PROTECTED,
+ FacilityCode.FAC_ABSTRACT_REC,
+ "RecoveryRecord::RecoveryRecord()"
+ + " - crash recovery constructor");
+ }
+
+ objectAddr = null;
+ state = null;
+ actionHandle = null;
+ }
+
+ /*
+ * Can we use this to force our parent to "remember" us when we commit, and
+ * prevent the system from creating another record in that action?
+ */
+
+ protected final void forgetAction (boolean commit)
+ {
+ if ((actionHandle != null) && (objectAddr != null))
+ {
+ StateManagerFriend.forgetAction(objectAddr, actionHandle, commit, RecordType.RECOVERY);
+ actionHandle = null; // only do this once!
+ }
+ }
+
+ protected StateManager objectAddr;
+
+ protected OutputObjectState state;
+
+ private BasicAction actionHandle;
+
+}
Added: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/StateManagerFriend.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/StateManagerFriend.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/abstractrecords/StateManagerFriend.java 2009-11-06 14:18:39 UTC (rev 30059)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 1998, 1999, 2000,
+ *
+ * Arjuna Solutions Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: CadaverActivationRecord.java 2342 2006-03-30 13:06:17Z $
+ */
+
+package com.arjuna.ats.internal.arjuna.abstractrecords;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import com.arjuna.ats.arjuna.StateManager;
+import com.arjuna.ats.arjuna.coordinator.BasicAction;
+
+/**
+ * Some StateManager methods really shouldn't be available to users to call inadvertently. In
+ * C++ valid users (specific AbstractRecord instances) were friends of StateManager.
+ */
+
+public class StateManagerFriend
+{
+ public static final boolean forgetAction (StateManager inst,
+ BasicAction act, boolean committed, int recordType)
+ {
+ try
+ {
+ Method m = StateManager.class.getDeclaredMethod("forgetAction", BasicAction.class, boolean.class, int.class);
+
+ m.setAccessible(true);
+ Boolean b = (Boolean) m.invoke(inst, act, committed, recordType);
+ m.setAccessible(false);
+
+ return b.booleanValue();
+ }
+ catch (final Throwable ex)
+ {
+ return false;
+ }
+ }
+
+ public static final void destroyed (StateManager inst) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException
+ {
+ Method m = StateManager.class.getDeclaredMethod("destroyed", (Class[]) null);
+
+ m.setAccessible(true);
+ m.invoke(inst, (Object[]) null);
+ m.setAccessible(false);
+ }
+
+ private StateManagerFriend()
+ {
+ }
+}
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/coordinator/AppendLogTransaction.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/coordinator/AppendLogTransaction.java 2009-11-06 14:07:23 UTC (rev 30058)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/coordinator/AppendLogTransaction.java 2009-11-06 14:18:39 UTC (rev 30059)
@@ -53,7 +53,7 @@
{
_previous = previous;
- super.add(new com.arjuna.ats.arjuna.DisposeRecord(previous.getStore(), previous));
+ super.add(new com.arjuna.ats.internal.arjuna.abstractrecords.DisposeRecord(previous.getStore(), previous));
return true;
}
More information about the jboss-svn-commits
mailing list