com.sun.jini.mercury
Class ListenerProxy

java.lang.Object
  extended by com.sun.jini.mercury.ListenerProxy
All Implemented Interfaces:
Serializable, Remote, EventListener, RemoteEventListener, ReferentUuid
Direct Known Subclasses:
ListenerProxy.ConstrainableListenerProxy

 class ListenerProxy
extends Object
implements RemoteEventListener, Serializable, ReferentUuid

The ListenerProxy class implements the RemoteEventListener interface. Instances of this class are provided as the event "forwarding" target to clients of the mailbox service.

Since:
1.1
Author:
Sun Microsystems, Inc.

Nested Class Summary
(package private) static class ListenerProxy.ConstrainableListenerProxy
          A subclass of ListenerProxy that implements RemoteMethodControl.
 
Field Summary
(package private)  Uuid registrationID
          The proxy's Uuid
private static long serialVersionUID
           
(package private)  MailboxBackEnd server
          The reference to the event mailbox service implementation
 
Constructor Summary
private ListenerProxy(MailboxBackEnd ref, Uuid regID)
          Simple constructor
 
Method Summary
(package private) static ListenerProxy create(Uuid id, MailboxBackEnd server)
          Creates a mailbox listener proxy, returning an instance that implements RemoteMethodControl if the server does too.
 boolean equals(Object o)
          Proxies for servers with the same proxyID are considered equal.
 Uuid getReferentUuid()
          Returns the universally unique identifier that has been assigned to the resource this proxy represents.
 int hashCode()
          Proxies for servers with the same proxyID have the same hash code.
 void notify(RemoteEvent theEvent)
          Notify the listener about an event.
private  void readObject(ObjectInputStream s)
          When an instance of this class is deserialized, this method is automatically invoked.
private  void readObjectNoData()
          During deserialization of an instance of this class, if it is found that the stream contains no data, this method is automatically invoked.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

server

final MailboxBackEnd server
The reference to the event mailbox service implementation


registrationID

final Uuid registrationID
The proxy's Uuid

Constructor Detail

ListenerProxy

private ListenerProxy(MailboxBackEnd ref,
                      Uuid regID)
Simple constructor

Method Detail

create

static ListenerProxy create(Uuid id,
                            MailboxBackEnd server)
Creates a mailbox listener proxy, returning an instance that implements RemoteMethodControl if the server does too.

Parameters:
id - the ID of the proxy
server - the server's listener proxy

notify

public void notify(RemoteEvent theEvent)
            throws UnknownEventException,
                   RemoteException
Description copied from interface: RemoteEventListener
Notify the listener about an event.

The call to notify is synchronous to allow the party making the call to know if the call succeeded. However, it is not part of the semantics of the call that the notification return can be delayed while the recipient of the call reacts to the occurrence of the event. Simply put, the best strategy on the part of the recipient is to note the occurrence in some way and then return from the notify method as quickly as possible.

UnknownEventException is thrown when the recipient does not recognize the combination of the event identifier and the event source as something in which it is interested. Throwing this exception has the effect of asking the sender to not send further notifications of this kind of event from this source in the future.

Specified by:
notify in interface RemoteEventListener
Parameters:
theEvent - the remote event that occurred
Throws:
UnknownEventException - the recipient does not recognize the combination of event identifier and event source
RemoteException

getReferentUuid

public final Uuid getReferentUuid()
Returns the universally unique identifier that has been assigned to the resource this proxy represents.

Specified by:
getReferentUuid in interface ReferentUuid
Returns:
the instance of Uuid that is associated with the resource this proxy represents. This method will not return null.
See Also:
ReferentUuid

hashCode

public int hashCode()
Proxies for servers with the same proxyID have the same hash code.

Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Proxies for servers with the same proxyID are considered equal.

Overrides:
equals in class Object

readObject

private void readObject(ObjectInputStream s)
                 throws IOException,
                        ClassNotFoundException
When an instance of this class is deserialized, this method is automatically invoked. This implementation of this method validates the state of the deserialized instance.

Throws:
InvalidObjectException - if the state of the deserialized instance of this class is found to be invalid.
IOException
ClassNotFoundException

readObjectNoData

private void readObjectNoData()
                       throws ObjectStreamException
During deserialization of an instance of this class, if it is found that the stream contains no data, this method is automatically invoked. Because it is expected that the stream should always contain data, this implementation of this method simply declares that something must be wrong.

Throws:
InvalidObjectException - to indicate that there was no data in the stream during deserialization of an instance of this class; declaring that something is wrong.
ObjectStreamException


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