1 /* 2 * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package java.rmi.activation; 27 28 import java.rmi.MarshalledObject; 29 import java.rmi.Remote; 30 import java.rmi.RemoteException; 31 import java.rmi.activation.UnknownGroupException; 32 import java.rmi.activation.UnknownObjectException; 33 34 /** 35 * An <code>ActivationMonitor</code> is specific to an 36 * <code>ActivationGroup</code> and is obtained when a group is 37 * reported active via a call to 38 * <code>ActivationSystem.activeGroup</code> (this is done 39 * internally). An activation group is responsible for informing its 40 * <code>ActivationMonitor</code> when either: its objects become active or 41 * inactive, or the group as a whole becomes inactive. 42 * 43 * @author Ann Wollrath 44 * @see Activator 45 * @see ActivationSystem 46 * @see ActivationGroup 47 * @since 1.2 48 */ 49 public interface ActivationMonitor extends Remote { 50 51 /** 52 * An activation group calls its monitor's 53 * <code>inactiveObject</code> method when an object in its group 54 * becomes inactive (deactivates). An activation group discovers 55 * that an object (that it participated in activating) in its VM 56 * is no longer active, via calls to the activation group's 57 * <code>inactiveObject</code> method. <p> 58 * 59 * The <code>inactiveObject</code> call informs the 60 * <code>ActivationMonitor</code> that the remote object reference 61 * it holds for the object with the activation identifier, 62 * <code>id</code>, is no longer valid. The monitor considers the 63 * reference associated with <code>id</code> as a stale reference. 64 * Since the reference is considered stale, a subsequent 65 * <code>activate</code> call for the same activation identifier 66 * results in re-activating the remote object. 67 * 68 * @param id the object's activation identifier 69 * @exception UnknownObjectException if object is unknown 70 * @exception RemoteException if remote call fails 71 * @since 1.2 72 */ 73 public void inactiveObject(ActivationID id) 74 throws UnknownObjectException, RemoteException; 75 76 /** 77 * Informs that an object is now active. An <code>ActivationGroup</code> 78 * informs its monitor if an object in its group becomes active by 79 * other means than being activated directly (i.e., the object 80 * is registered and "activated" itself). 81 * 82 * @param id the active object's id 83 * @param obj the marshalled form of the object's stub 84 * @exception UnknownObjectException if object is unknown 85 * @exception RemoteException if remote call fails 86 * @since 1.2 87 */ 88 public void activeObject(ActivationID id, 89 MarshalledObject<? extends Remote> obj) 90 throws UnknownObjectException, RemoteException; 91 92 /** 93 * Informs that the group is now inactive. The group will be 94 * recreated upon a subsequent request to activate an object 95 * within the group. A group becomes inactive when all objects 96 * in the group report that they are inactive. 97 * 98 * @param id the group's id 99 * @param incarnation the group's incarnation number 100 * @exception UnknownGroupException if group is unknown 101 * @exception RemoteException if remote call fails 102 * @since 1.2 103 */ 104 public void inactiveGroup(ActivationGroupID id, 105 long incarnation) 106 throws UnknownGroupException, RemoteException; 107 108 }