Overview | Package | Class | Tree | Index | Help

Oracle® Coherence Java API Reference
v3.5.3
E15583-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.tangosol.coherence.commonj
Class WorkManager.WorkHolder

    java.lang.Object
      com.tangosol.util.Base
          com.tangosol.coherence.commonj.WorkManager.WorkHolder

All Implemented Interfaces:
  commonj.work.RemoteWorkItem, commonj.work.WorkItem, java.lang.Comparable

Enclosing class:
  WorkManager

    protected class WorkManager.WorkHolder

extends Base
implements commonj.work.RemoteWorkItem

A holder for a Work object that serves as a communication intermediary between a client and a [remote] service.

Nested Class Summary
`protected class` | `WorkManager.WorkHolder.Event` A WorkEvent implementation.

Field Summary
`protected commonj.work.WorkListener` | `m_listener` A work listener associated with the corresponding Work.
`protected java.util.List` | `m_listWaits` A list of collections waiting for this Work to complete.
`protected long` | `m_lWorkId` The corresponding work id.
`protected Member` | `m_member` The server Member that is to run the Work.
`protected java.lang.Object` | `m_oResult` The Work result.
`protected InvocationService` | `m_service` The underlying Invocation service.
`protected WorkManager.WorkStatus` | `m_status` Current Work status.

Constructor Summary
`WorkManager.WorkHolder(long lWorkId, commonj.work.WorkListener listener, InvocationService service, Member member)` Construct a WorkHolder for a Work with a given work id that is scheduled to be executed on a specified service.

Method Summary
`void` | `addWait(java.util.Collection collWait)` Add a collection to a wait list.
`int` | `compareTo(java.lang.Object o)` Compare this WorkItem with the specified object for order.
`boolean` | `equals(java.lang.Object o)` Compare this WorkItem with the specified object for equality.
`commonj.work.WorkListener` | `getListener()` Return the associated WorkListener.
`commonj.work.WorkManager` | `getPinnedWorkManager()` Return a pinned WorkManager which represents the JVM that was used to execute this Work.
`commonj.work.Work` | `getResult()` Return the Work once it has completed.
`InvocationService` | `getService()` Return the InvocationService used to execute the corresponding Work.
`int` | `getStatus()` Return the current status of dispatching the Work.
`Member` | `getTargetMember()` Return the Member that the corresponding Work is to be executed at.
`java.util.Collection[]` | `getWaits()` Assemble an array of collection that wait for this Work.
`long` | `getWorkId()` Return the work id.
`WorkManager.WorkStatus` | `getWorkStatus()` Return the WorkStatus object.
`int` | `hashCode()` Return a hash code value for this WorkHolder.
`void` | `release()` Calls the remote Work object's `Work.release()` method.
`void` | `removeWait(java.util.Collection collWait)` Remove a collection from a wait list.
`protected void` | `setWorkStatus(WorkManager.WorkStatus status)` Update the WorkStatus.
`java.lang.String` | `toString()` Return a string representation of the WorkHolder object.

Field Detail

### m_lWorkId

    protected long m_lWorkId

  The corresponding work id.

### m_listener

    protected commonj.work.WorkListener m_listener

  A work listener associated with the corresponding Work.

### m_service

    protected InvocationService m_service

  The underlying Invocation service.

### m_member

    protected Member m_member

  The server Member that is to run the Work.

### m_status

    protected WorkManager.WorkStatus m_status

  Current Work status.

### m_oResult

    protected java.lang.Object m_oResult

  The Work result.

### m_listWaits

    protected java.util.List m_listWaits

  A list of collections waiting for this Work to complete. Usually this list contains no more than one item.

Constructor Detail

### WorkManager.WorkHolder

    public WorkManager.WorkHolder(long lWorkId,
                                  commonj.work.WorkListener listener,
                                  InvocationService service,
                                  Member member)

  Construct a WorkHolder for a Work with a given work id that is scheduled to be executed on a specified service.

  Parameters:
    `lWorkId` - the Work id
    `listener` - the WorkListener
    `service` - the InvocationService to use
    `member` - the target Member

Method Detail

### getStatus

    public int getStatus()

  Return the current status of dispatching the Work. See `WorkEvent` for the values.

  Specified by:
    `getStatus` in interface `commonj.work.WorkItem`
  Returns:
    the work status

### getResult

    public commonj.work.Work getResult()
                                throws commonj.work.WorkException

  Return the Work once it has completed. If the Work threw an exception during run then the exception is re-thrown here.

  Specified by:
    `getResult` in interface `commonj.work.WorkItem`
  Throws:
    `commonj.work.WorkException`

### getPinnedWorkManager

    public commonj.work.WorkManager getPinnedWorkManager()

  Return a pinned WorkManager which represents the JVM that was used to execute this Work.

  Specified by:
    `getPinnedWorkManager` in interface `commonj.work.RemoteWorkItem`

### release

    public void release()

  Calls the remote Work object's `Work.release()` method.

  Specified by:
    `release` in interface `commonj.work.RemoteWorkItem`

### compareTo

    public int compareTo(java.lang.Object o)

  Compare this WorkItem with the specified object for order.

  Specified by:
    `compareTo` in interface `java.lang.Comparable`

### getWorkId

    public long getWorkId()

  Return the work id.

  Returns:
    the work id.

### getWorkStatus

    public WorkManager.WorkStatus getWorkStatus()

  Return the WorkStatus object.

  Returns:
    the WorkStatus object

### getService

    public InvocationService getService()

  Return the InvocationService used to execute the corresponding Work.

  Returns:
    the InvocationService reference

### getTargetMember

    public Member getTargetMember()

  Return the Member that the corresponding Work is to be executed at.

  Returns:
    the target Member

### getListener

    public commonj.work.WorkListener getListener()

  Return the associated WorkListener.

  Returns:
    the listener object

### setWorkStatus

    protected void setWorkStatus(WorkManager.WorkStatus status)

  Update the WorkStatus.

  Parameters:
    `status` - the WorkStatus object to update

### addWait

    public void addWait(java.util.Collection collWait)

  Add a collection to a wait list.

  Parameters:
    `collWait` - a collection that waits for this Work

### removeWait

    public void removeWait(java.util.Collection collWait)

  Remove a collection from a wait list. The collection must have been added using the `addWait(java.util.Collection)` call.

  Parameters:
    `collWait` - a collection that waits for this Work

### getWaits

    public java.util.Collection[] getWaits()

  Assemble an array of collection that wait for this Work.

  Returns:
    an array of collections that wait for this Work

### hashCode

    public int hashCode()

  Return a hash code value for this WorkHolder.

### equals

    public boolean equals(java.lang.Object o)

  Compare this WorkItem with the specified object for equality.

### toString

    public java.lang.String toString()

  Return a string representation of the WorkHolder object.

Overview | Package | Class | Tree | Index | Help

Oracle® Coherence Java API Reference
v3.5.3
E15583-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2010, Oracle. All rights reserved.