Package org.apache.storm.daemon.worker
Class WorkerState
- java.lang.Object
-
- org.apache.storm.daemon.worker.WorkerState
-
public class WorkerState extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
WorkerState.ILocalTransferCallback
-
Constructor Summary
Constructors Constructor Description WorkerState(Map<String,Object> conf, IContext mqContext, String topologyId, String assignmentId, Supplier<SupervisorIfaceFactory> supervisorIfaceSupplier, int port, String workerId, Map<String,Object> topologyConf, IStateStorage stateStorage, IStormClusterState stormClusterState, Collection<IAutoCredentials> autoCredentials, StormMetricRegistry metricRegistry, Credentials initialCredentials)
-
Method Summary
-
-
-
Constructor Detail
-
WorkerState
public WorkerState(Map<String,Object> conf, IContext mqContext, String topologyId, String assignmentId, Supplier<SupervisorIfaceFactory> supervisorIfaceSupplier, int port, String workerId, Map<String,Object> topologyConf, IStateStorage stateStorage, IStormClusterState stormClusterState, Collection<IAutoCredentials> autoCredentials, StormMetricRegistry metricRegistry, Credentials initialCredentials) throws IOException, InvalidTopologyException
- Throws:
IOException
InvalidTopologyException
-
-
Method Detail
-
isConnectionReady
public static boolean isConnectionReady(IConnection connection)
-
getDeserializedWorkerHooks
public List<IWorkerHook> getDeserializedWorkerHooks()
-
getReceiver
public IConnection getReceiver()
-
getTopologyId
public String getTopologyId()
-
getPort
public int getPort()
-
getWorkerId
public String getWorkerId()
-
getStateStorage
public IStateStorage getStateStorage()
-
getIsWorkerActive
public CountDownLatch getIsWorkerActive()
-
getIsTopologyActive
public AtomicBoolean getIsTopologyActive()
-
getStormComponentToDebug
public AtomicReference<Map<String,DebugOptions>> getStormComponentToDebug()
-
getTopology
public StormTopology getTopology()
-
getSystemTopology
public StormTopology getSystemTopology()
-
getCachedNodeToPortSocket
public AtomicReference<Map<NodeInfo,IConnection>> getCachedNodeToPortSocket()
-
getSuicideCallback
public Runnable getSuicideCallback()
-
getUptime
public Utils.UptimeComputer getUptime()
-
getLoadMapping
public LoadMapping getLoadMapping()
-
getAssignmentVersions
public AtomicReference<Map<String,VersionedData<Assignment>>> getAssignmentVersions()
-
getUserTimer
public StormTimer getUserTimer()
-
makeTransferThread
public Utils.SmartThread makeTransferThread()
-
suicideIfLocalAssignmentsChanged
public void suicideIfLocalAssignmentsChanged(Assignment assignment)
-
refreshConnections
public void refreshConnections()
-
refreshStormActive
public void refreshStormActive()
-
refreshStormActive
public void refreshStormActive(Runnable callback)
-
refreshLoad
public void refreshLoad(List<IRunningExecutor> execs)
-
refreshBackPressureStatus
public void refreshBackPressureStatus()
-
activateWorkerWhenAllConnectionsReady
public void activateWorkerWhenAllConnectionsReady()
we will wait all connections to be ready and then activate the spout/bolt when the worker bootup.
-
tryTransferRemote
public boolean tryTransferRemote(AddressedTuple tuple, Queue<AddressedTuple> pendingEmits, ITupleSerializer serializer)
-
flushRemotes
public void flushRemotes() throws InterruptedException
- Throws:
InterruptedException
-
tryFlushRemotes
public boolean tryFlushRemotes()
-
checkSerialize
public void checkSerialize(KryoTupleSerializer serializer, AddressedTuple tuple)
-
getWorkerTopologyContext
public final WorkerTopologyContext getWorkerTopologyContext()
-
getWorkerUserContext
public final WorkerUserContext getWorkerUserContext()
-
runWorkerStartHooks
public void runWorkerStartHooks()
-
runWorkerShutdownHooks
public void runWorkerShutdownHooks()
-
closeResources
public void closeResources()
-
areAllConnectionsReady
public boolean areAllConnectionsReady()
-
getAutoCredentials
public Collection<IAutoCredentials> getAutoCredentials()
-
getCredentials
public Credentials getCredentials()
-
setCredentials
public void setCredentials(Credentials credentials)
-
hasRemoteOutboundTasks
public boolean hasRemoteOutboundTasks()
Check if this worker has remote outbound tasks.- Returns:
- true if this worker has remote outbound tasks; false otherwise.
-
isSingleWorker
public boolean isSingleWorker()
If all the tasks are local tasks, the topology has only one worker.- Returns:
- true if this worker is the single worker; false otherwise.
-
haltWorkerTransfer
public void haltWorkerTransfer()
-
getTransferQueue
public JCQueue getTransferQueue()
-
getMetricRegistry
public StormMetricRegistry getMetricRegistry()
-
-