aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/java/rmi/activation/Activatable.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/java/rmi/activation/Activatable.java')
-rw-r--r--libjava/classpath/java/rmi/activation/Activatable.java116
1 files changed, 58 insertions, 58 deletions
diff --git a/libjava/classpath/java/rmi/activation/Activatable.java b/libjava/classpath/java/rmi/activation/Activatable.java
index 6977d98..9ec7cad 100644
--- a/libjava/classpath/java/rmi/activation/Activatable.java
+++ b/libjava/classpath/java/rmi/activation/Activatable.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath 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
@@ -63,10 +63,10 @@ import java.rmi.server.UnicastRemoteObject;
* parameter being the {@link ActivationID} and the second the
* {@link MarshalledObject}. Activatable is the main class that developers need
* to use to implement and manage activatable objects. It also contains methods
- * for making activatable remote objects that are not derived from the
+ * for making activatable remote objects that are not derived from the
* Activatable class.
- *
- * @author Audrius Meskauskas (audriusa@bioinformatics.org) (from stub)
+ *
+ * @author Audrius Meskauskas (audriusa@bioinformatics.org) (from stub)
*/
public abstract class Activatable
extends RemoteServer
@@ -76,12 +76,12 @@ public abstract class Activatable
* Use SVUID for interoperability.
*/
static final long serialVersionUID = - 3120617863591563455L;
-
+
/**
* The object activation id.
*/
final ActivationID id;
-
+
/**
* This constructor is used to register export the object on the given port. A
* subclass of the Activatable class calls this constructor to register and
@@ -90,7 +90,7 @@ public abstract class Activatable
* with the activation system and "exported" (on an anonymous port, if port is
* zero) to the RMI runtime so that it is available to accept incoming calls
* from clients.
- *
+ *
* @param codebase the object code base url
* @param data the data, needed to activate the object.
* @param restart specifies reactivation mode after crash. If true, the object
@@ -118,7 +118,7 @@ public abstract class Activatable
* additionally specifying the socket factories. A subclass of the Activatable
* class calls this constructor to register and export the object during
* initial construction.
- *
+ *
* @param codebase the object code base url
* @param data the data, needed to activate the object.
* @param restart specifies reactivation mode after crash. If true, the object
@@ -151,7 +151,7 @@ public abstract class Activatable
* "activation" constructor with the two parameters ({@link ActivationID},
* {@link MarshalledObject}). As a side effect, the object is exported and is
* available to accept incoming calls.
- *
+ *
* @param anId the activation id
* @param port the port, on which the activatable will be listening
* @throws RemoteException if the activation failed.
@@ -166,7 +166,7 @@ public abstract class Activatable
catch (Exception e)
{
e.printStackTrace();
- RemoteException acex =
+ RemoteException acex =
new RemoteException("cannot export Activatable", e);
throw acex;
}
@@ -180,12 +180,12 @@ public abstract class Activatable
* "activation" constructor with the two parameters ({@link ActivationID},
* {@link MarshalledObject}). As a side effect, the object is exported and is
* available to accept incoming calls.
- *
+ *
* @param anId the activation id
* @param port the port, on which the activatable will be listening
* @param csf the client socket factory
* @param ssf the server socket factory
- *
+ *
* @throws RemoteException if the remote call failed
*/
protected Activatable(ActivationID anId, int port, RMIClientSocketFactory csf,
@@ -203,17 +203,17 @@ public abstract class Activatable
throw acex;
}
}
-
+
/**
* Get the objects activation identifier.
- *
+ *
* @return the object activation identifier
*/
protected ActivationID getID()
{
return id;
}
-
+
/**
* Obtain the activation Id from the activation descriptor by registering
* within the current group.
@@ -230,11 +230,11 @@ public abstract class Activatable
system = ActivationGroup.currentGroupID().getSystem();
return system.registerObject(descriptor);
}
-
+
/**
* This method registers an activatable object. The object is expected to be
* on the anonymous port (null client and server socket factories).
- *
+ *
* @param desc the object description.
* @return the remote stub for the activatable object (the first call on this
* stub will activate the object).
@@ -258,12 +258,12 @@ public abstract class Activatable
throw new ActivationException("Class not found: "+desc.getClassName());
}
}
-
+
/**
* Inactivates and unexports the object. The subsequent calls will activate
* the object again. The object is not inactivated if it is currently
* executing calls.
- *
+ *
* @param id the id of the object being inactivated
* @return true if the object has been inactivated, false if it has not been
* inactivated because of the running or pending calls.
@@ -278,10 +278,10 @@ public abstract class Activatable
id.group.inactiveObject(id);
return UnicastRemoteObject.unexportObject(id.activate(false), false);
}
-
+
/**
* Unregister the object (the object will no longer be activable with that id)
- *
+ *
* @param id the object id
* @throws UnknownObjectException if the id is unknown
* @throws ActivationException if the activation system is not running
@@ -293,23 +293,23 @@ public abstract class Activatable
ActivationGroup.currentGroupId.getSystem().unregisterObject(id);
UnicastServer.unregisterActivatable(id);
}
-
+
/**
* Register and export the object that activatable object that is not derived
* from the Activatable super class. It creates and registers the object
* activation descriptor. There is no need to call this method if the object
* extends Activable, as its work is done in the constructor
* {@link #Activatable(String, MarshalledObject, boolean, int)}.
- *
+ *
* @param obj the object, that is exported, becoming available at the given
* port.
* @param location the object code location (codebase).
* @param data the data, needed to activate the object
* @param restart the restart mode
* @param port the port, where the object will be available
- *
+ *
* @return the created object activation ID.
- *
+ *
* @throws ActivationException if the activation group is not active
* @throws RemoteException if the registration or export fails
*/
@@ -321,7 +321,7 @@ public abstract class Activatable
ActivationDesc descriptor = new ActivationDesc(obj.getClass().getName(),
location, data, restart);
ActivationID id = obtainId(descriptor);
- Remote stub = exportObject(obj, id, port);
+ Remote stub = exportObject(obj, id, port);
return id;
}
@@ -331,7 +331,7 @@ public abstract class Activatable
* activation descriptor. There is no need to call this method if the object
* extends Activable, as its work is done in the constructor
* {@link #Activatable(String, MarshalledObject, boolean, int, RMIClientSocketFactory, RMIServerSocketFactory)}
- *
+ *
* @param obj the object, that is exported, becoming available at the given
* port.
* @param location the object code location (codebase).
@@ -340,9 +340,9 @@ public abstract class Activatable
* @param port the port, where the object will be available
* @param csf the client socket factory
* @param ssf the server socket factory
- *
+ *
* @return the created object activation ID.
- *
+ *
* @throws ActivationException if the activation group is not active
* @throws RemoteException if the registration or export fails
*/
@@ -356,7 +356,7 @@ public abstract class Activatable
ActivationDesc descriptor = new ActivationDesc(obj.getClass().getName(),
location, data, restart);
ActivationID id = obtainId(descriptor);
- Remote stub = exportObject(obj, id, port, csf, ssf);
+ Remote stub = exportObject(obj, id, port, csf, ssf);
return id;
}
@@ -367,13 +367,13 @@ public abstract class Activatable
* class. There is no need to call this method if the object extends
* Activable, as its work is done in the constructor
* {@link #Activatable(ActivationID, int)}
- *
+ *
* @param obj the object
* @param id the known activation id
* @param port the object port
- *
+ *
* @return the remote stub of the activatable object
- *
+ *
* @throws RemoteException if the object export fails
*/
public static Remote exportObject(Remote obj, ActivationID id, int port)
@@ -389,15 +389,15 @@ public abstract class Activatable
* class. There is no need to call this method if the object extends
* Activable, as its work is done in the constructor
* {@link #Activatable(ActivationID, int)}
- *
+ *
* @param obj the object
* @param id the known activation id
* @param port the object port
* @param csf the client socket factory
* @param ssf the server socket factory
- *
+ *
* @return the remote stub of the activatable object
- *
+ *
* @throws RemoteException if the object export fails
*/
public static Remote exportObject(Remote obj, ActivationID id, int port,
@@ -405,7 +405,7 @@ public abstract class Activatable
RMIServerSocketFactory ssf)
throws RemoteException
{
- Remote stub = export(id, obj, port, ssf);
+ Remote stub = export(id, obj, port, ssf);
return stub;
}
@@ -414,7 +414,7 @@ public abstract class Activatable
* Make the remote object unavailable for incoming calls. This method also
* unregisters the object, so it cannot be activated again by incoming call
* (unless registered).
- *
+ *
* @param obj the object to unexport
* @param force if true, cancel all pending or running calls to that object
* (if false, the object with such calls is not unexported and false
@@ -426,7 +426,7 @@ public abstract class Activatable
throws NoSuchObjectException
{
Object aref = UnicastServer.getExportedRef(obj);
-
+
// Unregister it also (otherwise will be activated during the subsequent
// call.
if (aref instanceof ActivatableServerRef)
@@ -436,9 +436,9 @@ public abstract class Activatable
}
return UnicastRemoteObject.unexportObject(obj, force);
}
-
- static Remote exportObject(Remote obj, int port,
- RMIServerSocketFactory serverSocketFactory)
+
+ static Remote exportObject(Remote obj, int port,
+ RMIServerSocketFactory serverSocketFactory)
throws RemoteException
{
UnicastServerRef sref = null;
@@ -449,52 +449,52 @@ public abstract class Activatable
sref = new UnicastServerRef(new ObjID(), port, serverSocketFactory);
Remote stub = sref.exportObject(obj);
- // addStub(obj, stub);
+ // addStub(obj, stub);
// TODO Need to change the place of the stub repository
return stub;
}
-
+
/**
* Create and export the new remote object, making it available at the given
* port, using sockets, produced by the specified factories.
- *
+ *
* @param port the port, on that the object should become available. Zero
* means anonymous port.
* @param serverSocketFactory the server socket factory
*/
private static Remote export(ActivationID id, Remote obj, int port,
- RMIServerSocketFactory serverSocketFactory)
+ RMIServerSocketFactory serverSocketFactory)
throws RemoteException
{
ActivatableServerRef sref = null;
sref = new ActivatableServerRef(makeId(id), id, port, serverSocketFactory);
return sref.exportObject(obj);
- }
-
+ }
+
/**
* Make the object ID from the activation ID. The same activation ID always
* produces the identical object id.
- *
+ *
* @param aid the activation id
- *
+ *
* @return the object id
*/
private static ObjID makeId(ActivationID aid)
{
ObjID id = new ObjID(0);
-
+
// The fields of both ObjID and ActivationID must be package private,
// so we need to use the reflection to access them anyway.
// Probably other implementations use some very different approach.
-
+
try
{
Field idUid = ObjID.class.getDeclaredField("space");
Field aidUid = ActivationID.class.getDeclaredField("uid");
-
+
aidUid.setAccessible(true);
idUid.setAccessible(true);
-
+
idUid.set(id, aidUid.get(aid));
}
catch (Exception e)
@@ -503,10 +503,10 @@ public abstract class Activatable
ierr.initCause(e);
throw ierr;
}
-
+
return id;
- }
-
+ }
+
/**
* Connect the object to the UnicastServer (export), but not activate it.
* The object will be activated on the first call.
@@ -515,7 +515,7 @@ public abstract class Activatable
{
try
{
- ActivatableServerRef asr =
+ ActivatableServerRef asr =
new ActivatableServerRef(makeId(anId), anId, 0, null);
UnicastServer.exportActivatableObject(asr);
return asr.exportClass(stubFor);