1. /*
  2. * @(#)RequestPartitioningPolicy.java 1.2 04/06/04
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.corba.se.spi.extension ;
  8. import org.omg.CORBA.Policy ;
  9. import org.omg.CORBA.LocalObject ;
  10. import com.sun.corba.se.spi.logging.CORBALogDomains ;
  11. import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
  12. import com.sun.corba.se.impl.orbutil.ORBConstants ;
  13. /** Policy used to support the request partitioning feature and to
  14. * specify the partition to use.
  15. */
  16. public class RequestPartitioningPolicy extends LocalObject implements Policy
  17. {
  18. private static ORBUtilSystemException wrapper =
  19. ORBUtilSystemException.get( CORBALogDomains.OA_IOR ) ;
  20. public final static int DEFAULT_VALUE = 0;
  21. private final int value;
  22. public RequestPartitioningPolicy( int value )
  23. {
  24. if (value < ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID ||
  25. value > ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID) {
  26. throw wrapper.invalidRequestPartitioningPolicyValue(
  27. new Integer(value),
  28. new Integer(
  29. ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID),
  30. new Integer(
  31. ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID));
  32. }
  33. this.value = value;
  34. }
  35. public int getValue()
  36. {
  37. return value;
  38. }
  39. public int policy_type()
  40. {
  41. return ORBConstants.REQUEST_PARTITIONING_POLICY;
  42. }
  43. public org.omg.CORBA.Policy copy()
  44. {
  45. return this;
  46. }
  47. public void destroy()
  48. {
  49. // NO-OP
  50. }
  51. public String toString()
  52. {
  53. return "RequestPartitioningPolicy[" + value + "]" ;
  54. }
  55. }