Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/java/rmi/activation/Activator.java
38918 views
/*1* Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package java.rmi.activation;2627import java.rmi.MarshalledObject;28import java.rmi.Remote;29import java.rmi.RemoteException;30import java.rmi.activation.UnknownObjectException;3132/**33* The <code>Activator</code> facilitates remote object activation. A34* "faulting" remote reference calls the activator's35* <code>activate</code> method to obtain a "live" reference to a36* "activatable" remote object. Upon receiving a request for activation,37* the activator looks up the activation descriptor for the activation38* identifier, <code>id</code>, determines the group in which the39* object should be activated initiates object re-creation via the40* group's <code>ActivationInstantiator</code> (via a call to the41* <code>newInstance</code> method). The activator initiates the42* execution of activation groups as necessary. For example, if an43* activation group for a specific group identifier is not already44* executing, the activator initiates the execution of a VM for the45* group. <p>46*47* The <code>Activator</code> works closely with48* <code>ActivationSystem</code>, which provides a means for registering49* groups and objects within those groups, and <code>ActivationMonitor</code>,50* which recives information about active and inactive objects and inactive51* groups. <p>52*53* The activator is responsible for monitoring and detecting when54* activation groups fail so that it can remove stale remote references55* to groups and active object's within those groups.<p>56*57* @author Ann Wollrath58* @see ActivationInstantiator59* @see ActivationGroupDesc60* @see ActivationGroupID61* @since 1.262*/63public interface Activator extends Remote {64/**65* Activate the object associated with the activation identifier,66* <code>id</code>. If the activator knows the object to be active67* already, and <code>force</code> is false , the stub with a68* "live" reference is returned immediately to the caller;69* otherwise, if the activator does not know that corresponding70* the remote object is active, the activator uses the activation71* descriptor information (previously registered) to determine the72* group (VM) in which the object should be activated. If an73* <code>ActivationInstantiator</code> corresponding to the74* object's group descriptor already exists, the activator invokes75* the activation group's <code>newInstance</code> method passing76* it the object's id and descriptor. <p>77*78* If the activation group for the object's group descriptor does79* not yet exist, the activator starts an80* <code>ActivationInstantiator</code> executing (by spawning a81* child process, for example). When the activator receives the82* activation group's call back (via the83* <code>ActivationSystem</code>'s <code>activeGroup</code>84* method) specifying the activation group's reference, the85* activator can then invoke that activation instantiator's86* <code>newInstance</code> method to forward each pending87* activation request to the activation group and return the88* result (a marshalled remote object reference, a stub) to the89* caller.<p>90*91* Note that the activator receives a "marshalled" object instead of a92* Remote object so that the activator does not need to load the93* code for that object, or participate in distributed garbage94* collection for that object. If the activator kept a strong95* reference to the remote object, the activator would then96* prevent the object from being garbage collected under the97* normal distributed garbage collection mechanism. <p>98*99* @param id the activation identifier for the object being activated100* @param force if true, the activator contacts the group to obtain101* the remote object's reference; if false, returning the cached value102* is allowed.103* @return the remote object (a stub) in a marshalled form104* @exception ActivationException if object activation fails105* @exception UnknownObjectException if object is unknown (not registered)106* @exception RemoteException if remote call fails107* @since 1.2108*/109public MarshalledObject<? extends Remote> activate(ActivationID id,110boolean force)111throws ActivationException, UnknownObjectException, RemoteException;112113}114115116