Class ServantCachingPolicy

java.lang.Object
org.omg.CORBA.LocalObject
com.sun.corba.ee.spi.extension.ServantCachingPolicy
All Implemented Interfaces:
Serializable, Object, Policy, PolicyOperations, IDLEntity

public class ServantCachingPolicy extends LocalObject implements Policy
Policy used to implement servant caching optimization in the POA. Creating a POA with an instance pol of this policy where pol.getType() > NO_SERVANT_CACHING will cause the servant to be looked up in the POA and cached in the LocalClientRequestDispatcher when the ClientRequestDispatcher is colocated with the implementation of the objref. This greatly speeds up invocations at the cost of violating the POA semantics. In particular, every request to a particular objref must be handled by the same servant. Note that this is typically the case for EJB implementations.

If servant caching is used, there are two different additional features of the POA that are expensive:

  1. POA current semantics
  2. Proper handling of POA destroy.
POA current semantics requires maintaining a ThreadLocal stack of invocation information that is always available for POACurrent operations. Maintaining this stack is expensive on the timescale of optimized co-located calls, so the option is provided to turn it off. Similarly, causing POA.destroy() calls to wait for all active calls in the POA to complete requires careful tracking of the entry and exit of invocations in the POA. Again, tracking this is somewhat expensive.
See Also:
  • Field Details

    • NO_SERVANT_CACHING

      public static final int NO_SERVANT_CACHING
      Do not cache servants in the ClientRequestDispatcher. This will always support the full POA semantics, including changing the servant that handles requests on a particular objref.
      See Also:
    • FULL_SEMANTICS

      public static final int FULL_SEMANTICS
      Perform servant caching, preserving POA current and POA destroy semantics. We will use this as the new default, as the app server is making heavier use now of POA facilities.
      See Also:
    • INFO_ONLY_SEMANTICS

      public static final int INFO_ONLY_SEMANTICS
      Perform servant caching, preservent only POA current semantics. At least this level is required in order to support selection of ObjectCopiers for co-located RMI-IIOP calls, as the current copier is stored in OAInvocationInfo, which must be present on the stack inside the call.
      See Also:
    • MINIMAL_SEMANTICS

      public static final int MINIMAL_SEMANTICS
      Perform servant caching, not preserving POA current or POA destroy semantics.
      See Also:
    • policy

      private static ServantCachingPolicy policy
    • infoOnlyPolicy

      private static ServantCachingPolicy infoOnlyPolicy
    • minimalPolicy

      private static ServantCachingPolicy minimalPolicy
    • type

      private int type
  • Constructor Details

    • ServantCachingPolicy

      private ServantCachingPolicy(int type)
  • Method Details

    • typeToName

      public String typeToName()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getType

      public int getType()
    • getPolicy

      public static ServantCachingPolicy getPolicy()
      Return the default servant caching policy.
      Returns:
      default policy
    • getFullPolicy

      public static ServantCachingPolicy getFullPolicy()
    • getInfoOnlyPolicy

      public static ServantCachingPolicy getInfoOnlyPolicy()
    • getMinimalPolicy

      public static ServantCachingPolicy getMinimalPolicy()
    • policy_type

      public int policy_type()
      Description copied from interface: PolicyOperations
      Returns the constant value that corresponds to the type of the policy object. The values of the policy objects are allocated by the OMG. New values for PolicyType should be obtained from the OMG by sending mail to request@omg.org. In general the constant values that are allocated are defined in conjunction with the definition of the corresponding policy object.
      Specified by:
      policy_type in interface PolicyOperations
      Returns:
      the constant value that corresponds to the type of the policy object
    • copy

      public Policy copy()
      Description copied from interface: PolicyOperations
      Returns a copy of the Policy object. The copy does not retain any relationships that the policy had with any domain or object.
      Specified by:
      copy in interface PolicyOperations
      Returns:
      a copy of the Policy object
    • destroy

      public void destroy()
      Description copied from interface: PolicyOperations
      Destroys the Policy object. It is the responsibility of the Policy object to determine whether it can be destroyed.
      Specified by:
      destroy in interface PolicyOperations