KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > ejb > containers > util > ContainerWorkPool


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /*
25  * Filename: ContainerWorkPool.java
26  *
27  */

28
29 /**
30  * <BR> <I>$Source: /cvs/glassfish/appserv-core/src/java/com/sun/ejb/containers/util/ContainerWorkPool.java,v $</I>
31  * @author $Author: tcfujii $
32  * @version $Revision: 1.3 $ $Date: 2005/12/25 04:13:31 $
33  */

34
35 package com.sun.ejb.containers.util;
36
37 import com.sun.corba.ee.spi.orbutil.threadpool.Work;
38 import com.sun.corba.ee.spi.orbutil.threadpool.ThreadPoolManager;
39 import com.sun.corba.ee.spi.orbutil.threadpool.ThreadPool;
40 import com.sun.enterprise.util.S1ASThreadPoolManager;
41 import com.sun.enterprise.util.ORBManager;
42
43 import com.sun.enterprise.util.threadpool.Servicable;
44
45 import java.util.logging.Logger JavaDoc;
46 import java.util.logging.Level JavaDoc;
47 import com.sun.logging.LogDomains;
48
49 /**
50  * This class implements a singleton instance which
51  * is used by the container for its housekeeping tasks
52  * using the default threadpool of the appserver
53  */

54
55 public class ContainerWorkPool {
56
57     public static Logger JavaDoc _logger=LogDomains.getLogger(LogDomains.UTIL_LOGGER);
58
59     public static void addLast(Servicable ser) {
60         addLast(new WorkAdapter(ser));
61     }
62
63     public static void addFirst(Servicable ser) {
64         addLast(new WorkAdapter(ser));
65     }
66
67     public static void addFirst(Work work) {
68         addLast(work);
69     }
70
71     public static void addLast(Work work) {
72         ThreadPoolManager threadpoolMgr =
73             S1ASThreadPoolManager.getThreadPoolManager();
74         ThreadPool threadpool = threadpoolMgr.getDefaultThreadPool();
75         threadpool.getAnyWorkQueue().addWork(work);
76     }
77
78 }
79
80
Popular Tags