class ServiceRegistration extends Object implements LeasedResource, Comparable, Serializable
Modifier and Type | Field and Description |
---|---|
private Uuid |
cookie
Unique identifier object
|
private EventLogIterator |
eventIterator
Event log iterator.
|
private long |
expiration
The current expiration for this registration
|
private String |
iteratorNotifier
Lock object used to coordinate event delivery via the iterator.
|
private MarshalledObject |
marshalledEventTarget
The marshalled form of the client-provided notification target.
|
private RemoteEventListener |
preparedEventTarget
The prepared, client-provided notification target.
|
private Uuid |
remoteEventIteratorID
Unique identifier object for the currently enabled
(client-side) remote event iterator.
|
private static long |
serialVersionUID |
private Map |
unknownEvents
Map of collected EventID's that resulted in an
UnknownEventException for the current
eventTarget . |
Constructor and Description |
---|
ServiceRegistration(Uuid cookie,
EventLogIterator eventIterator)
Convenience constructor
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Object obj)
Primary sort by leaseExpiration, secondary by leaseID.
|
(package private) void |
dumpInfo(Logger logger)
Utility method to display debugging information to the
provided Logger
|
Uuid |
getCookie()
Returns the universally unique identifier associated with this
lease.
|
RemoteEventListener |
getEventTarget()
Get the reference to the prepared,
client-supplied notification target
|
long |
getExpiration()
Returns the expiration time of the lease.
|
Object |
getIteratorNotifier()
Get the remote iterator notifier object.
|
Uuid |
getRemoteEventIteratorID()
Get the remote iterator id
|
Map |
getUnknownEvents()
Return the identity map of EventIDs that caused an
UnknownEventException to be generated for the current
notification target.
|
boolean |
hasEventTarget()
Returns
true if an event target is currently set and
false otherwise. |
EventLogIterator |
iterator()
Get the reference to the registration's associated
EventLogIterator
|
void |
restoreTransientState(ProxyPreparer targetPreparer) |
void |
setEventTarget(RemoteEventListener preparedTarget)
Set the reference to the client-supplied notification target
|
void |
setExpiration(long newExpiration)
Changes the expiration time of the lease.
|
void |
setIterator(EventLogIterator iter)
Set the reference for this registration's
EventLogIterator
|
void |
setRemoteEventIteratorID(Uuid id)
Set the remote iterator id
|
String |
toString() |
private static final long serialVersionUID
private final Uuid cookie
private long expiration
private transient RemoteEventListener preparedEventTarget
private MarshalledObject marshalledEventTarget
private transient EventLogIterator eventIterator
private Map unknownEvents
eventTarget
. This Map
is checked
upon each mailbox notification for this registration.
If the received event has the same EventID
as the one contained in this Map
then an
UnknownEventException
is propagated back to the sender and the event is not logged.
This structure is also consulted before each event delivery request.
If the event to be delivered has an EventID that is
contained in this Map, then event delivery is cancelled
for that particular event. Note that this structure gets cleared
whenever a target listener is (re)set on the assumption that an
active (re)set will provide a new/better target listener that might
be able to handle these events.private Uuid remoteEventIteratorID
private final String iteratorNotifier
public ServiceRegistration(Uuid cookie, EventLogIterator eventIterator)
public void setExpiration(long newExpiration)
LeasedResource
setExpiration
in interface LeasedResource
newExpiration
- The new expiration time in milliseconds
since the beginning of the epochpublic long getExpiration()
LeasedResource
getExpiration
in interface LeasedResource
public Uuid getCookie()
LeasedResource
ReferentUuid
should return this object from their
getReferentUuid
method and should base their implementation of equals
on
this object.getCookie
in interface LeasedResource
public Map getUnknownEvents()
public RemoteEventListener getEventTarget()
public void setEventTarget(RemoteEventListener preparedTarget) throws IOException
IOException
public Uuid getRemoteEventIteratorID()
public Object getIteratorNotifier()
public void setRemoteEventIteratorID(Uuid id)
public boolean hasEventTarget()
true
if an event target is currently set and
false otherwise.public void restoreTransientState(ProxyPreparer targetPreparer) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public EventLogIterator iterator()
public void setIterator(EventLogIterator iter)
public int compareTo(Object obj)
compareTo
in interface Comparable
void dumpInfo(Logger logger)
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.