docs: public synchronized void addWork(WorkItem item) throws ProtocolException, TransactionException
      {
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "addWork", "WorkItem="+item);
  
          if (_state.get() != TransactionState.STATE_ACTIVE)
          {
              ProtocolException pe = new ProtocolException("TRAN_PROTOCOL_ERROR_SIMS1001", new Object[]{});
              if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Cannot add work to transaction. Transaction is complete or completing!", pe);
              if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "addWork");
              throw pe;
          }
          else
          {
              if (item != null)
              {
                  _state.set(TransactionState.STATE_COMMITTING_1PC);
  
                  // Create our work list for use in completion.
                  _workList.set(new TaskList());
  
                  _workList.get().addWork(item);
  
                  // Call registered callbacks.
                  for (int i = 0; i < _callbacks.size(); i++)
                  {
                      TransactionCallback callback = (TransactionCallback) _callbacks.get(i);
                      callback.beforeCompletion(this);
                  }
  
                  try
                  {
                      // We need to call preCommit first to
                      // see if we should continue with the
                      // transaction.
                      try
                      {
                          _workList.get().preCommit(this);
                      }
                      catch (Throwable t)
                      {
                          com.ibm.ws.ffdc.FFDCFilter.processException(t, "com.ibm.ws.sib.msgstore.transactions.AutoCommitTransaction.addWork", "1:186:1.10", this);
                          if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Exception caught during work list preCommit!", t);
  
                          // An error has occurred during preCommit
                          // so we need to rollback and throw a
                          // RollbackException
                          try
                          {
                              _state.set(TransactionState.STATE_ROLLINGBACK);
  
                              // When we throw our RollbackException the TM is
                              // going to assume we are complete so we need to
                              // ensure we are rolled-back.
                              _workList.get().rollback(this);
                          }
                          catch (Throwable t2)
                          {
                              com.ibm.ws.ffdc.FFDCFilter.processException(t2, "com.ibm.ws.sib.msgstore.transactions.AutoCommitTransaction.addWork", "1:203:1.10", this);
                              if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Exception caught rolling-back transaction after preCommit failure!", t2);
                          }
  
                          // Mark ourselves as complete and inform
                          // the TM that we have rolled-back.
                          _state.set(TransactionState.STATE_ROLLEDBACK);
  
                          if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Transaction rolled-back due to Exception in preCommit!", t);
                          throw new RollbackException("COMPLETION_EXCEPTION_SIMS1002", new Object[] {t}, t);
                      }
  
                      // Call the persistence layer to write to the
                      // database.
                      _persistence.commit(this, true);
  
                      // Now we have called the persistence layer we need
                      // to call the in memory model to ensure it matches
                      // the direction that the database took.
                      _workList.get().commit(this);
  
                      _state.set(TransactionState.STATE_COMMITTED);
                  }
                  catch (RollbackException rbe)
                  {
                      //No FFDC Code Needed.
                      throw rbe;
                  }
                  catch (SeverePersistenceException spe)
                  {
                      com.ibm.ws.ffdc.FFDCFilter.processException(spe, "com.ibm.ws.sib.msgstore.transactions.AutoCommitTransaction.addWork", "1:233:1.10", this);
  
                      // As we have thrown a severe exception we need to inform
                      // the ME that this instance is no longer able to continue.
                      if (_ms != null)
                      {
                          _ms.reportLocalError();
                      }
  
                      if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Unrecoverable persistence exception caught during commit phase of transaction!", spe);
                      throw new TransactionException("COMPLETION_EXCEPTION_SIMS1002", new Object[] {spe}, spe);
                  }
                  catch (PersistenceException pe)
                  {
                      com.ibm.ws.ffdc.FFDCFilter.processException(pe, "com.ibm.ws.sib.msgstore.transactions.AutoCommitTransaction.addWork", "1:247:1.10", this);
  
                      // The persistence layer has had a problem
                      // so we need to rollback our in memory model
                      // as we can't ensure our data's integrity.
                      try
                      {
                          // When we throw our RollbackException the TM is
                          // going to assume we are complete so we need to
                          // ensure we are rolled-back.
                          _workList.get().rollback(this);
  
                          _state.set(TransactionState.STATE_ROLLEDBACK);
                      }
                      catch (Throwable t)
                      {
                          com.ibm.ws.ffdc.FFDCFilter.processException(t, "com.ibm.ws.sib.msgstore.transactions.AutoCommitTransaction.addWork", "1:263:1.10", this);
                          if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Exception caught rolling-back WorkList after Commit failure!", t);
                      }
  
                      if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Transaction rolled-back due to Exception in Commit!", pe);
                      throw new RollbackException("COMPLETION_EXCEPTION_SIMS1002", new Object[] {pe}, pe);
                  }
                  catch (Throwable t)
                  {
                      com.ibm.ws.ffdc.FFDCFilter.processException(t, "com.ibm.ws.sib.msgstore.transactions.AutoCommitTransaction.addWork", "1:272:1.10", this);
                      if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Exception caught during commit phase of transaction!", t);
                      throw new TransactionException("COMPLETION_EXCEPTION_SIMS1002", new Object[] {t}, t);
                  }
                  finally
                  {
                      // Defect 237695
                      // We need to make sure that we are ready for
                      // re-use even if a problem occurs in afterCompletion.
                      try
                      {
                          boolean committed = (_state.get() == TransactionState.STATE_COMMITTED);
  
                          if (_workList.get() != null)
                          {
                              _workList.get().postComplete(this, committed);
                          }
  
                          for (int i = 0; i < _callbacks.size(); i++)
                          {
                              TransactionCallback callback = (TransactionCallback) _callbacks.get(i);
                              callback.afterCompletion(this, committed);
                          }
                      }
                      catch (Throwable t)
                      {
                          com.ibm.ws.ffdc.FFDCFilter.processException(t, "com.ibm.ws.sib.msgstore.transactions.AutoCommitTransaction.addWork", "1:298:1.10", this);
                          if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Exception caught during post commit phase of transaction!", t);
                          // Defect 316887
                          // We aren't going to rethrow this exception as if
                          // a previous exception has been thrown outside the
                          // finally block it is likely to have more
                          // information about the root problem.
                      }
  
                      // We need to reset all of our stateful variables
                      // so that we are ready for re-use.
                      _callbacks.clear();
                      _workList.set(null);
                      _state.set(TransactionState.STATE_ACTIVE);
                      _ptid     = null;
  
                      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "addWork");
                  }
              }
              else
              {
                  // We cannot do anything with a null
                  // item so we need to reset our
                  // state and throw an exception.
                  _state.set(TransactionState.STATE_ACTIVE);
  
                  ProtocolException pe = new ProtocolException("TRAN_PROTOCOL_ERROR_SIMS1001", new Object[]{});
                  if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Cannot add null work item to transaction!", pe);
                  if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "addWork");
                  throw pe;
              }
          }
      }