com.sun.jini.mercury
Class MailboxProxy

java.lang.Object
  extended by com.sun.jini.mercury.MailboxProxy
All Implemented Interfaces:
Serializable, Administrable, EventMailbox, PullEventMailbox, ReferentUuid
Direct Known Subclasses:
MailboxProxy.ConstrainableMailboxProxy

 class MailboxProxy
extends Object
implements PullEventMailbox, Administrable, Serializable, ReferentUuid

A MailboxProxy is a proxy for the event mailbox service. This is the object passed to clients of this service. It implements the PullEventMailbox and the Administrable interfaces.

Since:
1.1
Author:
Sun Microsystems, Inc.

Nested Class Summary
(package private) static class MailboxProxy.ConstrainableMailboxProxy
          A subclass of MailboxProxy that implements RemoteMethodControl.
 
Field Summary
(package private)  MailboxBackEnd mailbox
          The reference to the event mailbox service implementation
(package private)  Uuid proxyID
          The proxy's Uuid
private static long serialVersionUID
           
 
Constructor Summary
private MailboxProxy(MailboxBackEnd mailbox, Uuid proxyID)
          Convenience constructor.
 
Method Summary
(package private) static MailboxProxy create(MailboxBackEnd mailbox, Uuid id)
          Creates a mailbox 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.
 Object getAdmin()
          Returns an object that implements whatever administration interfaces are appropriate for the particular service.
 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.
 MailboxPullRegistration pullRegister(long duration)
          Defines the interface to the event mailbox service.
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.
 MailboxRegistration register(long duration)
          Defines the interface to the event mailbox service.
 
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

mailbox

final MailboxBackEnd mailbox
The reference to the event mailbox service implementation


proxyID

final Uuid proxyID
The proxy's Uuid

Constructor Detail

MailboxProxy

private MailboxProxy(MailboxBackEnd mailbox,
                     Uuid proxyID)
Convenience constructor.

Method Detail

create

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

Parameters:
mailbox - the server proxy
id - the ID of the server

register

public MailboxRegistration register(long duration)
                             throws RemoteException,
                                    LeaseDeniedException
Description copied from interface: EventMailbox
Defines the interface to the event mailbox service. Event mailbox clients utilize this service by invoking the register method to register themselves with the service.

Specified by:
register in interface EventMailbox
Parameters:
duration - the requested lease duration in milliseconds
Returns:
A new MailboxRegistration
Throws:
RemoteException - if there is a communication failure between the client and the service.
LeaseDeniedException - if the mailbox service is unable or unwilling to grant this registration request.

pullRegister

public MailboxPullRegistration pullRegister(long duration)
                                     throws RemoteException,
                                            LeaseDeniedException
Description copied from interface: PullEventMailbox
Defines the interface to the event mailbox service. Event mailbox clients utilize this service by invoking the pullRegister method to register themselves with the service.

Specified by:
pullRegister in interface PullEventMailbox
Parameters:
duration - the requested lease duration in milliseconds
Returns:
A new MailboxPullRegistration
Throws:
RemoteException - if there is a communication failure between the client and the service.
LeaseDeniedException - if the mailbox service is unable or unwilling to grant this registration request.

getAdmin

public Object getAdmin()
                throws RemoteException
Description copied from interface: Administrable
Returns an object that implements whatever administration interfaces are appropriate for the particular service.

Specified by:
getAdmin in interface Administrable
Returns:
an object that implements whatever administration interfaces are appropriate for the particular service.
Throws:
RemoteException
See Also:
JoinAdmin

getReferentUuid

public 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.