User: chirino
Date: 01/06/25 19:41:38
Modified: src/main/org/jbossmq SpyConnection.java
Log:
Now use a ThreadGroup to group all the client threads.
Revision Changes Path
1.10 +14 -2 jbossmq/src/main/org/jbossmq/SpyConnection.java
Index: SpyConnection.java
===================================================================
RCS file: /cvsroot/jboss/jbossmq/src/main/org/jbossmq/SpyConnection.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- SpyConnection.java 2001/06/24 23:24:47 1.9
+++ SpyConnection.java 2001/06/26 02:41:38 1.10
@@ -40,7 +40,7 @@
* @author Norbert Lataille ([EMAIL PROTECTED])
* @author Hiram Chirino ([EMAIL PROTECTED])
*
- * @version $Revision: 1.9 $
+ * @version $Revision: 1.10 $
*/
public class SpyConnection implements java.io.Serializable, javax.jms.Connection {
//////////////////////////////////////////////////////////////
@@ -575,6 +575,8 @@
+ static public Executor execeutor;
+ static private int spyConnectionCounter=0;
// The Executor holds a pool non-deamon threads that
// service all the async tasks on the client.
// We make this a class varibale to get better pooling.
@@ -585,8 +587,8 @@
// asynch client programs that do not create
// long running threads. The program would terminate when
// the connection is closed()
- static public Executor execeutor;
- static private int spyConnectionCounter=0;
+
+ static public ThreadGroup threadGroup;
synchronized private void closeExecutor() {
spyConnectionCounter--;
@@ -607,11 +609,21 @@
// up to 100 threads if the buffer gets full.
// allowing them to die if they are not used for 1 minute.
/// clients block if both the buffer is full and all 100 threads are
busy:
+
+ if ( threadGroup == null )
+ threadGroup = new ThreadGroup("JBossMQ Client Threads");
+
PooledExecutor pool = new PooledExecutor(50);
pool.setMinimumPoolSize(1);
pool.setKeepAliveTime(1000 * 60 * 1);
pool.createThreads(1);
pool.waitWhenBlocked();
+ pool.setThreadFactory( new ThreadFactory() {
+ public Thread newThread(Runnable command) {
+ return new Thread( threadGroup,
command, "Thread Pool Worker");
+ }
+ }
+ );
execeutor = pool;
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development