[jboss-cvs] JBossAS SVN: r63597 - in branches/JBoss_4_0_4_GA_CP/server/src/main/org/jboss: jms/asf and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jun 21 09:51:26 EDT 2007
Author: bdecoste
Date: 2007-06-21 09:51:25 -0400 (Thu, 21 Jun 2007)
New Revision: 63597
Modified:
branches/JBoss_4_0_4_GA_CP/server/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java
branches/JBoss_4_0_4_GA_CP/server/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvokerMBean.java
branches/JBoss_4_0_4_GA_CP/server/src/main/org/jboss/jms/asf/ServerSessionPoolFactory.java
branches/JBoss_4_0_4_GA_CP/server/src/main/org/jboss/jms/asf/StdServerSessionPool.java
branches/JBoss_4_0_4_GA_CP/server/src/main/org/jboss/jms/asf/StdServerSessionPoolFactory.java
Log:
[ASPATCH-240] Weston's changes to resolve issue with jms failover with tibco ems
Modified: branches/JBoss_4_0_4_GA_CP/server/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java
===================================================================
--- branches/JBoss_4_0_4_GA_CP/server/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java 2007-06-21 13:46:54 UTC (rev 63596)
+++ branches/JBoss_4_0_4_GA_CP/server/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java 2007-06-21 13:51:25 UTC (rev 63597)
@@ -146,6 +146,15 @@
/** If Dead letter queue should be used or not. */
protected boolean useDLQ = false;
+ /** The forceClearOnShutdown */
+ protected boolean forceClearOnShutdown = false;
+
+ /** The clearPoolInterval */
+ protected long forceClearInterval = 1000;
+
+ /** The forceClearAttempts */
+ protected int forceClearAttempts;
+
/**
* JNDI name of the provider adapter.
*
@@ -258,7 +267,39 @@
{
this.maxMessagesNr = maxMessages;
}
-
+
+ public void setForceClearOnShutdown(boolean forceClear)
+ {
+ this.forceClearOnShutdown = forceClear;
+
+ }
+
+ public boolean isForceClearOnShutdown()
+ {
+ return this.forceClearOnShutdown;
+ }
+
+ public long getForceClearOnShutdownInterval()
+ {
+ return this.forceClearInterval;
+ }
+
+ public void setForceClearOnShutdownInterval(long forceClearOnShutdownInterval)
+ {
+ this.forceClearInterval = forceClearOnShutdownInterval;
+ }
+
+ public int getForceClearAttempts()
+ {
+ return this.getForceClearAttempts();
+ }
+
+ public void setForceClearAttempts(int forceClearAttempts)
+ {
+ this.forceClearAttempts = forceClearAttempts;
+
+ }
+
public MessageDrivenMetaData getMetaData()
{
MessageDrivenMetaData config =
@@ -402,6 +443,51 @@
try
{
+ String forceClear = MetaData.getElementContent(MetaData.getUniqueChild(element, "ForceClearOnShutdown"));
+
+ if(forceClear != null)
+ {
+ forceClearOnShutdown = ("false".equalsIgnoreCase(forceClear)) ? false : true;
+
+ }
+
+ }catch(Exception ignore)
+ {
+
+ }
+
+ try
+ {
+ String clearInterval = MetaData.getElementContent(MetaData.getUniqueChild(element, "ForceClearInterval"));
+
+ if(clearInterval != null)
+ {
+ forceClearInterval = new Long(clearInterval).longValue();
+
+ }
+
+ }catch(Exception ignore)
+ {
+
+ }
+
+ try
+ {
+ String attempts = MetaData.getElementContent(MetaData.getUniqueChild(element, "ForceClearAttempts"));
+
+ if(attempts != null)
+ {
+ forceClearAttempts = new Integer(attempts).intValue();
+
+ }
+
+ }catch(Exception ignore)
+ {
+
+ }
+
+ try
+ {
String keepAliveMillis = MetaData.getElementContent
(MetaData.getUniqueChild(element, "KeepAliveMillis"));
keepAlive = Integer.parseInt(keepAliveMillis);
@@ -1168,7 +1254,7 @@
context.lookup(serverSessionPoolFactoryJNDI);
// the create the pool
- pool = factory.getServerSessionPool(destination, connection, minSession, maxSession, keepAlive, isTransacted, ack, !isContainerManagedTx || isNotSupportedTx, listener);
+ pool = factory.getServerSessionPool(destination, connection, minSession, maxSession, keepAlive, forceClearOnShutdown, forceClearInterval, forceClearAttempts, isTransacted, ack, !isContainerManagedTx || isNotSupportedTx, listener);
}
finally
{
Modified: branches/JBoss_4_0_4_GA_CP/server/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvokerMBean.java
===================================================================
--- branches/JBoss_4_0_4_GA_CP/server/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvokerMBean.java 2007-06-21 13:46:54 UTC (rev 63596)
+++ branches/JBoss_4_0_4_GA_CP/server/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvokerMBean.java 2007-06-21 13:51:25 UTC (rev 63597)
@@ -74,6 +74,49 @@
void setKeepAliveMillis(long keepAlive);
/**
+ * FIXME Comment this
+ *
+ * @return
+ */
+ boolean isForceClearOnShutdown();
+
+ /**
+ * FIXME Comment this
+ *
+ * @param forceClear
+ */
+ void setForceClearOnShutdown(boolean forceClear);
+
+ /**
+ * FIXME Comment this
+ *
+ * @return
+ */
+ long getForceClearOnShutdownInterval();
+
+ /**
+ * FIXME Comment this
+ *
+ * @param forceClearOnShutdownInterval
+ */
+ void setForceClearOnShutdownInterval(long forceClearOnShutdownInterval);
+
+ /**
+ * FIXME Comment this
+ *
+ * @return
+ */
+ int getForceClearAttempts();
+
+ /**
+ * FIXME Comment this
+ *
+ * @param forceClearAttempts
+ */
+ void setForceClearAttempts(int forceClearAttempts);
+
+
+ /**
* Get the maximum number of messages
*
* @return the number of messages
@@ -122,4 +165,7 @@
* @throws Exception for any error
*/
void stopDelivery() throws Exception;
+
+
+
}
Modified: branches/JBoss_4_0_4_GA_CP/server/src/main/org/jboss/jms/asf/ServerSessionPoolFactory.java
===================================================================
--- branches/JBoss_4_0_4_GA_CP/server/src/main/org/jboss/jms/asf/ServerSessionPoolFactory.java 2007-06-21 13:46:54 UTC (rev 63596)
+++ branches/JBoss_4_0_4_GA_CP/server/src/main/org/jboss/jms/asf/ServerSessionPoolFactory.java 2007-06-21 13:51:25 UTC (rev 63597)
@@ -77,6 +77,9 @@
* @param minSession the minimum number of sessions
* @param maxSession the maximum number of sessions
* @param keepAlive the time to keep sessions alive
+ * @param forceClear whether or not to force clearing the pool
+ * @param forceClearInterval the interval to wait between pool clearing attempts
+ * @param forceClearAttempts the number of attempts for clearing the pool
* @param isTransacted whether the pool is transacted
* @param ack the acknowledegement method
* @param listener the listener
@@ -85,6 +88,6 @@
* @throws JMSException for any error
*/
ServerSessionPool getServerSessionPool(Destination destination, Connection con, int minSession, int maxSession,
- long keepAlive, boolean isTransacted, int ack, boolean useLocalTX, MessageListener listener)
+ long keepAlive, boolean forceClear, long forceClearInterval, int forceClearAttempts,boolean isTransacted, int ack, boolean useLocalTX, MessageListener listener)
throws JMSException;
}
\ No newline at end of file
Modified: branches/JBoss_4_0_4_GA_CP/server/src/main/org/jboss/jms/asf/StdServerSessionPool.java
===================================================================
--- branches/JBoss_4_0_4_GA_CP/server/src/main/org/jboss/jms/asf/StdServerSessionPool.java 2007-06-21 13:46:54 UTC (rev 63596)
+++ branches/JBoss_4_0_4_GA_CP/server/src/main/org/jboss/jms/asf/StdServerSessionPool.java 2007-06-21 13:51:25 UTC (rev 63597)
@@ -99,6 +99,14 @@
/** Used to signal when the Pool is being closed down */
private boolean closing = false;
+ /** The forceClear */
+ private boolean forceClear = false;
+
+ /** The forceClearInterval */
+ private long forceClearInterval = 30000;
+
+ private int forceClearAttempts = 5;
+
/** Used during close down to wait for all server sessions to be returned and closed. */
private int numServerSessions = 0;
@@ -130,6 +138,9 @@
final int minSession,
final int maxSession,
final long keepAlive,
+ final boolean forceClear,
+ final long forceClearInterval,
+ final int forceClearAttempts,
final XidFactoryMBean xidFactory,
final TransactionManager tm)
throws JMSException
@@ -142,6 +153,9 @@
this.minSize = minSession;
this.poolSize = maxSession;
this.sessionPool = new ArrayList(maxSession);
+ this.forceClear = forceClear;
+ this.forceClearInterval = forceClearInterval;
+ this.forceClearAttempts = forceClearAttempts;
this.useLocalTX = useLocalTX;
this.xidFactory = xidFactory;
this.tm = tm;
@@ -242,16 +256,43 @@
//wait for all server sessions to be returned.
synchronized (sessionPool)
{
- while (numServerSessions > 0)
+ int attempts = 0;
+
+ if(forceClear)
{
- try
+ log.trace("Force clear behavior in effect. Waiting for " + forceClearInterval + " milliseconds for " + forceClearAttempts + " attempts.");
+
+ while((numServerSessions > 0) && (attempts < forceClearAttempts))
{
- sessionPool.wait();
+ try
+ {
+ sessionPool.wait(forceClearInterval);
+ log.trace("Clear attempt " + attempts);
+ ++attempts;
+
+ }catch(InterruptedException ignore)
+ {
+
+ }
+
}
- catch (InterruptedException ignore)
+
+ }
+ else
+ {
+ while (numServerSessions > 0)
{
+ try
+ {
+ sessionPool.wait();
+ }
+ catch (InterruptedException ignore)
+ {
+ }
}
+
}
+
}
}
Modified: branches/JBoss_4_0_4_GA_CP/server/src/main/org/jboss/jms/asf/StdServerSessionPoolFactory.java
===================================================================
--- branches/JBoss_4_0_4_GA_CP/server/src/main/org/jboss/jms/asf/StdServerSessionPoolFactory.java 2007-06-21 13:46:54 UTC (rev 63596)
+++ branches/JBoss_4_0_4_GA_CP/server/src/main/org/jboss/jms/asf/StdServerSessionPoolFactory.java 2007-06-21 13:51:25 UTC (rev 63597)
@@ -86,9 +86,10 @@
return transactionManager;
}
- public ServerSessionPool getServerSessionPool(Destination destination, Connection con, int minSession, int maxSession, long keepAlive, boolean isTransacted, int ack, boolean useLocalTX, MessageListener listener) throws JMSException
+
+ public ServerSessionPool getServerSessionPool(Destination destination, Connection con, int minSession, int maxSession, long keepAlive, boolean forceClear, long forceClearInterval, int forceClearAttempts, boolean isTransacted, int ack, boolean useLocalTX, MessageListener listener) throws JMSException
{
- ServerSessionPool pool = new StdServerSessionPool(destination, con, isTransacted, ack, useLocalTX, listener, minSession, maxSession, keepAlive, xidFactory, transactionManager);
+ ServerSessionPool pool = new StdServerSessionPool(destination, con, isTransacted, ack, useLocalTX, listener, minSession, maxSession, keepAlive, forceClear, forceClearInterval, forceClearAttempts, xidFactory, transactionManager);
return pool;
}
}
More information about the jboss-cvs-commits
mailing list