org.sapia.ubik.rmi.server
Class RemoteRef

java.lang.Object
  extended by org.sapia.ubik.rmi.server.RemoteRef
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, java.lang.reflect.InvocationHandler, HealthCheck, StubInvocationHandler
Direct Known Subclasses:
RemoteRefEx

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

This class implements the basic behavior of dynamic proxies that implement the logic for performing RPC on remote objects.

Author:
Yanick Duchesne
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

Field Summary
protected  boolean _callBack
           
protected  boolean _isFirstVoyage
           
protected  java.lang.Object _lock
           
protected  OID _oid
           
protected  Connections _pool
           
protected  ServerAddress _serverAddress
           
protected  VmId _vmId
           
 
Constructor Summary
RemoteRef()
           
RemoteRef(OID oid, ServerAddress serverAddress)
          Creates an instance of this class, with the given object and host identifiers.
 
Method Summary
 OID getOid()
          Returns this instance's object identifier.
 OID getOID()
          Returns the identifier of the remote object to which this instance corresponds.
 ServerAddress getServerAddress()
          Returns the address of the server to which this stub "belongs".
protected  void initPool(boolean force)
           
abstract  java.lang.Object invoke(java.lang.Object obj, java.lang.reflect.Method toCall, java.lang.Object[] params)
           
 boolean isCallBack()
          Returns true if this stub is in call-back mode.
 boolean isValid()
          Tests the connection between this handler and its server; returns false if connection is invalid.
 void readExternal(java.io.ObjectInput in)
           
protected  java.lang.Object sendCommand(RMICommand cmd)
           
protected  void setCallBack(boolean callBack)
          Sets this stub's call-back mode.
 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, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_callBack

protected boolean _callBack

_oid

protected OID _oid

_vmId

protected VmId _vmId

_serverAddress

protected ServerAddress _serverAddress

_isFirstVoyage

protected boolean _isFirstVoyage

_pool

protected transient Connections _pool

_lock

protected transient java.lang.Object _lock
Constructor Detail

RemoteRef

public RemoteRef()

RemoteRef

public RemoteRef(OID oid,
                 ServerAddress serverAddress)
Creates an instance of this class, with the given object and host identifiers.

Parameters:
oid - an OID
serverAddress - a ServerAddress
Method Detail

isCallBack

public boolean isCallBack()
Returns true if this stub is in call-back mode.

Returns:
true if this stub is in call-back mode.

getOID

public OID getOID()
Returns the identifier of the remote object to which this instance corresponds.

Specified by:
getOID in interface StubInvocationHandler
Returns:
an OID.

setCallBack

protected void setCallBack(boolean callBack)
Sets this stub's call-back mode.

Parameters:
callBack - must be true if this stub should be in call-back mode.

invoke

public abstract 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[])

getServerAddress

public ServerAddress getServerAddress()
Returns the address of the server to which this stub "belongs".

Returns:
a ServerAddress

getOid

public OID getOid()
Returns this instance's object identifier.

Returns:
a OID

isValid

public boolean isValid()
Tests the connection between this handler and its server; returns false if connection is invalid.

Specified by:
isValid in interface HealthCheck
Returns:
false if connection is invalid.

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)

sendCommand

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

initPool

protected void initPool(boolean force)
                 throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException


Copyright © 2010 Sapia OSS. All Rights Reserved.