Package com.arjuna.ats.arjuna

Examples of com.arjuna.ats.arjuna.StateManager


     */

    public int topLevelPrepare ()
    {
  int result = TwoPhaseOutcome.PREPARE_NOTOK;
  StateManager sm = super.objectAddr;
  LogWriteStateManager lwsm = null;
  boolean writeToLog = true;

  try
  {
      lwsm = (LogWriteStateManager) sm;
     
      writeToLog = lwsm.writeOptimisation();
  }
  catch (ClassCastException ex)
  {
      writeToLog = false;
  }
 
  if ((sm != null) && (store != null))
  {
      topLevelState = new OutputObjectState(sm.get_uid(), sm.type());
     
      if (writeToLog || (!store.fullCommitNeeded() &&
             (sm.save_state(topLevelState, ObjectType.ANDPERSISTENT)) &&
             (topLevelState.size() <= PersistenceRecord.MAX_OBJECT_SIZE)))
      {
    if (PersistenceRecord.classicPrepare)
    {
        OutputObjectState dummy = new OutputObjectState(Uid.nullUid(), null);

        /*
         * Write an empty shadow state to the store to indicate
         * one exists, and to prevent bogus activation in the case
         * where crash recovery hasn't run yet.
         */
       
        try
        {
      store.write_uncommitted(sm.get_uid(), sm.type(), dummy);
      result = TwoPhaseOutcome.PREPARE_OK;
        }
        catch (ObjectStoreException e)
        {
      tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_21",e);
        }
   
        dummy = null;
    }
    else
          {
        result = TwoPhaseOutcome.PREPARE_OK;
    }
      }
      else
      {
    if (sm.deactivate(store.getStoreName(), false))
    {
         shadowMade = true;
       
        result = TwoPhaseOutcome.PREPARE_OK;
    }
View Full Code Here


     */

    public int topLevelPrepare ()
    {
  int result = TwoPhaseOutcome.PREPARE_NOTOK;
  StateManager sm = super.objectAddr;
  LogWriteStateManager lwsm = null;
  boolean writeToLog = true;

  try
  {
      lwsm = (LogWriteStateManager) sm;
     
      writeToLog = lwsm.writeOptimisation();
  }
  catch (ClassCastException ex)
  {
      writeToLog = false;
  }
 
  if ((sm != null) && (store != null))
  {
      topLevelState = new OutputObjectState(sm.get_uid(), sm.type());
     
      if (writeToLog || (!store.fullCommitNeeded() &&
             (sm.save_state(topLevelState, ObjectType.ANDPERSISTENT)) &&
             (topLevelState.size() <= PersistenceRecord.MAX_OBJECT_SIZE)))
      {
    if (PersistenceRecord.classicPrepare)
    {
        OutputObjectState dummy = new OutputObjectState(Uid.nullUid(), null);

        /*
         * Write an empty shadow state to the store to indicate
         * one exists, and to prevent bogus activation in the case
         * where crash recovery hasn't run yet.
         */
       
        try
        {
      store.write_uncommitted(sm.get_uid(), sm.type(), dummy);
      result = TwoPhaseOutcome.PREPARE_OK;
        }
        catch (ObjectStoreException e)
        {
      tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_21",e);
        }
   
        dummy = null;
    }
    else
          {
        result = TwoPhaseOutcome.PREPARE_OK;
    }
      }
      else
      {
    if (sm.deactivate(store.getStoreName(), false))
    {
         shadowMade = true;
       
        result = TwoPhaseOutcome.PREPARE_OK;
    }
View Full Code Here

      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))
    {
        /*
         * Get ready to create our state to be saved. At this stage we're not
         * sure if the state will go into its own log or be written into the
         * transaction log for improved performance.
         */
       
      topLevelState = new OutputObjectState(sm.get_uid(), sm.type());

      if (writeOptimisation
          && (!store.fullCommitNeeded()
              && (sm.save_state(topLevelState, ObjectType.ANDPERSISTENT)) && (topLevelState.size() <= PersistenceRecord.MAX_OBJECT_SIZE)))
      {
          /*
           * We assume that crash recovery will always run before
           * the object can be reactivated!
           */

        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
        {
            /*
             * Don't write anything as our state will go into the log.
             */
           
          result = TwoPhaseOutcome.PREPARE_OK;
        }
      }
      else
      {
        if (sm.deactivate(store.getStoreName(), false))
        {
          shadowMade = true;

          result = TwoPhaseOutcome.PREPARE_OK;
        }
View Full Code Here

/*     */   }
/*     */
/*     */   public int topLevelPrepare()
/*     */   {
/* 151 */     int result = 1;
/* 152 */     StateManager sm = this.objectAddr;
/* 153 */     LogWriteStateManager lwsm = null;
/* 154 */     boolean writeToLog = true;
/*     */     try
/*     */     {
/* 158 */       lwsm = (LogWriteStateManager)sm;
/*     */
/* 160 */       writeToLog = lwsm.writeOptimisation();
/*     */     }
/*     */     catch (ClassCastException ex)
/*     */     {
/* 164 */       writeToLog = false;
/*     */     }
/*     */
/* 167 */     if ((sm != null) && (this.store != null))
/*     */     {
/* 169 */       this.topLevelState = new OutputObjectState(sm.get_uid(), sm.type());
/*     */
/* 171 */       if ((writeToLog) || ((!this.store.fullCommitNeeded()) && (sm.save_state(this.topLevelState, 1)) && (this.topLevelState.size() <= 4096)))
/*     */       {
/* 175 */         if (PersistenceRecord.classicPrepare)
/*     */         {
/* 177 */           OutputObjectState dummy = new OutputObjectState(Uid.nullUid(), null);
/*     */           try
/*     */           {
/* 187 */             this.store.write_uncommitted(sm.get_uid(), sm.type(), dummy);
/* 188 */             result = 0;
/*     */           }
/*     */           catch (ObjectStoreException e)
/*     */           {
/* 192 */             tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.PersistenceRecord_21", e);
/*     */           }
/*     */
/* 195 */           dummy = null;
/*     */         }
/*     */         else
/*     */         {
/* 199 */           result = 0;
/*     */         }
/*     */
/*     */       }
/* 204 */       else if (sm.deactivate(this.store.getStoreName(), false))
/*     */       {
/* 206 */         this.shadowMade = true;
/*     */
/* 208 */         result = 0;
/*     */       }
View Full Code Here

TOP

Related Classes of com.arjuna.ats.arjuna.StateManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.