|
Oracle® Coherence Java API Reference Release 3.6.0.0 E15725-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.tangosol.util.Base
com.tangosol.coherence.commonj.WorkManager
public class WorkManager
An implementation of commonj.work.WorkManager based on a joint BEA-IBM specification: "The Timer and Work Manager for Application Servers", which is a foundation of JSR 237: Work Manager for Application Servers. <p/> Implementation notes:
getCurrentResult(commonj.work.WorkItem)
method.Note: The WorkManager is a feature of the Coherence Enterprise Edition and Coherence Grid Edition. It cannot be used in a Coherence Standard Edition cluster.
Nested Class Summary | |
---|---|
protected static class |
WorkManager.AbstractWork Base class for Invocable tasks related to the WorkManager. |
protected static class |
WorkManager.CollectMembershipInfo Invocable task used during handshake, which has to be scheduled immediately . |
protected static class |
WorkManager.ReleaseWork Invocable task that forces a release for a wrapped Work object. |
protected class |
WorkManager.RemoteWorkManager RemoteWorkManager is a delegating WorkManager wrapper. |
protected static class |
WorkManager.RequestStatus Invocable task that requests a status for a given Work. |
protected static class |
WorkManager.ScheduleWork Invocable task that posts a wrapped Work object to a WorkManager queue. |
protected static class |
WorkManager.ScheduleWorkRejectedException The ScheduleWorkRejectedException is a WrapperException that carries the information about the rejected Work. |
protected static class |
WorkManager.SendFeedback Invocable task that delivers a WorkEvent to a WorkListener. |
protected class |
WorkManager.ServiceListener The member listener for the InvocataionService used by the WorkManager. |
protected class |
WorkManager.WorkHolder A holder for a Work object that serves as a communication intermediary between a client and a [remote] service. |
protected class |
WorkManager.WorkObserver The InvocationObserver for all posted work. |
protected static class |
WorkManager.WorkStatus A WorkStatus object is used to communicate a work execution status back to the caller. |
Field Summary | |
---|---|
protected InvocationObserver |
m_workObserver The ScheduleWork agent observer. |
Fields inherited from interface commonj.work.WorkManager |
---|
IMMEDIATE, INDEFINITE |
Constructor Summary | |
---|---|
WorkManager(String sManagerName, ConfigurableCacheFactory factory) Construct the WorkManager using the specified ConfigurableCacheFactory. |
|
WorkManager(String sManagerName, int cThreads) Construct the WorkManager. |
Method Summary | |
---|---|
void |
cancelPostedWork() Cancel all posted work that has not yet completed. |
protected Member |
chooseServer() Choose a Member to run a next Work at. |
protected void |
collectMembershipInfo() Inform all the members about this node's role (client or server) and collect the information regarding other nodes' roles |
void |
disableServer(Member member) Remove a Member from a list of active server nodes and terminate all work posted to that server. |
protected int |
generateWorkId() Generate a unique (for this WorkManager) work id. |
Map |
getAcceptedWork() Return a catalog of accepted ScheduleWork tasks as known by the server side keyed by the origin Member where the value is a map of ScheduleWork tasks keyed by the WorkId. |
WorkManager.WorkStatus |
getCurrentResult(commonj.work.WorkItem item) Retrieve a current WorkStatus (partial result) for a given Work. |
Map |
getPostedWork() Return a catalog of WorkHolder objects for all posted Work as known by the client side keyed by the corresponding work id. |
protected WorkManager.WorkHolder |
getPostedWork(long lWorkId) Return a WorkHolder for a posted work with a given id. |
Set |
getServers() Return a set of Members that run the same Invocation service as this WorkManager in a "server" capacity. |
InvocationService |
getService() Return an InvocationService used by this WorkManager. |
protected void |
init(String sManagerName, int cThreads, ConfigurableCacheFactory factory) Initialization. |
protected void |
initWork(WorkManager.ScheduleWork workAgent) Initialize the remote work agent. |
protected void |
installMemberListener() Install a MemberListener. |
protected void |
instantiateWorkObserver() Instantiate a Work observer. |
boolean |
isServer() Check whether or not this node operates in a "server" mode processing remote Work requests. |
static void |
main(String[] asArg) Entry point: start a stand-alone WorkManager (server) using the specified name and thread count. |
protected void |
processFeedback(WorkManager.SendFeedback workFeedback) Process a remote work feedback. |
protected WorkManager.WorkStatus |
processWork(WorkManager.ScheduleWork workAgent) Run the remote work agent. |
protected void |
releaseWork(WorkManager.ReleaseWork releaseAgent) Release the remote work agent. |
protected WorkManager.WorkHolder |
removePostedWork(long lWorkId) Remove a WorkHolder for a posted work with a given id. |
protected WorkManager.WorkStatus |
requestWorkStatus(WorkManager.RequestStatus requestAgent) Obtain current status of the specified Work. |
commonj.work.WorkItem |
schedule(commonj.work.Work work) Dispatches a Work asynchronously. |
commonj.work.WorkItem |
schedule(commonj.work.Work work, commonj.work.WorkListener workListener) Dispatches a Work asynchronously. |
protected commonj.work.WorkItem |
schedule(commonj.work.Work work, commonj.work.WorkListener workListener, Member member) Accepts a Work instance for processing at the specified Member. |
protected boolean |
updateWork(WorkManager.WorkStatus status) Update a WorkStatus for a work. |
boolean |
waitForAll(Collection collWorkItems, long lTimeoutMillis) Wait for all WorkItems in the collection to finish. |
Collection |
waitForAny(Collection collWorkItems, long lTimeoutMillis) Wait for any of the WorkItems in the collection to finish. |
Field Detail |
---|
protected InvocationObserver m_workObserver
Constructor Detail |
---|
public WorkManager(String sManagerName, int cThreads)
sManagerName
- a unique WorkManager namecThreads
- number of threads dedicated for Work processing; zero for WorkManagers in a "client-only" rolepublic WorkManager(String sManagerName, ConfigurableCacheFactory factory)
sManagerName
- a unique WorkManager namefactory
- ConfigurableCacheFactory that will be used to instantiate the corresponding InvocationService using the factory.ensureService(sManagerName)
callMethod Detail |
---|
protected void init(String sManagerName, int cThreads, ConfigurableCacheFactory factory)
sManagerName
- a unique WorkManager namecThreads
- number of threadsfactory
- ConfigurableCacheFactory to useprotected void installMemberListener()
protected void instantiateWorkObserver()
protected void collectMembershipInfo()
public commonj.work.WorkItem schedule(commonj.work.Work work) throws commonj.work.WorkException
schedule
in interface commonj.work.WorkManager
work
- the Work to execute.commonj.work.WorkException
- thrown if queuing this up results in an exceptionpublic commonj.work.WorkItem schedule(commonj.work.Work work, commonj.work.WorkListener workListener) throws commonj.work.WorkException
schedule
in interface commonj.work.WorkManager
work
- the Work to executeworkListener
- an optional WorkListener which is used to inform the application of the progress of a Workcommonj.work.WorkException
- thrown if queuing this up results in an exceptionprotected commonj.work.WorkItem schedule(commonj.work.Work work, commonj.work.WorkListener workListener, Member member) throws commonj.work.WorkException
work
- the Work to executeworkListener
- an optional WorkListener which is used to inform the application of the progress of a Workmember
- the Member to execute the Work atcommonj.work.WorkException
- thrown if queuing this up results in an exceptionpublic boolean waitForAll(Collection collWorkItems, long lTimeoutMillis) throws InterruptedException
waitForAll
in interface commonj.work.WorkManager
collWorkItems
- the Collection of WorkItem objects to wait forlTimeoutMillis
- the timout in milliseconds. If this value is zero then this method returns immediatelyInterruptedException
- thrown if the wait is interruptedIllegalArgumentException
- thrown if workItems is null, any of the objects in the collection are not WorkItems or the timeout is negativepublic Collection waitForAny(Collection collWorkItems, long lTimeoutMillis) throws InterruptedException
waitForAny
in interface commonj.work.WorkManager
collWorkItems
- the Collection of WorkItem objects to wait forlTimeoutMillis
- the timeout in ms. If this value is zero then the method returns immediately, i.e. does not blockInterruptedException
- thrown if the wait is interruptedIllegalArgumentException
- thrown if workItems is null, any of the objects in the collection are not WorkItems or the timeout is negativepublic WorkManager.WorkStatus getCurrentResult(commonj.work.WorkItem item)
item
- the WorkItem to retrieve the status forpublic InvocationService getService()
public Set getServers()
public Map getPostedWork()
public Map getAcceptedWork()
public boolean isServer()
public void disableServer(Member member)
member
- the Member to remove from the server listpublic void cancelPostedWork()
protected Member chooseServer()
protected WorkManager.WorkHolder getPostedWork(long lWorkId)
lWorkId
- a work idprotected WorkManager.WorkHolder removePostedWork(long lWorkId)
lWorkId
- a work idprotected int generateWorkId()
protected void processFeedback(WorkManager.SendFeedback workFeedback)
workFeedback
- the feedback Work objectprotected boolean updateWork(WorkManager.WorkStatus status)
status
- a WorkStatus object with an new statusprotected void initWork(WorkManager.ScheduleWork workAgent)
workAgent
- the agent Work objectprotected WorkManager.WorkStatus processWork(WorkManager.ScheduleWork workAgent)
workAgent
- the agent Work objectprotected WorkManager.WorkStatus requestWorkStatus(WorkManager.RequestStatus requestAgent)
requestAgent
- the request statusprotected void releaseWork(WorkManager.ReleaseWork releaseAgent)
releaseAgent
- the release workpublic static void main(String[] asArg)
Example: java com.tangosol.coherence.commonj.WorkManager Manager 5
|
Oracle® Coherence Java API Reference Release 3.6.0.0 E15725-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |