1 // $Id: IWorkerPool.java 1365 2007-06-23 10:06:40Z grro $ 2 3 /* 4 * Copyright (c) xsocket.org, 2006 - 2007. All rights reserved. 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * 20 * Please refer to the LGPL license at: http://www.gnu.org/copyleft/lesser.txt 21 * The latest copy of this software may be found on http://www.xsocket.org/ 22 */ 23 24 25 package org.xsocket; 26 27 import java.util.Collection; 28 import java.util.List; 29 import java.util.concurrent.Callable; 30 import java.util.concurrent.Executor; 31 import java.util.concurrent.Future; 32 33 34 /** 35 * @deprecated replaced by {@link Executor} 36 * 37 * @author grro@xsocket.org 38 */ 39 public interface IWorkerPool extends Executor { 40 41 /** 42 * 43 * @param command the commnd to execute 44 */ 45 public void execute(Runnable command); 46 47 48 /** 49 * 50 * @param tasks the collection of tasks 51 * @return A list of Futures representing the tasks, 52 * in the same sequential order as produced by 53 * the iterator for the given task list, each of which has completed. 54 * @throws InterruptedException if interrupted while waiting, in which case unfinished tasks are cancelled. 55 */ 56 public <T> List<Future<T>> invokeAll(Collection<Callable<T>> tasks) throws InterruptedException; 57 58 59 60 61 /** 62 * 63 * @return the number of the workers 64 */ 65 public int getPoolSize(); 66 67 68 /** 69 * 70 * @return the number of workes 71 */ 72 public int getActiveCount(); 73 } 74