Class Slot
- java.lang.Object
-
- java.lang.Thread
-
- org.apache.storm.daemon.supervisor.Slot
-
- All Implemented Interfaces:
AutoCloseable
,Runnable
,BlobChangingCallback
public class Slot extends Thread implements AutoCloseable, BlobChangingCallback
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
-
Field Summary
-
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description Slot(AsyncLocalizer localizer, Map<String,Object> conf, ContainerLauncher containerLauncher, String host, int port, LocalState localState, IStormClusterState clusterState, ISupervisor supervisor, AtomicReference<Map<Long,LocalAssignment>> cachedCurrentAssignments, OnlyLatestExecutor<Integer> metricsExec, WorkerMetricsProcessor metricsProcessor, org.apache.storm.daemon.supervisor.SlotMetrics slotMetrics)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addProfilerActions(Set<org.apache.storm.daemon.supervisor.Slot.TopoProfileAction> actions)
void
blobChanging(LocalAssignment assignment, int port, LocallyCachedBlob blob, GoodToGo go)
Informs the listener that a blob has changed and is ready to update and replace a localized blob that has been marked as tied to the life cycle of the worker process.void
close()
String
getWorkerId()
get the workerID (nullable) from CURRENT container, if existed, or return null.void
run()
void
setNewAssignment(LocalAssignment newAssignment)
Set a new assignment asynchronously.-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Constructor Detail
-
Slot
public Slot(AsyncLocalizer localizer, Map<String,Object> conf, ContainerLauncher containerLauncher, String host, int port, LocalState localState, IStormClusterState clusterState, ISupervisor supervisor, AtomicReference<Map<Long,LocalAssignment>> cachedCurrentAssignments, OnlyLatestExecutor<Integer> metricsExec, WorkerMetricsProcessor metricsProcessor, org.apache.storm.daemon.supervisor.SlotMetrics slotMetrics) throws Exception
- Throws:
Exception
-
-
Method Detail
-
setNewAssignment
public final void setNewAssignment(LocalAssignment newAssignment)
Set a new assignment asynchronously.- Parameters:
newAssignment
- the new assignment for this slot to run, null to run nothing
-
blobChanging
public void blobChanging(LocalAssignment assignment, int port, LocallyCachedBlob blob, GoodToGo go)
Description copied from interface:BlobChangingCallback
Informs the listener that a blob has changed and is ready to update and replace a localized blob that has been marked as tied to the life cycle of the worker process.If `go.getLatch()` is never called before the method completes it is assumed that the listener is good with the blob changing.
- Specified by:
blobChanging
in interfaceBlobChangingCallback
- Parameters:
assignment
- the assignment this resource and callback are registered with.port
- the port that this resource and callback are registered with.blob
- the blob that is going to change.go
- a way to indicate if the listener is ready for the resource to change.
-
addProfilerActions
public void addProfilerActions(Set<org.apache.storm.daemon.supervisor.Slot.TopoProfileAction> actions)
-
getWorkerId
public String getWorkerId()
get the workerID (nullable) from CURRENT container, if existed, or return null.- Returns:
- workerID
-
close
public void close() throws Exception
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-
-