use of com.datatorrent.stram.security.StramDelegationTokenManager in project apex-core by apache.
the class StreamingAppMasterService method serviceInit.
@Override
protected void serviceInit(Configuration conf) throws Exception {
LOG.info("Application master" + ", appId=" + appAttemptID.getApplicationId().getId() + ", clustertimestamp=" + appAttemptID.getApplicationId().getClusterTimestamp() + ", attemptId=" + appAttemptID.getAttemptId());
FileInputStream fis = new FileInputStream("./" + LogicalPlan.SER_FILE_NAME);
try {
this.dag = LogicalPlan.read(fis);
} finally {
fis.close();
}
// "debug" simply dumps all data using LOG.info
if (dag.isDebug()) {
dumpOutDebugInfo();
}
dag.setAttribute(LogicalPlan.APPLICATION_ATTEMPT_ID, appAttemptID.getAttemptId());
FSRecoveryHandler recoveryHandler = new FSRecoveryHandler(dag.assertAppPath(), conf);
this.dnmgr = StreamingContainerManager.getInstance(recoveryHandler, dag, true);
dag = this.dnmgr.getLogicalPlan();
this.appContext = new ClusterAppContextImpl(dag.getAttributes());
Map<Class<?>, Class<? extends StringCodec<?>>> codecs = dag.getAttributes().get(DAG.STRING_CODECS);
StringCodecs.loadConverters(codecs);
LOG.info("Starting application with {} operators in {} containers", dnmgr.getPhysicalPlan().getAllOperators().size(), dnmgr.getPhysicalPlan().getContainers().size());
// Setup security configuration such as that for web security
SecurityUtils.init(conf, dag.getValue(LogicalPlan.STRAM_HTTP_AUTHENTICATION));
if (UserGroupInformation.isSecurityEnabled()) {
// TODO :- Need to perform token renewal
delegationTokenManager = new StramDelegationTokenManager(DELEGATION_KEY_UPDATE_INTERVAL, DELEGATION_TOKEN_MAX_LIFETIME, DELEGATION_TOKEN_RENEW_INTERVAL, DELEGATION_TOKEN_REMOVER_SCAN_INTERVAL);
}
this.nmClient = new NMClientAsyncImpl(new NMCallbackHandler());
addService(nmClient);
this.amRmClient = AMRMClient.createAMRMClient();
addService(amRmClient);
// start RPC server
int rpcListenerCount = dag.getValue(DAGContext.HEARTBEAT_LISTENER_THREAD_COUNT);
this.heartbeatListener = new StreamingContainerParent(this.getClass().getName(), dnmgr, delegationTokenManager, rpcListenerCount);
addService(heartbeatListener);
AutoMetric.Transport appDataPushTransport = dag.getValue(LogicalPlan.METRICS_TRANSPORT);
if (appDataPushTransport != null) {
this.appDataPushAgent = new AppDataPushAgent(dnmgr, appContext);
addService(this.appDataPushAgent);
}
initApexPluginDispatcher();
// Initialize all services added above
super.serviceInit(conf);
}
Aggregations