jdk/src/share/classes/java/rmi/activation/Activator.java
author ohair
Tue, 25 May 2010 15:58:33 -0700
changeset 5506 202f599c92aa
parent 2 90ce3da70b43
child 23720 7d5147c21927
permissions -rw-r--r--
6943119: Rebrand source copyright notices Reviewed-by: darcy, weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.rmi.activation;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.rmi.MarshalledObject;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.rmi.Remote;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.rmi.RemoteException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.rmi.activation.UnknownObjectException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * The <code>Activator</code> facilitates remote object activation. A
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * "faulting" remote reference calls the activator's
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * <code>activate</code> method to obtain a "live" reference to a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * "activatable" remote object. Upon receiving a request for activation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * the activator looks up the activation descriptor for the activation
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * identifier, <code>id</code>, determines the group in which the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * object should be activated initiates object re-creation via the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * group's <code>ActivationInstantiator</code> (via a call to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * <code>newInstance</code> method). The activator initiates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * execution of activation groups as necessary. For example, if an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * activation group for a specific group identifier is not already
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * executing, the activator initiates the execution of a VM for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * group. <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * The <code>Activator</code> works closely with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * <code>ActivationSystem</code>, which provides a means for registering
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * groups and objects within those groups, and <code>ActivationMonitor</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * which recives information about active and inactive objects and inactive
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * groups. <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * The activator is responsible for monitoring and detecting when
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * activation groups fail so that it can remove stale remote references
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * to groups and active object's within those groups.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * @author      Ann Wollrath
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * @see         ActivationInstantiator
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * @see         ActivationGroupDesc
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * @see         ActivationGroupID
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * @since       1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
public interface Activator extends Remote {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * Activate the object associated with the activation identifier,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * <code>id</code>. If the activator knows the object to be active
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * already, and <code>force</code> is false , the stub with a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * "live" reference is returned immediately to the caller;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * otherwise, if the activator does not know that corresponding
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * the remote object is active, the activator uses the activation
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * descriptor information (previously registered) to determine the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * group (VM) in which the object should be activated. If an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * <code>ActivationInstantiator</code> corresponding to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * object's group descriptor already exists, the activator invokes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * the activation group's <code>newInstance</code> method passing
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * it the object's id and descriptor. <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * If the activation group for the object's group descriptor does
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * not yet exist, the activator starts an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * <code>ActivationInstantiator</code> executing (by spawning a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * child process, for example). When the activator receives the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * activation group's call back (via the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * <code>ActivationSystem</code>'s <code>activeGroup</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * method) specifying the activation group's reference, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * activator can then invoke that activation instantiator's
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * <code>newInstance</code> method to forward each pending
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * activation request to the activation group and return the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * result (a marshalled remote object reference, a stub) to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * caller.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * Note that the activator receives a "marshalled" object instead of a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * Remote object so that the activator does not need to load the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * code for that object, or participate in distributed garbage
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * collection for that object. If the activator kept a strong
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * reference to the remote object, the activator would then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * prevent the object from being garbage collected under the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * normal distributed garbage collection mechanism. <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * @param id the activation identifier for the object being activated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * @param force if true, the activator contacts the group to obtain
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * the remote object's reference; if false, returning the cached value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * is allowed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * @return the remote object (a stub) in a marshalled form
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * @exception ActivationException if object activation fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * @exception UnknownObjectException if object is unknown (not registered)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * @exception RemoteException if remote call fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    public MarshalledObject<? extends Remote> activate(ActivationID id,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
                                                       boolean force)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        throws ActivationException, UnknownObjectException, RemoteException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
}