- java.lang.Object
-
- swim.system.AbstractWarpRef
-
- swim.system.AbstractTierBinding
-
- swim.system.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 NodeContext
nodeContext
protected TaskContext
taskContext
-
Fields inherited from class swim.system.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()
Stage
asyncStage()
LinkBinding
bindDownlink(Downlink downlink)
<T> T
bottomNode(Class<T> nodeClass)
<T> Call<T>
call(Cont<T> future)
Returns aCall
that completes thecont
inuation.NodeAddress
cellAddress()
void
closeDownlink(LinkBinding link)
void
closeLane(Uri laneUri)
<V> CommandLane<V>
commandLane()
<A extends Agent>
AgentFactory<A>createAgentFactory(NodeBinding node, Class<? extends A> agentClass)
AgentFactory<?>
createAgentFactory(NodeBinding node, AgentDef agentDef)
long
createdTime()
protected LaneContext
createLaneContext(LaneAddress laneAddress, LaneBinding lane)
void
debug(Object message)
Logs a debug-level message.<V> DemandLane<V>
demandLane()
<K,V>
DemandMapLane<K,V>demandMapLane()
void
didClose()
protected void
didCloseLane(LaneBinding lane)
void
didFail(Throwable error)
protected void
didOpenLane(LaneBinding lane)
String
edgeName()
void
error(Object message)
Logs an error-level message.void
execute(Runnable command)
Schedules arunnable
for concurrent execution.void
fail(Object message)
Logs an fail-level message.<K,V>
SpatialLane<K,R2Shape,V>geospatialLane()
LaneBinding
getLane(Uri laneUri)
HostBinding
host()
Uri
hostUri()
<V> HttpLane<V>
httpLane()
Identity
identity()
void
info(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()
Uri
meshUri()
NodeContext
nodeContext()
Uri
nodeUri()
NodeBinding
nodeWrapper()
protected static Uri
normalizedLaneUri(Uri laneUri)
void
openAgents(NodeBinding node)
void
openDownlink(LinkBinding link)
LaneBinding
openLane(Uri laneUri)
LaneBinding
openLane(Uri laneUri, Lane lane)
LaneBinding
openLane(Uri laneUri, LaneBinding lane)
void
openLanes(NodeBinding node)
LaneBinding
openLaneView(Uri laneUri, LaneView laneView)
void
openMetaDownlink(LinkBinding downlink, NodeBinding metaDownlink)
void
openMetaLane(LaneBinding lane, NodeBinding metaLane)
void
openMetaNode(NodeBinding node, NodeBinding metaNode)
void
openMetaUplink(LinkBinding uplink, NodeBinding metaUplink)
protected void
openUnknownUplink(Uri laneUri, LinkBinding link)
void
openUplink(LinkBinding link)
Value
partKey()
Policy
policy()
void
pushDown(Push<?> push)
void
pushUp(Push<?> push)
void
reportDown(Metric metric)
void
runTask()
Executes this sequential process.Schedule
schedule()
void
setNodeContext(NodeContext nodeContext)
void
setTaskContext(TaskContext taskContext)
Sets the context used to managed thisTask
.TimerRef
setTimer(long millis, TimerFunction timer)
Schedulestimer
to execute aftermillis
milliseconds have elapsed.<K,S,V>
SpatialLane<K,S,V>spatialLane(Z2Form<S> shapeForm)
Stage
stage()
StoreBinding
store()
<V> SupplyLane<V>
supplyLane()
TaskRef
task(TaskFunction task)
Returns an uncuedTaskRef
bound to thetask
, which can later be used to cue thetask
.TaskContext
taskContext()
Returns the context used to managed thisTask
.void
taskDidCancel()
Lifecycle callback invoked after thisTask
is explicitly cancelled.boolean
taskWillBlock()
Returnstrue
if thisTask
might block its thread of execution when running; returnsfalse
if thisTask
will never block.void
taskWillCue()
Lifecycle callback invoked before thisTask
is scheduled for execution.TierContext
tierContext()
TimerRef
timer(TimerFunction timer)
Returns an unscheduledTimerRef
bound totimer
, which can later be used to scheduletimer
.void
trace(Object message)
Logs a trace-level message.<T> T
unwrapNode(Class<T> nodeClass)
<V> ValueLane<V>
valueLane()
void
warn(Object message)
Logs a warn-level message.protected void
willClose()
protected void
willLoad()
protected void
willOpen()
protected void
willStart()
protected void
willStop()
protected void
willUnload()
<I,O>
WsLane<I,O>wsLane()
-
Methods inherited from class swim.system.AbstractTierBinding
activate, awaitStart, close, didLoad, didOpen, didStart, didStop, didUnload, isClosed, isLoaded, isOpened, isStarted, load, open, start, stop, unload
-
Methods inherited from class swim.system.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:
tierContext
in interfaceTierBinding
- Specified by:
tierContext
in classAbstractTierBinding
-
host
public final HostBinding host()
- Specified by:
host
in interfaceNodeBinding
-
nodeWrapper
public final NodeBinding nodeWrapper()
- Specified by:
nodeWrapper
in interfaceNodeBinding
-
nodeContext
public final NodeContext nodeContext()
- Specified by:
nodeContext
in interfaceNodeBinding
-
setNodeContext
public void setNodeContext(NodeContext nodeContext)
- Specified by:
setNodeContext
in interfaceNodeBinding
-
unwrapNode
public <T> T unwrapNode(Class<T> nodeClass)
- Specified by:
unwrapNode
in interfaceNodeBinding
-
bottomNode
public <T> T bottomNode(Class<T> nodeClass)
- Specified by:
bottomNode
in interfaceNodeBinding
-
taskContext
public final TaskContext taskContext()
Description copied from interface:Task
- Specified by:
taskContext
in interfaceTask
-
setTaskContext
public void setTaskContext(TaskContext taskContext)
Description copied from interface:Task
Sets the context used to managed thisTask
. ATaskContext
is assigned when binding thisTask
to aStage
.- Specified by:
setTaskContext
in interfaceTask
-
createLaneContext
protected LaneContext createLaneContext(LaneAddress laneAddress, LaneBinding lane)
-
cellAddress
public NodeAddress cellAddress()
- Specified by:
cellAddress
in interfaceCellContext
- Specified by:
cellAddress
in interfaceNodeBinding
-
edgeName
public final String edgeName()
- Specified by:
edgeName
in interfaceCellContext
-
meshUri
public final Uri meshUri()
- Specified by:
meshUri
in interfaceCellContext
- Specified by:
meshUri
in interfaceNodeBinding
-
partKey
public final Value partKey()
- Specified by:
partKey
in interfaceNodeBinding
-
hostUri
public final Uri hostUri()
- Specified by:
hostUri
in interfaceNodeBinding
-
nodeUri
public final Uri nodeUri()
- Specified by:
nodeUri
in interfaceNodeBinding
-
createdTime
public long createdTime()
- Specified by:
createdTime
in interfaceNodeBinding
-
identity
public final Identity identity()
-
openMetaNode
public void openMetaNode(NodeBinding node, NodeBinding metaNode)
- Specified by:
openMetaNode
in interfaceNodeBinding
-
openLanes
public void openLanes(NodeBinding node)
- Specified by:
openLanes
in interfaceNodeBinding
-
agentIds
public FingerTrieSeq<Value> agentIds()
- Specified by:
agentIds
in interfaceNodeBinding
-
agents
public FingerTrieSeq<Agent> agents()
- Specified by:
agents
in interfaceNodeBinding
-
createAgentFactory
public AgentFactory<?> createAgentFactory(NodeBinding node, AgentDef agentDef)
- Specified by:
createAgentFactory
in interfaceNodeBinding
-
createAgentFactory
public <A extends Agent> AgentFactory<A> createAgentFactory(NodeBinding node, Class<? extends A> agentClass)
- Specified by:
createAgentFactory
in interfaceNodeBinding
-
openAgents
public void openAgents(NodeBinding node)
- Specified by:
openAgents
in interfaceNodeBinding
-
lanes
public HashTrieMap<Uri,LaneBinding> lanes()
- Specified by:
lanes
in interfaceNodeBinding
-
getLane
public LaneBinding getLane(Uri laneUri)
- Specified by:
getLane
in 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:
openLane
in interfaceNodeBinding
-
openLane
public LaneBinding openLane(Uri laneUri, LaneBinding lane)
- Specified by:
openLane
in 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:
commandLane
in interfaceLaneFactory
-
demandLane
public <V> DemandLane<V> demandLane()
- Specified by:
demandLane
in interfaceLaneFactory
-
demandMapLane
public <K,V> DemandMapLane<K,V> demandMapLane()
- Specified by:
demandMapLane
in interfaceLaneFactory
-
httpLane
public <V> HttpLane<V> httpLane()
- Specified by:
httpLane
in interfaceLaneFactory
-
joinMapLane
public <L,K,V> JoinMapLane<L,K,V> joinMapLane()
- Specified by:
joinMapLane
in interfaceLaneFactory
-
joinValueLane
public <K,V> JoinValueLane<K,V> joinValueLane()
- Specified by:
joinValueLane
in interfaceLaneFactory
-
listLane
public <V> ListLane<V> listLane()
- Specified by:
listLane
in interfaceLaneFactory
-
mapLane
public <K,V> MapLane<K,V> mapLane()
- Specified by:
mapLane
in interfaceLaneFactory
-
spatialLane
public <K,S,V> SpatialLane<K,S,V> spatialLane(Z2Form<S> shapeForm)
- Specified by:
spatialLane
in interfaceLaneFactory
-
geospatialLane
public <K,V> SpatialLane<K,R2Shape,V> geospatialLane()
- Specified by:
geospatialLane
in interfaceLaneFactory
-
supplyLane
public <V> SupplyLane<V> supplyLane()
- Specified by:
supplyLane
in interfaceLaneFactory
-
valueLane
public <V> ValueLane<V> valueLane()
- Specified by:
valueLane
in interfaceLaneFactory
-
wsLane
public <I,O> WsLane<I,O> wsLane()
- Specified by:
wsLane
in interfaceLaneFactory
-
openMetaLane
public void openMetaLane(LaneBinding lane, NodeBinding metaLane)
- Specified by:
openMetaLane
in interfaceNodeBinding
-
openMetaUplink
public void openMetaUplink(LinkBinding uplink, NodeBinding metaUplink)
- Specified by:
openMetaUplink
in interfaceNodeBinding
-
openMetaDownlink
public void openMetaDownlink(LinkBinding downlink, NodeBinding metaDownlink)
- Specified by:
openMetaDownlink
in interfaceCellContext
-
openUplink
public void openUplink(LinkBinding link)
- Specified by:
openUplink
in interfaceCellBinding
-
openUnknownUplink
protected void openUnknownUplink(Uri laneUri, LinkBinding link)
-
bindDownlink
public LinkBinding bindDownlink(Downlink downlink)
- Specified by:
bindDownlink
in interfaceCellContext
-
openDownlink
public void openDownlink(LinkBinding link)
- Specified by:
openDownlink
in interfaceCellContext
-
closeDownlink
public void closeDownlink(LinkBinding link)
- Specified by:
closeDownlink
in interfaceCellContext
-
pushUp
public void pushUp(Push<?> push)
- Specified by:
pushUp
in interfaceCellBinding
-
pushDown
public void pushDown(Push<?> push)
- Specified by:
pushDown
in interfaceCellContext
-
reportDown
public void reportDown(Metric metric)
- Specified by:
reportDown
in interfaceCellContext
-
trace
public void trace(Object message)
Description copied from interface:Log
Logs a trace-level message.
-
debug
public void debug(Object message)
Description copied from interface:Log
Logs a debug-level message.
-
info
public void info(Object message)
Description copied from interface:Log
Logs an info-level message.
-
warn
public void warn(Object message)
Description copied from interface:Log
Logs a warn-level message.
-
error
public void error(Object message)
Description copied from interface:Log
Logs an error-level message.
-
fail
public void fail(Object message)
Description copied from interface:Log
Logs an fail-level message.
-
willOpen
protected void willOpen()
- Overrides:
willOpen
in classAbstractTierBinding
-
willLoad
protected void willLoad()
- Overrides:
willLoad
in classAbstractTierBinding
-
willStart
protected void willStart()
- Overrides:
willStart
in classAbstractTierBinding
-
willStop
protected void willStop()
- Overrides:
willStop
in classAbstractTierBinding
-
willUnload
protected void willUnload()
- Overrides:
willUnload
in classAbstractTierBinding
-
willClose
protected void willClose()
- Overrides:
willClose
in classAbstractTierBinding
-
didClose
public void didClose()
- Specified by:
didClose
in interfaceTierBinding
- Overrides:
didClose
in classAbstractTierBinding
-
didFail
public void didFail(Throwable error)
- Specified by:
didFail
in interfaceTierBinding
- Overrides:
didFail
in classAbstractTierBinding
-
policy
public Policy policy()
- Specified by:
policy
in interfaceCellContext
-
schedule
public Schedule schedule()
- Specified by:
schedule
in interfaceCellContext
-
stage
public Stage stage()
- Specified by:
stage
in interfaceCellContext
-
asyncStage
public Stage asyncStage()
-
store
public StoreBinding store()
- Specified by:
store
in interfaceCellContext
-
timer
public TimerRef timer(TimerFunction timer)
Description copied from interface:Schedule
Returns an unscheduledTimerRef
bound totimer
, which can later be used to scheduletimer
.
-
setTimer
public TimerRef setTimer(long millis, TimerFunction timer)
Description copied from interface:Schedule
Schedulestimer
to execute aftermillis
milliseconds have elapsed. Returns aTimerRef
that can be used to check the status of, reschedule, and canceltimer
.
-
task
public TaskRef task(TaskFunction task)
Description copied from interface:Stage
Returns an uncuedTaskRef
bound to thetask
, which can later be used to cue thetask
.
-
call
public <T> Call<T> call(Cont<T> future)
Description copied from interface:Stage
Returns aCall
that completes thecont
inuation.
-
execute
public void execute(Runnable command)
Description copied from interface:Stage
Schedules arunnable
for concurrent execution.
-
taskWillBlock
public boolean taskWillBlock()
Description copied from interface:Task
Returnstrue
if thisTask
might block its thread of execution when running; returnsfalse
if thisTask
will never block. Used by the executionStage
to prevent thread starvation when concurrently running many blocking tasks.- Specified by:
taskWillBlock
in interfaceTask
-
runTask
public void runTask()
Description copied from interface:Task
Executes this sequential process. Only one thread at a time will executerunTask
for thisTask
.- Specified by:
runTask
in interfaceTask
- Specified by:
runTask
in interfaceTaskFunction
-
taskWillCue
public void taskWillCue()
Description copied from interface:Task
Lifecycle callback invoked before thisTask
is scheduled for execution.- Specified by:
taskWillCue
in interfaceTask
-
taskDidCancel
public void taskDidCancel()
Description copied from interface:Task
Lifecycle callback invoked after thisTask
is explicitly cancelled.- Specified by:
taskDidCancel
in interfaceTask
-
-