use of org.apache.storm.metric.api.IMetricsRegistrant in project storm by apache.
the class BoltExecutor method init.
public void init(ArrayList<Task> idToTask, int idToTaskBase) throws InterruptedException {
executorTransfer.initLocalRecvQueues();
workerReady.await();
while (!stormActive.get()) {
// Topology may be deployed in deactivated mode, wait for activation
Utils.sleepNoSimulation(100);
}
LOG.info("Preparing bolt {}:{}", componentId, getTaskIds());
for (Task taskData : idToTask) {
if (taskData == null) {
// This happens if the min id is too small
continue;
}
IBolt boltObject = (IBolt) taskData.getTaskObject();
TopologyContext userContext = taskData.getUserContext();
if (boltObject instanceof ICredentialsListener) {
((ICredentialsListener) boltObject).setCredentials(credentials);
}
if (Constants.SYSTEM_COMPONENT_ID.equals(componentId)) {
BuiltinMetricsUtil.registerIconnectionServerMetric(workerData.getReceiver(), topoConf, userContext);
// add any autocredential expiry metrics from the worker
if (workerData.getAutoCredentials() != null) {
for (IAutoCredentials autoCredential : workerData.getAutoCredentials()) {
if (autoCredential instanceof IMetricsRegistrant) {
IMetricsRegistrant registrant = (IMetricsRegistrant) autoCredential;
registrant.registerMetrics(userContext, topoConf);
}
}
}
}
this.outputCollector = new BoltOutputCollectorImpl(this, taskData, rand, hasEventLoggers, ackingEnabled, isDebug);
boltObject.prepare(topoConf, userContext, new OutputCollector(outputCollector));
}
openOrPrepareWasCalled.set(true);
LOG.info("Prepared bolt {}:{}", componentId, taskIds);
setupTicks(false);
setupMetrics();
}
Aggregations