KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > impl > work > NullWorkExecutorPool


1 /*
2  * $Id: NullWorkExecutorPool.java 3798 2006-11-04 04:07:14Z aperepel $
3  * --------------------------------------------------------------------------------------
4  * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
5  *
6  * The software in this package is published under the terms of the MuleSource MPL
7  * license, a copy of which has been included with this distribution in the
8  * LICENSE.txt file.
9  */

10
11 /**
12  *
13  * Copyright 2004 The Apache Software Foundation
14  *
15  * Licensed under the Apache License, Version 2.0 (the "License");
16  * you may not use this file except in compliance with the License.
17  * You may obtain a copy of the License at
18  *
19  * http://www.apache.org/licenses/LICENSE-2.0
20  *
21  * Unless required by applicable law or agreed to in writing, software
22  * distributed under the License is distributed on an "AS IS" BASIS,
23  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24  * See the License for the specific language governing permissions and
25  * limitations under the License.
26  */

27
28 package org.mule.impl.work;
29
30 import org.mule.config.ThreadingProfile;
31
32 /**
33  * @version $Rev: 3798 $ $Date: 2006-11-03 22:07:14 -0600 (Fri, 03 Nov 2006) $
34  */

35 public class NullWorkExecutorPool implements WorkExecutorPool
36 {
37
38     private ThreadingProfile profile;
39     private String JavaDoc name;
40
41     public NullWorkExecutorPool(ThreadingProfile profile, String JavaDoc name)
42     {
43         this.profile = profile;
44         this.name = name;
45     }
46
47     public int getPoolSize()
48     {
49         return 0;
50     }
51
52     public int getMaximumPoolSize()
53     {
54         return profile.getMaxThreadsActive();
55     }
56
57     public void setMaximumPoolSize(int maxSize)
58     {
59         profile.setMaxThreadsActive(maxSize);
60     }
61
62     public WorkExecutorPool start()
63     {
64         return new WorkExecutorPoolImpl(profile, name);
65     }
66
67     public WorkExecutorPool stop()
68     {
69         return this;
70     }
71
72     public void execute(Runnable JavaDoc command)
73     {
74         throw new IllegalStateException JavaDoc("Stopped");
75     }
76 }
77
Popular Tags