src/share/classes/com/sun/corba/se/spi/orbutil/threadpool/ThreadPool.java

Print this page


   1 /*
   2  * Copyright (c) 2003, 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 com.sun.corba.se.spi.orbutil.threadpool;
  27 

  28 
  29 public interface ThreadPool




  30 {

  31     /**
  32     * This method will return any instance of the WorkQueue. If the ThreadPool
  33     * instance only services one WorkQueue then that WorkQueue instance will
  34     * be returned. If there are more than one WorkQueues serviced by this
  35     * ThreadPool, then this method would return a WorkQueue based on the
  36     * implementation of the class that implements this interface. For PE 8.0 we
  37     * would return a WorkQueue in a roundrobin fashion everytime this method
  38     * is called. In the future we could allow pluggability of  Policy objects for this.
  39     */
  40     public WorkQueue getAnyWorkQueue();
  41 
  42     /**
  43     * This method will return an instance of the of the WorkQueue given a queueId.
  44     * This will be useful in situations where there are more than one WorkQueues
  45     * managed by the ThreadPool and the user of the ThreadPool wants to always use
  46     * the same WorkQueue for doing the Work.
  47     * If the number of WorkQueues in the ThreadPool are 10, then queueIds will go
  48     * from 0-9
  49     *
  50     * @throws NoSuchWorkQueueException thrown when queueId passed is invalid


   1 /*
   2  * Copyright (c) 2003, 2012, 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 com.sun.corba.se.spi.orbutil.threadpool;
  27 
  28 import java.io.Closeable;
  29 
  30 /** This interface defines a thread pool execution service.  The ORB uses this
  31  * interface, which preceeds the JDK 5 ExecutorService.  Note that the close
  32  * method must be called in order to reclaim thread resources.
  33  */
  34 public interface ThreadPool extends Closeable
  35 {
  36 
  37     /**
  38     * This method will return any instance of the WorkQueue. If the ThreadPool
  39     * instance only services one WorkQueue then that WorkQueue instance will
  40     * be returned. If there are more than one WorkQueues serviced by this
  41     * ThreadPool, then this method would return a WorkQueue based on the
  42     * implementation of the class that implements this interface. For PE 8.0 we
  43     * would return a WorkQueue in a roundrobin fashion everytime this method
  44     * is called. In the future we could allow pluggability of  Policy objects for this.
  45     */
  46     public WorkQueue getAnyWorkQueue();
  47 
  48     /**
  49     * This method will return an instance of the of the WorkQueue given a queueId.
  50     * This will be useful in situations where there are more than one WorkQueues
  51     * managed by the ThreadPool and the user of the ThreadPool wants to always use
  52     * the same WorkQueue for doing the Work.
  53     * If the number of WorkQueues in the ThreadPool are 10, then queueIds will go
  54     * from 0-9
  55     *
  56     * @throws NoSuchWorkQueueException thrown when queueId passed is invalid