com.sun.jini.norm.event
Class EventTypeGenerator

java.lang.Object
  extended by com.sun.jini.norm.event.EventTypeGenerator
All Implemented Interfaces:
Serializable

public class EventTypeGenerator
extends Object
implements Serializable

Factory class for EventType objects. All EventType objects created by the same generator (or associated with the same generator by a EventType.restoreTransientState call) will use the same thread pool to manage their event send threads.

Author:
Sun Microsystems, Inc.
See Also:
EventType, EventType.restoreTransientState(com.sun.jini.norm.event.EventTypeGenerator, com.sun.jini.norm.event.SendMonitor, net.jini.security.ProxyPreparer), Serialized Form

Field Summary
private  long nextEvID
          Next event ID.
private static long serialVersionUID
           
private  TaskManager taskManager
          Task manager used to send events
private  WakeupManager wakeupManager
          Wakeup manager used by the event sending tasks to schedule retries.
 
Constructor Summary
EventTypeGenerator()
           
 
Method Summary
(package private)  TaskManager getTaskManager()
          Return the task manager that EventType objects created by this generator should use to send their events.
(package private)  WakeupManager getWakeupManager()
          Return the wakeup manager that EventType objects created by this generator should use to send their events.
 EventType newEventType(SendMonitor monitor)
          Create a new EventType object.
 EventType newEventType(SendMonitor monitor, long eventID)
          Create a new EventType object specify the event id it should have.
private  void readObject(ObjectInputStream in)
          Override readObject to create a TaskManager and a WakeupManager.
(package private)  void recoverEventID(long evID)
          Called by event types during transient state recovery to ensure the generator knows about there event ID.
 void terminate()
          Terminate any independent treads started by event types associated with this generator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

nextEvID

private long nextEvID
Next event ID.


taskManager

private transient TaskManager taskManager
Task manager used to send events


wakeupManager

private transient WakeupManager wakeupManager
Wakeup manager used by the event sending tasks to schedule retries.

Constructor Detail

EventTypeGenerator

public EventTypeGenerator()
Method Detail

newEventType

public EventType newEventType(SendMonitor monitor)
                       throws IOException
Create a new EventType object. The event ID for this type will be generated by this call.

Parameters:
monitor - Object to callback when an event sending attempt fails with a definite exception and to ensure that the lease on the event is still current. May not be null.
Returns:
the new EventType object
Throws:
IOException - if listener cannot be serialized

newEventType

public EventType newEventType(SendMonitor monitor,
                              long eventID)
                       throws IOException
Create a new EventType object specify the event id it should have.

Parameters:
eventID - the event ID of this type
monitor - Object to callback when an event sending attempt fails with a definite exception and to ensure that the lease on the event is still current. May not be null.
Returns:
the new EventType object
Throws:
IOException - if listener cannot be serialized

recoverEventID

void recoverEventID(long evID)
Called by event types during transient state recovery to ensure the generator knows about there event ID.

Note: this method is not synchronized.

Parameters:
evID - event ID of recovered EventType object

getTaskManager

TaskManager getTaskManager()
Return the task manager that EventType objects created by this generator should use to send their events.


getWakeupManager

WakeupManager getWakeupManager()
Return the wakeup manager that EventType objects created by this generator should use to send their events.


terminate

public void terminate()
Terminate any independent treads started by event types associated with this generator.


readObject

private void readObject(ObjectInputStream in)
                 throws IOException,
                        ClassNotFoundException
Override readObject to create a TaskManager and a WakeupManager.

Throws:
IOException
ClassNotFoundException
See Also:
ObjectInputStream.defaultReadObject()


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.