Esempio n. 1
0
 /**
  * produce
  * Transfer the user command to the core which will eventually send the command to the server
  * handle the command status received by the server
  * @param command
  * @param <T>
  * @throws PlanckDBException
  * @throws EntityLockException
  */
 public void produce(Command command)
 {
     if(command.isModeCommand()){
     //noinspection SynchronizationOnLocalVariableOrMethodParameter
     lock(command){
         getCore().consume(command);
         CommandStatus status = command.getStatus();
         if( ! CommandStatus.success.Equals(status)){
             if(CommandStatus.notNodeOwner.Equals(status)){
                 throw new EntityLockException(status,status.getMessage());
             }else{
                 throw new PlanckDBException(status,status.getMessage());
             }
         }
         try {
             Monitor.Wait(command,120000000);
         } catch (Exception e) {
             throw new PlanckDBException(status,"Fatal exception in command synchronization process ( while waiting for awake notification, an  InterruptedException occurred. ");
         }
     }
     }else{
     getCore().consume(command);
     }
     CommandStatus commandStatus =command.getStatus();
     if (!CommandStatus.success.Equals(commandStatus))
     {
     throw new PlanckDBException(commandStatus, commandStatus.getMessage() + " schema : " + sessionMetaData.getSchemaName() + " user " + sessionMetaData.getUserName());
     }
 }