- java.lang.Object
-
- swim.runtime.AbstractWarpRef
-
- swim.runtime.AbstractTierBinding
-
- swim.runtime.agent.AgentNode
-
- All Implemented Interfaces:
Executor,DownlinkFactory,LaneFactory,WarpRef,Schedule,Stage,Task,TaskFunction,CellBinding,CellContext,NodeBinding,TierBinding,Log
- Direct Known Subclasses:
AgentModel,MetaEdgeAgent,MetaHostAgent,MetaLaneAgent,MetaMeshAgent,MetaPartAgent
public class AgentNode extends AbstractTierBinding implements NodeBinding, CellContext, LaneFactory, Schedule, Stage, Task
-
-
Field Summary
Fields Modifier and Type Field Description protected NodeContextnodeContextprotected TaskContexttaskContext-
Fields inherited from class swim.runtime.AbstractTierBinding
CLOSED_PHASE, CLOSED_STATE, CLOSING_STATE, FAILED_STATE, FAILING_STATE, LOADED_PHASE, LOADED_STATE, LOADING_STATE, OPENED_PHASE, OPENED_STATE, OPENING_STATE, PHASE_MASK, PHASE_SHIFT, RECOVERING_STATE, STARTED_PHASE, STARTED_STATE, STARTING_STATE, STATE_MASK, status, STATUS, STOPPING_STATE, UNLOADING_STATE
-
-
Constructor Summary
Constructors Constructor Description AgentNode()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description FingerTrieSeq<Value>agentIds()FingerTrieSeq<Agent>agents()StageasyncStage()LinkBindingbindDownlink(Downlink downlink)<T> TbottomNode(Class<T> nodeClass)<T> Call<T>call(Cont<T> future)Returns aCallthat completes thecontinuation.NodeAddresscellAddress()voidcloseDownlink(LinkBinding link)voidcloseLane(Uri laneUri)<V> CommandLane<V>commandLane()<A extends Agent>
AgentFactory<A>createAgentFactory(NodeBinding node, Class<? extends A> agentClass)AgentFactory<?>createAgentFactory(NodeBinding node, AgentDef agentDef)longcreatedTime()protected LaneContextcreateLaneContext(LaneAddress laneAddress, LaneBinding lane)voiddebug(Object message)Logs a debug-level message.<V> DemandLane<V>demandLane()<K,V>
DemandMapLane<K,V>demandMapLane()voiddidClose()protected voiddidCloseLane(LaneBinding lane)voiddidFail(Throwable error)protected voiddidOpenLane(LaneBinding lane)StringedgeName()voiderror(Object message)Logs an error-level message.voidexecute(Runnable command)Schedules arunnablefor concurrent execution.voidfail(Object message)Logs an fail-level message.<K,V>
SpatialLane<K,R2Shape,V>geospatialLane()LaneBindinggetLane(Uri laneUri)HostBindinghost()UrihostUri()<V> HttpLane<V>httpLane()Identityidentity()voidinfo(Object message)Logs an info-level message.<L,K,V>
JoinMapLane<L,K,V>joinMapLane()<K,V>
JoinValueLane<K,V>joinValueLane()HashTrieMap<Uri,LaneBinding>lanes()<V> ListLane<V>listLane()<K,V>
MapLane<K,V>mapLane()UrimeshUri()NodeContextnodeContext()UrinodeUri()NodeBindingnodeWrapper()protected static UrinormalizedLaneUri(Uri laneUri)voidopenAgents(NodeBinding node)voidopenDownlink(LinkBinding link)LaneBindingopenLane(Uri laneUri)LaneBindingopenLane(Uri laneUri, Lane lane)LaneBindingopenLane(Uri laneUri, LaneBinding lane)voidopenLanes(NodeBinding node)LaneBindingopenLaneView(Uri laneUri, LaneView laneView)voidopenMetaDownlink(LinkBinding downlink, NodeBinding metaDownlink)voidopenMetaLane(LaneBinding lane, NodeBinding metaLane)voidopenMetaNode(NodeBinding node, NodeBinding metaNode)voidopenMetaUplink(LinkBinding uplink, NodeBinding metaUplink)protected voidopenUnknownUplink(Uri laneUri, LinkBinding link)voidopenUplink(LinkBinding link)ValuepartKey()Policypolicy()voidpushDown(Push<?> push)voidpushUp(Push<?> push)voidreportDown(Metric metric)voidrunTask()Executes this sequential process.Scheduleschedule()voidsetNodeContext(NodeContext nodeContext)voidsetTaskContext(TaskContext taskContext)Sets the context used to managed thisTask.TimerRefsetTimer(long millis, TimerFunction timer)Schedulestimerto execute aftermillismilliseconds have elapsed.<K,S,V>
SpatialLane<K,S,V>spatialLane(Z2Form<S> shapeForm)Stagestage()StoreBindingstore()<V> SupplyLane<V>supplyLane()TaskReftask(TaskFunction task)Returns an uncuedTaskRefbound to thetask, which can later be used to cue thetask.TaskContexttaskContext()Returns the context used to managed thisTask.voidtaskDidCancel()Lifecycle callback invoked after thisTaskis explicitly cancelled.booleantaskWillBlock()Returnstrueif thisTaskmight block its thread of execution when running; returnsfalseif thisTaskwill never block.voidtaskWillCue()Lifecycle callback invoked before thisTaskis scheduled for execution.TierContexttierContext()TimerReftimer(TimerFunction timer)Returns an unscheduledTimerRefbound totimer, which can later be used to scheduletimer.voidtrace(Object message)Logs a trace-level message.<T> TunwrapNode(Class<T> nodeClass)<V> ValueLane<V>valueLane()voidwarn(Object message)Logs a warn-level message.protected voidwillClose()protected voidwillLoad()protected voidwillOpen()protected voidwillStart()protected voidwillStop()protected voidwillUnload()<I,O>
WsLane<I,O>wsLane()-
Methods inherited from class swim.runtime.AbstractTierBinding
activate, close, didLoad, didOpen, didStart, didStop, didUnload, isClosed, isLoaded, isOpened, isStarted, load, open, start, stop, unload
-
Methods inherited from class swim.runtime.AbstractWarpRef
command, command, command, command, command, command, command, command, command, command, command, command, command, command, command, command, downlink, downlinkHttp, downlinkList, downlinkMap, downlinkValue, downlinkWs, hostRef, hostRef, laneRef, laneRef, laneRef, laneRef, nodeRef, nodeRef, nodeRef, nodeRef
-
-
-
-
Field Detail
-
nodeContext
protected NodeContext nodeContext
-
taskContext
protected TaskContext taskContext
-
-
Method Detail
-
tierContext
public final TierContext tierContext()
- Specified by:
tierContextin interfaceTierBinding- Specified by:
tierContextin classAbstractTierBinding
-
host
public final HostBinding host()
- Specified by:
hostin interfaceNodeBinding
-
nodeWrapper
public final NodeBinding nodeWrapper()
- Specified by:
nodeWrapperin interfaceNodeBinding
-
nodeContext
public final NodeContext nodeContext()
- Specified by:
nodeContextin interfaceNodeBinding
-
setNodeContext
public void setNodeContext(NodeContext nodeContext)
- Specified by:
setNodeContextin interfaceNodeBinding
-
unwrapNode
public <T> T unwrapNode(Class<T> nodeClass)
- Specified by:
unwrapNodein interfaceNodeBinding
-
bottomNode
public <T> T bottomNode(Class<T> nodeClass)
- Specified by:
bottomNodein interfaceNodeBinding
-
taskContext
public final TaskContext taskContext()
Description copied from interface:Task- Specified by:
taskContextin interfaceTask
-
setTaskContext
public void setTaskContext(TaskContext taskContext)
Description copied from interface:TaskSets the context used to managed thisTask. ATaskContextis assigned when binding thisTaskto aStage.- Specified by:
setTaskContextin interfaceTask
-
createLaneContext
protected LaneContext createLaneContext(LaneAddress laneAddress, LaneBinding lane)
-
cellAddress
public NodeAddress cellAddress()
- Specified by:
cellAddressin interfaceCellContext- Specified by:
cellAddressin interfaceNodeBinding
-
edgeName
public final String edgeName()
- Specified by:
edgeNamein interfaceCellContext
-
meshUri
public final Uri meshUri()
- Specified by:
meshUriin interfaceCellContext- Specified by:
meshUriin interfaceNodeBinding
-
partKey
public final Value partKey()
- Specified by:
partKeyin interfaceNodeBinding
-
hostUri
public final Uri hostUri()
- Specified by:
hostUriin interfaceNodeBinding
-
nodeUri
public final Uri nodeUri()
- Specified by:
nodeUriin interfaceNodeBinding
-
createdTime
public long createdTime()
- Specified by:
createdTimein interfaceNodeBinding
-
identity
public final Identity identity()
-
openMetaNode
public void openMetaNode(NodeBinding node, NodeBinding metaNode)
- Specified by:
openMetaNodein interfaceNodeBinding
-
openLanes
public void openLanes(NodeBinding node)
- Specified by:
openLanesin interfaceNodeBinding
-
agentIds
public FingerTrieSeq<Value> agentIds()
- Specified by:
agentIdsin interfaceNodeBinding
-
agents
public FingerTrieSeq<Agent> agents()
- Specified by:
agentsin interfaceNodeBinding
-
createAgentFactory
public AgentFactory<?> createAgentFactory(NodeBinding node, AgentDef agentDef)
- Specified by:
createAgentFactoryin interfaceNodeBinding
-
createAgentFactory
public <A extends Agent> AgentFactory<A> createAgentFactory(NodeBinding node, Class<? extends A> agentClass)
- Specified by:
createAgentFactoryin interfaceNodeBinding
-
openAgents
public void openAgents(NodeBinding node)
- Specified by:
openAgentsin interfaceNodeBinding
-
lanes
public HashTrieMap<Uri,LaneBinding> lanes()
- Specified by:
lanesin interfaceNodeBinding
-
getLane
public LaneBinding getLane(Uri laneUri)
- Specified by:
getLanein interfaceNodeBinding
-
openLaneView
public LaneBinding openLaneView(Uri laneUri, LaneView laneView)
-
openLane
public LaneBinding openLane(Uri laneUri, Lane lane)
-
openLane
public LaneBinding openLane(Uri laneUri)
- Specified by:
openLanein interfaceNodeBinding
-
openLane
public LaneBinding openLane(Uri laneUri, LaneBinding lane)
- Specified by:
openLanein interfaceNodeBinding
-
closeLane
public void closeLane(Uri laneUri)
-
didOpenLane
protected void didOpenLane(LaneBinding lane)
-
didCloseLane
protected void didCloseLane(LaneBinding lane)
-
commandLane
public <V> CommandLane<V> commandLane()
- Specified by:
commandLanein interfaceLaneFactory
-
demandLane
public <V> DemandLane<V> demandLane()
- Specified by:
demandLanein interfaceLaneFactory
-
demandMapLane
public <K,V> DemandMapLane<K,V> demandMapLane()
- Specified by:
demandMapLanein interfaceLaneFactory
-
httpLane
public <V> HttpLane<V> httpLane()
- Specified by:
httpLanein interfaceLaneFactory
-
joinMapLane
public <L,K,V> JoinMapLane<L,K,V> joinMapLane()
- Specified by:
joinMapLanein interfaceLaneFactory
-
joinValueLane
public <K,V> JoinValueLane<K,V> joinValueLane()
- Specified by:
joinValueLanein interfaceLaneFactory
-
listLane
public <V> ListLane<V> listLane()
- Specified by:
listLanein interfaceLaneFactory
-
mapLane
public <K,V> MapLane<K,V> mapLane()
- Specified by:
mapLanein interfaceLaneFactory
-
spatialLane
public <K,S,V> SpatialLane<K,S,V> spatialLane(Z2Form<S> shapeForm)
- Specified by:
spatialLanein interfaceLaneFactory
-
geospatialLane
public <K,V> SpatialLane<K,R2Shape,V> geospatialLane()
- Specified by:
geospatialLanein interfaceLaneFactory
-
supplyLane
public <V> SupplyLane<V> supplyLane()
- Specified by:
supplyLanein interfaceLaneFactory
-
valueLane
public <V> ValueLane<V> valueLane()
- Specified by:
valueLanein interfaceLaneFactory
-
wsLane
public <I,O> WsLane<I,O> wsLane()
- Specified by:
wsLanein interfaceLaneFactory
-
openMetaLane
public void openMetaLane(LaneBinding lane, NodeBinding metaLane)
- Specified by:
openMetaLanein interfaceNodeBinding
-
openMetaUplink
public void openMetaUplink(LinkBinding uplink, NodeBinding metaUplink)
- Specified by:
openMetaUplinkin interfaceNodeBinding
-
openMetaDownlink
public void openMetaDownlink(LinkBinding downlink, NodeBinding metaDownlink)
- Specified by:
openMetaDownlinkin interfaceCellContext
-
openUplink
public void openUplink(LinkBinding link)
- Specified by:
openUplinkin interfaceCellBinding
-
openUnknownUplink
protected void openUnknownUplink(Uri laneUri, LinkBinding link)
-
bindDownlink
public LinkBinding bindDownlink(Downlink downlink)
- Specified by:
bindDownlinkin interfaceCellContext
-
openDownlink
public void openDownlink(LinkBinding link)
- Specified by:
openDownlinkin interfaceCellContext
-
closeDownlink
public void closeDownlink(LinkBinding link)
- Specified by:
closeDownlinkin interfaceCellContext
-
pushUp
public void pushUp(Push<?> push)
- Specified by:
pushUpin interfaceCellBinding
-
pushDown
public void pushDown(Push<?> push)
- Specified by:
pushDownin interfaceCellContext
-
reportDown
public void reportDown(Metric metric)
- Specified by:
reportDownin interfaceCellContext
-
trace
public void trace(Object message)
Description copied from interface:LogLogs a trace-level message.
-
debug
public void debug(Object message)
Description copied from interface:LogLogs a debug-level message.
-
info
public void info(Object message)
Description copied from interface:LogLogs an info-level message.
-
warn
public void warn(Object message)
Description copied from interface:LogLogs a warn-level message.
-
error
public void error(Object message)
Description copied from interface:LogLogs an error-level message.
-
fail
public void fail(Object message)
Description copied from interface:LogLogs an fail-level message.
-
willOpen
protected void willOpen()
- Overrides:
willOpenin classAbstractTierBinding
-
willLoad
protected void willLoad()
- Overrides:
willLoadin classAbstractTierBinding
-
willStart
protected void willStart()
- Overrides:
willStartin classAbstractTierBinding
-
willStop
protected void willStop()
- Overrides:
willStopin classAbstractTierBinding
-
willUnload
protected void willUnload()
- Overrides:
willUnloadin classAbstractTierBinding
-
willClose
protected void willClose()
- Overrides:
willClosein classAbstractTierBinding
-
didClose
public void didClose()
- Specified by:
didClosein interfaceTierBinding- Overrides:
didClosein classAbstractTierBinding
-
didFail
public void didFail(Throwable error)
- Specified by:
didFailin interfaceTierBinding- Overrides:
didFailin classAbstractTierBinding
-
policy
public Policy policy()
- Specified by:
policyin interfaceCellContext
-
schedule
public Schedule schedule()
- Specified by:
schedulein interfaceCellContext
-
stage
public Stage stage()
- Specified by:
stagein interfaceCellContext
-
asyncStage
public Stage asyncStage()
-
store
public StoreBinding store()
- Specified by:
storein interfaceCellContext
-
timer
public TimerRef timer(TimerFunction timer)
Description copied from interface:ScheduleReturns an unscheduledTimerRefbound totimer, which can later be used to scheduletimer.
-
setTimer
public TimerRef setTimer(long millis, TimerFunction timer)
Description copied from interface:ScheduleSchedulestimerto execute aftermillismilliseconds have elapsed. Returns aTimerRefthat can be used to check the status of, reschedule, and canceltimer.
-
task
public TaskRef task(TaskFunction task)
Description copied from interface:StageReturns an uncuedTaskRefbound to thetask, which can later be used to cue thetask.
-
call
public <T> Call<T> call(Cont<T> future)
Description copied from interface:StageReturns aCallthat completes thecontinuation.
-
execute
public void execute(Runnable command)
Description copied from interface:StageSchedules arunnablefor concurrent execution.
-
taskWillBlock
public boolean taskWillBlock()
Description copied from interface:TaskReturnstrueif thisTaskmight block its thread of execution when running; returnsfalseif thisTaskwill never block. Used by the executionStageto prevent thread starvation when concurrently running many blocking tasks.- Specified by:
taskWillBlockin interfaceTask
-
runTask
public void runTask()
Description copied from interface:TaskExecutes this sequential process. Only one thread at a time will executerunTaskfor thisTask.- Specified by:
runTaskin interfaceTask- Specified by:
runTaskin interfaceTaskFunction
-
taskWillCue
public void taskWillCue()
Description copied from interface:TaskLifecycle callback invoked before thisTaskis scheduled for execution.- Specified by:
taskWillCuein interfaceTask
-
taskDidCancel
public void taskDidCancel()
Description copied from interface:TaskLifecycle callback invoked after thisTaskis explicitly cancelled.- Specified by:
taskDidCancelin interfaceTask
-
-