1. /*
  2. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  3. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  4. */
  5. package com.sun.corba.se.spi.orbutil.threadpool;
  6. public interface ThreadPool
  7. {
  8. /**
  9. * This method will return any instance of the WorkQueue. If the ThreadPool
  10. * instance only services one WorkQueue then that WorkQueue instance will
  11. * be returned. If there are more than one WorkQueues serviced by this
  12. * ThreadPool, then this method would return a WorkQueue based on the
  13. * implementation of the class that implements this interface. For PE 8.0 we
  14. * would return a WorkQueue in a roundrobin fashion everytime this method
  15. * is called. In the future we could allow pluggability of Policy objects for this.
  16. */
  17. public WorkQueue getAnyWorkQueue();
  18. /**
  19. * This method will return an instance of the of the WorkQueue given a queueId.
  20. * This will be useful in situations where there are more than one WorkQueues
  21. * managed by the ThreadPool and the user of the ThreadPool wants to always use
  22. * the same WorkQueue for doing the Work.
  23. * If the number of WorkQueues in the ThreadPool are 10, then queueIds will go
  24. * from 0-9
  25. *
  26. * @throws NoSuchWorkQueueException thrown when queueId passed is invalid
  27. */
  28. public WorkQueue getWorkQueue(int queueId) throws NoSuchWorkQueueException;
  29. /**
  30. * This method will return the number of WorkQueues serviced by the threadpool.
  31. */
  32. public int numberOfWorkQueues();
  33. /**
  34. * This method will return the minimum number of threads maintained by the threadpool.
  35. */
  36. public int minimumNumberOfThreads();
  37. /**
  38. * This method will return the maximum number of threads in the threadpool at any
  39. * point in time, for the life of the threadpool
  40. */
  41. public int maximumNumberOfThreads();
  42. /**
  43. * This method will return the time in milliseconds when idle threads in the threadpool are
  44. * removed.
  45. */
  46. public long idleTimeoutForThreads();
  47. /**
  48. * This method will return the current number of threads in the threadpool. This method
  49. * returns a value which is not synchronized.
  50. */
  51. public int currentNumberOfThreads();
  52. /**
  53. * This method will return the number of available threads in the threadpool which are
  54. * waiting for work. This method returns a value which is not synchronized.
  55. */
  56. public int numberOfAvailableThreads();
  57. /**
  58. * This method will return the number of busy threads in the threadpool
  59. * This method returns a value which is not synchronized.
  60. */
  61. public int numberOfBusyThreads();
  62. /**
  63. * This method returns the number of Work items processed by the threadpool
  64. */
  65. public long currentProcessedCount();
  66. /**
  67. * This method returns the average elapsed time taken to complete a Work
  68. * item.
  69. */
  70. public long averageWorkCompletionTime();
  71. /**
  72. * This method will return the name of the threadpool.
  73. */
  74. public String getName();
  75. }
  76. // End of file.