public void start ( ) throws IOException , YarnException { if ( UserGroupInformation . isSecurityEnabled ( ) ) { Credentials credentials = UserGroupInformation . getCurrentUser ( ) . getCredentials ( ) ; DataOutputBuffer credentialsBuffer = new DataOutputBuffer ( ) ; credentials . writeTokenStorageToStream ( credentialsBuffer ) ; // Now remove the AM -> RM token so that containers cannot access it. Iterator < Token < ? > > iter = credentials . getAllTokens ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { Token < ? > token = iter . next ( ) ; if ( token . getKind ( ) . equals ( AMRMTokenIdentifier . KIND_NAME ) ) { iter . remove ( ) ; } } mAllTokens = ByteBuffer . wrap ( credentialsBuffer . getData ( ) , 0 , credentialsBuffer . getLength ( ) ) ; } mNMClient . init ( mYarnConf ) ; mNMClient . start ( ) ; mRMClient . init ( mYarnConf ) ; mRMClient . start ( ) ; mYarnClient . init ( mYarnConf ) ; mYarnClient . start ( ) ; // Register with ResourceManager String hostname = NetworkAddressUtils . getLocalHostName ( ( int ) mAlluxioConf . getMs ( PropertyKey . NETWORK_HOST_RESOLUTION_TIMEOUT_MS ) ) ; mRMClient . registerApplicationMaster ( hostname , 0 /* port */ , "" /* tracking url */ ) ; LOG . info ( "ApplicationMaster registered" ) ; }
Starts the application master .