Пример #1
0
 @Override
 public NMContainerStatus getNMContainerStatus() {
   this.readLock.lock();
   try {
     return NMContainerStatus.newInstance(
         this.containerId,
         getCurrentState(),
         getResource(),
         diagnostics.toString(),
         exitCode,
         containerTokenIdentifier.getPriority(),
         containerTokenIdentifier.getCreationTime());
   } finally {
     this.readLock.unlock();
   }
 }
Пример #2
0
  public ContainerImpl(
      Configuration conf,
      Dispatcher dispatcher,
      ContainerLaunchContext launchContext,
      Credentials creds,
      NodeManagerMetrics metrics,
      ContainerTokenIdentifier containerTokenIdentifier) {
    this.daemonConf = conf;
    this.dispatcher = dispatcher;
    this.launchContext = launchContext;
    this.containerTokenIdentifier = containerTokenIdentifier;
    this.containerId = containerTokenIdentifier.getContainerID();
    this.resource = containerTokenIdentifier.getResource();
    this.diagnostics = new StringBuilder();
    this.credentials = creds;
    this.metrics = metrics;
    user = containerTokenIdentifier.getApplicationSubmitter();
    ReadWriteLock readWriteLock = new ReentrantReadWriteLock();
    this.readLock = readWriteLock.readLock();
    this.writeLock = readWriteLock.writeLock();

    stateMachine = stateMachineFactory.make(this);
  }
Пример #3
0
 @VisibleForTesting
 public static Token newContainerToken(
     NodeId nodeId, byte[] password, ContainerTokenIdentifier tokenIdentifier) {
   // RPC layer client expects ip:port as service for tokens
   InetSocketAddress addr = NetUtils.createSocketAddrForHost(nodeId.getHost(), nodeId.getPort());
   // NOTE: use SecurityUtil.setTokenService if this becomes a "real" token
   Token containerToken =
       newToken(
           Token.class,
           tokenIdentifier.getBytes(),
           ContainerTokenIdentifier.KIND.toString(),
           password,
           SecurityUtil.buildTokenService(addr).toString());
   return containerToken;
 }