Interface Fiber
-
- All Known Subinterfaces:
InitializableFiber
,MockServiceDaemonMBean
,NotifdQueueHandler
,PausableFiber
,ServiceDaemon
,ServiceDaemonMBean
- All Known Implementing Classes:
AbstractServiceDaemon
,Actiond
,Alarmd
,AsteriskGateway
,Collectd
,Correlator
,DataSender
,DefaultQueueHandler
,Discovery
,EnhancedLinkd
,Eventd
,EventTranslator
,EventTranslator
,JettyServer
,LegacyScheduler
,MockServiceDaemon
,Notifd
,PassiveStatusd
,PassiveStatusKeeper
,Poller
,Queued
,RTCManager
,Scriptd
,SnmpPoller
,Syslogd
,Tl1d
,Trapd
,Vacuumd
public interface Fiber
The
Fiber
interface is similar to the core Java languageThread
class. TheFiber
class is used to define a working context, which is the basic feature of aThread
. The differences end there since theThread
class is part of the core language and can only be extended since it is a concrete class.The
Fiber
concept is used to represent an implementation defined execution context outside of the core Java language. It provides a very loose definition of what and how aFiber
should behave. This gives a great deal of implementation independence to the implementing classes.For example, the
Fiber
interface could be used to represent a one-to-one mapping of a JavaThread
. It could be used to represent a thread pool where multiple threads are grouped as oneFiber
unit. Additionally, it could be used to defined a new execution environment where multiple Runnable elements are multiplexed over a one or more threads, where the Runnables far exceed the core Java threads.- Author:
- Brian Weaver
-
-
Field Summary
Fields Modifier and Type Field Description static int
RUNNING
This state is used to define the normal runtime condition of aFiber
.static int
START_PENDING
This is the initialFiber
state.static int
STARTING
This state is used to define when aFiber
has begun the Initialization process.static java.lang.String[]
STATUS_NAMES
The string names that correspond to the states of the fiber.static int
STOP_PENDING
This state is used to denote when theFiber
is terminating processing.static int
STOPPED
This state represents the final resting state of aFiber
.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
getName()
This method is used to return the name of theFiber
.int
getStatus()
This method is used to get the current status of theFiber
.void
start()
This method is used to start the initialization process of theFiber
, which should eventually transition to aRUNNING
status.void
stop()
This method is used to stop a currently runningFiber
.
-
-
-
Field Detail
-
STATUS_NAMES
static final java.lang.String[] STATUS_NAMES
The string names that correspond to the states of the fiber.
-
START_PENDING
static final int START_PENDING
This is the initialFiber
state. When theFiber
begins it startup process it will transition to theSTARTING
state. AFiber
in a start pending state has not begun any of the initialization process.- See Also:
- Constant Field Values
-
STARTING
static final int STARTING
This state is used to define when aFiber
has begun the Initialization process. Once the initialization process is completed theFiber
will transition to aRUNNING
status.- See Also:
- Constant Field Values
-
RUNNING
static final int RUNNING
This state is used to define the normal runtime condition of aFiber
. When aFiber
is in this state then it is processing normally.- See Also:
- Constant Field Values
-
STOP_PENDING
static final int STOP_PENDING
This state is used to denote when theFiber
is terminating processing. This state is always followed by the stateST0PPED
.- See Also:
- Constant Field Values
-
STOPPED
static final int STOPPED
This state represents the final resting state of aFiber
. Depending on the implementation it may be possible to resurrect theFiber
from this state.- See Also:
- Constant Field Values
-
-
Method Detail
-
start
void start()
This method is used to start the initialization process of theFiber
, which should eventually transition to aRUNNING
status.
-
stop
void stop()
This method is used to stop a currently runningFiber
. Once invoked theFiber
should begin it's shutdown process. Depending on the implementation, this method may block until theFiber
terminates.
-
getName
java.lang.String getName()
This method is used to return the name of theFiber
. The name of the instance is defined by the implementor, but it should be realitively unique when possible.- Returns:
- The name of the
Fiber
.
-
getStatus
int getStatus()
This method is used to get the current status of theFiber
. The status of the fiber should be one of the predefined constants of theFiber
interface, or from one of the derived interfaces.- Returns:
- The current status of the
Fiber
.
-
-