[Jboss-cvs] JBossAS SVN: r56115 - branches/JBoss_4_0_3_SP1_JBAS_3511/server/src/main/org/jboss/jms/asf
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Aug 21 11:57:42 EDT 2006
Author: weston.price at jboss.com
Date: 2006-08-21 11:57:41 -0400 (Mon, 21 Aug 2006)
New Revision: 56115
Modified:
branches/JBoss_4_0_3_SP1_JBAS_3511/server/src/main/org/jboss/jms/asf/StdServerSessionPool.java
Log:
[JBAS-3511] Reworked session pool for new create method as well as
recycle idle sessions.
Modified: branches/JBoss_4_0_3_SP1_JBAS_3511/server/src/main/org/jboss/jms/asf/StdServerSessionPool.java
===================================================================
--- branches/JBoss_4_0_3_SP1_JBAS_3511/server/src/main/org/jboss/jms/asf/StdServerSessionPool.java 2006-08-21 15:57:05 UTC (rev 56114)
+++ branches/JBoss_4_0_3_SP1_JBAS_3511/server/src/main/org/jboss/jms/asf/StdServerSessionPool.java 2006-08-21 15:57:41 UTC (rev 56115)
@@ -170,12 +170,12 @@
// finish initializing the session
if(!lazyInitialization)
{
- create();
+ create(this.poolSize);
}else
{
log.debug("SessionPool is specified as lazy init. No sessions being created.");
-
+ create(this.minSize);
}
if(recycleIdleSessions)
@@ -234,7 +234,7 @@
executor.setThreadFactory(new DefaultThreadFactory());
// finish initializing the session
- create();
+ create(this.poolSize);
log.debug("Server Session pool set up");
}
@@ -374,6 +374,21 @@
{
return transacted;
}
+
+ void recycleIdleSession(StdServerSession session)
+ {
+ synchronized (sessionPool)
+ {
+ session.close();
+ numServerSessions--;
+ if (numServerSessions == 0)
+ {
+ //notify clear thread.
+ sessionPool.notifyAll();
+ }
+
+ }
+ }
/**
* Recycle a server session.
@@ -384,7 +399,7 @@
{
synchronized (sessionPool)
{
- if (closing || lazyInitialization)
+ if (closing)
{
session.close();
numServerSessions--;
@@ -455,11 +470,11 @@
return serverSession;
}
- private void create() throws JMSException
+ private void create(int size) throws JMSException
{
boolean debug = log.isDebugEnabled();
- for (int index = 0; index < poolSize; index++)
+ for (int index = 0; index < size; index++)
{
// Here is the meat, that MUST follow the spec
Session ses = null;
@@ -520,9 +535,7 @@
if(session.isTimedOut(timeout))
{
- recycle(session);
-
- }
+ recycleIdleSession(session); }
else
break;
More information about the jboss-cvs-commits
mailing list