Imported GNU Classpath 0.90
Imported GNU Classpath 0.90 * scripts/makemake.tcl: LocaleData.java moved to gnu/java/locale. * sources.am: Regenerated. * gcj/javaprims.h: Regenerated. * Makefile.in: Regenerated. * gcj/Makefile.in: Regenerated. * include/Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. * gnu/java/lang/VMInstrumentationImpl.java: New override. * gnu/java/net/local/LocalSocketImpl.java: Likewise. * gnu/classpath/jdwp/VMMethod.java: Likewise. * gnu/classpath/jdwp/VMVirtualMachine.java: Update to latest interface. * java/lang/Thread.java: Add UncaughtExceptionHandler. * java/lang/reflect/Method.java: Implements GenericDeclaration and isSynthetic(), * java/lang/reflect/Field.java: Likewise. * java/lang/reflect/Constructor.java * java/lang/Class.java: Implements Type, GenericDeclaration, getSimpleName() and getEnclosing*() methods. * java/lang/Class.h: Add new public methods. * java/lang/Math.java: Add signum(), ulp() and log10(). * java/lang/natMath.cc (log10): New function. * java/security/VMSecureRandom.java: New override. * java/util/logging/Logger.java: Updated to latest classpath version. * java/util/logging/LogManager.java: New override. From-SVN: r113887
This commit is contained in:
parent
eaec4980e1
commit
4f9533c772
1640 changed files with 126485 additions and 104808 deletions
libjava/classpath/java/rmi/activation
|
@ -1,5 +1,5 @@
|
|||
/* ActivationGroup.java --
|
||||
Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
/* ActivationGroup.java -- the RMI activation group.
|
||||
Copyright (c) 1996, 1997, 1998, 1999, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -38,48 +38,302 @@ exception statement from your version. */
|
|||
|
||||
package java.rmi.activation;
|
||||
|
||||
import gnu.java.rmi.activation.DefaultActivationGroup;
|
||||
import gnu.java.rmi.activation.DefaultActivationSystem;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.rmi.MarshalledObject;
|
||||
import java.rmi.Remote;
|
||||
import java.rmi.RemoteException;
|
||||
import java.rmi.server.UnicastRemoteObject;
|
||||
|
||||
public abstract class ActivationGroup extends UnicastRemoteObject
|
||||
implements ActivationInstantiator
|
||||
/**
|
||||
* The entity that receives the request to activate object and activates it.
|
||||
* Frequently there is one activation group per virtual machine.
|
||||
*
|
||||
* @author Audrius Meskauskas (audriusa@Bioinformatics.org) (from stub)
|
||||
*/
|
||||
public abstract class ActivationGroup
|
||||
extends UnicastRemoteObject
|
||||
implements ActivationInstantiator
|
||||
{
|
||||
static final long serialVersionUID = -7696947875314805420L;
|
||||
|
||||
protected ActivationGroup(ActivationGroupID groupID) throws RemoteException {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
/**
|
||||
* Use the SVUID for interoperability.
|
||||
*/
|
||||
static final long serialVersionUID = - 7696947875314805420L;
|
||||
|
||||
/**
|
||||
* The Id of the current group on this VM (null if none).
|
||||
*/
|
||||
static ActivationGroupID currentGroupId = null;
|
||||
|
||||
/**
|
||||
* The groups identifier.
|
||||
*/
|
||||
final ActivationGroupID groupId;
|
||||
|
||||
public boolean inactiveObject(ActivationID id) throws ActivationException, UnknownObjectException, RemoteException {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
/**
|
||||
* The groups activation monitor.
|
||||
*/
|
||||
ActivationMonitor monitor;
|
||||
|
||||
/**
|
||||
* The groups incarnation number.
|
||||
*/
|
||||
long incarnation;
|
||||
|
||||
/**
|
||||
* The groups activation system.
|
||||
*/
|
||||
static ActivationSystem system;
|
||||
|
||||
/**
|
||||
* Used during the group creation (required constructor).
|
||||
*/
|
||||
static final Class[] cConstructorTypes = new Class[]
|
||||
{
|
||||
ActivationGroupID.class,
|
||||
MarshalledObject.class
|
||||
};
|
||||
|
||||
public abstract void activeObject(ActivationID id, Remote obj) throws ActivationException, UnknownObjectException, RemoteException;
|
||||
/**
|
||||
* Create the new activation group with the given group id.
|
||||
*
|
||||
* @param aGroupId the group Id.
|
||||
*
|
||||
* @throws RemoteException if the group export fails.
|
||||
*/
|
||||
protected ActivationGroup(ActivationGroupID aGroupId) throws RemoteException
|
||||
{
|
||||
groupId = aGroupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method is called when the object is exported. The group must notify
|
||||
* the activation monitor, if this was not already done before.
|
||||
*
|
||||
* @param id the object activation id
|
||||
* @param obj the remote object implementation
|
||||
*
|
||||
* @throws ActivationException if the group is inactive
|
||||
* @throws UnknownObjectException if such object is not known
|
||||
* @throws RemoteException if the call to monitor fails
|
||||
*/
|
||||
public abstract void activeObject(ActivationID id, Remote obj)
|
||||
throws ActivationException, UnknownObjectException, RemoteException;
|
||||
|
||||
/**
|
||||
* Notifies the monitor about the object being inactivated.
|
||||
*
|
||||
* @param id the object being inactivated.
|
||||
* @return true always (must be overridden to return other values).
|
||||
* @throws ActivationException never
|
||||
* @throws UnknownObjectException if the object is not known
|
||||
* @throws RemoteException if the remote call to monitor fails
|
||||
*/
|
||||
public boolean inactiveObject(ActivationID id) throws ActivationException,
|
||||
UnknownObjectException, RemoteException
|
||||
{
|
||||
if (monitor != null)
|
||||
monitor.inactiveObject(id);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static ActivationGroup createGroup(ActivationGroupID id, ActivationGroupDesc desc, long incarnation) throws ActivationException {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
/**
|
||||
* Create the new instance of the activation group, using the class name and
|
||||
* location information, stored in the passed descriptor. The method expects
|
||||
* the group class to have the two parameter constructor, the first parameter
|
||||
* being the {@link ActivationGroupID} and the second the
|
||||
* {@link MarshalledObject}. The group must be first be registered with the
|
||||
* ActivationSystem. Once a group is created, the currentGroupID method
|
||||
* returns the identifier for this group until the group becomes inactive.
|
||||
*
|
||||
* @param id the activation group id
|
||||
* @param desc the group descriptor, providing the information, necessary to
|
||||
* create the group
|
||||
* @param incarnation the incarnation number
|
||||
* @return the created group instance
|
||||
* @throws ActivationException if the activation fails due any reason
|
||||
*/
|
||||
public static ActivationGroup createGroup(ActivationGroupID id,
|
||||
ActivationGroupDesc desc,
|
||||
long incarnation)
|
||||
throws ActivationException
|
||||
{
|
||||
// If the activation system is not yet set, set it to the system.
|
||||
// passed in the group id.
|
||||
if (system == null)
|
||||
system = id.system;
|
||||
|
||||
ActivationGroup group = null;
|
||||
|
||||
public static ActivationGroupID currentGroupID() {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
// TODO at the moment all groups are created on the current jre and the
|
||||
// group class must be reachable via thread context class loader.
|
||||
Class groupClass;
|
||||
|
||||
public static void setSystem(ActivationSystem system) throws ActivationException {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
if (desc.className != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
||||
groupClass = loader.loadClass(desc.className);
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
ActivationException acex = new ActivationException(
|
||||
"Cannot load " + desc.className);
|
||||
acex.detail = e;
|
||||
throw acex;
|
||||
}
|
||||
}
|
||||
else
|
||||
groupClass = DefaultActivationGroup.class;
|
||||
|
||||
public static ActivationSystem getSystem() throws ActivationException {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
try
|
||||
{
|
||||
Constructor constructor = groupClass.getConstructor(cConstructorTypes);
|
||||
group = (ActivationGroup) constructor.newInstance(
|
||||
new Object[] { id, desc.data });
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
ActivationException acex = new ActivationException(
|
||||
"Cannot instantiate " + desc.className);
|
||||
acex.detail = e;
|
||||
throw acex;
|
||||
}
|
||||
|
||||
protected void activeObject(ActivationID id, MarshalledObject mobj) throws ActivationException, UnknownObjectException, RemoteException {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
currentGroupId = id;
|
||||
try
|
||||
{
|
||||
group.monitor = getSystem().activeGroup(id, group, incarnation);
|
||||
return group;
|
||||
}
|
||||
catch (RemoteException e)
|
||||
{
|
||||
ActivationException acex = new ActivationException("createGroup");
|
||||
acex.detail = e;
|
||||
throw acex;
|
||||
}
|
||||
}
|
||||
|
||||
protected void inactiveGroup() throws UnknownGroupException, RemoteException {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
/**
|
||||
* Get the id of current activation group.
|
||||
*
|
||||
* @return the id of the current activation group or null if none exists.
|
||||
*/
|
||||
public static ActivationGroupID currentGroupID()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (currentGroupId==null)
|
||||
{
|
||||
// This will also assing the currentGroupId to the current
|
||||
// (default) group of the default system.
|
||||
setSystem(DefaultActivationSystem.get());
|
||||
}
|
||||
}
|
||||
catch (ActivationException e)
|
||||
{
|
||||
InternalError ierr = new InternalError("Unable to activate AS");
|
||||
ierr.initCause(e);
|
||||
throw ierr;
|
||||
}
|
||||
|
||||
return currentGroupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the activation system for this virtual machine. The system can only
|
||||
* be set if no group is active.
|
||||
*
|
||||
* @param aSystem the system to set
|
||||
*
|
||||
* @throws ActivationException if some group is active now.
|
||||
*/
|
||||
public static void setSystem(ActivationSystem aSystem)
|
||||
throws ActivationException
|
||||
{
|
||||
if (currentGroupId!=null)
|
||||
throw new ActivationException("Group active");
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
// Register the default transient activation system and group.
|
||||
system = aSystem;
|
||||
ActivationGroupDesc def = new ActivationGroupDesc(
|
||||
DefaultActivationGroup.class.getName(),
|
||||
"",
|
||||
null,
|
||||
null,
|
||||
null);
|
||||
currentGroupId = system.registerGroup(def);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
InternalError ierr = new InternalError("Unable to start default AG");
|
||||
ierr.initCause(ex);
|
||||
throw ierr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current activation system. If the system is not set via
|
||||
* {@link #setSystem} method, the default system for this virtual machine is
|
||||
* returned. The default system is first searched by name
|
||||
* "java.rmi.activation.ActivationSystem" on the activation registry port. The
|
||||
* default value of the activation registry port is
|
||||
* {@link ActivationSystem#SYSTEM_PORT}, but it can be changed by putting the
|
||||
* system property java.rmi.activation.port. Both activation system and
|
||||
* activation registry are provided by the RMI daemon tool, RMID, if it is
|
||||
* running on the local host. If the RMID is not running, the internal
|
||||
* transient activation system will be created and returned. This internal
|
||||
* system is highly limited in in capabilities and is not intended to be used
|
||||
* anywhere apart automated testing.
|
||||
*
|
||||
* @return the activation system for this virtual machine
|
||||
* @throws ActivationException
|
||||
*/
|
||||
public static ActivationSystem getSystem() throws ActivationException
|
||||
{
|
||||
if (system == null)
|
||||
system = DefaultActivationSystem.get();
|
||||
return system;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the call back to the groups {@link ActivationMonitor}.
|
||||
*
|
||||
* @param id the id obj the object being activated
|
||||
* @param mObject the marshalled object, contains the activated remote object
|
||||
* stub.
|
||||
* @throws ActivationException on activation error
|
||||
* @throws UnknownObjectException if such object is not registered
|
||||
* @throws RemoteException on remote call (to monitor) error
|
||||
*/
|
||||
protected void activeObject(ActivationID id, MarshalledObject mObject)
|
||||
throws ActivationException, UnknownObjectException, RemoteException
|
||||
{
|
||||
if (monitor!=null)
|
||||
monitor.activeObject(id, mObject);
|
||||
|
||||
id.group = this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the call back to the groups {@link ActivationMonitor} and sets
|
||||
* the current group to null.
|
||||
*/
|
||||
protected void inactiveGroup() throws UnknownGroupException, RemoteException
|
||||
{
|
||||
if (monitor!=null)
|
||||
monitor.inactiveGroup(groupId, incarnation);
|
||||
|
||||
if (currentGroupId!=null && currentGroupId.equals(groupId))
|
||||
currentGroupId = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue