@Override
  public void computeDeployments(
      @NotNull final ServerRuntimeInstance.ComputeDeploymentsCallback callback) {
    myTasksExecutor.submit(
        new ThrowableRunnable<Exception>() {
          @Override
          public void run() throws Exception {
            myAgentTaskExecutor.execute(
                new Computable<DeploymentData[]>() {

                  @Override
                  public DeploymentData[] compute() {
                    return myAgent.getDeployments();
                  }
                },
                new CallbackWrapper<DeploymentData[]>() {

                  @Override
                  public void onSuccess(DeploymentData[] deployments) {
                    for (DeploymentData deployment : deployments) {
                      callback.addDeployment(deployment.getName());
                    }
                    callback.succeeded();
                  }

                  @Override
                  public void onError(String message) {
                    callback.errorOccurred(message);
                  }
                });
          }
        },
        callback);
  }
  @Override
  public void disconnect() {
    myTasksExecutor.submit(
        new Runnable() {

          @Override
          public void run() {
            myAgent.disconnect();
          }
        });
  }
  @Override
  public void deploy(
      @NotNull final DeploymentTask<DC> task,
      @NotNull final DeploymentLogManager logManager,
      @NotNull final ServerRuntimeInstance.DeploymentOperationCallback callback) {
    myTasksExecutor.submit(
        new ThrowableRunnable<Exception>() {

          @Override
          public void run() throws Exception {
            createDeploymentRuntime(myConfiguration, myTasksExecutor, task, logManager)
                .deploy(callback);
          }
        },
        callback);
  }
コード例 #4
0
  @Override
  public void undeploy(final @NotNull UndeploymentTaskCallback callback) {
    myTasksExecutor.submit(
        new ThrowableRunnable<Exception>() {

          @Override
          public void run() throws Exception {
            try {
              undeploy();
              callback.succeeded();
            } catch (ServerRuntimeException e) {
              callback.errorOccurred(e.getMessage());
            }
          }
        },
        callback);
  }