@Override
 public long updateCurrentMessageIdForSafeZone(long messageId, String nodeId) throws TException {
   long slotDeletionSafeZone;
   if (AndesContext.getInstance().getClusteringAgent().isCoordinator()) {
     slotDeletionSafeZone = slotManager.updateAndReturnSlotDeleteSafeZone(nodeId, messageId);
   } else {
     throw new TException("This node is not the slot coordinator right now");
   }
   return slotDeletionSafeZone;
 }
 @Override
 public void reAssignSlotWhenNoSubscribers(String nodeId, String queueName) throws TException {
   if (AndesContext.getInstance().getClusteringAgent().isCoordinator()) {
     try {
       slotManager.reAssignSlotWhenNoSubscribers(nodeId, queueName);
     } catch (AndesException e) {
       throw new TException("Failed to reAssign slot for node:" + nodeId + " queue:" + queueName);
     }
   } else {
     throw new TException("This node is not the slot coordinator right now");
   }
 }
 @Override
 public void clearAllActiveSlotRelationsToQueue(String queueName) throws TException {
   if (AndesContext.getInstance().getClusteringAgent().isCoordinator()) {
     try {
       slotManager.clearAllActiveSlotRelationsToQueue(queueName);
     } catch (AndesException e) {
       throw new TException("Failed to clear active slots for queue:" + queueName);
     }
   } else {
     throw new TException("This node is not the slot coordinator right now");
   }
 }
 @Override
 public void updateMessageId(
     String queueName, String nodeId, long startMessageId, long endMessageId) throws TException {
   if (AndesContext.getInstance().getClusteringAgent().isCoordinator()) {
     try {
       slotManager.updateMessageID(queueName, nodeId, startMessageId, endMessageId);
     } catch (AndesException e) {
       throw new TException(
           "Failed to update message id for queue: " + queueName + " nodeId: " + nodeId, e);
     }
   } else {
     throw new TException("This node is not the slot coordinator right now");
   }
 }
 @Override
 public boolean deleteSlot(String queueName, SlotInfo slotInfo, String nodeId) throws TException {
   if (AndesContext.getInstance().getClusteringAgent().isCoordinator()) {
     Slot slot = new Slot();
     boolean result = false;
     slot.setStartMessageId(slotInfo.getStartMessageId());
     slot.setEndMessageId(slotInfo.getEndMessageId());
     slot.setStorageQueueName(slotInfo.getQueueName());
     try {
       result = slotManager.deleteSlot(queueName, slot, nodeId);
     } catch (AndesException e) {
       throw new TException("Failed to delete slot for queue:" + queueName);
     }
     return result;
   } else {
     throw new TException("This node is not the slot coordinator right now");
   }
 }
 @Override
 public SlotInfo getSlotInfo(String queueName, String nodeId) throws TException {
   if (AndesContext.getInstance().getClusteringAgent().isCoordinator()) {
     SlotInfo slotInfo = new SlotInfo();
     try {
       Slot slot = slotManager.getSlot(queueName, nodeId);
       if (null != slot) {
         slotInfo =
             new SlotInfo(
                 slot.getStartMessageId(),
                 slot.getEndMessageId(),
                 slot.getStorageQueueName(),
                 nodeId,
                 slot.isAnOverlappingSlot());
       }
     } catch (AndesException e) {
       throw new TException(
           "Failed to get slot info for queue: " + queueName + " nodeId: " + nodeId, e);
     }
     return slotInfo;
   } else {
     throw new TException("This node is not the slot coordinator right now");
   }
 }