/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
transient boolean force = false;
"activation requires 1.2 stubs";
/**
* Create a new (empty) ActivatableRef
*/
public ActivatableRef()
{}
/**
* Create a ActivatableRef with the specified id
*/
{
}
/**
* Returns the stub for the remote object whose class is
* specified in the activation descriptor. The ActivatableRef
* in the resulting stub has its activation id set to the
* activation id supplied as the second argument.
*/
throws StubNotFoundException
{
try {
} catch (IllegalArgumentException e) {
throw new StubNotFoundException(
"class implements an illegal remote interface", e);
} catch (ClassNotFoundException e) {
throw new StubNotFoundException("unable to load class: " +
className, e);
} catch (MalformedURLException e) {
throw new StubNotFoundException("malformed URL", e);
}
}
/**
* Invoke method on remote object. This method delegates remote
* method invocation to the underlying ref type. If the
* underlying reference is not known (is null), then the object
* must be activated first. If an attempt at method invocation
* fails, the object should force reactivation. Method invocation
* must preserve "at most once" call semantics. In RMI, "at most
* once" applies to parameter deserialization at the remote site
* and the remote object's method execution. "At most once" does
* not apply to parameter serialization at the client so the
* parameters of a call don't need to be buffered in anticipation
* of call retry. Thus, a method call is only be retried if the
* initial method invocation does not execute at all at the server
* (including parameter deserialization).
*/
long opnum)
throws Exception
{
boolean force = false;
/*
* Attempt object activation if active ref is unknown.
* Throws a RemoteException if object can't be activated.
*/
synchronized (this) {
force = true;
} else {
}
}
try {
} catch (NoSuchObjectException e) {
/*
* Object is not active in VM; retry call
*/
exception = e;
} catch (ConnectException e) {
/*
* Failure during connection setup; retry call
*/
exception = e;
} catch (UnknownHostException e) {
/*
* Failure during connection setup; retry call.
*/
exception = e;
} catch (ConnectIOException e) {
/*
* Failure setting up multiplexed connection or reusing
* cached connection; retry call
*/
exception = e;
} catch (MarshalException e) {
/*
* Failure during parameter serialization; call may
* have reached server, so call retry not possible.
*/
throw e;
} catch (ServerError e) {
/*
* Call reached server; propagate remote exception.
*/
throw e;
} catch (ServerException e) {
/*
* Call reached server; propagate remote exception
*/
throw e;
} catch (RemoteException e) {
/*
* This is a catch-all for other RemoteExceptions.
* UnmarshalException being the only one relevant.
*
* StubNotFoundException should never show up because
* it is generally thrown when attempting to locate
* a stub.
*
* UnexpectedException should never show up because
* it is only thrown by a stub and would be wrapped
* in a ServerException if it was propagated by a
* remote call.
*/
synchronized (this) {
}
}
throw e;
}
if (retries > 1) {
/*
* Activate object, since object could not be reached.
*/
synchronized (this) {
exception instanceof NoSuchObjectException &&
force == false) {
/*
* If last exception was NoSuchObjectException,
* then old value of ref is definitely wrong,
* so make sure that it is different.
*/
}
force = true;
} else {
force = false;
}
}
}
}
/*
* Retries unsuccessful, so throw last exception
*/
throw exception;
}
/**
* private method to obtain the ref for a call.
*/
throws RemoteException
{
}
return ref;
}
/**
* private method to activate the remote object.
*
* NOTE: the caller must be synchronized on "this" before
* calling this method.
*/
throws RemoteException
{
try {
/*
* Activate the object and retrieve the remote reference
* from inside the stub returned as the result. Then
* set this activatable ref's internal ref to be the
* ref inside the ref of the stub. In more clear terms,
* the stub returned from the activate call contains an
* ActivatableRef. We need to set the ref in *this*
* ActivatableRef to the ref inside the ActivatableRef
* retrieved from the stub. The ref type embedded in the
* ActivatableRef is typically a UnicastRef.
*/
if (proxy instanceof RemoteStub) {
} else {
/*
* Assume that proxy is an instance of a dynamic proxy
* class. If that assumption is not correct, or either of
* the casts below fails, the resulting exception will be
* wrapped in an ActivateFailedException below.
*/
}
return ref;
} catch (ConnectException e) {
throw new ConnectException("activation failed", e);
} catch (RemoteException e) {
throw new ConnectIOException("activation failed", e);
} catch (UnknownObjectException e) {
throw new NoSuchObjectException("object not registered");
} catch (ActivationException e) {
throw new ActivateFailedException("activation failed", e);
}
}
/**
* This call is used by the old 1.1 stub protocol and is
* unsupported since activation requires 1.2 stubs.
*/
int opnum,
long hash)
throws RemoteException
{
throw new UnsupportedOperationException(versionComplaint);
}
/**
* This call is used by the old 1.1 stub protocol and is
* unsupported since activation requires 1.2 stubs.
*/
{
throw new UnsupportedOperationException(versionComplaint);
}
/**
* This call is used by the old 1.1 stub protocol and is
* unsupported since activation requires 1.2 stubs.
*/
throw new UnsupportedOperationException(versionComplaint);
}
/**
* Returns the class of the ref type to be serialized
*/
{
return "ActivatableRef";
}
/**
* Write out external representation for remote ref.
*/
{
} else {
}
}
/**
* Read in external representation for remote ref.
* @exception ClassNotFoundException If the class for an object
* being restored cannot be found.
*/
throws IOException, ClassNotFoundException
{
try {
} catch (InstantiationException e) {
throw new UnmarshalException("Unable to create remote reference",
e);
} catch (IllegalAccessException e) {
throw new UnmarshalException("Illegal access creating remote reference");
}
}
//----------------------------------------------------------------------;
/**
* Method from object, forward from RemoteObject
*/
}
/**
* default implementation of hashCode for remote objects
*/
public int remoteHashCode() {
}
/** default implementation of equals for remote objects
*/
if (ref instanceof ActivatableRef)
return false;
}
}