001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.kernel.executor;
016    
017    import com.liferay.portal.kernel.concurrent.ThreadPoolExecutor;
018    
019    import java.util.concurrent.Callable;
020    import java.util.concurrent.ExecutionException;
021    import java.util.concurrent.Future;
022    import java.util.concurrent.TimeUnit;
023    import java.util.concurrent.TimeoutException;
024    
025    /**
026     * @author Shuyang Zhou
027     */
028    public interface PortalExecutorManager {
029    
030            public <T> Future<T> execute(String name, Callable<T> callable);
031    
032            public <T> T execute(
033                            String name, Callable<T> callable, long timeout, TimeUnit timeUnit)
034                    throws ExecutionException, InterruptedException, TimeoutException;
035    
036            public ThreadPoolExecutor getPortalExecutor(String name);
037    
038            public ThreadPoolExecutor getPortalExecutor(
039                    String name, boolean createIfAbsent);
040    
041            public void shutdown();
042    
043            public void shutdown(boolean interrupt);
044    
045            public void shutdown(String name);
046    
047            public void shutdown(String name, boolean interrupt);
048    
049    }