示例#1
0
  /**
   * The method does the following:
   *
   * <p>1.in case of none atomic command
   *
   * <p>- execute the command using the command executor
   *
   * <p>- notify all waiting thread about the command execution
   *
   * <p>2.in case of atomic command
   *
   * <p>- execute the command using the command executor
   *
   * <p>- notify all waiting thread about the command execution only
   *
   * <p>if the current command is the last element in the atomic command
   *
   * @param modelCommand
   * @throws PlanckDBException
   */
  @SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter")
  public void doJobs(final Command modelCommand) throws PlanckDBException {
    boolean consume = true;
    if (modelCommand.getTransaction() == TRUE
        && modelCommand.getSessionId() == sessionMetaData.getSessionId()) {
      consume = false;
    }
    if (consume) {
      commandExecutor.consume(modelCommand);
    }
    if (atomicContainer.isPartOfAtomicCommand(modelCommand)) {
      Command rootCommand = atomicContainer.update(modelCommand);
      if (rootCommand != null) {
        synchronized (rootCommand) {
          rootCommand.notifyAll();
        }
      }

    } else {
      synchronized (modelCommand) {
        modelCommand.notifyAll();
      }
    }

    // log.debug("message done version : "+modelCommand.getVersion()+" id
    // "+modelCommand.getEntityId());
  }
示例#2
0
 public void addModelChangedListener(NodeModelChangedListener nodeModelChangedListener) {
   commandExecutor.addModelChangedListener(nodeModelChangedListener);
 }
示例#3
0
 public void removeModelChangedListener(NodeModelChangedListener nodeModelChangedListener) {
   commandExecutor.removeModelChangedListener(nodeModelChangedListener);
 }