org.sapia.ubik.rmi.server
Class RemoteRefStateless

java.lang.Object
  extended by org.sapia.ubik.rmi.server.RemoteRefStateless
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, java.lang.reflect.InvocationHandler, HealthCheck, StubInvocationHandler

public class RemoteRefStateless
extends java.lang.Object
implements StubInvocationHandler, java.io.Externalizable, HealthCheck

A stub handler that manages reconnecting to another server instance provided a method call fails.

Note that this class does NOT inherit from RemoteRef - despite what the name mignt suggest. This is because this class, by definition, does not correspond to a single server endpoint, but to multiple server endpoints.

Indeed, an instance of this class corresponds to all servers that were bound under a given name.

This design might review eventually, to provide a more consistent class hierarchy.

Copyright:
Copyright © 2002-2003 Sapia Open Source Software. All Rights Reserved.
License:
Read the license.txt file of the jar or visit the license page at the Sapia OSS web site

See Also:
Serialized Form

Nested Class Summary
static class RemoteRefStateless.ServiceInfo
           
 
Field Summary
protected  java.lang.String _domain
           
protected  boolean _isRegistered
           
protected  java.lang.String _mcastAddress
           
protected  int _mcastPort
           
protected  javax.naming.Name _name
           
protected  OID _oid
           
protected  java.util.List _serviceInfos
           
 
Constructor Summary
RemoteRefStateless()
          Constructor for RemoteRefStateless.
RemoteRefStateless(javax.naming.Name name, java.lang.String domain)
          Creates an instance of this class
 
Method Summary
protected  RemoteRefStateless.ServiceInfo acquire()
           
 void addSibling(RemoteRefStateless other)
          Adds another ref's information to this instance.
protected  boolean clean()
           
protected  java.lang.Object doInvoke(RemoteRefStateless.ServiceInfo info, java.lang.Object obj, java.lang.reflect.Method toCall, java.lang.Object[] params)
           
 boolean equals(java.lang.Object o)
           
static RemoteRefStateless fromRemoteRefs(javax.naming.Name name, java.lang.String domain, java.util.List remoteRefs)
          Returns a stateless remote reference.
 OID getOID()
          Returns the object identifier of the remote object corresponding to this instance.
protected  java.lang.Object handleError(RemoteRefStateless.ServiceInfo info, java.lang.Object obj, java.lang.reflect.Method toCall, java.lang.Object[] params, java.lang.Throwable err)
           
 int hashCode()
           
 java.lang.Object invoke(java.lang.Object obj, java.lang.reflect.Method toCall, java.lang.Object[] params)
           
 boolean isValid()
           
 void readExternal(java.io.ObjectInput in)
           
protected  RemoteRefStateless.ServiceInfo removeAcquire(RemoteRefStateless.ServiceInfo toRemove)
           
protected  java.lang.Object sendCommand(RMICommand cmd)
           
 java.lang.String toString()
           
 StubContainer toStubContainer(java.lang.Object proxy)
          Returns this instance's stub container.
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_name

protected javax.naming.Name _name

_domain

protected java.lang.String _domain

_mcastAddress

protected java.lang.String _mcastAddress

_mcastPort

protected int _mcastPort

_oid

protected OID _oid

_isRegistered

protected transient boolean _isRegistered

_serviceInfos

protected java.util.List _serviceInfos
Constructor Detail

RemoteRefStateless

public RemoteRefStateless()
Constructor for RemoteRefStateless.


RemoteRefStateless

public RemoteRefStateless(javax.naming.Name name,
                          java.lang.String domain)
Creates an instance of this class

Method Detail

getOID

public OID getOID()
Description copied from interface: StubInvocationHandler
Returns the object identifier of the remote object corresponding to this instance.

Specified by:
getOID in interface StubInvocationHandler
Returns:
an OID.
See Also:
StubInvocationHandler.getOID()

invoke

public java.lang.Object invoke(java.lang.Object obj,
                               java.lang.reflect.Method toCall,
                               java.lang.Object[] params)
                        throws java.lang.Throwable
Specified by:
invoke in interface java.lang.reflect.InvocationHandler
Throws:
java.lang.Throwable
See Also:
InvocationHandler.invoke(Object, Method, Object[])

isValid

public boolean isValid()
Specified by:
isValid in interface HealthCheck
See Also:
HealthCheck.isValid()

toStubContainer

public StubContainer toStubContainer(java.lang.Object proxy)
Description copied from interface: StubInvocationHandler
Returns this instance's stub container.

Specified by:
toStubContainer in interface StubInvocationHandler
Returns:
a StubContainer
See Also:
StubInvocationHandler.toStubContainer(Object)

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException
See Also:
Externalizable.readExternal(ObjectInput)

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException
See Also:
Externalizable.writeExternal(ObjectOutput)

fromRemoteRefs

public static RemoteRefStateless fromRemoteRefs(javax.naming.Name name,
                                                java.lang.String domain,
                                                java.util.List remoteRefs)
Returns a stateless remote reference.

Parameters:
remoteRefs - a list of RemoteRef
name - the name of the service to which the returned object corresponds.
domain - the name of the domain to which the service belongs.
Returns:
a RemoteRefStateless instance.

addSibling

public void addSibling(RemoteRefStateless other)
Adds another ref's information to this instance.

Parameters:
other - a RemoteRefStateless.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

clean

protected boolean clean()

sendCommand

protected java.lang.Object sendCommand(RMICommand cmd)
                                throws java.lang.Throwable
Throws:
java.lang.Throwable

doInvoke

protected java.lang.Object doInvoke(RemoteRefStateless.ServiceInfo info,
                                    java.lang.Object obj,
                                    java.lang.reflect.Method toCall,
                                    java.lang.Object[] params)
                             throws java.lang.Throwable
Throws:
java.lang.Throwable

acquire

protected RemoteRefStateless.ServiceInfo acquire()
                                          throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

removeAcquire

protected RemoteRefStateless.ServiceInfo removeAcquire(RemoteRefStateless.ServiceInfo toRemove)
                                                throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

handleError

protected java.lang.Object handleError(RemoteRefStateless.ServiceInfo info,
                                       java.lang.Object obj,
                                       java.lang.reflect.Method toCall,
                                       java.lang.Object[] params,
                                       java.lang.Throwable err)
                                throws java.lang.Throwable
Throws:
java.lang.Throwable


Copyright © 2010 Sapia OSS. All Rights Reserved.