docs: public boolean cleanupBaseDestination()
                      throws
                      SIRollbackException,
                      SIConnectionLostException,
                      SIIncorrectCallException,
                      SIResourceException
      {
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
              SibTr.entry(tc, "cleanupBaseDestination");
  
          // true if all localisations have been cleaned up successfully
          boolean allCleanedUp = true;
  
          // We must get the locks in the same order as
          // DestinationManager.deleteDestinationLocalization, as it's possible for us
          // to be in this method on the asynch deletion thread doing CLEANUP_PENDING
          // related work while a delete comes in on another thread
          synchronized (getMediationConsumerLockObject()) // Lock1
          {
  
              //TODO concern over "guest" producers, like forwrd routing paths, put1ers etc
              //they dont have a producersession, we need a shared lock they can take to
              //allow them to finish a send before clean up completes.
  
              //Check the destination has not already been deleted first
              // Don't try to do anything with corrupt destinations at this point.
              if (!isDeleted() && !isCorruptOrIndoubt())
              {
                  if (!isPubSub())
                      _protoRealization.
                                      getReallocationLockManager().
                                      lockExclusive(); // Lock2
                  try
                  {
                      synchronized (this) // Lock3 Stop cleanup happening while the destination is being altered
                      { //synchronizes with updateLocalisationSet
  
                          // Now that we are synchronized, check another thread has not begun deletion
                          // logic for this destination. If it has, we shouldn't attempt to continue.
                          // Instead, we should return without performing any work because the other
                          // thread will restart this logic when the destination is ready for deletion.
                          if (isDeleteInProgress())
                          {
                              allCleanedUp = false;
                          }
                          else
                          {
                              //Clean-up the itemstreams for queue points, and
                              //transmission queues
                              allCleanedUp = cleanupLocalisations();
  
                              //Code moved from cleanupLocalisations so we only do it IF the destination
                              //is being deleted
                              if (isToBeDeleted())
                              {
                                  // Last but not least, make sure the in doubt data has
                                  // been handled before we try to remove anything.
                                  if (!assureAllFlushed())
                                  {
                                      allCleanedUp = false;
                                  }
                              }
                              //End of code move
  
                              if (!isPubSub())
                              {
                                  // If the destination is being completely removed and the delete of
                                  // the localisations was succesful, then proceed with removing the
                                  // destination handler.
                                  if ((isToBeDeleted()) && (allCleanedUp))
                                  {
  
                                      try
                                      {
                                          LocalTransaction siTran =
                                                          txManager.createLocalTransaction(false);
  
                                          //First ensure there are no batched deletes of protocol items
                                          BatchHandler sourceBatchHandler =
                                                          messageProcessor.getSourceBatchHandler();
                                          sourceBatchHandler.completeBatch(true);
  
                                          // Remove any protocol items
                                          _protoRealization.
                                                          getRemoteSupport().
                                                          removeProtocolItems(siTran);
  
                                          _protoRealization.
                                                          getRemoteSupport().
                                                          resetProtocolStreams();
  
                                          // 176558.3.1 - Register the transaction handler for callback on transaction completion
                                          siTran.registerCallback(
                                                          new DestinationRemoveTransactionCallback());
  
                                          // Useful debug
                                          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                          {
                                              Statistics stats = getStatistics();
                                              SibTr.debug(tc, "Destination :" + getName() + " " + getUuid().toString() +
                                                              " Adding : " + stats.getAddingItemCount() +
                                                              " Available : " + stats.getAvailableItemCount() +
                                                              " Expiring : " + stats.getExpiringItemCount() +
                                                              " Locked : " + stats.getLockedItemCount() +
                                                              " Removing : " + stats.getRemovingItemCount() +
                                                              " Total : " + stats.getTotalItemCount() +
                                                              " Unavailable : " + stats.getUnavailableItemCount() +
                                                              " Updating : " + stats.getUpdatingItemCount());
                                          }
  
                                          // All the localisations are deleted now, so the destinationHandler itself can
                                          // also be deleted.
                                          Transaction msTran = messageProcessor.resolveAndEnlistMsgStoreTransaction(siTran);
                                          remove(msTran, NO_LOCK_ID);
  
                                          siTran.commit();
  
                                          //Remember that the destination has been deleted
                                          setDeleted();
  
                                          //Pt-to-pt destinations are remembered in destinationManager so that
                                          //inbound messages from other ME's can be sent to them.  Remove this
                                          //lookup now the destination has been deleted.
  
                                          //TODO Im concerned about a timing window here.  If another ME creates
                                          //a stream after we've cleaned up our destination, but before we remove
                                          //it from the uuid set, then an attempt could be made to use this
                                          //destinationHandler when its not fit for use.  Perhaps this removal
                                          //could be moved to the point where the inbound stream state is all
                                          //cleaned up? DM
                                      } catch (MessageStoreException e)
                                      {
                                          FFDCFilter.processException(
                                                                      e,
                                                                      "com.ibm.ws.sib.processor.impl.BaseDestinationHandler.cleanupBaseDestination",
                                                                      "1:3138:1.700.3.45",
                                                                      this);
  
                                          SibTr.exception(tc, e);
  
                                          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                                              SibTr.exit(tc, "cleanupBaseDestination", "SIResourceException");
  
                                          throw new SIResourceException(e);
                                      }
                                  }
                              }
                              else //Destination is a pub/sub topicspace
                              {
                                  if ((isToBeDeleted()) && (allCleanedUp))
                                  {
                                      //signal to _pubSubRealization to gracefully exit from deleteMsgsWithNoReferences()
                                      //as cleaning up destination is started from cleanupDestination()
                                      _pubSubRealization.stopDeletingMsgsWihoutReferencesTask(true);
                                      _pubSubRealization.cleanupDestination();
                                  }
                              }
  
                              if (getHasReconciledStreamsToBeDeleted())
                              {
                                  //this is no longer the case
                                  setHasReconciledStreamsToBeDeleted(false);
                              }
                          } // !deleteInProgress
                      } // Lock3
                  } finally
                  {
                      if (!isPubSub())
                          _protoRealization.
                                          getReallocationLockManager().
                                          unlockExclusive(); // Lock2
                  }
              }//end !deleted !corrupt
  
          } // Lock1
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
              SibTr.exit(tc, "cleanupBaseDestination", Boolean.valueOf(allCleanedUp));
  
          return allCleanedUp;
      }