1. /*
  2. * @(#)Activator.java 1.12 01/11/29
  3. *
  4. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.rmi.activation;
  8. import java.rmi.MarshalledObject;
  9. import java.rmi.Remote;
  10. import java.rmi.RemoteException;
  11. import java.rmi.activation.UnknownObjectException;
  12. /**
  13. * The <code>Activator</code> facilitates remote object activation. A
  14. * "faulting" remote reference calls the activator's
  15. * <code>activate</code> method to obtain a "live" reference to a
  16. * "activatable" remote object. Upon receiving a request for activation,
  17. * the activator looks up the activation descriptor for the activation
  18. * identifier, <code>id</code>, determines the group in which the
  19. * object should be activated initiates object re-creation via the
  20. * group's <code>ActivationInstantiator</code> (via a call to the
  21. * <code>newInstance</code> method). The activator initiates the
  22. * execution of activation groups as necessary. For example, if an
  23. * activation group for a specific group identifier is not already
  24. * executing, the activator initiates the execution of a VM for the
  25. * group. <p>
  26. *
  27. * The <code>Activator</code> works closely with
  28. * <code>ActivationSystem</code>, which provides a means for registering
  29. * groups and objects within those groups, and <code>ActivationMonitor</code>,
  30. * which recives information about active and inactive objects and inactive
  31. * groups. <p>
  32. *
  33. * The activator is responsible for monitoring and detecting when
  34. * activation groups fail so that it can remove stale remote references
  35. * to groups and active object's within those groups.<p>
  36. *
  37. * @author Ann Wollrath
  38. * @version 1.12, 11/29/01
  39. * @see ActivationInstantiator
  40. * @see ActivationGroupDesc
  41. * @see ActivationGroupID
  42. * @since JDK1.2
  43. */
  44. public interface Activator extends Remote {
  45. /**
  46. * Activate the object associated with the activation identifier,
  47. * <code>id</code>. If the activator knows the object to be active
  48. * already, and <code>force</code> is false , the stub with a
  49. * "live" reference is returned immediately to the caller;
  50. * otherwise, if the activator does not know that corresponding
  51. * the remote object is active, the activator uses the activation
  52. * descriptor information (previously registered) to determine the
  53. * group (VM) in which the object should be activated. If an
  54. * <code>ActivationInstantiator</code> corresponding to the
  55. * object's group descriptor already exists, the activator invokes
  56. * the activation group's <code>newInstance</code> method passing
  57. * it the object's id and descriptor. <p>
  58. *
  59. * If the activation group for the object's group descriptor does
  60. * not yet exist, the activator starts an
  61. * <code>ActivationInstantiator</code> executing (by spawning a
  62. * child process, for example). When the activator receives the
  63. * activation group's call back (via the
  64. * <code>ActivationSystem</code>'s <code>activeGroup</code>
  65. * method) specifying the activation group's reference, the
  66. * activator can then invoke that activation instantiator's
  67. * <code>newInstance</code> method to forward each pending
  68. * activation request to the activation group and return the
  69. * result (a marshalled remote object reference, a stub) to the
  70. * caller.<p>
  71. *
  72. * Note that the activator receives a "marshalled" object instead of a
  73. * Remote object so that the activator does not need to load the
  74. * code for that object, or participate in distributed garbage
  75. * collection for that object. If the activator kept a strong
  76. * reference to the remote object, the activator would then
  77. * prevent the object from being garbage collected under the
  78. * normal distributed garbage collection mechanism. <p>
  79. *
  80. * @param id the activation identifier for the object being activated
  81. * @param force if true, the activator contacts the group to obtain
  82. * the remote object's reference; if false, returning the cached value
  83. * is allowed.
  84. * @return the remote object (a stub) in a marshalled form
  85. * @exception ActivationException if object activation fails
  86. * @exception UnknownObjectException if object is unknown (not registered)
  87. * @exception RemoteException if remote call fails
  88. * @since JDK1.2
  89. */
  90. public MarshalledObject activate(ActivationID id, boolean force)
  91. throws ActivationException, UnknownObjectException, RemoteException;
  92. }