- java.lang.Object
-
- org.praxislive.base.AbstractRoot.Controller
-
- All Implemented Interfaces:
Root.Controller
- Enclosing class:
- AbstractRoot
protected class AbstractRoot.Controller extends Object implements Root.Controller
Implementation of Root.Controller.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Controller()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
onQueueReceipt()
Called on receipt of aPacket
(Call) or a Runnable task.void
shutdown()
Signal the Root to be shutdown.void
start(ThreadFactory threadFactory)
Start the Root.boolean
submitPacket(Packet packet)
Deliver a Packet to this Root.
-
-
-
Method Detail
-
submitPacket
public boolean submitPacket(Packet packet)
Description copied from interface:Root.Controller
Deliver a Packet to this Root. This method is intended to be called from a thread other than the primary thread of the Root. It will add the packet to a queue and return immediately - this method will never block as it may be called from the thread of another Root. This method will return true if the Packet can be handled (see eg. BlockingQueue::offer)- Specified by:
submitPacket
in interfaceRoot.Controller
- Parameters:
packet
- message (see Packet / Call) to handle- Returns:
- true if the packet can be handled
-
start
public void start(ThreadFactory threadFactory)
Description copied from interface:Root.Controller
Start the Root. If the Root implementation requires a primary thread to run on it will use the supplied ThreadFactory so that the RootHub can manage thread creation. The ThreadFactory is not required to support the creation of more than one Thread. Controller implementations will ensure that this method can only be invoked once.- Specified by:
start
in interfaceRoot.Controller
- Parameters:
threadFactory
- used if the Root requires a thread to run on.
-
shutdown
public void shutdown()
Description copied from interface:Root.Controller
Signal the Root to be shutdown. This method is intended to be called asynchronously and will return immediately - it will not wait for the Root to actually complete execution.- Specified by:
shutdown
in interfaceRoot.Controller
-
onQueueReceipt
protected void onQueueReceipt()
Called on receipt of aPacket
(Call) or a Runnable task. The default implementation will callAbstractRoot.Delegate.onQueueReceipt()
if a delegate is attached, or otherwise trigger an asynchronous poll of the queue.
-
-