com.resilientedge.util.workerPool
Class WorkerPoolEvent

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--com.resilientedge.util.workerPool.WorkerPoolEvent
All Implemented Interfaces:
java.io.Serializable

public class WorkerPoolEvent
extends java.util.EventObject

WorkerPool event. These events are generated for a listener on a thread (worker) pool.

Author:
jgardner
See Also:
Serialized Form

Field Summary
static int ADD_EVENT
          thread added to pool
static int REMOVE_EVENT
          thread removed from pool
static int WORK_COMPLETED_EVENT
          a thread completed work
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
WorkerPoolEvent(WorkerPool source, int id, int curr, int min, int max)
          Constructor.
WorkerPoolEvent(WorkerPool source, int id, int curr, int min, int max, java.lang.Object obj)
          Constructor.
 
Method Summary
 int getCurrentSize()
           
 int getEventId()
           
 WorkerPool getEventSource()
           
 int getMaxSize()
           
 int getMinSize()
           
 java.lang.Object getWorkResult()
          If this is a work completion event, the work result is the object that was returned when a request completed on a worker in the pool.
 java.lang.String toString()
           
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ADD_EVENT

public static final int ADD_EVENT
thread added to pool

REMOVE_EVENT

public static final int REMOVE_EVENT
thread removed from pool

WORK_COMPLETED_EVENT

public static final int WORK_COMPLETED_EVENT
a thread completed work
Constructor Detail

WorkerPoolEvent

public WorkerPoolEvent(WorkerPool source,
                       int id,
                       int curr,
                       int min,
                       int max)
Constructor.
Parameters:
source - the thread pool where the event originated
id - the event id
curr - the current number of pool entries
min - the minimum number of pool entries
max - the maximum number of pool entries, if less than minimum, minimum is used

WorkerPoolEvent

public WorkerPoolEvent(WorkerPool source,
                       int id,
                       int curr,
                       int min,
                       int max,
                       java.lang.Object obj)
Constructor.
Parameters:
source - the worker (thread) pool where the event originated
id - the event id
curr - the current number of pool entries
min - the minimum number of pool entries
max - the maximum number of pool entries, if less than minimum, minimum is used
obj - an optional object whose meaning is event dependent
Method Detail

getEventSource

public WorkerPool getEventSource()
Returns:
the worker (thread) pool that generated the event

getEventId

public int getEventId()
Returns:
the event identifier

getCurrentSize

public int getCurrentSize()
Returns:
the current pool size when the event was generated

getMinSize

public int getMinSize()
Returns:
the minimum pool size when the event was generated

getMaxSize

public int getMaxSize()
Returns:
the maximum pool size when the event was generated

getWorkResult

public java.lang.Object getWorkResult()
If this is a work completion event, the work result is the object that was returned when a request completed on a worker in the pool.
Returns:
the object that was generated by the completion of a request, may be null

toString

public java.lang.String toString()
Overrides:
toString in class java.util.EventObject
Returns:
the event identifier


Copyright © 2001 Resilient Edge, Inc. All Rights Reserved.