|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.rioproject.event.EventHandler
public abstract class EventHandler
The EventHandler is an abstract class which handles the basic event plumbing. The EventHandler sets up a LandLordLessor for the event type and creates leased event registrations for event registrants
| Nested Class Summary | |
|---|---|
protected static class |
EventHandler.EventRegistrationResource
Container class for event registration objects which are created and behave as the resource that is being leased and controlled by the ServiceResource |
| Field Summary | |
|---|---|
protected EventDescriptor |
descriptor
|
protected long |
ektime
|
protected LandlordLessor |
landlord
|
protected LeasedListManager |
resourceMgr
|
static String |
RESPONSE_WATCH
|
protected StopWatch |
responseWatch
|
protected long |
sendTime
|
protected int |
sent
|
protected long |
sequenceNumber
The sequence number is an increasing value that will act as a hint to the number of occurances of an event type. |
protected long |
sktime
|
protected int |
step
|
protected long |
t0
|
protected long |
t1
|
protected float |
tmp
|
protected WatchDataSourceRegistry |
watchRegistry
|
| Constructor Summary | |
|---|---|
EventHandler(EventDescriptor descriptor)
Use this constructor to create an EventHandler for a given EventDescriptor with a LandlordLessor created with default values used for LeasePeriodPolicy |
|
EventHandler(EventDescriptor descriptor,
Configuration config)
Use this constructor to create an EventHandler for a given EventDescriptor with a LandlordLessor created with specific values used for LeaseDurationPolicy. |
|
| Method Summary | |
|---|---|
void |
createWatch(WatchDataSourceRegistry watchRegistry)
Create a response time watch for this EventHandler, which will track the response time for event consumers, measured by how long each fire() invocation takes |
void |
destroyWatch()
Destroys the response time watch. |
abstract void |
fire(RemoteServiceEvent event)
The fire method must be overridden by classes that extend this EventHandler, hence the reason the method is declared abstract. |
protected ServiceResource |
getNextServiceResource()
Used to get the next ServiceResource from a
LandlordLessor |
int |
getRegistrantCount()
Gets the total number of ServiceResource instances contained by the LandlordLessor used by this EventHandler |
Watch |
getWatch()
Get the response time watch for this EventHandler |
protected void |
printStats()
Convenience method to print statisitics for every thousand events sent. |
EventRegistration |
register(Object eventSource,
RemoteEventListener listener,
MarshalledObject handback,
long duration)
Registers a RemoteEventListener for this event type. |
void |
terminate()
Terminates this EventHandler. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected EventDescriptor descriptor
protected LandlordLessor landlord
protected int sent
protected long sktime
protected long ektime
protected float tmp
protected StopWatch responseWatch
protected WatchDataSourceRegistry watchRegistry
protected LeasedListManager resourceMgr
public static final String RESPONSE_WATCH
protected int step
protected long t0
protected long t1
protected long sendTime
protected long sequenceNumber
| Constructor Detail |
|---|
public EventHandler(EventDescriptor descriptor)
throws Exception
descriptor - EventDescriptor for the event to handle
Exception - If a landlord lease manager cannot be created
public EventHandler(EventDescriptor descriptor,
Configuration config)
throws Exception
descriptor - EventDescriptor for the event to handleconfig - A Configuration object
Exception - If a landlord lease manager cannot be created| Method Detail |
|---|
public EventRegistration register(Object eventSource,
RemoteEventListener listener,
MarshalledObject handback,
long duration)
throws LeaseDeniedException
eventSource - The event sourcelistener - RemoteEventListenerhandback - MarshalledObjectduration - Requested EventRegistration lease LeaseDeniedException - If the lease manager denies the leasepublic void terminate()
public void createWatch(WatchDataSourceRegistry watchRegistry)
watchRegistry - The WatchRegistry to register the StopWatchpublic void destroyWatch()
public Watch getWatch()
public abstract void fire(RemoteServiceEvent event)
throws NoEventConsumerException
event - The event to send
NoEventConsumerException - This method may choose to throw a
NoEventConsumerException if there are no event consumers registeredpublic int getRegistrantCount()
protected ServiceResource getNextServiceResource()
ServiceResource from a
LandlordLessor
ServiceResource contained by the
LandlordLessor. If there are no
ServiceResource instances available in the
LandlordLessor then a value a null is returnedprotected void printStats()
-Dorg.rioproject.debug flag is set
|
Copyright © Rio Project. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||