View Javadoc

1   /***
2    * 
3    */
4   package com.eviware.soapui.monitor;
5   
6   import java.util.concurrent.TimeUnit;
7   
8   import org.mortbay.thread.ThreadPool;
9   
10  import com.eviware.soapui.SoapUI;
11  
12  /*
13   *  soapUI, copyright (C) 2004-2010 eviware.com 
14   *
15   *  soapUI is free software; you can redistribute it and/or modify it under the 
16   *  terms of version 2.1 of the GNU Lesser General Public License as published by 
17   *  the Free Software Foundation.
18   *
19   *  soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
20   *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
21   *  See the GNU Lesser General Public License for more details at gnu.org.
22   */
23  
24  public final class SoapUIJettyThreadPool implements ThreadPool
25  {
26  	@Override
27  	public boolean dispatch( Runnable arg0 )
28  	{
29  		SoapUI.getThreadPool().execute( arg0 );
30  		return true;
31  	}
32  
33  	@Override
34  	public int getIdleThreads()
35  	{
36  		return 0;
37  	}
38  
39  	@Override
40  	public int getThreads()
41  	{
42  		return SoapUI.getThreadPool().getActiveCount();
43  	}
44  
45  	@Override
46  	public boolean isLowOnThreads()
47  	{
48  		return false;
49  	}
50  
51  	@Override
52  	public void join() throws InterruptedException
53  	{
54  		SoapUI.getThreadPool().awaitTermination( 30, TimeUnit.SECONDS );
55  	}
56  }