[jboss-cvs] JBoss Messaging SVN: r5443 - in trunk: src/main/org/jboss/messaging/core/config/impl and 19 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Dec 1 07:44:59 EST 2008
Author: timfox
Date: 2008-12-01 07:44:59 -0500 (Mon, 01 Dec 2008)
New Revision: 5443
Added:
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectTest.java
Modified:
trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java
trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java
trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java
trunk/src/main/org/jboss/messaging/core/client/impl/RandomConnectionLoadBalancingPolicy.java
trunk/src/main/org/jboss/messaging/core/client/impl/RoundRobinConnectionLoadBalancingPolicy.java
trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java
trunk/src/main/org/jboss/messaging/core/filter/impl/FilterImpl.java
trunk/src/main/org/jboss/messaging/core/filter/impl/Identifier.java
trunk/src/main/org/jboss/messaging/core/filter/impl/Operator.java
trunk/src/main/org/jboss/messaging/core/filter/impl/RegExp.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnector.java
trunk/src/main/org/jboss/messaging/core/remoting/spi/Connector.java
trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java
trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java
trunk/src/main/org/jboss/messaging/jms/server/JMSServerManager.java
trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java
trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java
trunk/src/main/org/jboss/messaging/jms/server/management/JMSServerControlMBean.java
trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSServerControl.java
trunk/src/main/org/jboss/messaging/util/Random.java
trunk/src/main/org/jboss/messaging/util/XMLUtil.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/JMSTestCase.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientCrashTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReplicateConnectionFailureTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/jms/cluster/JMSFailoverTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/jms/consumer/ConsumerTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSQueueControlTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSUtil.java
trunk/tests/src/org/jboss/messaging/tests/integration/remoting/PingTest.java
Log:
Mainly server reconnect logic
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -38,8 +38,6 @@
* @author <a href="mailto:ataylor at redhat.com">Andy Taylor</a>
* @version <tt>$Revision: 3602 $</tt>
*
- * Note! There should never be more than one clientsessionfactory with the same connection params
- * Otherwise failover won't work properly since channel ids won't match on live and backup
*/
public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, DiscoveryListener
{
@@ -80,14 +78,21 @@
public static final int DEFAULT_ACK_BATCH_SIZE = 1024 * 1024;
public static final boolean DEFAULT_PRE_ACKNOWLEDGE = false;
-
+
public static final long DEFAULT_DISCOVERY_INITIAL_WAIT = 10000;
-
+
+ public static final boolean DEFAULT_RETRY_ON_FAILURE = true;
+
+ public static final long DEFAULT_RETRY_INTERVAL = 5000;
+
+ public static final double DEFAULT_RETRY_INTERVAL_MULTIPLIER = 1d;
+
+ public static final int DEFAULT_MAX_RETRIES = -1;
+
// Attributes
// -----------------------------------------------------------------------------------
- private final Map<Pair<TransportConfiguration, TransportConfiguration>, ConnectionManager> connectionManagerMap =
- new LinkedHashMap<Pair<TransportConfiguration, TransportConfiguration>, ConnectionManager>();
+ private final Map<Pair<TransportConfiguration, TransportConfiguration>, ConnectionManager> connectionManagerMap = new LinkedHashMap<Pair<TransportConfiguration, TransportConfiguration>, ConnectionManager>();
private ConnectionManager[] connectionManagerArray;
@@ -130,6 +135,16 @@
private final long initialWaitTimeout;
+ //Reconnect params
+
+ private final boolean retryOnFailure;
+
+ private final long retryInterval;
+
+ private final double retryIntervalMultiplier; // For exponential backoff
+
+ private final int maxRetries;
+
// Static
// ---------------------------------------------------------------------------------------
@@ -173,6 +188,10 @@
this.maxConnections = DEFAULT_MAX_CONNECTIONS;
this.ackBatchSize = DEFAULT_ACK_BATCH_SIZE;
this.preAcknowledge = DEFAULT_PRE_ACKNOWLEDGE;
+ this.retryOnFailure = DEFAULT_RETRY_ON_FAILURE;
+ this.retryInterval = DEFAULT_RETRY_INTERVAL;
+ this.retryIntervalMultiplier = DEFAULT_RETRY_INTERVAL_MULTIPLIER;
+ this.maxRetries = DEFAULT_MAX_RETRIES;
}
public ClientSessionFactoryImpl(final String discoveryGroupName,
@@ -193,21 +212,25 @@
final boolean autoGroup,
final int maxConnections,
final boolean preAcknowledge,
- final int ackBatchSize) throws MessagingException
+ final int ackBatchSize,
+ final boolean retryOnFailure,
+ final long retryInterval,
+ final double retryIntervalMultiplier,
+ final int maxRetries) throws MessagingException
{
try
{
InetAddress groupAddress = InetAddress.getByName(discoveryGroupName);
-
+
discoveryGroup = new DiscoveryGroupImpl(groupAddress, discoveryGroupPort, discoveryRefreshTimeout);
-
+
discoveryGroup.registerListener(this);
-
+
discoveryGroup.start();
}
catch (Exception e)
{
- //TODO - better execption
+ // TODO - better execption
throw new MessagingException(MessagingException.INTERNAL_ERROR, "Failed to connect discovery group");
}
@@ -227,6 +250,10 @@
this.maxConnections = maxConnections;
this.ackBatchSize = ackBatchSize;
this.preAcknowledge = preAcknowledge;
+ this.retryOnFailure = retryOnFailure;
+ this.retryInterval = retryInterval;
+ this.retryIntervalMultiplier = retryIntervalMultiplier;
+ this.maxRetries = maxRetries;
}
public ClientSessionFactoryImpl(final List<Pair<TransportConfiguration, TransportConfiguration>> connectors,
@@ -244,7 +271,11 @@
final boolean autoGroup,
final int maxConnections,
final boolean preAcknowledge,
- final int ackBatchSize)
+ final int ackBatchSize,
+ final boolean retryOnFailure,
+ final long retryInterval,
+ final double retryIntervalMultiplier,
+ final int maxRetries)
{
this.loadBalancingPolicy = instantiateLoadBalancingPolicy(connectionloadBalancingPolicyClassName);
this.pingPeriod = pingPeriod;
@@ -261,23 +292,83 @@
this.maxConnections = maxConnections;
this.ackBatchSize = ackBatchSize;
this.preAcknowledge = preAcknowledge;
+ this.retryOnFailure = retryOnFailure;
+ this.retryInterval = retryInterval;
+ this.retryIntervalMultiplier = retryIntervalMultiplier;
+ this.maxRetries = maxRetries;
+
this.initialWaitTimeout = -1;
for (Pair<TransportConfiguration, TransportConfiguration> pair : connectors)
{
- ConnectionManager cm = new ConnectionManagerImpl(pair.a, pair.b, maxConnections, callTimeout, pingPeriod);
-
+ ConnectionManager cm = new ConnectionManagerImpl(pair.a,
+ pair.b,
+ maxConnections,
+ callTimeout,
+ pingPeriod,
+ retryOnFailure,
+ retryInterval,
+ retryIntervalMultiplier,
+ maxRetries);
+
connectionManagerMap.put(pair, cm);
}
-
+
updateConnectionManagerArray();
this.discoveryGroup = null;
}
+
+ public ClientSessionFactoryImpl(final TransportConfiguration connectorConfig,
+ final long retryInterval,
+ final double retryIntervalMultiplier,
+ final int maxRetries)
+ {
+ this.loadBalancingPolicy = new FirstElementConnectionLoadBalancingPolicy();
+ this.pingPeriod = DEFAULT_PING_PERIOD;
+ this.callTimeout = DEFAULT_CALL_TIMEOUT;
+ this.consumerWindowSize = DEFAULT_CONSUMER_WINDOW_SIZE;
+ this.consumerMaxRate = DEFAULT_CONSUMER_MAX_RATE;
+ this.sendWindowSize = DEFAULT_SEND_WINDOW_SIZE;
+ this.producerMaxRate = DEFAULT_PRODUCER_MAX_RATE;
+ this.blockOnAcknowledge = DEFAULT_BLOCK_ON_ACKNOWLEDGE;
+ this.blockOnNonPersistentSend = DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND;
+ this.blockOnPersistentSend = DEFAULT_BLOCK_ON_PERSISTENT_SEND;
+ this.minLargeMessageSize = DEFAULT_MIN_LARGE_MESSAGE_SIZE;
+ this.autoGroup = DEFAULT_AUTO_GROUP;
+ this.maxConnections = DEFAULT_MAX_CONNECTIONS;
+ this.ackBatchSize = DEFAULT_ACK_BATCH_SIZE;
+ this.preAcknowledge = DEFAULT_PRE_ACKNOWLEDGE;
+ this.retryOnFailure = true;
+ this.retryInterval = retryInterval;
+ this.retryIntervalMultiplier = retryIntervalMultiplier;
+ this.maxRetries = maxRetries;
+ this.initialWaitTimeout = -1;
+
+ Pair<TransportConfiguration, TransportConfiguration> pair = new Pair<TransportConfiguration, TransportConfiguration>(connectorConfig,
+ null);
+
+ ConnectionManager cm = new ConnectionManagerImpl(pair.a,
+ pair.b,
+ maxConnections,
+ callTimeout,
+ pingPeriod,
+ retryOnFailure,
+ retryInterval,
+ retryIntervalMultiplier,
+ maxRetries);
+
+ connectionManagerMap.put(pair, cm);
+
+ updateConnectionManagerArray();
+
+ discoveryGroup = null;
+ }
+
public ClientSessionFactoryImpl(final TransportConfiguration connectorConfig,
final TransportConfiguration backupConfig)
- {
+ {
this.loadBalancingPolicy = new FirstElementConnectionLoadBalancingPolicy();
this.pingPeriod = DEFAULT_PING_PERIOD;
this.callTimeout = DEFAULT_CALL_TIMEOUT;
@@ -293,20 +384,33 @@
this.maxConnections = DEFAULT_MAX_CONNECTIONS;
this.ackBatchSize = DEFAULT_ACK_BATCH_SIZE;
this.preAcknowledge = DEFAULT_PRE_ACKNOWLEDGE;
+ this.retryOnFailure = DEFAULT_RETRY_ON_FAILURE;
+ this.retryInterval = DEFAULT_RETRY_INTERVAL;
+ this.retryIntervalMultiplier = DEFAULT_RETRY_INTERVAL_MULTIPLIER;
+ this.maxRetries = DEFAULT_MAX_RETRIES;
+
this.initialWaitTimeout = -1;
Pair<TransportConfiguration, TransportConfiguration> pair = new Pair<TransportConfiguration, TransportConfiguration>(connectorConfig,
- backupConfig);
-
- ConnectionManager cm = new ConnectionManagerImpl(pair.a, pair.b, maxConnections, callTimeout, pingPeriod);
-
+ backupConfig);
+
+ ConnectionManager cm = new ConnectionManagerImpl(pair.a,
+ pair.b,
+ maxConnections,
+ callTimeout,
+ pingPeriod,
+ retryOnFailure,
+ retryInterval,
+ retryIntervalMultiplier,
+ maxRetries);
+
connectionManagerMap.put(pair, cm);
-
+
updateConnectionManagerArray();
discoveryGroup = null;
}
-
+
public ClientSessionFactoryImpl(final TransportConfiguration connectorConfig,
final TransportConfiguration backupConfig,
final String connectionloadBalancingPolicyClassName,
@@ -323,7 +427,11 @@
final boolean autoGroup,
final int maxConnections,
final boolean preAcknowledge,
- final int ackBatchSize)
+ final int ackBatchSize,
+ final boolean retryOnFailure,
+ final long retryInterval,
+ final double retryIntervalMultiplier,
+ final int maxRetries)
{
this.loadBalancingPolicy = instantiateLoadBalancingPolicy(connectionloadBalancingPolicyClassName);
this.pingPeriod = pingPeriod;
@@ -340,20 +448,33 @@
this.maxConnections = maxConnections;
this.ackBatchSize = ackBatchSize;
this.preAcknowledge = preAcknowledge;
+ this.retryOnFailure = retryOnFailure;
+ this.retryInterval = retryInterval;
+ this.retryIntervalMultiplier = retryIntervalMultiplier;
+ this.maxRetries = maxRetries;
+
this.initialWaitTimeout = -1;
Pair<TransportConfiguration, TransportConfiguration> pair = new Pair<TransportConfiguration, TransportConfiguration>(connectorConfig,
- backupConfig);
-
- ConnectionManager cm = new ConnectionManagerImpl(pair.a, pair.b, maxConnections, callTimeout, pingPeriod);
-
+ backupConfig);
+
+ ConnectionManager cm = new ConnectionManagerImpl(pair.a,
+ pair.b,
+ maxConnections,
+ callTimeout,
+ pingPeriod,
+ retryOnFailure,
+ retryInterval,
+ retryIntervalMultiplier,
+ maxRetries);
+
connectionManagerMap.put(pair, cm);
-
+
updateConnectionManagerArray();
discoveryGroup = null;
}
-
+
/**
* Create a ClientSessionFactoryImpl specify transport type and using defaults
*/
@@ -362,7 +483,7 @@
this(connectorConfig, null);
}
- // ClientSessionFactory implementation------------------------------------------------------------
+ // ClientSessionFactory implementation------------------------------------------------------------
public ClientSession createSession(final String username,
final String password,
@@ -383,7 +504,7 @@
public ClientSession createSession(final boolean xa, final boolean autoCommitSends, final boolean autoCommitAcks) throws MessagingException
{
- return createSessionInternal(null, null, xa, autoCommitSends, autoCommitAcks, preAcknowledge, ackBatchSize);
+ return createSessionInternal(null, null, xa, autoCommitSends, autoCommitAcks, preAcknowledge, this.ackBatchSize);
}
public ClientSession createSession(final boolean xa,
@@ -391,10 +512,9 @@
final boolean autoCommitAcks,
final boolean preAcknowledge) throws MessagingException
{
- return createSessionInternal(null, null, xa, autoCommitSends, autoCommitAcks, preAcknowledge, ackBatchSize);
+ return createSessionInternal(null, null, xa, autoCommitSends, autoCommitAcks, preAcknowledge, this.ackBatchSize);
}
-
public int getConsumerWindowSize()
{
return consumerWindowSize;
@@ -530,7 +650,7 @@
{
int num = 0;
- for (ConnectionManager connectionManager: connectionManagerMap.values())
+ for (ConnectionManager connectionManager : connectionManagerMap.values())
{
num += connectionManager.numSessions();
}
@@ -542,7 +662,7 @@
{
int num = 0;
- for (ConnectionManager connectionManager: connectionManagerMap.values())
+ for (ConnectionManager connectionManager : connectionManagerMap.values())
{
num += connectionManager.numConnections();
}
@@ -572,16 +692,17 @@
receivedBroadcast = true;
List<Pair<TransportConfiguration, TransportConfiguration>> newConnectors = discoveryGroup.getConnectors();
-
+
Set<Pair<TransportConfiguration, TransportConfiguration>> connectorSet = new HashSet<Pair<TransportConfiguration, TransportConfiguration>>();
connectorSet.addAll(newConnectors);
- Iterator<Map.Entry<Pair<TransportConfiguration,TransportConfiguration>, ConnectionManager>> iter = connectionManagerMap.entrySet().iterator();
+ Iterator<Map.Entry<Pair<TransportConfiguration, TransportConfiguration>, ConnectionManager>> iter = connectionManagerMap.entrySet()
+ .iterator();
while (iter.hasNext())
{
- Map.Entry<Pair<TransportConfiguration,TransportConfiguration>, ConnectionManager> entry = iter.next();
+ Map.Entry<Pair<TransportConfiguration, TransportConfiguration>, ConnectionManager> entry = iter.next();
if (!connectorSet.contains(entry.getKey()))
{
@@ -591,27 +712,31 @@
}
}
- for (Pair<TransportConfiguration,TransportConfiguration> connectorPair : newConnectors)
+ for (Pair<TransportConfiguration, TransportConfiguration> connectorPair : newConnectors)
{
if (!connectionManagerMap.containsKey(connectorPair))
{
- //Create a new ConnectionManager
-
+ // Create a new ConnectionManager
+
ConnectionManager connectionManager = new ConnectionManagerImpl(connectorPair.a,
connectorPair.b,
maxConnections,
callTimeout,
- pingPeriod);
+ pingPeriod,
+ retryOnFailure,
+ retryInterval,
+ retryIntervalMultiplier,
+ maxRetries);
- connectionManagerMap.put(connectorPair, connectionManager);
+ connectionManagerMap.put(connectorPair, connectionManager);
}
}
-
+
updateConnectionManagerArray();
}
-
+
// Protected ------------------------------------------------------------------------------
-
+
protected void finalize() throws Throwable
{
if (discoveryGroup != null)
@@ -619,7 +744,7 @@
discoveryGroup.stop();
}
}
-
+
// Private --------------------------------------------------------------------------------
private synchronized ClientSession createSessionInternal(final String username,
@@ -662,7 +787,7 @@
blockOnNonPersistentSend,
blockOnPersistentSend);
}
-
+
private ConnectionLoadBalancingPolicy instantiateLoadBalancingPolicy(final String className)
{
ClassLoader loader = Thread.currentThread().getContextClassLoader();
@@ -679,11 +804,11 @@
return lbPolicy;
}
-
+
private void updateConnectionManagerArray()
- {
+ {
connectionManagerArray = new ConnectionManager[connectionManagerMap.size()];
-
+
connectionManagerMap.values().toArray(connectionManagerArray);
}
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -657,8 +657,6 @@
return;
}
- // log.info("closing client session " + System.identityHashCode(this));
-
try
{
closeChildren();
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -75,7 +75,7 @@
private static final long serialVersionUID = 2512460695662741413L;
- private static final Logger log = Logger.getLogger(ClientSessionFactoryImpl.class);
+ private static final Logger log = Logger.getLogger(ConnectionManagerImpl.class);
// Attributes
// -----------------------------------------------------------------------------------
@@ -115,7 +115,15 @@
private Iterator<ConnectionEntry> mapIterator;
private Object failConnectionLock = new Object();
+
+ private final boolean retryOnFailure;
+ private final long retryInterval;
+
+ private final double retryIntervalMultiplier; // For exponential backoff
+
+ private final int maxRetries;
+
// Static
// ---------------------------------------------------------------------------------------
@@ -126,7 +134,11 @@
final TransportConfiguration backupConfig,
final int maxConnections,
final long callTimeout,
- final long pingPeriod)
+ final long pingPeriod,
+ final boolean retryOnFailure,
+ final long retryInterval,
+ final double retryIntervalMultiplier,
+ final int maxRetries)
{
connectorFactory = instantiateConnectorFactory(connectorConfig.getFactoryClassName());
@@ -137,7 +149,6 @@
backupConnectorFactory = instantiateConnectorFactory(backupConfig.getFactoryClassName());
backupTransportParams = backupConfig.getParams();
-
}
else
{
@@ -145,11 +156,20 @@
backupTransportParams = null;
}
+
this.maxConnections = maxConnections;
this.callTimeout = callTimeout;
this.pingPeriod = pingPeriod;
+
+ this.retryOnFailure = retryOnFailure;
+
+ this.retryInterval = retryInterval;
+
+ this.retryIntervalMultiplier = retryIntervalMultiplier;
+
+ this.maxRetries = maxRetries;
}
// ConnectionLifeCycleListener implementation --------------------
@@ -408,9 +428,17 @@
// It can then release the channel 1 lock, and retry (which will cause locking on failoverLock
// until failover is complete
- if (this.backupConnectorFactory != null)
+ if (backupConnectorFactory != null || retryOnFailure)
{
- log.info("Commencing automatic failover");
+ if (backupConnectorFactory != null)
+ {
+ log.info("Commencing automatic failover");
+ }
+ else
+ {
+ log.info("Will attempt reconnection");
+ }
+
lockAllChannel1s();
final boolean needToInterrupt;
@@ -449,7 +477,7 @@
// Now we absolutely know that no threads are executing in or blocked in createSession, and no
// more will execute it until failover is complete
- // So.. do failover
+ // So.. do failover / reconnection
Set<RemotingConnection> oldConnections = new HashSet<RemotingConnection>();
@@ -464,10 +492,13 @@
mapIterator = null;
- connectorFactory = backupConnectorFactory;
+ if (backupConnectorFactory != null)
+ {
+ connectorFactory = backupConnectorFactory;
+
+ transportParams = backupTransportParams;
+ }
- transportParams = backupTransportParams;
-
backupConnectorFactory = null;
backupTransportParams = null;
@@ -495,17 +526,28 @@
sessions.add(session);
}
+ boolean ok = true;
+
for (Map.Entry<RemotingConnection, List<ClientSessionInternal>> entry : sessionsPerConnection.entrySet())
{
- List<ClientSessionInternal> sessions = entry.getValue();
+ List<ClientSessionInternal> theSessions = entry.getValue();
+
+ RemotingConnection backupConnection = getConnectionWithRetry(theSessions);
- RemotingConnection backupConnection = getConnection(sessions.size());
-
- for (ClientSessionInternal session : sessions)
+ if (backupConnection == null)
{
+ log.warn("Failed to reconnect to server.");
+
+ ok = false;
+
+ break;
+ }
+
+ for (ClientSessionInternal session : theSessions)
+ {
session.handleFailover(backupConnection);
- this.sessions.put(session, backupConnection);
+ sessions.put(session, backupConnection);
}
}
@@ -514,11 +556,68 @@
connection.destroy();
}
- log.info("Failover complete");
+ if (ok)
+ {
+ log.info("Failover complete");
+ }
}
}
}
+ private RemotingConnection getConnectionWithRetry(final List<ClientSessionInternal> sessions)
+ {
+ long interval = retryInterval;
+
+ int count = 0;
+
+ log.info("Getting connection with retry");
+
+ while (true)
+ {
+ RemotingConnection connection = getConnection(sessions.size());
+
+ log.info("Got connection " + connection);
+
+ if (connection == null)
+ {
+ //Failed to get backup connection
+
+ if (retryOnFailure)
+ {
+ if (maxRetries != -1 && count == maxRetries)
+ {
+ log.warn("Retried " + maxRetries + " times to reconnect. Now giving up.");
+
+ return null;
+ }
+
+ count++;
+
+ log.warn("Now waiting " + interval + " ms before attempting reconnection.");
+
+ try
+ {
+ Thread.sleep(interval);
+ }
+ catch (InterruptedException ignore)
+ {
+ }
+
+ //Exponential back-off
+ interval *= retryIntervalMultiplier;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ else
+ {
+ return connection;
+ }
+ }
+ }
+
// Public
// ---------------------------------------------------------------------------------------
@@ -556,7 +655,7 @@
}
}
- private RemotingConnection getConnection(int count)
+ private RemotingConnection getConnection(final int count)
{
RemotingConnection conn;
@@ -574,7 +673,7 @@
if (tc == null)
{
- throw new IllegalStateException("Failed to connect");
+ return null;
}
conn = new RemotingConnectionImpl(tc, callTimeout, pingPeriod, pingExecutor, null);
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/RandomConnectionLoadBalancingPolicy.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/RandomConnectionLoadBalancingPolicy.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/RandomConnectionLoadBalancingPolicy.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -37,7 +37,7 @@
*/
public class RandomConnectionLoadBalancingPolicy implements ConnectionLoadBalancingPolicy
{
- private Random random = new Random();
+ private final Random random = new Random();
public int select(final int max)
{
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/RoundRobinConnectionLoadBalancingPolicy.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/RoundRobinConnectionLoadBalancingPolicy.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/RoundRobinConnectionLoadBalancingPolicy.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -37,7 +37,7 @@
*/
public class RoundRobinConnectionLoadBalancingPolicy implements ConnectionLoadBalancingPolicy
{
- private Random random = new Random();
+ private final Random random = new Random();
private boolean first = true;
Modified: trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -273,7 +273,7 @@
NodeList nl = e.getElementsByTagName(name);
if (nl.getLength() > 0)
{
- return parseBoolean(nl.item(0));
+ return XMLUtil.parseBoolean(nl.item(0));
}
return def;
}
@@ -283,7 +283,7 @@
NodeList nl = e.getElementsByTagName(name);
if (nl.getLength() > 0)
{
- return parseInt(nl.item(0));
+ return XMLUtil.parseInt(nl.item(0));
}
return def;
}
@@ -293,7 +293,7 @@
NodeList nl = e.getElementsByTagName(name);
if (nl.getLength() > 0)
{
- return parseLong(nl.item(0));
+ return XMLUtil.parseLong(nl.item(0));
}
return def;
}
@@ -344,13 +344,13 @@
if (type.equalsIgnoreCase("Integer"))
{
- int iVal = parseInt(nValue);
+ int iVal = XMLUtil.parseInt(nValue);
params.put(key, iVal);
}
else if (type.equalsIgnoreCase("Long"))
{
- long lVal = parseLong(nValue);
+ long lVal = XMLUtil.parseLong(nValue);
params.put(key, lVal);
}
@@ -360,7 +360,7 @@
}
else if (type.equalsIgnoreCase("Boolean"))
{
- boolean bVal = parseBoolean(nValue);
+ boolean bVal = XMLUtil.parseBoolean(nValue);
params.put(key, bVal);
}
@@ -402,7 +402,7 @@
}
else if (child.getNodeName().equals("local-bind-port"))
{
- localBindPort = parseInt(child);
+ localBindPort = XMLUtil.parseInt(child);
}
else if (child.getNodeName().equals("group-address"))
{
@@ -410,11 +410,11 @@
}
else if (child.getNodeName().equals("group-port"))
{
- groupPort = parseInt(child);
+ groupPort = XMLUtil.parseInt(child);
}
else if (child.getNodeName().equals("broadcast-period"))
{
- broadcastPeriod = parseLong(child);
+ broadcastPeriod = XMLUtil.parseLong(child);
}
else if (child.getNodeName().equals("connector-ref"))
{
@@ -468,11 +468,11 @@
}
else if (child.getNodeName().equals("group-port"))
{
- groupPort = parseInt(child);
+ groupPort = XMLUtil.parseInt(child);
}
else if (child.getNodeName().equals("refresh-timeout"))
{
- refreshTimeout = parseLong(child);
+ refreshTimeout = XMLUtil.parseLong(child);
}
}
@@ -529,15 +529,15 @@
}
else if (child.getNodeName().equals("fanout"))
{
- fanout = parseBoolean(child);
+ fanout = XMLUtil.parseBoolean(child);
}
else if (child.getNodeName().equals("max-batch-size"))
{
- maxBatchSize = parseInt(child);
+ maxBatchSize = XMLUtil.parseInt(child);
}
else if (child.getNodeName().equals("max-batch-time"))
{
- maxBatchTime = parseLong(child);
+ maxBatchTime = XMLUtil.parseLong(child);
}
else if (child.getNodeName().equals("discovery-group-ref"))
{
@@ -592,54 +592,5 @@
messageFlowConfigurations.add(config);
}
- private long parseLong(final Node elem)
- {
- String value = elem.getTextContent().trim();
- try
- {
- return Long.parseLong(value);
- }
- catch (NumberFormatException e)
- {
- throw new IllegalArgumentException("Element " + elem +
- " requires a valid Long value, but '" +
- value +
- "' cannot be parsed as a Long");
- }
- }
-
- private int parseInt(final Node elem)
- {
- String value = elem.getTextContent().trim();
-
- try
- {
- return Integer.parseInt(value);
- }
- catch (NumberFormatException e)
- {
- throw new IllegalArgumentException("Element " + elem +
- " requires a valid Integer value, but '" +
- value +
- "' cannot be parsed as an Integer");
- }
- }
-
- private boolean parseBoolean(final Node elem)
- {
- String value = elem.getTextContent().trim();
-
- try
- {
- return Boolean.parseBoolean(value);
- }
- catch (NumberFormatException e)
- {
- throw new IllegalArgumentException("Element " + elem +
- " requires a valid Boolean value, but '" +
- value +
- "' cannot be parsed as a Boolean");
- }
- }
}
Modified: trunk/src/main/org/jboss/messaging/core/filter/impl/FilterImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/filter/impl/FilterImpl.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/src/main/org/jboss/messaging/core/filter/impl/FilterImpl.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -18,7 +18,7 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.messaging.core.filter.impl;
@@ -65,143 +65,143 @@
public class FilterImpl implements Filter
{
- // Constants -----------------------------------------------------
+ // Constants -----------------------------------------------------
- private static final Logger log = Logger.getLogger(FilterImpl.class);
-
- private static final SimpleString JBM_EXPIRATION = new SimpleString("JBMExpiration");
+ private static final Logger log = Logger.getLogger(FilterImpl.class);
- private static final SimpleString JBM_DURABLE = new SimpleString("JBMDurable");
+ private static final SimpleString JBM_EXPIRATION = new SimpleString("JBMExpiration");
- private static final SimpleString NON_DURABLE = new SimpleString("NON_DURABLE");
+ private static final SimpleString JBM_DURABLE = new SimpleString("JBMDurable");
- private static final SimpleString DURABLE = new SimpleString("DURABLE");
+ private static final SimpleString NON_DURABLE = new SimpleString("NON_DURABLE");
- private static final SimpleString JBM_TIMESTAMP = new SimpleString("JBMTimestamp");
+ private static final SimpleString DURABLE = new SimpleString("DURABLE");
- private static final SimpleString JBM_PRIORITY = new SimpleString("JBMPriority");
+ private static final SimpleString JBM_TIMESTAMP = new SimpleString("JBMTimestamp");
- private static final SimpleString JBM_MESSAGE_ID = new SimpleString("JBMMessageID");
-
- private static final SimpleString JBM_SIZE = new SimpleString("JBMSize");
+ private static final SimpleString JBM_PRIORITY = new SimpleString("JBMPriority");
- private static final SimpleString JBM_PREFIX = new SimpleString("JBM");
-
- // Attributes -----------------------------------------------------
-
- private final SimpleString sfilterString;
-
- private final Map<SimpleString, Identifier> identifiers = new HashMap<SimpleString, Identifier>();
-
- private final Operator operator;
-
- private final FilterParser parser = new FilterParser();
-
- // Static ---------------------------------------------------------
+ private static final SimpleString JBM_MESSAGE_ID = new SimpleString("JBMMessageID");
- /**
- * @return null if <code>filterStr</code> is null or a valid filter else
- * @throws MessagingException if the string does not correspond to a valid filter
- */
- public static Filter createFilter(final String filterStr) throws MessagingException
- {
- Filter filter = (filterStr == null) ? null : new FilterImpl(new SimpleString(filterStr));
- return filter;
- }
+ private static final SimpleString JBM_SIZE = new SimpleString("JBMSize");
- // Constructors ---------------------------------------------------
-
- public FilterImpl(final SimpleString str) throws MessagingException
- {
- this.sfilterString = str;
+ private static final SimpleString JBM_PREFIX = new SimpleString("JBM");
- try
- {
- operator = (Operator)parser.parse(sfilterString, identifiers);
- }
- catch (Throwable e)
- {
- throw new MessagingException(MessagingException.INVALID_FILTER_EXPRESSION, "Invalid filter: " + sfilterString);
- }
- }
-
- // Filter implementation ---------------------------------------------------------------------
-
- public SimpleString getFilterString()
- {
- return sfilterString;
- }
-
- public boolean match(final ServerMessage message)
- {
- try
- {
- // Set the identifiers values
-
- for (Identifier id : identifiers.values())
- {
- Object val = null;
-
- if (id.getName().startsWith(JBM_PREFIX))
- {
- //Look it up as header fields
- val = getHeaderFieldValue(message, id.getName());
- }
-
- if (val == null)
- {
- val = message.getProperty(id.getName());
- }
+ // Attributes -----------------------------------------------------
- id.setValue(val);
+ private final SimpleString sfilterString;
- }
-
- // Compute the result of this operator
-
- boolean res = (Boolean)operator.apply();
-
- return res;
- }
- catch (Exception e)
- {
- log.warn("Invalid filter string: " + sfilterString, e);
-
- return false;
- }
- }
-
- // Private --------------------------------------------------------------------------
-
- private Object getHeaderFieldValue(final ServerMessage msg, final SimpleString fieldName)
- {
- if (JBM_MESSAGE_ID.equals(fieldName))
- {
- return msg.getMessageID();
- }
- else if (JBM_PRIORITY.equals(fieldName))
- {
- return new Integer(msg.getPriority());
- }
- else if (JBM_TIMESTAMP.equals(fieldName))
- {
- return msg.getTimestamp();
- }
- else if (JBM_DURABLE.equals(fieldName))
- {
- return msg.isDurable() ? DURABLE : NON_DURABLE;
- }
- else if (JBM_EXPIRATION.equals(fieldName))
- {
- return msg.getExpiration();
- }
- else if (JBM_SIZE.equals(fieldName))
- {
- return msg.getEncodeSize();
- }
- else
- {
- return null;
- }
- }
+ private final Map<SimpleString, Identifier> identifiers = new HashMap<SimpleString, Identifier>();
+
+ private final Operator operator;
+
+ private final FilterParser parser = new FilterParser();
+
+ // Static ---------------------------------------------------------
+
+ /**
+ * @return null if <code>filterStr</code> is null or a valid filter else
+ * @throws MessagingException if the string does not correspond to a valid filter
+ */
+ public static Filter createFilter(final String filterStr) throws MessagingException
+ {
+ Filter filter = filterStr == null ? null : new FilterImpl(new SimpleString(filterStr));
+ return filter;
+ }
+
+ // Constructors ---------------------------------------------------
+
+ public FilterImpl(final SimpleString str) throws MessagingException
+ {
+ sfilterString = str;
+
+ try
+ {
+ operator = (Operator)parser.parse(sfilterString, identifiers);
+ }
+ catch (Throwable e)
+ {
+ throw new MessagingException(MessagingException.INVALID_FILTER_EXPRESSION, "Invalid filter: " + sfilterString);
+ }
+ }
+
+ // Filter implementation ---------------------------------------------------------------------
+
+ public SimpleString getFilterString()
+ {
+ return sfilterString;
+ }
+
+ public boolean match(final ServerMessage message)
+ {
+ try
+ {
+ // Set the identifiers values
+
+ for (Identifier id : identifiers.values())
+ {
+ Object val = null;
+
+ if (id.getName().startsWith(JBM_PREFIX))
+ {
+ // Look it up as header fields
+ val = getHeaderFieldValue(message, id.getName());
+ }
+
+ if (val == null)
+ {
+ val = message.getProperty(id.getName());
+ }
+
+ id.setValue(val);
+
+ }
+
+ // Compute the result of this operator
+
+ boolean res = (Boolean)operator.apply();
+
+ return res;
+ }
+ catch (Exception e)
+ {
+ log.warn("Invalid filter string: " + sfilterString, e);
+
+ return false;
+ }
+ }
+
+ // Private --------------------------------------------------------------------------
+
+ private Object getHeaderFieldValue(final ServerMessage msg, final SimpleString fieldName)
+ {
+ if (JBM_MESSAGE_ID.equals(fieldName))
+ {
+ return msg.getMessageID();
+ }
+ else if (JBM_PRIORITY.equals(fieldName))
+ {
+ return new Integer(msg.getPriority());
+ }
+ else if (JBM_TIMESTAMP.equals(fieldName))
+ {
+ return msg.getTimestamp();
+ }
+ else if (JBM_DURABLE.equals(fieldName))
+ {
+ return msg.isDurable() ? DURABLE : NON_DURABLE;
+ }
+ else if (JBM_EXPIRATION.equals(fieldName))
+ {
+ return msg.getExpiration();
+ }
+ else if (JBM_SIZE.equals(fieldName))
+ {
+ return msg.getEncodeSize();
+ }
+ else
+ {
+ return null;
+ }
+ }
}
Modified: trunk/src/main/org/jboss/messaging/core/filter/impl/Identifier.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/filter/impl/Identifier.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/src/main/org/jboss/messaging/core/filter/impl/Identifier.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -18,7 +18,7 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.messaging.core.filter.impl;
@@ -37,38 +37,41 @@
public class Identifier
{
private final SimpleString name;
-
+
private Object value;
-
+
private final int hash;
-
+
public Identifier(final SimpleString name)
{
this.name = name;
-
+
hash = name.hashCode();
-
+
value = null;
}
-
+
+ @Override
public String toString()
{
return "Identifier@" + name;
}
-
- public boolean equals(Object obj)
+
+ @Override
+ public boolean equals(final Object obj)
{
- if ( obj.getClass() != Identifier.class )
+ if (obj.getClass() != Identifier.class)
{
return false;
}
- if ( obj.hashCode() != hash )
+ if (obj.hashCode() != hash)
{
return false;
}
- return ( ( Identifier )obj ).name.equals( name );
+ return ((Identifier)obj).name.equals(name);
}
-
+
+ @Override
public int hashCode()
{
return hash;
@@ -78,12 +81,12 @@
{
return name;
}
-
+
public Object getValue()
{
return value;
}
-
+
public void setValue(final Object value)
{
this.value = value;
Modified: trunk/src/main/org/jboss/messaging/core/filter/impl/Operator.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/filter/impl/Operator.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/src/main/org/jboss/messaging/core/filter/impl/Operator.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -18,7 +18,7 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.messaging.core.filter.impl;
@@ -38,1078 +38,1372 @@
*/
public class Operator
{
- int operation;
- Object oper1;
- Object oper2;
- Object oper3;
+ int operation;
- Object arg1;
- Object arg2;
- Object arg3;
+ Object oper1;
- int class1;
- int class2;
- int class3;
-
- // info about the regular expression
- // if this is a LIKE operator
- // (perhaps this should be a subclass)
- RegExp re = null;
+ Object oper2;
- public final static int EQUAL = 0;
- public final static int NOT = 1;
- public final static int AND = 2;
- public final static int OR = 3;
- public final static int GT = 4;
- public final static int GE = 5;
- public final static int LT = 6;
- public final static int LE = 7;
- public final static int DIFFERENT = 8;
- public final static int ADD = 9;
- public final static int SUB = 10;
- public final static int NEG = 11;
- public final static int MUL = 12;
- public final static int DIV = 13;
- public final static int BETWEEN = 14;
- public final static int NOT_BETWEEN = 15;
- public final static int LIKE = 16;
- public final static int NOT_LIKE = 17;
- public final static int LIKE_ESCAPE = 18;
- public final static int NOT_LIKE_ESCAPE = 19;
- public final static int IS_NULL = 20;
- public final static int IS_NOT_NULL = 21;
- public final static int IN = 22;
- public final static int NOT_IN = 23;
+ Object oper3;
- public final static int DOUBLE = 1;
- //DOUBLE FLOAT
- public final static int LONG = 2;
- //LONG BYTE SHORT INTEGER
- public final static int BOOLEAN = 3;
- public final static int SIMPLE_STRING = 4;
+ Object arg1;
- public Operator(int operation, Object oper1, Object oper2, Object oper3)
- {
- this.operation = operation;
- this.oper1 = oper1;
- this.oper2 = oper2;
- this.oper3 = oper3;
- }
+ Object arg2;
- public Operator(int operation, Object oper1, Object oper2)
- {
- this.operation = operation;
- this.oper1 = oper1;
- this.oper2 = oper2;
- this.oper3 = null;
- }
+ Object arg3;
- public Operator(int operation, Object oper1)
- {
- this.operation = operation;
- this.oper1 = oper1;
- this.oper2 = null;
- this.oper3 = null;
- }
+ int class1;
- //--- Print functions ---
+ int class2;
- public String toString()
- {
- return print("");
- }
+ int class3;
- public String print(String level)
- {
- String st = level + operation + ":" + operationString(operation) + "(\n";
+ // info about the regular expression
+ // if this is a LIKE operator
+ // (perhaps this should be a subclass)
+ RegExp re = null;
- String nextLevel = level + " ";
+ public final static int EQUAL = 0;
- if (oper1 == null)
- st += nextLevel + "null\n";
- else if (oper1 instanceof Operator)
- st += ((Operator) oper1).print( nextLevel );
- else
- st += nextLevel + oper1.toString() + "\n";
+ public final static int NOT = 1;
- if (oper2 != null)
- {
- if (oper2 instanceof Operator)
- st += ((Operator) oper2).print(nextLevel);
- else
- st += nextLevel + oper2.toString() + "\n";
- }
+ public final static int AND = 2;
- if (oper3 != null)
- {
- if (oper3 instanceof Operator)
- st += ((Operator) oper3).print(nextLevel);
- else
- st += nextLevel + oper3.toString() + "\n";
- }
+ public final static int OR = 3;
- st += level + ")\n";
+ public final static int GT = 4;
- return st;
- }
+ public final static int GE = 5;
+ public final static int LT = 6;
- //Operator 20
- Object is_null() throws Exception
- {
- computeArgument1();
- if (arg1 == null)
- return Boolean.TRUE;
- else
- return Boolean.FALSE;
- }
+ public final static int LE = 7;
- //Operator 21
- Object is_not_null() throws Exception
- {
- computeArgument1();
- if (arg1 != null)
- return Boolean.TRUE;
- else
- return Boolean.FALSE;
- }
+ public final static int DIFFERENT = 8;
- //Operation 0
- Object equal() throws Exception
- {
- computeArgument1();
- if (arg1 == null)
- return Boolean.FALSE;
+ public final static int ADD = 9;
- switch (class1)
- {
- case LONG:
- computeArgument1();
- if (arg1 == null)
- return null;
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 == LONG)
- return Boolean.valueOf(((Number) arg1).longValue() == ((Number) arg2).longValue());
- if (class2 == DOUBLE)
- return Boolean.valueOf(((Number) arg1).longValue() == ((Number) arg2).doubleValue());
- return Boolean.FALSE;
- case DOUBLE:
- computeArgument1();
- if (arg1 == null)
- return null;
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 == LONG)
- return Boolean.valueOf(((Number) arg1).doubleValue() == ((Number) arg2).longValue());
- if (class2 == DOUBLE)
- return Boolean.valueOf(((Number) arg1).doubleValue() == ((Number) arg2).doubleValue());
- return Boolean.FALSE;
- case SIMPLE_STRING:
- case BOOLEAN:
- computeArgument2();
- if (arg2 == null)
- return Boolean.FALSE;
- if (class2 != class1)
- throwBadObjectException(class1, class2);
- return Boolean.valueOf(arg1.equals(arg2));
- default:
- throwBadObjectException(class1);
- return null;
- }
+ public final static int SUB = 10;
- }
+ public final static int NEG = 11;
- //Operation 1
- Object not() throws Exception
- {
- computeArgument1();
- if (arg1 == null)
- return null;
- if (class1 != BOOLEAN)
- throwBadObjectException(class1);
- if (((Boolean)arg1).booleanValue())
- return Boolean.FALSE;
- else
- return Boolean.TRUE;
- }
+ public final static int MUL = 12;
- //Operation 2
- Object and() throws Exception
- {
- computeArgument1();
- if (arg1 == null)
- {
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 != BOOLEAN)
- throwBadObjectException(class2);
- if (((Boolean) arg2).booleanValue() == false )
- return Boolean.FALSE;
- return null;
- }
+ public final static int DIV = 13;
- if (class1 == BOOLEAN)
- {
- if (((Boolean) arg1).booleanValue() == false)
- return Boolean.FALSE;
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 != BOOLEAN)
- throwBadObjectException(class2);
- return arg2;
- }
+ public final static int BETWEEN = 14;
- throwBadObjectException(class1);
- return null;
- }
+ public final static int NOT_BETWEEN = 15;
- /**
- * Operation 3
- *
- * | OR | T | F | U
- * +------+-------+-------+--------
- * | T | T | T | T
- * | F | T | F | U
- * | U | T | U | U
- * +------+-------+-------+-------
- */
- Object or() throws Exception
- {
- short falseCounter=0;
-
- computeArgument1();
- if (arg1 != null)
- {
- if (class1 != BOOLEAN)
- throwBadObjectException(class1);
- if (((Boolean) arg1).booleanValue())
- return Boolean.TRUE;
- else
- falseCounter++;
- }
+ public final static int LIKE = 16;
- computeArgument2();
- if (arg2 != null)
- {
- if (class2 != BOOLEAN)
- throwBadObjectException(class2);
- if (((Boolean)arg2).booleanValue())
- return Boolean.TRUE;
- else
- falseCounter++;
- }
+ public final static int NOT_LIKE = 17;
- if (falseCounter == 2)
- return Boolean.FALSE;
-
- return null;
- }
+ public final static int LIKE_ESCAPE = 18;
- //Operation 4
- Object gt() throws Exception
- {
- computeArgument1();
- if (arg1 == null)
- return null;
+ public final static int NOT_LIKE_ESCAPE = 19;
- if (class1 == LONG)
- {
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 == LONG)
- return Boolean.valueOf(((Number) arg1).longValue() > ((Number) arg2).longValue());
- if (class2 == DOUBLE)
- return Boolean.valueOf(((Number) arg1).longValue() > ((Number) arg2).doubleValue());
- }
- else if ( class1 == DOUBLE )
- {
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 == LONG)
- return Boolean.valueOf(((Number) arg1).doubleValue() > ((Number) arg2).longValue());
- if (class2 == DOUBLE)
- return Boolean.valueOf(((Number) arg1).doubleValue() > ((Number) arg2).doubleValue());
- return Boolean.FALSE;
- }
- return Boolean.FALSE;
- }
+ public final static int IS_NULL = 20;
- //Operation 5
- Object ge() throws Exception
- {
- computeArgument1();
- if (arg1 == null)
- return null;
+ public final static int IS_NOT_NULL = 21;
- if (class1 == LONG)
- {
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 == LONG)
- return Boolean.valueOf(((Number) arg1).longValue() >= ((Number) arg2).longValue());
- if (class2 == DOUBLE)
- return Boolean.valueOf(((Number) arg1).longValue() >= ((Number) arg2).doubleValue());
- }
- else if ( class1 == DOUBLE )
- {
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 == LONG)
- return Boolean.valueOf(((Number) arg1).longValue() >= ((Number) arg2).longValue());
- if (class2 == DOUBLE)
- return Boolean.valueOf(((Number) arg1).doubleValue() >= ((Number) arg2).doubleValue());
- return Boolean.FALSE;
- }
- return Boolean.FALSE;
- }
+ public final static int IN = 22;
- //Operation 6
- Object lt() throws Exception
- {
- computeArgument1();
- if (arg1 == null)
- return null;
+ public final static int NOT_IN = 23;
- if (class1 == LONG)
- {
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 == LONG)
- return Boolean.valueOf(((Number) arg1).longValue() < ((Number) arg2).longValue());
- if (class2 == DOUBLE)
- return Boolean.valueOf(((Number) arg1).longValue() < ((Number) arg2).doubleValue());
- }
- else if (class1 == DOUBLE)
- {
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 == LONG)
- return Boolean.valueOf(((Number) arg1).doubleValue() < ((Number) arg2).longValue());
- if (class2 == DOUBLE)
- return Boolean.valueOf(((Number) arg1).doubleValue() < ((Number) arg2).doubleValue());
- }
+ public final static int DOUBLE = 1;
- return Boolean.FALSE;
- }
+ // DOUBLE FLOAT
+ public final static int LONG = 2;
- //Operation 7
- Object le() throws Exception
- {
- computeArgument1();
- if (arg1 == null)
- return null;
+ // LONG BYTE SHORT INTEGER
+ public final static int BOOLEAN = 3;
- if (class1 == LONG)
- {
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 == LONG)
- return Boolean.valueOf(((Number) arg1).longValue() <= ((Number) arg2).longValue());
- if (class2 == DOUBLE)
- return Boolean.valueOf(((Number) arg1).longValue() <= ((Number) arg2).doubleValue());
- }
- else if (class1 == DOUBLE)
- {
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 == LONG)
- return Boolean.valueOf(((Number) arg1).doubleValue() <= ((Number) arg2).longValue());
- if (class2 == DOUBLE)
- return Boolean.valueOf(((Number) arg1).doubleValue() <= ((Number) arg2).doubleValue());
- }
- return Boolean.FALSE;
- }
+ public final static int SIMPLE_STRING = 4;
- //Operation 8
- Object different() throws Exception
- {
- computeArgument1();
- if ( arg1 == null)
- {
- computeArgument2();
- if (arg2 == null)
- {
- return Boolean.FALSE;
- } else
- {
- return Boolean.TRUE;
- }
- }
+ public Operator(final int operation, final Object oper1, final Object oper2, final Object oper3)
+ {
+ this.operation = operation;
+ this.oper1 = oper1;
+ this.oper2 = oper2;
+ this.oper3 = oper3;
+ }
- switch (class1)
- {
- case LONG:
- computeArgument1();
- if (arg1 == null)
- return null;
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 == LONG)
- return Boolean.valueOf(((Number) arg1).longValue() != ((Number) arg2).longValue());
- if (class2 == DOUBLE)
- return Boolean.valueOf(((Number) arg1).longValue() != ((Number) arg2).doubleValue());
- return Boolean.FALSE;
- case DOUBLE:
- computeArgument1();
- if (arg1 == null)
- return null;
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 == LONG)
- return Boolean.valueOf(((Number) arg1).doubleValue() != ((Number) arg2).longValue());
- if (class2 == DOUBLE)
- return Boolean.valueOf(((Number) arg1).doubleValue() != ((Number) arg2).doubleValue());
- return Boolean.FALSE;
- case SIMPLE_STRING:
- case BOOLEAN:
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 != class1)
- throwBadObjectException(class1, class2);
- return Boolean.valueOf(arg1.equals(arg2) == false);
- default:
- throwBadObjectException(class1);
- }
- return null;
- }
+ public Operator(final int operation, final Object oper1, final Object oper2)
+ {
+ this.operation = operation;
+ this.oper1 = oper1;
+ this.oper2 = oper2;
+ oper3 = null;
+ }
- //Operator 9
- Object add() throws Exception
- {
- computeArgument1();
- computeArgument2();
+ public Operator(final int operation, final Object oper1)
+ {
+ this.operation = operation;
+ this.oper1 = oper1;
+ oper2 = null;
+ oper3 = null;
+ }
- if (arg1 == null || arg2 == null)
- return null;
- switch (class1)
- {
- case DOUBLE:
- switch (class2)
- {
- case DOUBLE:
- return new Double(((Number) arg1).doubleValue() + ((Number) arg2).doubleValue());
- case LONG:
- return new Double(((Number) arg1).doubleValue() + ((Number) arg2).doubleValue());
- default:
- throwBadObjectException(class2);
- }
- case LONG:
- switch (class2)
- {
- case DOUBLE:
- return new Double(((Number) arg1).doubleValue() + ((Number) arg2).doubleValue());
- case LONG:
- return new Long(((Number) arg1).longValue() + ((Number) arg2).longValue());
- default:
- throwBadObjectException(class2);
- }
- default:
- throwBadObjectException(class1);
- }
- return null;
- }
+ // --- Print functions ---
- //Operator 10
- Object sub() throws Exception
- {
- computeArgument1();
- computeArgument2();
+ @Override
+ public String toString()
+ {
+ return print("");
+ }
- if (arg1 == null || arg2 == null)
- return null;
- switch (class1)
- {
- case DOUBLE:
- switch (class2)
- {
- case DOUBLE:
- return new Double(((Number) arg1).doubleValue() - ((Number) arg2).doubleValue());
- case LONG:
- return new Double(((Number) arg1).doubleValue() - ((Number) arg2).doubleValue());
- default:
- throwBadObjectException(class2);
- }
- case LONG:
- switch (class2)
- {
- case DOUBLE:
- return new Double(((Number) arg1).doubleValue() - ((Number) arg2).doubleValue());
- case LONG:
- return new Long(((Number) arg1).longValue() - ((Number) arg2).longValue());
- default:
- throwBadObjectException(class2);
- }
- default:
- throwBadObjectException(class1);
- }
- return null;
- }
+ public String print(final String level)
+ {
+ String st = level + operation + ":" + operationString(operation) + "(\n";
- //Operator 11
- Object neg() throws Exception
- {
- computeArgument1();
- if (arg1 == null)
- return null;
- switch (class1)
- {
- case DOUBLE:
- return new Double(-((Number) arg1).doubleValue());
- case LONG:
- return new Long(-((Number)arg1).longValue());
- default:
- throwBadObjectException(class1);
- }
- return null;
- }
+ String nextLevel = level + " ";
- //Operator 12
- Object mul() throws Exception
- {
- computeArgument1();
- computeArgument2();
- if (arg1 == null || arg2 == null)
- return null;
- switch (class1)
- {
- case DOUBLE:
- switch (class2)
- {
- case DOUBLE:
- return new Double(((Number) arg1).doubleValue() * ((Number) arg2).doubleValue());
- case LONG:
- return new Double(((Number) arg1).doubleValue() * ((Number) arg2).doubleValue());
- default:
- throwBadObjectException(class2);
- }
- case LONG:
- switch (class2)
- {
- case DOUBLE:
- return new Double(((Number) arg1).doubleValue() * ((Number) arg2).doubleValue());
- case LONG:
- return new Long(((Number) arg1).longValue() * ((Number) arg2).longValue());
- default:
- throwBadObjectException(class2);
- }
- default:
- throwBadObjectException(class1);
- }
- return null;
- }
+ if (oper1 == null)
+ {
+ st += nextLevel + "null\n";
+ }
+ else if (oper1 instanceof Operator)
+ {
+ st += ((Operator)oper1).print(nextLevel);
+ }
+ else
+ {
+ st += nextLevel + oper1.toString() + "\n";
+ }
- //Operator 13
- Object div() throws Exception
- {
- //Can throw Divide by zero exception...
- computeArgument1();
- computeArgument2();
- if (arg1 == null || arg2 == null)
- return null;
- switch (class1)
- {
- case DOUBLE:
- switch (class2)
- {
- case DOUBLE:
- return new Double(((Number) arg1).doubleValue() / ((Number) arg2).doubleValue());
- case LONG:
- return new Double(((Number) arg1).doubleValue() / ((Number) arg2).doubleValue());
- default:
- throwBadObjectException(class2);
- }
- case LONG:
- switch (class2)
- {
- case DOUBLE:
- return new Double(((Number) arg1).doubleValue() / ((Number) arg2).doubleValue());
- case LONG:
- return new Long(((Number) arg1).longValue() / ((Number) arg2).longValue());
- default:
- throwBadObjectException(class2);
- }
- default:
- throwBadObjectException(class1);
- }
- return null;
- }
+ if (oper2 != null)
+ {
+ if (oper2 instanceof Operator)
+ {
+ st += ((Operator)oper2).print(nextLevel);
+ }
+ else
+ {
+ st += nextLevel + oper2.toString() + "\n";
+ }
+ }
- //Operator 14
- Object between() throws Exception
- {
- Object res = ge();
- if (res == null)
- return null;
- if (((Boolean) res).booleanValue() == false)
- return res;
+ if (oper3 != null)
+ {
+ if (oper3 instanceof Operator)
+ {
+ st += ((Operator)oper3).print(nextLevel);
+ }
+ else
+ {
+ st += nextLevel + oper3.toString() + "\n";
+ }
+ }
- Object oper4 = oper2;
- oper2 = oper3;
- res = le();
- oper2 = oper4;
- return res;
- }
+ st += level + ")\n";
- //Operator 15
- Object not_between() throws Exception
- {
- Object res = lt();
- if (res == null)
- return null;
- if (((Boolean) res).booleanValue())
- return res;
+ return st;
+ }
- Object oper4 = oper2;
- oper2 = oper3;
- res = gt();
- oper2 = oper4;
- return res;
- }
+ // Operator 20
+ Object is_null() throws Exception
+ {
+ computeArgument1();
+ if (arg1 == null)
+ {
+ return Boolean.TRUE;
+ }
+ else
+ {
+ return Boolean.FALSE;
+ }
+ }
- //Operation 16,17,18,19
- /**
- * Handle LIKE, NOT LIKE, LIKE ESCAPE, and NOT LIKE ESCAPE operators.
- *
- * @param not true if this is a NOT LIKE construct, false if this
- * is a LIKE construct.
- * @param use_escape true if this is a LIKE ESCAPE construct, false if
- * there is no ESCAPE clause
- * @return Description of the Returned Value
- * @exception Exception Description of Exception
- */
- Object like(boolean not, boolean use_escape) throws Exception
- {
- Character escapeChar = null;
+ // Operator 21
+ Object is_not_null() throws Exception
+ {
+ computeArgument1();
+ if (arg1 != null)
+ {
+ return Boolean.TRUE;
+ }
+ else
+ {
+ return Boolean.FALSE;
+ }
+ }
- computeArgument1();
- if (arg1 == null)
- return null;
- if (class1 != SIMPLE_STRING)
- throwBadObjectException(class1);
+ // Operation 0
+ Object equal() throws Exception
+ {
+ computeArgument1();
+ if (arg1 == null)
+ {
+ return Boolean.FALSE;
+ }
- computeArgument2();
- if (arg2 == null)
- return null;
- if (class2 != SIMPLE_STRING)
- throwBadObjectException(class2);
+ switch (class1)
+ {
+ case LONG:
+ computeArgument1();
+ if (arg1 == null)
+ {
+ return null;
+ }
+ computeArgument2();
+ if (arg2 == null)
+ {
+ return null;
+ }
+ if (class2 == LONG)
+ {
+ return Boolean.valueOf(((Number)arg1).longValue() == ((Number)arg2).longValue());
+ }
+ if (class2 == DOUBLE)
+ {
+ return Boolean.valueOf(((Number)arg1).longValue() == ((Number)arg2).doubleValue());
+ }
+ return Boolean.FALSE;
+ case DOUBLE:
+ computeArgument1();
+ if (arg1 == null)
+ {
+ return null;
+ }
+ computeArgument2();
+ if (arg2 == null)
+ {
+ return null;
+ }
+ if (class2 == LONG)
+ {
+ return Boolean.valueOf(((Number)arg1).doubleValue() == ((Number)arg2).longValue());
+ }
+ if (class2 == DOUBLE)
+ {
+ return Boolean.valueOf(((Number)arg1).doubleValue() == ((Number)arg2).doubleValue());
+ }
+ return Boolean.FALSE;
+ case SIMPLE_STRING:
+ case BOOLEAN:
+ computeArgument2();
+ if (arg2 == null)
+ {
+ return Boolean.FALSE;
+ }
+ if (class2 != class1)
+ {
+ throwBadObjectException(class1, class2);
+ }
+ return Boolean.valueOf(arg1.equals(arg2));
+ default:
+ throwBadObjectException(class1);
+ return null;
+ }
- if (use_escape)
- {
- computeArgument3();
- if (arg3 == null)
- return null;
+ }
- if (class3 != SIMPLE_STRING)
- throwBadObjectException(class3);
+ // Operation 1
+ Object not() throws Exception
+ {
+ computeArgument1();
+ if (arg1 == null)
+ {
+ return null;
+ }
+ if (class1 != BOOLEAN)
+ {
+ throwBadObjectException(class1);
+ }
+ if (((Boolean)arg1).booleanValue())
+ {
+ return Boolean.FALSE;
+ }
+ else
+ {
+ return Boolean.TRUE;
+ }
+ }
- SimpleString escapeString = (SimpleString) arg3;
- if (escapeString.length() != 1)
- throw new Exception("LIKE ESCAPE: Bad escape character " + escapeString.toString());
+ // Operation 2
+ Object and() throws Exception
+ {
+ computeArgument1();
+ if (arg1 == null)
+ {
+ computeArgument2();
+ if (arg2 == null)
+ {
+ return null;
+ }
+ if (class2 != BOOLEAN)
+ {
+ throwBadObjectException(class2);
+ }
+ if (((Boolean)arg2).booleanValue() == false)
+ {
+ return Boolean.FALSE;
+ }
+ return null;
+ }
- escapeChar = new Character(escapeString.charAt(0));
- }
+ if (class1 == BOOLEAN)
+ {
+ if (((Boolean)arg1).booleanValue() == false)
+ {
+ return Boolean.FALSE;
+ }
+ computeArgument2();
+ if (arg2 == null)
+ {
+ return null;
+ }
+ if (class2 != BOOLEAN)
+ {
+ throwBadObjectException(class2);
+ }
+ return arg2;
+ }
- if (re == null)
- // the first time through we prepare the regular expression
- re = new RegExp (arg2.toString(), escapeChar);
-
- boolean result = re.isMatch (arg1);
- if (not)
- result = !result;
-
- if (result == true)
- return Boolean.TRUE;
- else
- return Boolean.FALSE;
- }
+ throwBadObjectException(class1);
+ return null;
+ }
- //Operator 22
- Object in() throws Exception
- {
- computeArgument1();
- if (arg1 == null)
- return null;
- if (class1 != SIMPLE_STRING)
- throwBadObjectException(class1);
- if (((HashSet) oper2).contains(arg1))
- return Boolean.TRUE;
- else
- return Boolean.FALSE;
- }
+ /**
+ * Operation 3
+ *
+ * | OR | T | F | U
+ * +------+-------+-------+--------
+ * | T | T | T | T
+ * | F | T | F | U
+ * | U | T | U | U
+ * +------+-------+-------+-------
+ */
+ Object or() throws Exception
+ {
+ short falseCounter = 0;
- //Operator 23
- Object not_in() throws Exception
- {
- computeArgument1();
- if (arg1 == null)
- return null;
- if (class1 != SIMPLE_STRING)
- throwBadObjectException(class1);
- if (((HashSet) oper2).contains(arg1))
- return Boolean.FALSE;
- else
- return Boolean.TRUE;
- }
+ computeArgument1();
+ if (arg1 != null)
+ {
+ if (class1 != BOOLEAN)
+ {
+ throwBadObjectException(class1);
+ }
+ if (((Boolean)arg1).booleanValue())
+ {
+ return Boolean.TRUE;
+ }
+ else
+ {
+ falseCounter++;
+ }
+ }
+ computeArgument2();
+ if (arg2 != null)
+ {
+ if (class2 != BOOLEAN)
+ {
+ throwBadObjectException(class2);
+ }
+ if (((Boolean)arg2).booleanValue())
+ {
+ return Boolean.TRUE;
+ }
+ else
+ {
+ falseCounter++;
+ }
+ }
- void computeArgument1() throws Exception
- {
- if (oper1 == null)
- {
- class1 = 0;
- return;
- }
- Class className = oper1.getClass();
+ if (falseCounter == 2)
+ {
+ return Boolean.FALSE;
+ }
- if (className == Identifier.class)
- arg1 = ((Identifier) oper1).getValue();
- else if (className == Operator.class)
- arg1 = ((Operator) oper1).apply();
- else
- arg1 = oper1;
+ return null;
+ }
- if (arg1 == null)
- {
- class1 = 0;
- return;
- }
+ // Operation 4
+ Object gt() throws Exception
+ {
+ computeArgument1();
+ if (arg1 == null)
+ {
+ return null;
+ }
- className = arg1.getClass();
+ if (class1 == LONG)
+ {
+ computeArgument2();
+ if (arg2 == null)
+ {
+ return null;
+ }
+ if (class2 == LONG)
+ {
+ return Boolean.valueOf(((Number)arg1).longValue() > ((Number)arg2).longValue());
+ }
+ if (class2 == DOUBLE)
+ {
+ return Boolean.valueOf(((Number)arg1).longValue() > ((Number)arg2).doubleValue());
+ }
+ }
+ else if (class1 == DOUBLE)
+ {
+ computeArgument2();
+ if (arg2 == null)
+ {
+ return null;
+ }
+ if (class2 == LONG)
+ {
+ return Boolean.valueOf(((Number)arg1).doubleValue() > ((Number)arg2).longValue());
+ }
+ if (class2 == DOUBLE)
+ {
+ return Boolean.valueOf(((Number)arg1).doubleValue() > ((Number)arg2).doubleValue());
+ }
+ return Boolean.FALSE;
+ }
+ return Boolean.FALSE;
+ }
- if (className == SimpleString.class)
- class1 = SIMPLE_STRING;
- else if (className == Double.class)
- class1 = DOUBLE;
- else if (className == Long.class)
- class1 = LONG;
- else if (className == Integer.class)
- {
- class1 = LONG;
- arg1 = new Long(((Integer) arg1).longValue());
- }
- else if (className == Short.class)
- {
- class1 = LONG;
- arg1 = new Long(((Short) arg1).longValue());
- }
- else if (className == Byte.class)
- {
- class1 = LONG;
- arg1 = new Long(((Byte) arg1).longValue());
- }
- else if (className == Float.class)
- {
- class1 = DOUBLE;
- arg1 = new Double(((Float) arg1).doubleValue());
- }
- else if (className == Boolean.class)
- class1 = BOOLEAN;
- else
- throwBadObjectException(className);
- }
+ // Operation 5
+ Object ge() throws Exception
+ {
+ computeArgument1();
+ if (arg1 == null)
+ {
+ return null;
+ }
- void computeArgument2() throws Exception
- {
- if (oper2 == null)
- {
- class2 = 0;
- return;
- }
+ if (class1 == LONG)
+ {
+ computeArgument2();
+ if (arg2 == null)
+ {
+ return null;
+ }
+ if (class2 == LONG)
+ {
+ return Boolean.valueOf(((Number)arg1).longValue() >= ((Number)arg2).longValue());
+ }
+ if (class2 == DOUBLE)
+ {
+ return Boolean.valueOf(((Number)arg1).longValue() >= ((Number)arg2).doubleValue());
+ }
+ }
+ else if (class1 == DOUBLE)
+ {
+ computeArgument2();
+ if (arg2 == null)
+ {
+ return null;
+ }
+ if (class2 == LONG)
+ {
+ return Boolean.valueOf(((Number)arg1).longValue() >= ((Number)arg2).longValue());
+ }
+ if (class2 == DOUBLE)
+ {
+ return Boolean.valueOf(((Number)arg1).doubleValue() >= ((Number)arg2).doubleValue());
+ }
+ return Boolean.FALSE;
+ }
+ return Boolean.FALSE;
+ }
- Class className = oper2.getClass();
+ // Operation 6
+ Object lt() throws Exception
+ {
+ computeArgument1();
+ if (arg1 == null)
+ {
+ return null;
+ }
- if (className == Identifier.class)
- arg2 = ((Identifier) oper2).getValue();
- else if (className == Operator.class)
- arg2 = ((Operator) oper2).apply();
- else
- arg2 = oper2;
+ if (class1 == LONG)
+ {
+ computeArgument2();
+ if (arg2 == null)
+ {
+ return null;
+ }
+ if (class2 == LONG)
+ {
+ return Boolean.valueOf(((Number)arg1).longValue() < ((Number)arg2).longValue());
+ }
+ if (class2 == DOUBLE)
+ {
+ return Boolean.valueOf(((Number)arg1).longValue() < ((Number)arg2).doubleValue());
+ }
+ }
+ else if (class1 == DOUBLE)
+ {
+ computeArgument2();
+ if (arg2 == null)
+ {
+ return null;
+ }
+ if (class2 == LONG)
+ {
+ return Boolean.valueOf(((Number)arg1).doubleValue() < ((Number)arg2).longValue());
+ }
+ if (class2 == DOUBLE)
+ {
+ return Boolean.valueOf(((Number)arg1).doubleValue() < ((Number)arg2).doubleValue());
+ }
+ }
- if (arg2 == null)
- {
- class2 = 0;
- return;
- }
+ return Boolean.FALSE;
+ }
- className = arg2.getClass();
+ // Operation 7
+ Object le() throws Exception
+ {
+ computeArgument1();
+ if (arg1 == null)
+ {
+ return null;
+ }
- if (className == SimpleString.class)
- class2 = SIMPLE_STRING;
- else if (className == Double.class)
- class2 = DOUBLE;
- else if (className == Long.class)
- class2 = LONG;
- else if (className == Integer.class)
- {
- class2 = LONG;
- arg2 = new Long(((Integer) arg2).longValue());
- }
- else if (className == Short.class)
- {
- class2 = LONG;
- arg2 = new Long(((Short) arg2).longValue());
- }
- else if (className == Byte.class)
- {
- class2 = LONG;
- arg2 = new Long(((Byte) arg2).longValue());
- }
- else if (className == Float.class)
- {
- class2 = DOUBLE;
- arg2 = new Double(((Float) arg2).doubleValue());
- }
- else if (className == Boolean.class)
- class2 = BOOLEAN;
- else
- throwBadObjectException(className);
- }
+ if (class1 == LONG)
+ {
+ computeArgument2();
+ if (arg2 == null)
+ {
+ return null;
+ }
+ if (class2 == LONG)
+ {
+ return Boolean.valueOf(((Number)arg1).longValue() <= ((Number)arg2).longValue());
+ }
+ if (class2 == DOUBLE)
+ {
+ return Boolean.valueOf(((Number)arg1).longValue() <= ((Number)arg2).doubleValue());
+ }
+ }
+ else if (class1 == DOUBLE)
+ {
+ computeArgument2();
+ if (arg2 == null)
+ {
+ return null;
+ }
+ if (class2 == LONG)
+ {
+ return Boolean.valueOf(((Number)arg1).doubleValue() <= ((Number)arg2).longValue());
+ }
+ if (class2 == DOUBLE)
+ {
+ return Boolean.valueOf(((Number)arg1).doubleValue() <= ((Number)arg2).doubleValue());
+ }
+ }
+ return Boolean.FALSE;
+ }
- void computeArgument3() throws Exception
- {
- if (oper3 == null)
- {
- class3 = 0;
- return;
- }
+ // Operation 8
+ Object different() throws Exception
+ {
+ computeArgument1();
+ if (arg1 == null)
+ {
+ computeArgument2();
+ if (arg2 == null)
+ {
+ return Boolean.FALSE;
+ }
+ else
+ {
+ return Boolean.TRUE;
+ }
+ }
- Class className = oper3.getClass();
+ switch (class1)
+ {
+ case LONG:
+ computeArgument1();
+ if (arg1 == null)
+ {
+ return null;
+ }
+ computeArgument2();
+ if (arg2 == null)
+ {
+ return null;
+ }
+ if (class2 == LONG)
+ {
+ return Boolean.valueOf(((Number)arg1).longValue() != ((Number)arg2).longValue());
+ }
+ if (class2 == DOUBLE)
+ {
+ return Boolean.valueOf(((Number)arg1).longValue() != ((Number)arg2).doubleValue());
+ }
+ return Boolean.FALSE;
+ case DOUBLE:
+ computeArgument1();
+ if (arg1 == null)
+ {
+ return null;
+ }
+ computeArgument2();
+ if (arg2 == null)
+ {
+ return null;
+ }
+ if (class2 == LONG)
+ {
+ return Boolean.valueOf(((Number)arg1).doubleValue() != ((Number)arg2).longValue());
+ }
+ if (class2 == DOUBLE)
+ {
+ return Boolean.valueOf(((Number)arg1).doubleValue() != ((Number)arg2).doubleValue());
+ }
+ return Boolean.FALSE;
+ case SIMPLE_STRING:
+ case BOOLEAN:
+ computeArgument2();
+ if (arg2 == null)
+ {
+ return null;
+ }
+ if (class2 != class1)
+ {
+ throwBadObjectException(class1, class2);
+ }
+ return Boolean.valueOf(arg1.equals(arg2) == false);
+ default:
+ throwBadObjectException(class1);
+ }
+ return null;
+ }
- if (className == Identifier.class)
- arg3 = ((Identifier) oper3).getValue();
- else if (className == Operator.class)
- arg3 = ((Operator ) oper3).apply();
- else
- arg3 = oper3;
+ // Operator 9
+ Object add() throws Exception
+ {
+ computeArgument1();
+ computeArgument2();
- if (arg3 == null)
- {
- class3 = 0;
- return;
- }
+ if (arg1 == null || arg2 == null)
+ {
+ return null;
+ }
+ switch (class1)
+ {
+ case DOUBLE:
+ switch (class2)
+ {
+ case DOUBLE:
+ return new Double(((Number)arg1).doubleValue() + ((Number)arg2).doubleValue());
+ case LONG:
+ return new Double(((Number)arg1).doubleValue() + ((Number)arg2).doubleValue());
+ default:
+ throwBadObjectException(class2);
+ }
+ case LONG:
+ switch (class2)
+ {
+ case DOUBLE:
+ return new Double(((Number)arg1).doubleValue() + ((Number)arg2).doubleValue());
+ case LONG:
+ return new Long(((Number)arg1).longValue() + ((Number)arg2).longValue());
+ default:
+ throwBadObjectException(class2);
+ }
+ default:
+ throwBadObjectException(class1);
+ }
+ return null;
+ }
- className = arg3.getClass();
+ // Operator 10
+ Object sub() throws Exception
+ {
+ computeArgument1();
+ computeArgument2();
- if (className == SimpleString.class)
- class3 = SIMPLE_STRING;
- else if (className == Double.class)
- class3 = DOUBLE;
- else if (className == Long.class)
- class3 = LONG;
- else if (className == Integer.class)
- {
- class3 = LONG;
- arg3 = new Long(((Integer) arg3).longValue());
- }
- else if (className == Short.class)
- {
- class3 = LONG;
- arg3 = new Long(((Short) arg3).longValue());
- }
- else if (className == Byte.class)
- {
- class3 = LONG;
- arg3 = new Long(((Byte) arg3).longValue());
- }
- else if (className == Float.class)
- {
- class3 = DOUBLE;
- arg3 = new Double(((Float) arg3).doubleValue());
- }
- else if (className == Boolean.class)
- class3 = BOOLEAN;
- else
- throwBadObjectException(className);
- }
+ if (arg1 == null || arg2 == null)
+ {
+ return null;
+ }
+ switch (class1)
+ {
+ case DOUBLE:
+ switch (class2)
+ {
+ case DOUBLE:
+ return new Double(((Number)arg1).doubleValue() - ((Number)arg2).doubleValue());
+ case LONG:
+ return new Double(((Number)arg1).doubleValue() - ((Number)arg2).doubleValue());
+ default:
+ throwBadObjectException(class2);
+ }
+ case LONG:
+ switch (class2)
+ {
+ case DOUBLE:
+ return new Double(((Number)arg1).doubleValue() - ((Number)arg2).doubleValue());
+ case LONG:
+ return new Long(((Number)arg1).longValue() - ((Number)arg2).longValue());
+ default:
+ throwBadObjectException(class2);
+ }
+ default:
+ throwBadObjectException(class1);
+ }
+ return null;
+ }
- public Object apply() throws Exception
- {
- switch (operation)
- {
- case EQUAL:
- return equal();
- case NOT:
- return not();
- case AND:
- return and();
- case OR:
- return or();
- case GT:
- return gt();
- case GE:
- return ge();
- case LT:
- return lt();
- case LE:
- return le();
- case DIFFERENT:
- return different();
- case ADD:
- return add();
- case SUB:
- return sub();
- case NEG:
- return neg();
- case MUL:
- return mul();
- case DIV:
- return div();
- case BETWEEN:
- return between();
- case NOT_BETWEEN:
- return not_between();
- case LIKE:
- return like(false, false);
- case NOT_LIKE:
- return like(true, false);
- case LIKE_ESCAPE:
- return like(false, true);
- case NOT_LIKE_ESCAPE:
- return like(true, true);
- case IS_NULL:
- return is_null();
- case IS_NOT_NULL:
- return is_not_null();
- case IN:
- return in();
- case NOT_IN:
- return not_in();
- }
+ // Operator 11
+ Object neg() throws Exception
+ {
+ computeArgument1();
+ if (arg1 == null)
+ {
+ return null;
+ }
+ switch (class1)
+ {
+ case DOUBLE:
+ return new Double(-((Number)arg1).doubleValue());
+ case LONG:
+ return new Long(-((Number)arg1).longValue());
+ default:
+ throwBadObjectException(class1);
+ }
+ return null;
+ }
- throw new Exception("Unknown operation: " + toString());
- }
+ // Operator 12
+ Object mul() throws Exception
+ {
+ computeArgument1();
+ computeArgument2();
+ if (arg1 == null || arg2 == null)
+ {
+ return null;
+ }
+ switch (class1)
+ {
+ case DOUBLE:
+ switch (class2)
+ {
+ case DOUBLE:
+ return new Double(((Number)arg1).doubleValue() * ((Number)arg2).doubleValue());
+ case LONG:
+ return new Double(((Number)arg1).doubleValue() * ((Number)arg2).doubleValue());
+ default:
+ throwBadObjectException(class2);
+ }
+ case LONG:
+ switch (class2)
+ {
+ case DOUBLE:
+ return new Double(((Number)arg1).doubleValue() * ((Number)arg2).doubleValue());
+ case LONG:
+ return new Long(((Number)arg1).longValue() * ((Number)arg2).longValue());
+ default:
+ throwBadObjectException(class2);
+ }
+ default:
+ throwBadObjectException(class1);
+ }
+ return null;
+ }
- public void throwBadObjectException(Class class1) throws Exception
- {
- throw new Exception("Bad Object: '" + class1.getName() + "' for operation: " + toString());
- }
+ // Operator 13
+ Object div() throws Exception
+ {
+ // Can throw Divide by zero exception...
+ computeArgument1();
+ computeArgument2();
+ if (arg1 == null || arg2 == null)
+ {
+ return null;
+ }
+ switch (class1)
+ {
+ case DOUBLE:
+ switch (class2)
+ {
+ case DOUBLE:
+ return new Double(((Number)arg1).doubleValue() / ((Number)arg2).doubleValue());
+ case LONG:
+ return new Double(((Number)arg1).doubleValue() / ((Number)arg2).doubleValue());
+ default:
+ throwBadObjectException(class2);
+ }
+ case LONG:
+ switch (class2)
+ {
+ case DOUBLE:
+ return new Double(((Number)arg1).doubleValue() / ((Number)arg2).doubleValue());
+ case LONG:
+ return new Long(((Number)arg1).longValue() / ((Number)arg2).longValue());
+ default:
+ throwBadObjectException(class2);
+ }
+ default:
+ throwBadObjectException(class1);
+ }
+ return null;
+ }
- public void throwBadObjectException(int class1) throws Exception
- {
- throw new Exception("Bad Object: '" + getClassName(class1) + "' for operation: " + toString());
- }
+ // Operator 14
+ Object between() throws Exception
+ {
+ Object res = ge();
+ if (res == null)
+ {
+ return null;
+ }
+ if (((Boolean)res).booleanValue() == false)
+ {
+ return res;
+ }
- public void throwBadObjectException(int class1, int class2) throws Exception
- {
- throw new Exception("Bad Object: expected '" + getClassName(class1) + "' got '" + getClassName(class2) + "' for operation: " + toString());
- }
+ Object oper4 = oper2;
+ oper2 = oper3;
+ res = le();
+ oper2 = oper4;
+ return res;
+ }
- static String getClassName(int class1)
- {
- String str = "Unknown";
- switch (class1)
- {
- case SIMPLE_STRING:
- str = "SimpleString";
- break;
- case LONG:
- str = "Long";
- break;
- case DOUBLE:
- str = "Double";
- break;
- case BOOLEAN:
- str = "Boolean";
- break;
- }
- return str;
- }
+ // Operator 15
+ Object not_between() throws Exception
+ {
+ Object res = lt();
+ if (res == null)
+ {
+ return null;
+ }
+ if (((Boolean)res).booleanValue())
+ {
+ return res;
+ }
- static String operationString(int operation)
- {
- String str = "Unknown";
- switch( operation )
- {
- case EQUAL:
- str = "EQUAL";
- break;
- case NOT:
- str = "NOT";
- break;
- case AND:
- str = "AND";
- break;
- case OR:
- str = "OR";
- break;
- case GT:
- str = "GT";
- break;
- case GE:
- str = "GE";
- break;
- case LT:
- str = "LT";
- break;
- case LE:
- str = "LE";
- break;
- case DIFFERENT:
- str = "DIFFERENT";
- break;
- case ADD:
- str = "ADD";
- break;
- case SUB:
- str = "SUB";
- break;
- case NEG:
- str = "NEG";
- break;
- case MUL:
- str = "MUL";
- break;
- case DIV:
- str = "DIV";
- break;
- case BETWEEN:
- str = "BETWEEN";
- break;
- case NOT_BETWEEN:
- str = "NOT_BETWEEN";
- break;
- case LIKE:
- str = "LIKE";
- break;
- case NOT_LIKE:
- str = "NOT_LIKE";
- break;
- case LIKE_ESCAPE:
- str = "LIKE_ESCAPE";
- break;
- case NOT_LIKE_ESCAPE:
- str = "NOT_LIKE_ESCAPE";
- break;
- case IS_NULL:
- str = "IS_NULL";
- break;
- case IS_NOT_NULL:
- str = "IS_NOT_NULL";
- break;
- case IN:
- str = "IN";
- break;
- case NOT_IN:
- str = "NOT_IN";
- break;
- }
- return str;
- }
+ Object oper4 = oper2;
+ oper2 = oper3;
+ res = gt();
+ oper2 = oper4;
+ return res;
+ }
+
+ // Operation 16,17,18,19
+ /**
+ * Handle LIKE, NOT LIKE, LIKE ESCAPE, and NOT LIKE ESCAPE operators.
+ *
+ * @param not true if this is a NOT LIKE construct, false if this
+ * is a LIKE construct.
+ * @param use_escape true if this is a LIKE ESCAPE construct, false if
+ * there is no ESCAPE clause
+ * @return Description of the Returned Value
+ * @exception Exception Description of Exception
+ */
+ Object like(final boolean not, final boolean use_escape) throws Exception
+ {
+ Character escapeChar = null;
+
+ computeArgument1();
+ if (arg1 == null)
+ {
+ return null;
+ }
+ if (class1 != SIMPLE_STRING)
+ {
+ throwBadObjectException(class1);
+ }
+
+ computeArgument2();
+ if (arg2 == null)
+ {
+ return null;
+ }
+ if (class2 != SIMPLE_STRING)
+ {
+ throwBadObjectException(class2);
+ }
+
+ if (use_escape)
+ {
+ computeArgument3();
+ if (arg3 == null)
+ {
+ return null;
+ }
+
+ if (class3 != SIMPLE_STRING)
+ {
+ throwBadObjectException(class3);
+ }
+
+ SimpleString escapeString = (SimpleString)arg3;
+ if (escapeString.length() != 1)
+ {
+ throw new Exception("LIKE ESCAPE: Bad escape character " + escapeString.toString());
+ }
+
+ escapeChar = new Character(escapeString.charAt(0));
+ }
+
+ if (re == null)
+ {
+ // the first time through we prepare the regular expression
+ re = new RegExp(arg2.toString(), escapeChar);
+ }
+
+ boolean result = re.isMatch(arg1);
+ if (not)
+ {
+ result = !result;
+ }
+
+ if (result == true)
+ {
+ return Boolean.TRUE;
+ }
+ else
+ {
+ return Boolean.FALSE;
+ }
+ }
+
+ // Operator 22
+ Object in() throws Exception
+ {
+ computeArgument1();
+ if (arg1 == null)
+ {
+ return null;
+ }
+ if (class1 != SIMPLE_STRING)
+ {
+ throwBadObjectException(class1);
+ }
+ if (((HashSet)oper2).contains(arg1))
+ {
+ return Boolean.TRUE;
+ }
+ else
+ {
+ return Boolean.FALSE;
+ }
+ }
+
+ // Operator 23
+ Object not_in() throws Exception
+ {
+ computeArgument1();
+ if (arg1 == null)
+ {
+ return null;
+ }
+ if (class1 != SIMPLE_STRING)
+ {
+ throwBadObjectException(class1);
+ }
+ if (((HashSet)oper2).contains(arg1))
+ {
+ return Boolean.FALSE;
+ }
+ else
+ {
+ return Boolean.TRUE;
+ }
+ }
+
+ void computeArgument1() throws Exception
+ {
+ if (oper1 == null)
+ {
+ class1 = 0;
+ return;
+ }
+ Class className = oper1.getClass();
+
+ if (className == Identifier.class)
+ {
+ arg1 = ((Identifier)oper1).getValue();
+ }
+ else if (className == Operator.class)
+ {
+ arg1 = ((Operator)oper1).apply();
+ }
+ else
+ {
+ arg1 = oper1;
+ }
+
+ if (arg1 == null)
+ {
+ class1 = 0;
+ return;
+ }
+
+ className = arg1.getClass();
+
+ if (className == SimpleString.class)
+ {
+ class1 = SIMPLE_STRING;
+ }
+ else if (className == Double.class)
+ {
+ class1 = DOUBLE;
+ }
+ else if (className == Long.class)
+ {
+ class1 = LONG;
+ }
+ else if (className == Integer.class)
+ {
+ class1 = LONG;
+ arg1 = new Long(((Integer)arg1).longValue());
+ }
+ else if (className == Short.class)
+ {
+ class1 = LONG;
+ arg1 = new Long(((Short)arg1).longValue());
+ }
+ else if (className == Byte.class)
+ {
+ class1 = LONG;
+ arg1 = new Long(((Byte)arg1).longValue());
+ }
+ else if (className == Float.class)
+ {
+ class1 = DOUBLE;
+ arg1 = new Double(((Float)arg1).doubleValue());
+ }
+ else if (className == Boolean.class)
+ {
+ class1 = BOOLEAN;
+ }
+ else
+ {
+ throwBadObjectException(className);
+ }
+ }
+
+ void computeArgument2() throws Exception
+ {
+ if (oper2 == null)
+ {
+ class2 = 0;
+ return;
+ }
+
+ Class className = oper2.getClass();
+
+ if (className == Identifier.class)
+ {
+ arg2 = ((Identifier)oper2).getValue();
+ }
+ else if (className == Operator.class)
+ {
+ arg2 = ((Operator)oper2).apply();
+ }
+ else
+ {
+ arg2 = oper2;
+ }
+
+ if (arg2 == null)
+ {
+ class2 = 0;
+ return;
+ }
+
+ className = arg2.getClass();
+
+ if (className == SimpleString.class)
+ {
+ class2 = SIMPLE_STRING;
+ }
+ else if (className == Double.class)
+ {
+ class2 = DOUBLE;
+ }
+ else if (className == Long.class)
+ {
+ class2 = LONG;
+ }
+ else if (className == Integer.class)
+ {
+ class2 = LONG;
+ arg2 = new Long(((Integer)arg2).longValue());
+ }
+ else if (className == Short.class)
+ {
+ class2 = LONG;
+ arg2 = new Long(((Short)arg2).longValue());
+ }
+ else if (className == Byte.class)
+ {
+ class2 = LONG;
+ arg2 = new Long(((Byte)arg2).longValue());
+ }
+ else if (className == Float.class)
+ {
+ class2 = DOUBLE;
+ arg2 = new Double(((Float)arg2).doubleValue());
+ }
+ else if (className == Boolean.class)
+ {
+ class2 = BOOLEAN;
+ }
+ else
+ {
+ throwBadObjectException(className);
+ }
+ }
+
+ void computeArgument3() throws Exception
+ {
+ if (oper3 == null)
+ {
+ class3 = 0;
+ return;
+ }
+
+ Class className = oper3.getClass();
+
+ if (className == Identifier.class)
+ {
+ arg3 = ((Identifier)oper3).getValue();
+ }
+ else if (className == Operator.class)
+ {
+ arg3 = ((Operator)oper3).apply();
+ }
+ else
+ {
+ arg3 = oper3;
+ }
+
+ if (arg3 == null)
+ {
+ class3 = 0;
+ return;
+ }
+
+ className = arg3.getClass();
+
+ if (className == SimpleString.class)
+ {
+ class3 = SIMPLE_STRING;
+ }
+ else if (className == Double.class)
+ {
+ class3 = DOUBLE;
+ }
+ else if (className == Long.class)
+ {
+ class3 = LONG;
+ }
+ else if (className == Integer.class)
+ {
+ class3 = LONG;
+ arg3 = new Long(((Integer)arg3).longValue());
+ }
+ else if (className == Short.class)
+ {
+ class3 = LONG;
+ arg3 = new Long(((Short)arg3).longValue());
+ }
+ else if (className == Byte.class)
+ {
+ class3 = LONG;
+ arg3 = new Long(((Byte)arg3).longValue());
+ }
+ else if (className == Float.class)
+ {
+ class3 = DOUBLE;
+ arg3 = new Double(((Float)arg3).doubleValue());
+ }
+ else if (className == Boolean.class)
+ {
+ class3 = BOOLEAN;
+ }
+ else
+ {
+ throwBadObjectException(className);
+ }
+ }
+
+ public Object apply() throws Exception
+ {
+ switch (operation)
+ {
+ case EQUAL:
+ return equal();
+ case NOT:
+ return not();
+ case AND:
+ return and();
+ case OR:
+ return or();
+ case GT:
+ return gt();
+ case GE:
+ return ge();
+ case LT:
+ return lt();
+ case LE:
+ return le();
+ case DIFFERENT:
+ return different();
+ case ADD:
+ return add();
+ case SUB:
+ return sub();
+ case NEG:
+ return neg();
+ case MUL:
+ return mul();
+ case DIV:
+ return div();
+ case BETWEEN:
+ return between();
+ case NOT_BETWEEN:
+ return not_between();
+ case LIKE:
+ return like(false, false);
+ case NOT_LIKE:
+ return like(true, false);
+ case LIKE_ESCAPE:
+ return like(false, true);
+ case NOT_LIKE_ESCAPE:
+ return like(true, true);
+ case IS_NULL:
+ return is_null();
+ case IS_NOT_NULL:
+ return is_not_null();
+ case IN:
+ return in();
+ case NOT_IN:
+ return not_in();
+ }
+
+ throw new Exception("Unknown operation: " + toString());
+ }
+
+ public void throwBadObjectException(final Class class1) throws Exception
+ {
+ throw new Exception("Bad Object: '" + class1.getName() + "' for operation: " + toString());
+ }
+
+ public void throwBadObjectException(final int class1) throws Exception
+ {
+ throw new Exception("Bad Object: '" + getClassName(class1) + "' for operation: " + toString());
+ }
+
+ public void throwBadObjectException(final int class1, final int class2) throws Exception
+ {
+ throw new Exception("Bad Object: expected '" + getClassName(class1) +
+ "' got '" +
+ getClassName(class2) +
+ "' for operation: " +
+ toString());
+ }
+
+ static String getClassName(final int class1)
+ {
+ String str = "Unknown";
+ switch (class1)
+ {
+ case SIMPLE_STRING:
+ str = "SimpleString";
+ break;
+ case LONG:
+ str = "Long";
+ break;
+ case DOUBLE:
+ str = "Double";
+ break;
+ case BOOLEAN:
+ str = "Boolean";
+ break;
+ }
+ return str;
+ }
+
+ static String operationString(final int operation)
+ {
+ String str = "Unknown";
+ switch (operation)
+ {
+ case EQUAL:
+ str = "EQUAL";
+ break;
+ case NOT:
+ str = "NOT";
+ break;
+ case AND:
+ str = "AND";
+ break;
+ case OR:
+ str = "OR";
+ break;
+ case GT:
+ str = "GT";
+ break;
+ case GE:
+ str = "GE";
+ break;
+ case LT:
+ str = "LT";
+ break;
+ case LE:
+ str = "LE";
+ break;
+ case DIFFERENT:
+ str = "DIFFERENT";
+ break;
+ case ADD:
+ str = "ADD";
+ break;
+ case SUB:
+ str = "SUB";
+ break;
+ case NEG:
+ str = "NEG";
+ break;
+ case MUL:
+ str = "MUL";
+ break;
+ case DIV:
+ str = "DIV";
+ break;
+ case BETWEEN:
+ str = "BETWEEN";
+ break;
+ case NOT_BETWEEN:
+ str = "NOT_BETWEEN";
+ break;
+ case LIKE:
+ str = "LIKE";
+ break;
+ case NOT_LIKE:
+ str = "NOT_LIKE";
+ break;
+ case LIKE_ESCAPE:
+ str = "LIKE_ESCAPE";
+ break;
+ case NOT_LIKE_ESCAPE:
+ str = "NOT_LIKE_ESCAPE";
+ break;
+ case IS_NULL:
+ str = "IS_NULL";
+ break;
+ case IS_NOT_NULL:
+ str = "IS_NOT_NULL";
+ break;
+ case IN:
+ str = "IN";
+ break;
+ case NOT_IN:
+ str = "NOT_IN";
+ break;
+ }
+ return str;
+ }
}
-
Modified: trunk/src/main/org/jboss/messaging/core/filter/impl/RegExp.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/filter/impl/RegExp.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/src/main/org/jboss/messaging/core/filter/impl/RegExp.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -18,7 +18,7 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.messaging.core.filter.impl;
@@ -37,111 +37,110 @@
*
* $Id: RegExp.java 2681 2007-05-15 00:09:10Z timfox $
*/
-public class RegExp
+public class RegExp
{
private final Pattern re;
-
- public RegExp(final String pattern, final Character escapeChar)
- throws Exception
+
+ public RegExp(final String pattern, final Character escapeChar) throws Exception
{
String pat = adjustPattern(pattern, escapeChar);
-
+
re = Pattern.compile(pat);
}
-
- public boolean isMatch(final Object target)
+
+ public boolean isMatch(final Object target)
{
String str = target != null ? target.toString() : "";
-
+
return re.matcher(str).matches();
}
-
- protected String adjustPattern(final String pattern, final Character escapeChar)
- throws Exception
+
+ protected String adjustPattern(final String pattern, final Character escapeChar) throws Exception
{
int patternLen = pattern.length();
-
+
StringBuffer REpattern = new StringBuffer(patternLen + 10);
-
- boolean useEscape = (escapeChar != null);
-
+
+ boolean useEscape = escapeChar != null;
+
char escape = Character.UNASSIGNED;
-
+
if (useEscape)
{
escape = escapeChar.charValue();
}
-
- REpattern.append ('^');
+ REpattern.append('^');
+
for (int i = 0; i < patternLen; i++)
{
boolean escaped = false;
-
- char c = pattern.charAt( i );
+ char c = pattern.charAt(i);
+
if (useEscape && escape == c)
{
i++;
-
- if ( i < patternLen )
+
+ if (i < patternLen)
{
escaped = true;
- c = pattern.charAt( i );
+ c = pattern.charAt(i);
}
else
{
- throw new Exception( "LIKE ESCAPE: Bad use of escape character" );
+ throw new Exception("LIKE ESCAPE: Bad use of escape character");
}
}
// Match characters, or escape ones special to the underlying
// regex engine
- switch ( c )
+ switch (c)
{
- case '_':
- if ( escaped )
- {
- REpattern.append( c );
- } else
- {
- REpattern.append( '.' );
- }
- break;
- case '%':
- if ( escaped )
- {
- REpattern.append( c );
- } else
- {
- REpattern.append( ".*" );
- }
- break;
- case '*':
- case '.':
- case '\\':
- case '^':
- case '$':
- case '[':
- case ']':
- case '(':
- case ')':
- case '+':
- case '?':
- case '{':
- case '}':
- case '|':
- REpattern.append( "\\");
- REpattern.append ( c );
- break;
- default:
- REpattern.append( c );
- break;
+ case '_':
+ if (escaped)
+ {
+ REpattern.append(c);
+ }
+ else
+ {
+ REpattern.append('.');
+ }
+ break;
+ case '%':
+ if (escaped)
+ {
+ REpattern.append(c);
+ }
+ else
+ {
+ REpattern.append(".*");
+ }
+ break;
+ case '*':
+ case '.':
+ case '\\':
+ case '^':
+ case '$':
+ case '[':
+ case ']':
+ case '(':
+ case ')':
+ case '+':
+ case '?':
+ case '{':
+ case '}':
+ case '|':
+ REpattern.append("\\");
+ REpattern.append(c);
+ break;
+ default:
+ REpattern.append(c);
+ break;
}
}
- REpattern.append( '$' );
+ REpattern.append('$');
return REpattern.toString();
}
}
-
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -1005,13 +1005,11 @@
}
public Packet sendBlocking(final Packet packet) throws MessagingException
- {
- // log.info("sending blocking channel id" + id + " packet id " + packet.getType() + " on connection " +
+ {
// System.identityHashCode(this.connection) + " " + packet.getType());
if (closed)
- {
- // log.info("channel is closed");
+ {
throw new MessagingException(MessagingException.NOT_CONNECTED, "Connection is destroyed");
}
@@ -1044,7 +1042,7 @@
}
lock.lock();
-
+
try
{
while (failingOver)
@@ -1209,8 +1207,7 @@
}
public void close()
- {
- // log.info("channel " + id + " is being closed on connection " + System.identityHashCode(connection));
+ {
if (closed)
{
return;
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnector.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnector.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnector.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -42,6 +42,9 @@
public class InVMConnector implements Connector
{
public static final Logger log = Logger.getLogger(InVMConnector.class);
+
+ //Used for testing failure only
+ public static volatile boolean failOnCreateConnection;
private final int id;
@@ -94,6 +97,12 @@
public Connection createConnection()
{
+ if (failOnCreateConnection)
+ {
+ //For testing only
+ return null;
+ }
+
Connection conn = internalCreateConnection(acceptor.getHandler(), new Listener());
acceptor.connect((String)conn.getID(), handler, this);
@@ -131,9 +140,7 @@
{
return new InVMConnection(handler, listener);
}
-
-
-
+
private class Listener implements ConnectionLifeCycleListener
{
public void connectionCreated(final Connection connection)
Modified: trunk/src/main/org/jboss/messaging/core/remoting/spi/Connector.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/spi/Connector.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/src/main/org/jboss/messaging/core/remoting/spi/Connector.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -34,5 +34,13 @@
void close();
+ /**
+ * Create and return a connection from this connector.
+ *
+ * This method must NOT throw an exception if it fails to create the connection
+ * (e.g. network is not available), in this case it MUST return null
+ *
+ * @return The connection, or null if unable to create a connection (e.g. network is unavailable)
+ */
Connection createConnection();
}
Modified: trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -67,30 +67,33 @@
// Attributes ----------------------------------------------------
private ExecutorService bossExecutor;
+
private ExecutorService workerExecutor;
- private ChannelFactory channelFactory;
+
+ private ChannelFactory channelFactory;
+
private ClientBootstrap bootstrap;
private final BufferHandler handler;
private final ConnectionLifeCycleListener listener;
-
+
private final boolean sslEnabled;
-
- private final boolean useNio;
-
+
+ private final boolean useNio;
+
private final String host;
private final int port;
-
+
private final String keyStorePath;
-
+
private final String keyStorePassword;
-
+
private final boolean tcpNoDelay;
-
+
private final int tcpSendBufferSize;
-
+
private final int tcpReceiveBufferSize;
// Static --------------------------------------------------------
@@ -99,7 +102,7 @@
// Public --------------------------------------------------------
- public NettyConnector(final Map<String, Object> configuration,
+ public NettyConnector(final Map<String, Object> configuration,
final BufferHandler handler,
final ConnectionLifeCycleListener listener)
{
@@ -107,44 +110,53 @@
{
throw new IllegalArgumentException("Invalid argument null listener");
}
-
+
if (handler == null)
{
throw new IllegalArgumentException("Invalid argument null handler");
}
this.listener = listener;
-
+
this.handler = handler;
-
- this.sslEnabled =
- ConfigurationHelper.getBooleanProperty(TransportConstants.SSL_ENABLED_PROP_NAME, TransportConstants.DEFAULT_SSL_ENABLED, configuration);
- this.useNio =
- ConfigurationHelper.getBooleanProperty(TransportConstants.USE_NIO_PROP_NAME, TransportConstants.DEFAULT_USE_NIO, configuration);
- this.host =
- ConfigurationHelper.getStringProperty(TransportConstants.HOST_PROP_NAME, TransportConstants.DEFAULT_HOST, configuration);
- this.port =
- ConfigurationHelper.getIntProperty(TransportConstants.PORT_PROP_NAME, TransportConstants.DEFAULT_PORT, configuration);
+
+ this.sslEnabled = ConfigurationHelper.getBooleanProperty(TransportConstants.SSL_ENABLED_PROP_NAME,
+ TransportConstants.DEFAULT_SSL_ENABLED,
+ configuration);
+ this.useNio = ConfigurationHelper.getBooleanProperty(TransportConstants.USE_NIO_PROP_NAME,
+ TransportConstants.DEFAULT_USE_NIO,
+ configuration);
+ this.host = ConfigurationHelper.getStringProperty(TransportConstants.HOST_PROP_NAME,
+ TransportConstants.DEFAULT_HOST,
+ configuration);
+ this.port = ConfigurationHelper.getIntProperty(TransportConstants.PORT_PROP_NAME,
+ TransportConstants.DEFAULT_PORT,
+ configuration);
if (sslEnabled)
{
- this.keyStorePath =
- ConfigurationHelper.getStringProperty(TransportConstants.KEYSTORE_PATH_PROP_NAME, TransportConstants.DEFAULT_KEYSTORE_PATH, configuration);
- this.keyStorePassword =
- ConfigurationHelper.getStringProperty(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME, TransportConstants.DEFAULT_KEYSTORE_PASSWORD, configuration);
- }
+ this.keyStorePath = ConfigurationHelper.getStringProperty(TransportConstants.KEYSTORE_PATH_PROP_NAME,
+ TransportConstants.DEFAULT_KEYSTORE_PATH,
+ configuration);
+ this.keyStorePassword = ConfigurationHelper.getStringProperty(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME,
+ TransportConstants.DEFAULT_KEYSTORE_PASSWORD,
+ configuration);
+ }
else
{
this.keyStorePath = null;
this.keyStorePassword = null;
}
-
- this.tcpNoDelay =
- ConfigurationHelper.getBooleanProperty(TransportConstants.TCP_NODELAY_PROPNAME, TransportConstants.DEFAULT_TCP_NODELAY, configuration);
- this.tcpSendBufferSize =
- ConfigurationHelper.getIntProperty(TransportConstants.TCP_SENDBUFFER_SIZE_PROPNAME, TransportConstants.DEFAULT_TCP_SENDBUFFER_SIZE, configuration);
- this.tcpReceiveBufferSize =
- ConfigurationHelper.getIntProperty(TransportConstants.TCP_RECEIVEBUFFER_SIZE_PROPNAME, TransportConstants.DEFAULT_TCP_RECEIVEBUFFER_SIZE, configuration);
+ this.tcpNoDelay = ConfigurationHelper.getBooleanProperty(TransportConstants.TCP_NODELAY_PROPNAME,
+ TransportConstants.DEFAULT_TCP_NODELAY,
+ configuration);
+ this.tcpSendBufferSize = ConfigurationHelper.getIntProperty(TransportConstants.TCP_SENDBUFFER_SIZE_PROPNAME,
+ TransportConstants.DEFAULT_TCP_SENDBUFFER_SIZE,
+ configuration);
+ this.tcpReceiveBufferSize = ConfigurationHelper.getIntProperty(TransportConstants.TCP_RECEIVEBUFFER_SIZE_PROPNAME,
+ TransportConstants.DEFAULT_TCP_RECEIVEBUFFER_SIZE,
+ configuration);
+
}
public synchronized void start()
@@ -157,7 +169,7 @@
workerExecutor = Executors.newCachedThreadPool(new JBMThreadFactory("jbm-netty-connector-worker-threads"));
if (useNio)
{
- bossExecutor = Executors.newCachedThreadPool(new JBMThreadFactory("jbm-netty-connector-boss-threads"));
+ bossExecutor = Executors.newCachedThreadPool(new JBMThreadFactory("jbm-netty-connector-boss-threads"));
channelFactory = new NioClientSocketChannelFactory(bossExecutor, workerExecutor);
}
else
@@ -188,8 +200,7 @@
catch (Exception e)
{
close();
- IllegalStateException ise = new IllegalStateException(
- "Unable to create NettyConnector for " + host);
+ IllegalStateException ise = new IllegalStateException("Unable to create NettyConnector for " + host);
ise.initCause(e);
throw ise;
}
@@ -199,7 +210,8 @@
context = null; // Unused
}
- bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
+ bootstrap.setPipelineFactory(new ChannelPipelineFactory()
+ {
public ChannelPipeline getPipeline() throws Exception
{
ChannelPipeline pipeline = pipeline();
@@ -213,7 +225,7 @@
}
});
}
-
+
public synchronized void close()
{
if (channelFactory == null)
@@ -225,7 +237,7 @@
channelFactory = null;
if (bossExecutor != null)
{
- bossExecutor.shutdown();
+ bossExecutor.shutdown();
}
workerExecutor.shutdown();
if (bossExecutor != null)
@@ -244,12 +256,13 @@
// Ignore
}
}
- }
+ }
}
public Connection createConnection()
{
- if (channelFactory == null) {
+ if (channelFactory == null)
+ {
return null;
}
@@ -267,9 +280,12 @@
{
ChannelFuture handshakeFuture = sslHandler.handshake(ch);
handshakeFuture.awaitUninterruptibly();
- if (handshakeFuture.isSuccess()) {
+ if (handshakeFuture.isSuccess())
+ {
ch.getPipeline().get(MessagingChannelHandler.class).active = true;
- } else {
+ }
+ else
+ {
ch.close().awaitUninterruptibly();
return null;
}
Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -112,7 +112,16 @@
private final int maxConnections;
private final boolean preAcknowledge;
+
+ private final boolean retryOnFailure;
+
+ private final long retryInterval;
+
+ private final double retryIntervalMultiplier; // For exponential backoff
+
+ private final int maxRetries;
+
// Constructors ---------------------------------------------------------------------------------
public JBossConnectionFactory(final String discoveryGroupAddress,
@@ -135,7 +144,11 @@
final boolean blockOnPersistentSend,
final boolean autoGroup,
final int maxConnections,
- final boolean preAcknowledge)
+ final boolean preAcknowledge,
+ final boolean retryOnFailure,
+ final long retryInterval,
+ final double retryIntervalMultiplier,
+ final int maxRetries)
{
this.connectorConfigs = null;
this.discoveryGroupAddress = discoveryGroupAddress;
@@ -159,6 +172,10 @@
this.autoGroup = autoGroup;
this.maxConnections = maxConnections;
this.preAcknowledge = preAcknowledge;
+ this.retryOnFailure = retryOnFailure;
+ this.retryInterval = retryInterval;
+ this.retryIntervalMultiplier = retryIntervalMultiplier;
+ this.maxRetries = maxRetries;
}
public JBossConnectionFactory(final String discoveryGroupAddress,
@@ -188,6 +205,10 @@
this.autoGroup = ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP;
this.maxConnections = ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS;
this.preAcknowledge = ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
+ this.retryOnFailure = ClientSessionFactoryImpl.DEFAULT_RETRY_ON_FAILURE;
+ this.retryInterval = ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
+ this.retryIntervalMultiplier = ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
+ this.maxRetries = ClientSessionFactoryImpl.DEFAULT_MAX_RETRIES;
}
public JBossConnectionFactory(final String discoveryGroupName, final int discoveryGroupPort)
@@ -215,7 +236,11 @@
final boolean blockOnPersistentSend,
final boolean autoGroup,
final int maxConnections,
- final boolean preAcknowledge)
+ final boolean preAcknowledge,
+ final boolean retryOnFailure,
+ final long retryInterval,
+ final double retryIntervalMultiplier,
+ final int maxRetries)
{
this.discoveryGroupAddress = null;
this.discoveryGroupPort = -1;
@@ -239,6 +264,10 @@
this.autoGroup = autoGroup;
this.maxConnections = maxConnections;
this.preAcknowledge = preAcknowledge;
+ this.retryOnFailure = retryOnFailure;
+ this.retryInterval = retryInterval;
+ this.retryIntervalMultiplier = retryIntervalMultiplier;
+ this.maxRetries = maxRetries;
}
public JBossConnectionFactory(final TransportConfiguration transportConfig,
@@ -259,7 +288,11 @@
final boolean blockOnPersistentSend,
final boolean autoGroup,
final int maxConnections,
- final boolean preAcknowledge)
+ final boolean preAcknowledge,
+ final boolean retryOnFailure,
+ final long retryInterval,
+ final double retryIntervalMultiplier,
+ final int maxRetries)
{
this.discoveryGroupAddress = null;
this.discoveryGroupPort = -1;
@@ -285,6 +318,10 @@
this.autoGroup = autoGroup;
this.maxConnections = maxConnections;
this.preAcknowledge = preAcknowledge;
+ this.retryOnFailure = retryOnFailure;
+ this.retryInterval = retryInterval;
+ this.retryIntervalMultiplier = retryIntervalMultiplier;
+ this.maxRetries = maxRetries;
}
@@ -312,6 +349,10 @@
this.autoGroup = ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP;
this.maxConnections = ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS;
this.preAcknowledge = ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
+ this.retryOnFailure = ClientSessionFactoryImpl.DEFAULT_RETRY_ON_FAILURE;
+ this.retryInterval = ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
+ this.retryIntervalMultiplier = ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
+ this.maxRetries = ClientSessionFactoryImpl.DEFAULT_MAX_RETRIES;
}
public JBossConnectionFactory(final TransportConfiguration connectorConfig)
@@ -342,6 +383,10 @@
this.autoGroup = ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP;
this.maxConnections = ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS;
this.preAcknowledge = ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
+ this.retryOnFailure = ClientSessionFactoryImpl.DEFAULT_RETRY_ON_FAILURE;
+ this.retryInterval = ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
+ this.retryIntervalMultiplier = ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
+ this.maxRetries = ClientSessionFactoryImpl.DEFAULT_MAX_RETRIES;
}
// ConnectionFactory implementation -------------------------------------------------------------
@@ -518,7 +563,11 @@
autoGroup,
maxConnections,
preAcknowledge,
- DEFAULT_ACK_BATCH_SIZE);
+ dupsOKBatchSize,
+ retryOnFailure,
+ retryInterval,
+ retryIntervalMultiplier,
+ maxRetries);
}
else
{
@@ -540,7 +589,11 @@
autoGroup,
maxConnections,
preAcknowledge,
- DEFAULT_ACK_BATCH_SIZE);
+ dupsOKBatchSize,
+ retryOnFailure,
+ retryInterval,
+ retryIntervalMultiplier,
+ maxRetries);
}
}
Modified: trunk/src/main/org/jboss/messaging/jms/server/JMSServerManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/JMSServerManager.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/src/main/org/jboss/messaging/jms/server/JMSServerManager.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -126,6 +126,10 @@
boolean autoGroup,
int maxConnections,
boolean preAcknowledge,
+ final boolean retryOnFailure,
+ final long retryInterval,
+ final double retryIntervalMultiplier,
+ final int maxRetries,
List<String> jndiBindings) throws Exception;
boolean createConnectionFactory(String name,
@@ -148,6 +152,10 @@
boolean autoGroup,
int maxConnections,
boolean preAcknowledge,
+ final boolean retryOnFailure,
+ final long retryInterval,
+ final double retryIntervalMultiplier,
+ final int maxRetries,
List<String> jndiBindings) throws Exception;
/**
Modified: trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -24,6 +24,7 @@
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.jms.server.JMSServerManager;
import org.jboss.messaging.util.Pair;
+import org.jboss.messaging.util.XMLUtil;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -71,6 +72,14 @@
private static final String PRE_ACKNOWLEDGE_ELEMENT = "pre-acknowledge";
+ private static final String RETRY_ON_FAILURE_ELEMENT = "retry-on-failure";
+
+ private static final String RETRY_INTERVAL = "retry-interval";
+
+ private static final String RETRY_INTERVAL_MULTIPLIER = "retry-interval-multiplier";
+
+ private static final String MAX_RETRIES = "max-retries";
+
private static final String CONNECTOR_LINK_ELEMENT = "connector-ref";
private static final String DISCOVERY_GROUP_ELEMENT = "discovery-group-ref";
@@ -82,9 +91,9 @@
private static final String QUEUE_NODE_NAME = "queue";
private static final String TOPIC_NODE_NAME = "topic";
-
+
private static final String CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME_ELEMENT = "connection-load-balancing-policy-class-name";
-
+
private static final String DISCOVERY_INITIAL_WAIT_ELEMENT = "discovery-initial-wait";
public JMSServerDeployer(final DeploymentManager deploymentManager, final Configuration config)
@@ -150,100 +159,120 @@
boolean autoGroup = ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP;
int maxConnections = ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS;
boolean preAcknowledge = ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
+ boolean retryOnFailure = ClientSessionFactoryImpl.DEFAULT_RETRY_ON_FAILURE;
+ long retryInterval = ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
+ double retryIntervalMultiplier = ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
+ int maxRetries = ClientSessionFactoryImpl.DEFAULT_MAX_RETRIES;
+
List<String> jndiBindings = new ArrayList<String>();
List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs = new ArrayList<Pair<TransportConfiguration, TransportConfiguration>>();
DiscoveryGroupConfiguration discoveryGroupConfiguration = null;
String connectionLoadBalancingPolicyClassName = ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME;
long discoveryInitialWait = ClientSessionFactoryImpl.DEFAULT_DISCOVERY_INITIAL_WAIT;
-
+
for (int j = 0; j < children.getLength(); j++)
{
Node child = children.item(j);
- String childText = child.getTextContent().trim();
-
- if (PING_PERIOD_ELEMENT.equalsIgnoreCase(child.getNodeName()))
+ if (PING_PERIOD_ELEMENT.equals(child.getNodeName()))
{
- pingPeriod = Long.parseLong(childText);
+ pingPeriod = XMLUtil.parseLong(child);
}
- else if (CALL_TIMEOUT_ELEMENT.equalsIgnoreCase(child.getNodeName()))
+ else if (CALL_TIMEOUT_ELEMENT.equals(child.getNodeName()))
{
- callTimeout = Long.parseLong(childText);
+ callTimeout = XMLUtil.parseLong(child);
}
- else if (CONSUMER_WINDOW_SIZE_ELEMENT.equalsIgnoreCase(child.getNodeName()))
+ else if (CONSUMER_WINDOW_SIZE_ELEMENT.equals(child.getNodeName()))
{
- consumerWindowSize = Integer.parseInt(childText);
+ consumerWindowSize = XMLUtil.parseInt(child);
}
- else if (CONSUMER_MAX_RATE_ELEMENT.equalsIgnoreCase(child.getNodeName()))
+ else if (CONSUMER_MAX_RATE_ELEMENT.equals(child.getNodeName()))
{
- consumerMaxRate = Integer.parseInt(childText);
+ consumerMaxRate = XMLUtil.parseInt(child);
}
- else if (SEND_WINDOW_SIZE.equalsIgnoreCase(child.getNodeName()))
+ else if (SEND_WINDOW_SIZE.equals(child.getNodeName()))
{
- sendWindowSize = Integer.parseInt(childText);
+ sendWindowSize = XMLUtil.parseInt(child);
}
- else if (PRODUCER_MAX_RATE_ELEMENT.equalsIgnoreCase(child.getNodeName()))
+ else if (PRODUCER_MAX_RATE_ELEMENT.equals(child.getNodeName()))
{
- producerMaxRate = Integer.parseInt(childText);
+ producerMaxRate = XMLUtil.parseInt(child);
}
- else if (BIG_MESSAGE_ELEMENT.equalsIgnoreCase(child.getNodeName()))
+ else if (BIG_MESSAGE_ELEMENT.equals(child.getNodeName()))
{
- minLargeMessageSize = Integer.parseInt(childText);
+ minLargeMessageSize = XMLUtil.parseInt(child);
}
- else if (CLIENTID_ELEMENT.equalsIgnoreCase(child.getNodeName()))
+ else if (CLIENTID_ELEMENT.equals(child.getNodeName()))
{
- clientID = childText;
+ clientID = child.getTextContent().trim();
}
- else if (DUPS_OK_BATCH_SIZE_ELEMENT.equalsIgnoreCase(child.getNodeName()))
+ else if (DUPS_OK_BATCH_SIZE_ELEMENT.equals(child.getNodeName()))
{
- dupsOKBatchSize = Integer.parseInt(childText);
+ dupsOKBatchSize = XMLUtil.parseInt(child);
}
- else if (TRANSACTION_BATCH_SIZE_ELEMENT.equalsIgnoreCase(child.getNodeName()))
+ else if (TRANSACTION_BATCH_SIZE_ELEMENT.equals(child.getNodeName()))
{
- transactionBatchSize = Integer.parseInt(childText);
+ transactionBatchSize = XMLUtil.parseInt(child);
}
- else if (BLOCK_ON_ACKNOWLEDGE_ELEMENT.equalsIgnoreCase(child.getNodeName()))
+ else if (BLOCK_ON_ACKNOWLEDGE_ELEMENT.equals(child.getNodeName()))
{
- blockOnAcknowledge = Boolean.parseBoolean(childText);
+ blockOnAcknowledge = XMLUtil.parseBoolean(child);
}
- else if (SEND_NP_MESSAGES_SYNCHRONOUSLY_ELEMENT.equalsIgnoreCase(child.getNodeName()))
+ else if (SEND_NP_MESSAGES_SYNCHRONOUSLY_ELEMENT.equals(child.getNodeName()))
{
- blockOnNonPersistentSend = Boolean.parseBoolean(childText);
+ blockOnNonPersistentSend = XMLUtil.parseBoolean(child);
}
- else if (SEND_P_MESSAGES_SYNCHRONOUSLY_ELEMENT.equalsIgnoreCase(child.getNodeName()))
+ else if (SEND_P_MESSAGES_SYNCHRONOUSLY_ELEMENT.equals(child.getNodeName()))
{
- blockOnPersistentSend = Boolean.parseBoolean(childText);
+ blockOnPersistentSend = XMLUtil.parseBoolean(child);
}
- else if (AUTO_GROUP_ID_ELEMENT.equalsIgnoreCase(child.getNodeName()))
+ else if (AUTO_GROUP_ID_ELEMENT.equals(child.getNodeName()))
{
- autoGroup = Boolean.parseBoolean(childText);
+ autoGroup = XMLUtil.parseBoolean(child);
}
- else if (MAX_CONNECTIONS_ELEMENT.equalsIgnoreCase(child.getNodeName()))
+ else if (MAX_CONNECTIONS_ELEMENT.equals(child.getNodeName()))
{
- maxConnections = Integer.parseInt(childText);
+ maxConnections = XMLUtil.parseInt(child);
}
- else if (PRE_ACKNOWLEDGE_ELEMENT.equalsIgnoreCase(child.getNodeName()))
+ else if (PRE_ACKNOWLEDGE_ELEMENT.equals(child.getNodeName()))
{
- preAcknowledge = Boolean.parseBoolean(childText);;
+ preAcknowledge = XMLUtil.parseBoolean(child);;
}
- else if (ENTRY_NODE_NAME.equalsIgnoreCase(child.getNodeName()))
+ else if (RETRY_ON_FAILURE_ELEMENT.equals(child.getNodeName()))
{
+ preAcknowledge = XMLUtil.parseBoolean(child);;
+ }
+ else if (RETRY_INTERVAL.equals(child.getNodeName()))
+ {
+ retryInterval = XMLUtil.parseInt(child);;
+ }
+ else if (RETRY_INTERVAL_MULTIPLIER.equals(child.getNodeName()))
+ {
+ retryIntervalMultiplier = XMLUtil.parseDouble(child);
+ }
+ else if (MAX_RETRIES.equals(child.getNodeName()))
+ {
+ maxRetries = XMLUtil.parseInt(child);;
+ }
+ else if (ENTRY_NODE_NAME.equals(child.getNodeName()))
+ {
String jndiName = child.getAttributes().getNamedItem("name").getNodeValue();
+
jndiBindings.add(jndiName);
}
- else if (CONNECTOR_LINK_ELEMENT.equalsIgnoreCase(child.getNodeName()))
+ else if (CONNECTOR_LINK_ELEMENT.equals(child.getNodeName()))
{
String connectorName = child.getAttributes().getNamedItem("connector-name").getNodeValue();
TransportConfiguration connector = configuration.getConnectorConfigurations().get(connectorName);
-
+
if (connector == null)
{
log.warn("There is no connector with name '" + connectorName + "' deployed.");
return;
}
-
+
TransportConfiguration backupConnector = null;
Node backupNode = child.getAttributes().getNamedItem("backup-connector-name");
@@ -251,42 +280,42 @@
if (backupNode != null)
{
String backupConnectorName = node.getNodeValue();
-
+
backupConnector = configuration.getConnectorConfigurations().get(backupConnectorName);
-
+
if (backupConnector == null)
{
log.warn("There is no backup connector with name '" + connectorName + "' deployed.");
return;
- }
+ }
}
-
+
connectorConfigs.add(new Pair<TransportConfiguration, TransportConfiguration>(connector, backupConnector));
}
- else if (DISCOVERY_GROUP_ELEMENT.equalsIgnoreCase(child.getNodeName()))
+ else if (DISCOVERY_GROUP_ELEMENT.equals(child.getNodeName()))
{
String discoveryGroupName = child.getAttributes().getNamedItem("discovery-group-name").getNodeValue();
-
+
discoveryGroupConfiguration = configuration.getDiscoveryGroupConfigurations().get(discoveryGroupName);
-
+
if (discoveryGroupConfiguration == null)
{
log.warn("There is no discovery group with name '" + discoveryGroupName + "' deployed.");
return;
- }
+ }
}
- else if (CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME_ELEMENT.equalsIgnoreCase(child.getNodeName()))
+ else if (CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME_ELEMENT.equals(child.getNodeName()))
{
connectionLoadBalancingPolicyClassName = child.getTextContent().trim();
}
- else if (DISCOVERY_INITIAL_WAIT_ELEMENT.equalsIgnoreCase(child.getNodeName()))
+ else if (DISCOVERY_INITIAL_WAIT_ELEMENT.equals(child.getNodeName()))
{
- discoveryInitialWait = Integer.parseInt(child.getTextContent().trim());
+ discoveryInitialWait = XMLUtil.parseInt(child);
}
}
-
+
String name = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
if (discoveryGroupConfiguration != null)
@@ -311,6 +340,10 @@
autoGroup,
maxConnections,
preAcknowledge,
+ retryOnFailure,
+ retryInterval,
+ retryIntervalMultiplier,
+ maxRetries,
jndiBindings);
}
else
@@ -334,6 +367,10 @@
autoGroup,
maxConnections,
preAcknowledge,
+ retryOnFailure,
+ retryInterval,
+ retryIntervalMultiplier,
+ maxRetries,
jndiBindings);
}
}
@@ -345,7 +382,7 @@
{
Node child = children.item(i);
- if (ENTRY_NODE_NAME.equalsIgnoreCase(children.item(i).getNodeName()))
+ if (ENTRY_NODE_NAME.equals(children.item(i).getNodeName()))
{
String jndiName = child.getAttributes().getNamedItem("name").getNodeValue();
jmsServerManager.createQueue(queueName, jndiName);
@@ -360,7 +397,7 @@
{
Node child = children.item(i);
- if (ENTRY_NODE_NAME.equalsIgnoreCase(children.item(i).getNodeName()))
+ if (ENTRY_NODE_NAME.equals(children.item(i).getNodeName()))
{
String jndiName = child.getAttributes().getNamedItem("name").getNodeValue();
jmsServerManager.createTopic(topicName, jndiName);
Modified: trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -231,6 +231,10 @@
final boolean autoGroup,
final int maxConnections,
final boolean preAcknowledge,
+ final boolean retryOnFailure,
+ final long retryInterval,
+ final double retryIntervalMultiplier,
+ final int maxRetries,
final List<String> jndiBindings) throws Exception
{
JBossConnectionFactory cf = connectionFactories.get(name);
@@ -253,7 +257,11 @@
blockOnPersistentSend,
autoGroup,
maxConnections,
- preAcknowledge);
+ preAcknowledge,
+ retryOnFailure,
+ retryInterval,
+ retryIntervalMultiplier,
+ maxRetries);
}
bindConnectionFactory(cf, name, jndiBindings);
@@ -281,6 +289,10 @@
final boolean autoGroup,
final int maxConnections,
final boolean preAcknowledge,
+ final boolean retryOnFailure,
+ final long retryInterval,
+ final double retryIntervalMultiplier,
+ final int maxRetries,
final List<String> jndiBindings) throws Exception
{
JBossConnectionFactory cf = connectionFactories.get(name);
@@ -306,7 +318,11 @@
blockOnPersistentSend,
autoGroup,
maxConnections,
- preAcknowledge);
+ preAcknowledge,
+ retryOnFailure,
+ retryInterval,
+ retryIntervalMultiplier,
+ maxRetries);
}
bindConnectionFactory(cf, name, jndiBindings);
Modified: trunk/src/main/org/jboss/messaging/jms/server/management/JMSServerControlMBean.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/JMSServerControlMBean.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/JMSServerControlMBean.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -106,7 +106,15 @@
@Parameter(name = "maxConnections", desc = "The maximum number of physical connections created per client using this connection factory. Sessions created will be assigned a connection in a round-robin fashion")
int maxConnections,
@Parameter(name = "preAcknowledge", desc = "If the server will acknowledge delivery of a message before it is delivered")
- boolean preAcknowledge,
+ boolean preAcknowledge,
+ @Parameter(name = "retryOnFailure", desc = "Will the server attempt to retry connecting to same server in event of failure?")
+ boolean retryOnFailure,
+ @Parameter(name = "retryInterval", desc = "The retry interval in ms when retrying connecting to same server")
+ long retryInterval,
+ @Parameter(name = "retryIntervalMultiplier", desc = "The retry interval multiplier when retrying connecting to same server")
+ double retryIntervalMultiplier,
+ @Parameter(name = "maxRetries", desc = "The maximum number of retries when retrying connecting to same server. -1 means no maximum")
+ int maxRetries,
@Parameter(name = "jndiBinding", desc = "JNDI Binding")
String jndiBinding) throws Exception;
@@ -151,6 +159,14 @@
int maxConnections,
@Parameter(name = "preAcknowledge", desc = "If the server will acknowledge delivery of a message before it is delivered")
boolean preAcknowledge,
+ @Parameter(name = "retryOnFailure", desc = "Will the server attempt to retry connecting to same server in event of failure?")
+ boolean retryOnFailure,
+ @Parameter(name = "retryInterval", desc = "The retry interval in ms when retrying connecting to same server")
+ long retryInterval,
+ @Parameter(name = "retryIntervalMultiplier", desc = "The retry interval multiplier when retrying connecting to same server")
+ double retryIntervalMultiplier,
+ @Parameter(name = "maxRetries", desc = "The maximum number of retries when retrying connecting to same server. -1 means no maximum")
+ int maxRetries,
@Parameter(name = "jndiBinding", desc = "JNDI Binding")
String jndiBinding) throws Exception;
Modified: trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSServerControl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSServerControl.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSServerControl.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -97,6 +97,10 @@
boolean autoGroup,
int maxConnections,
boolean preAcknowledge,
+ boolean retryOnFailure,
+ long retryInterval,
+ double retryIntervalMultiplier,
+ int maxRetries,
String jndiBinding) throws Exception
{
List<String> bindings = new ArrayList<String>();
@@ -121,6 +125,10 @@
autoGroup,
maxConnections,
preAcknowledge,
+ retryOnFailure,
+ retryInterval,
+ retryIntervalMultiplier,
+ maxRetries,
bindings);
if (created)
{
@@ -148,6 +156,10 @@
boolean autoGroup,
int maxConnections,
boolean preAcknowledge,
+ final boolean retryOnFailure,
+ final long retryInterval,
+ final double retryIntervalMultiplier,
+ final int maxRetries,
String jndiBinding) throws Exception
{
List<String> bindings = new ArrayList<String>();
@@ -173,6 +185,10 @@
autoGroup,
maxConnections,
preAcknowledge,
+ retryOnFailure,
+ retryInterval,
+ retryIntervalMultiplier,
+ maxRetries,
bindings);
if (created)
{
Modified: trunk/src/main/org/jboss/messaging/util/Random.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/Random.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/src/main/org/jboss/messaging/util/Random.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -37,7 +37,7 @@
{
private static int extraSeed;
- private static long getSeed()
+ private static synchronized long getSeed()
{
long seed = System.currentTimeMillis() + extraSeed++;
Modified: trunk/src/main/org/jboss/messaging/util/XMLUtil.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/XMLUtil.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/src/main/org/jboss/messaging/util/XMLUtil.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -45,6 +45,7 @@
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @version <tt>$Revision$</tt>
* $Id$
*/
@@ -397,7 +398,75 @@
}
return xml;
}
+
+ public static long parseLong(final Node elem)
+ {
+ String value = elem.getTextContent().trim();
+ try
+ {
+ return Long.parseLong(value);
+ }
+ catch (NumberFormatException e)
+ {
+ throw new IllegalArgumentException("Element " + elem +
+ " requires a valid Long value, but '" +
+ value +
+ "' cannot be parsed as a Long");
+ }
+ }
+
+ public static int parseInt(final Node elem)
+ {
+ String value = elem.getTextContent().trim();
+
+ try
+ {
+ return Integer.parseInt(value);
+ }
+ catch (NumberFormatException e)
+ {
+ throw new IllegalArgumentException("Element " + elem +
+ " requires a valid Integer value, but '" +
+ value +
+ "' cannot be parsed as an Integer");
+ }
+ }
+
+ public static boolean parseBoolean(final Node elem)
+ {
+ String value = elem.getTextContent().trim();
+
+ try
+ {
+ return Boolean.parseBoolean(value);
+ }
+ catch (NumberFormatException e)
+ {
+ throw new IllegalArgumentException("Element " + elem +
+ " requires a valid Boolean value, but '" +
+ value +
+ "' cannot be parsed as a Boolean");
+ }
+ }
+
+ public static double parseDouble(final Node elem)
+ {
+ String value = elem.getTextContent().trim();
+
+ try
+ {
+ return Double.parseDouble(value);
+ }
+ catch (NumberFormatException e)
+ {
+ throw new IllegalArgumentException("Element " + elem +
+ " requires a valid Double value, but '" +
+ value +
+ "' cannot be parsed as a Double");
+ }
+ }
+
// Attributes -----------------------------------------------------------------------------------
// Constructors ---------------------------------------------------------------------------------
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -21,6 +21,11 @@
*/
package org.jboss.test.messaging.jms;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_RETRIES;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_ON_FAILURE;
+
import java.util.ArrayList;
import java.util.List;
@@ -115,6 +120,10 @@
ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP,
ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS,
ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE,
+ DEFAULT_RETRY_ON_FAILURE,
+ DEFAULT_RETRY_INTERVAL,
+ DEFAULT_RETRY_INTERVAL_MULTIPLIER,
+ DEFAULT_MAX_RETRIES,
jndiBindings);
cf = (JBossConnectionFactory)getInitialContext().lookup("/StrictTCKConnectionFactory");
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/JMSTestCase.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/JMSTestCase.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/JMSTestCase.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -1,5 +1,10 @@
package org.jboss.test.messaging.jms;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_RETRIES;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_ON_FAILURE;
+
import java.util.ArrayList;
import java.util.List;
@@ -69,6 +74,10 @@
ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP,
ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS,
ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE,
+ DEFAULT_RETRY_ON_FAILURE,
+ DEFAULT_RETRY_INTERVAL,
+ DEFAULT_RETRY_INTERVAL_MULTIPLIER,
+ DEFAULT_MAX_RETRIES,
jndiBindings);
cf = (JBossConnectionFactory)getInitialContext().lookup("/testsuitecf");
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -21,6 +21,11 @@
*/
package org.jboss.test.messaging.tools.container;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_RETRIES;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_ON_FAILURE;
+
import java.io.File;
import java.lang.management.ManagementFactory;
import java.sql.Connection;
@@ -562,6 +567,10 @@
false,
8,
false,
+ DEFAULT_RETRY_ON_FAILURE,
+ DEFAULT_RETRY_INTERVAL,
+ DEFAULT_RETRY_INTERVAL_MULTIPLIER,
+ DEFAULT_MAX_RETRIES,
jndiBindings);
}
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientCrashTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientCrashTest.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientCrashTest.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -32,9 +32,13 @@
import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE;
import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE;
import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_RETRIES;
import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_ON_FAILURE;
import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE;
import org.jboss.messaging.core.client.ClientConsumer;
@@ -148,7 +152,6 @@
{
super.setUp();
-
Configuration config = createDefaultConfig(true);
config.setSecurityEnabled(false);
messagingService = createService(false, config);
@@ -170,7 +173,11 @@
DEFAULT_AUTO_GROUP,
DEFAULT_MAX_CONNECTIONS,
DEFAULT_PRE_ACKNOWLEDGE,
- DEFAULT_ACK_BATCH_SIZE);
+ DEFAULT_ACK_BATCH_SIZE,
+ DEFAULT_RETRY_ON_FAILURE,
+ DEFAULT_RETRY_INTERVAL,
+ DEFAULT_RETRY_INTERVAL_MULTIPLIER,
+ DEFAULT_MAX_RETRIES);
}
Added: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectTest.java (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectTest.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -0,0 +1,613 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2005-2008, Red Hat
+ * Middleware LLC, and individual contributors by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of individual
+ * contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.tests.integration.cluster.failover;
+
+import junit.framework.TestCase;
+
+import org.jboss.messaging.core.client.ClientConsumer;
+import org.jboss.messaging.core.client.ClientMessage;
+import org.jboss.messaging.core.client.ClientProducer;
+import org.jboss.messaging.core.client.ClientSession;
+import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
+import org.jboss.messaging.core.client.impl.ClientSessionFactoryInternal;
+import org.jboss.messaging.core.client.impl.ClientSessionImpl;
+import org.jboss.messaging.core.config.Configuration;
+import org.jboss.messaging.core.config.TransportConfiguration;
+import org.jboss.messaging.core.config.impl.ConfigurationImpl;
+import org.jboss.messaging.core.exception.MessagingException;
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.RemotingConnection;
+import org.jboss.messaging.core.remoting.impl.invm.InVMConnector;
+import org.jboss.messaging.core.remoting.impl.invm.InVMRegistry;
+import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
+import org.jboss.messaging.jms.client.JBossTextMessage;
+import org.jboss.messaging.util.SimpleString;
+
+/**
+ *
+ * A ReconnectTest
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ * Created 4 Nov 2008 16:54:50
+ *
+ *
+ */
+public class ReconnectTest extends TestCase
+{
+ private static final Logger log = Logger.getLogger(ReconnectTest.class);
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private static final SimpleString ADDRESS = new SimpleString("FailoverTestAddress");
+
+ private MessagingService service;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ /*
+ * Test failure on connection, but server is still up so should immediately reconnect
+ */
+ public void testImmediateReconnect() throws Exception
+ {
+ final long retryInterval = 500;
+
+ final double retryMultiplier = 1d;
+
+ final int maxRetries = -1;
+
+ ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
+ retryInterval,
+ retryMultiplier,
+ maxRetries);
+
+ ClientSession session = sf.createSession(false, true, true);
+
+ session.createQueue(ADDRESS, ADDRESS, null, false, false, true);
+
+ ClientProducer producer = session.createProducer(ADDRESS);
+
+ final int numMessages = 1000;
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session.createClientMessage(JBossTextMessage.TYPE,
+ false,
+ 0,
+ System.currentTimeMillis(),
+ (byte)1);
+ message.putIntProperty(new SimpleString("count"), i);
+ message.getBody().putString("aardvarks");
+ message.getBody().flip();
+ producer.send(message);
+ }
+ log.info("Sent messages");
+
+ ClientConsumer consumer = session.createConsumer(ADDRESS);
+
+ RemotingConnection conn = ((ClientSessionImpl)session).getConnection();
+
+ conn.fail(new MessagingException(MessagingException.NOT_CONNECTED));
+
+ session.start();
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = consumer.receive(500);
+
+ assertNotNull(message);
+
+ assertEquals("aardvarks", message.getBody().getString());
+
+ assertEquals(i, message.getProperty(new SimpleString("count")));
+
+ message.acknowledge();
+ }
+
+ ClientMessage message = consumer.receiveImmediate();
+
+ assertNull(message);
+
+ session.close();
+
+ sf.close();
+ }
+
+ /*
+ * Test failure on connection, simulate failure to create connection for a while, then
+ * allow connection to be recreated
+ */
+ public void testDelayedReconnect() throws Exception
+ {
+ final long retryInterval = 500;
+
+ final double retryMultiplier = 1d;
+
+ final int maxRetries = -1;
+
+ ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
+ retryInterval,
+ retryMultiplier,
+ maxRetries);
+
+ ClientSession session = sf.createSession(false, true, true);
+
+ session.createQueue(ADDRESS, ADDRESS, null, false, false, true);
+
+ ClientProducer producer = session.createProducer(ADDRESS);
+
+ final int numMessages = 1000;
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session.createClientMessage(JBossTextMessage.TYPE,
+ false,
+ 0,
+ System.currentTimeMillis(),
+ (byte)1);
+ message.putIntProperty(new SimpleString("count"), i);
+ message.getBody().putString("aardvarks");
+ message.getBody().flip();
+ producer.send(message);
+ }
+ log.info("Sent messages");
+
+ ClientConsumer consumer = session.createConsumer(ADDRESS);
+
+ InVMConnector.failOnCreateConnection = true;
+
+ RemotingConnection conn = ((ClientSessionImpl)session).getConnection();
+
+ Thread t = new Thread()
+ {
+ public void run()
+ {
+ try
+ {
+ Thread.sleep(retryInterval * 3);
+ }
+ catch (InterruptedException ignore)
+ {
+ }
+
+ InVMConnector.failOnCreateConnection = false;
+ }
+ };
+
+ t.start();
+
+ conn.fail(new MessagingException(MessagingException.NOT_CONNECTED));
+
+ session.start();
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = consumer.receive(500);
+
+ assertNotNull(message);
+
+ assertEquals("aardvarks", message.getBody().getString());
+
+ assertEquals(i, message.getProperty(new SimpleString("count")));
+
+ message.acknowledge();
+ }
+
+ ClientMessage message = consumer.receiveImmediate();
+
+ assertNull(message);
+
+ session.close();
+
+ sf.close();
+
+ t.join();
+ }
+
+ public void testMaxRetriesFailsToReconnect() throws Exception
+ {
+ final long retryInterval = 500;
+
+ final double retryMultiplier = 1d;
+
+ final int maxRetries = 3;
+
+ ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
+ retryInterval,
+ retryMultiplier,
+ maxRetries);
+
+ ClientSession session = sf.createSession(false, true, true);
+
+ session.createQueue(ADDRESS, ADDRESS, null, false, false, true);
+
+ ClientProducer producer = session.createProducer(ADDRESS);
+
+ final int numMessages = 1000;
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session.createClientMessage(JBossTextMessage.TYPE,
+ false,
+ 0,
+ System.currentTimeMillis(),
+ (byte)1);
+ message.putIntProperty(new SimpleString("count"), i);
+ message.getBody().putString("aardvarks");
+ message.getBody().flip();
+ producer.send(message);
+ }
+ log.info("Sent messages");
+
+ ClientConsumer consumer = session.createConsumer(ADDRESS);
+
+ InVMConnector.failOnCreateConnection = true;
+
+ RemotingConnection conn = ((ClientSessionImpl)session).getConnection();
+
+ //Sleep for longer than max retries so should fail to reconnect
+
+ Thread t = new Thread()
+ {
+ public void run()
+ {
+ try
+ {
+ Thread.sleep(retryInterval * (maxRetries + 1));
+ }
+ catch (InterruptedException ignore)
+ {
+ }
+
+ InVMConnector.failOnCreateConnection = false;
+ }
+ };
+
+ t.start();
+
+ conn.fail(new MessagingException(MessagingException.NOT_CONNECTED));
+
+ session.start();
+
+ //Should be null since failed to reconnect
+ ClientMessage message = consumer.receive(500);
+
+ assertNull(message);
+
+ session.close();
+
+ sf.close();
+
+ t.join();
+ }
+
+ public void testMaxRetriesSucceedsInReconnecting() throws Exception
+ {
+ final long retryInterval = 500;
+
+ final double retryMultiplier = 1d;
+
+ final int maxRetries = 3;
+
+ ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
+ retryInterval,
+ retryMultiplier,
+ maxRetries);
+
+ ClientSession session = sf.createSession(false, true, true);
+
+ session.createQueue(ADDRESS, ADDRESS, null, false, false, true);
+
+ ClientProducer producer = session.createProducer(ADDRESS);
+
+ final int numMessages = 1000;
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session.createClientMessage(JBossTextMessage.TYPE,
+ false,
+ 0,
+ System.currentTimeMillis(),
+ (byte)1);
+ message.putIntProperty(new SimpleString("count"), i);
+ message.getBody().putString("aardvarks");
+ message.getBody().flip();
+ producer.send(message);
+ }
+ log.info("Sent messages");
+
+ ClientConsumer consumer = session.createConsumer(ADDRESS);
+
+ InVMConnector.failOnCreateConnection = true;
+
+ RemotingConnection conn = ((ClientSessionImpl)session).getConnection();
+
+ //Sleep for less than max retries so should succeed in reconnecting
+
+ Thread t = new Thread()
+ {
+ public void run()
+ {
+ try
+ {
+ Thread.sleep(retryInterval * (maxRetries - 1));
+ }
+ catch (InterruptedException ignore)
+ {
+ }
+
+ InVMConnector.failOnCreateConnection = false;
+ }
+ };
+
+ t.start();
+
+ conn.fail(new MessagingException(MessagingException.NOT_CONNECTED));
+
+ session.start();
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = consumer.receive(500);
+
+ assertNotNull(message);
+
+ assertEquals("aardvarks", message.getBody().getString());
+
+ assertEquals(i, message.getProperty(new SimpleString("count")));
+
+ message.acknowledge();
+ }
+
+ ClientMessage message = consumer.receiveImmediate();
+
+ assertNull(message);
+
+ session.close();
+
+ sf.close();
+
+ t.join();
+ }
+
+ public void testRetryInterval() throws Exception
+ {
+ final long retryInterval = 500;
+
+ final double retryMultiplier = 1d;
+
+ final int maxRetries = -1;
+
+ ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
+ retryInterval,
+ retryMultiplier,
+ maxRetries);
+
+ ClientSession session = sf.createSession(false, true, true);
+
+ session.createQueue(ADDRESS, ADDRESS, null, false, false, true);
+
+ ClientProducer producer = session.createProducer(ADDRESS);
+
+ final int numMessages = 1000;
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session.createClientMessage(JBossTextMessage.TYPE,
+ false,
+ 0,
+ System.currentTimeMillis(),
+ (byte)1);
+ message.putIntProperty(new SimpleString("count"), i);
+ message.getBody().putString("aardvarks");
+ message.getBody().flip();
+ producer.send(message);
+ }
+ log.info("Sent messages");
+
+ ClientConsumer consumer = session.createConsumer(ADDRESS);
+
+ InVMConnector.failOnCreateConnection = true;
+
+ RemotingConnection conn = ((ClientSessionImpl)session).getConnection();
+
+ long start = System.currentTimeMillis();
+
+ Thread t = new Thread()
+ {
+ public void run()
+ {
+ try
+ {
+ Thread.sleep(retryInterval / 2);
+ }
+ catch (InterruptedException ignore)
+ {
+ }
+ InVMConnector.failOnCreateConnection = false;
+ }
+ };
+
+ t.start();
+
+ conn.fail(new MessagingException(MessagingException.NOT_CONNECTED));
+
+ session.start();
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = consumer.receive(500);
+
+ assertNotNull(message);
+
+ assertEquals("aardvarks", message.getBody().getString());
+
+ assertEquals(i, message.getProperty(new SimpleString("count")));
+
+ message.acknowledge();
+ }
+
+ ClientMessage message = consumer.receiveImmediate();
+
+ assertNull(message);
+
+ long end = System.currentTimeMillis();
+
+ assertTrue((end - start) >= retryInterval);
+
+ session.close();
+
+ sf.close();
+
+ t.join();
+ }
+
+ public void testExponentialBackoff() throws Exception
+ {
+ final long retryInterval = 500;
+
+ final double retryMultiplier = 4d;
+
+ final int maxRetries = -1;
+
+ ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
+ retryInterval,
+ retryMultiplier,
+ maxRetries);
+
+ ClientSession session = sf.createSession(false, true, true);
+
+ session.createQueue(ADDRESS, ADDRESS, null, false, false, true);
+
+ ClientProducer producer = session.createProducer(ADDRESS);
+
+ final int numMessages = 1000;
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session.createClientMessage(JBossTextMessage.TYPE,
+ false,
+ 0,
+ System.currentTimeMillis(),
+ (byte)1);
+ message.putIntProperty(new SimpleString("count"), i);
+ message.getBody().putString("aardvarks");
+ message.getBody().flip();
+ producer.send(message);
+ }
+ log.info("Sent messages");
+
+ ClientConsumer consumer = session.createConsumer(ADDRESS);
+
+ InVMConnector.failOnCreateConnection = true;
+
+ RemotingConnection conn = ((ClientSessionImpl)session).getConnection();
+
+ long start = System.currentTimeMillis();
+
+ Thread t = new Thread()
+ {
+ public void run()
+ {
+ try
+ {
+ Thread.sleep(retryInterval * 2);
+ }
+ catch (InterruptedException ignore)
+ {
+ }
+
+ InVMConnector.failOnCreateConnection = false;
+ }
+ };
+
+ t.start();
+
+ conn.fail(new MessagingException(MessagingException.NOT_CONNECTED));
+
+ session.start();
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = consumer.receive(500);
+
+ assertNotNull(message);
+
+ assertEquals("aardvarks", message.getBody().getString());
+
+ assertEquals(i, message.getProperty(new SimpleString("count")));
+
+ message.acknowledge();
+ }
+
+ ClientMessage message = consumer.receiveImmediate();
+
+ assertNull(message);
+
+ long end = System.currentTimeMillis();
+
+ assertTrue((end - start) >= retryInterval * (1 + retryMultiplier));
+
+ session.close();
+
+ sf.close();
+
+ t.join();
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ Configuration liveConf = new ConfigurationImpl();
+ liveConf.setSecurityEnabled(false);
+ liveConf.getAcceptorConfigurations()
+ .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory"));
+ service = MessagingServiceImpl.newNullStorageMessagingServer(liveConf);
+ service.start();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ assertEquals(0, service.getServer().getRemotingService().getConnections().size());
+
+ service.stop();
+
+ assertEquals(0, InVMRegistry.instance.size());
+ }
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReplicateConnectionFailureTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReplicateConnectionFailureTest.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReplicateConnectionFailureTest.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -22,6 +22,25 @@
package org.jboss.messaging.tests.integration.cluster.failover;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_ACKNOWLEDGE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_PERSISTENT_SEND;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_RETRIES;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_ON_FAILURE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE;
+
import java.util.HashMap;
import java.util.Map;
@@ -80,21 +99,25 @@
ClientSessionFactoryInternal sf1 = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
backupParams),
- ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
+ DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
pingPeriod,
- ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_ACKNOWLEDGE,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_PERSISTENT_SEND,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND,
- ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP,
- ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS,
- ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE,
- ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE);
+ DEFAULT_CALL_TIMEOUT,
+ DEFAULT_CONSUMER_WINDOW_SIZE,
+ DEFAULT_CONSUMER_MAX_RATE,
+ DEFAULT_SEND_WINDOW_SIZE,
+ DEFAULT_PRODUCER_MAX_RATE,
+ DEFAULT_MIN_LARGE_MESSAGE_SIZE,
+ DEFAULT_BLOCK_ON_ACKNOWLEDGE,
+ DEFAULT_BLOCK_ON_PERSISTENT_SEND,
+ DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND,
+ DEFAULT_AUTO_GROUP,
+ DEFAULT_MAX_CONNECTIONS,
+ DEFAULT_PRE_ACKNOWLEDGE,
+ DEFAULT_ACK_BATCH_SIZE,
+ DEFAULT_RETRY_ON_FAILURE,
+ DEFAULT_RETRY_INTERVAL,
+ DEFAULT_RETRY_INTERVAL_MULTIPLIER,
+ DEFAULT_MAX_RETRIES);
sf1.setSendWindowSize(32 * 1024);
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/cluster/JMSFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/cluster/JMSFailoverTest.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/cluster/JMSFailoverTest.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -22,6 +22,25 @@
package org.jboss.messaging.tests.integration.jms.cluster;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_ACKNOWLEDGE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_RETRIES;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PING_PERIOD;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_ON_FAILURE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE;
+
import java.util.HashMap;
import java.util.Map;
@@ -92,23 +111,27 @@
JBossConnectionFactory jbcf = new JBossConnectionFactory(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
backupParams),
- ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
- ClientSessionFactoryImpl.DEFAULT_PING_PERIOD,
- ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT,
+ DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
+ DEFAULT_PING_PERIOD,
+ DEFAULT_CALL_TIMEOUT,
null,
- ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE,
- ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_ACKNOWLEDGE,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND,
+ DEFAULT_ACK_BATCH_SIZE,
+ DEFAULT_ACK_BATCH_SIZE,
+ DEFAULT_CONSUMER_WINDOW_SIZE,
+ DEFAULT_CONSUMER_MAX_RATE,
+ DEFAULT_SEND_WINDOW_SIZE,
+ DEFAULT_PRODUCER_MAX_RATE,
+ DEFAULT_MIN_LARGE_MESSAGE_SIZE,
+ DEFAULT_BLOCK_ON_ACKNOWLEDGE,
+ DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND,
true,
- ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP,
- ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS,
- ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE);
+ DEFAULT_AUTO_GROUP,
+ DEFAULT_MAX_CONNECTIONS,
+ DEFAULT_PRE_ACKNOWLEDGE,
+ DEFAULT_RETRY_ON_FAILURE,
+ DEFAULT_RETRY_INTERVAL,
+ DEFAULT_RETRY_INTERVAL_MULTIPLIER,
+ DEFAULT_MAX_RETRIES);
Connection conn = jbcf.createConnection();
@@ -173,44 +196,52 @@
{
JBossConnectionFactory jbcfLive = new JBossConnectionFactory(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
null,
- ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
- ClientSessionFactoryImpl.DEFAULT_PING_PERIOD,
- ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT,
+ DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
+ DEFAULT_PING_PERIOD,
+ DEFAULT_CALL_TIMEOUT,
null,
- ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE,
- ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_ACKNOWLEDGE,
+ DEFAULT_ACK_BATCH_SIZE,
+ DEFAULT_ACK_BATCH_SIZE,
+ DEFAULT_CONSUMER_WINDOW_SIZE,
+ DEFAULT_CONSUMER_MAX_RATE,
+ DEFAULT_SEND_WINDOW_SIZE,
+ DEFAULT_PRODUCER_MAX_RATE,
+ DEFAULT_MIN_LARGE_MESSAGE_SIZE,
+ DEFAULT_BLOCK_ON_ACKNOWLEDGE,
true,
true,
- ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP,
- ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS,
- ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE);
+ DEFAULT_AUTO_GROUP,
+ DEFAULT_MAX_CONNECTIONS,
+ DEFAULT_PRE_ACKNOWLEDGE,
+ DEFAULT_RETRY_ON_FAILURE,
+ DEFAULT_RETRY_INTERVAL,
+ DEFAULT_RETRY_INTERVAL_MULTIPLIER,
+ DEFAULT_MAX_RETRIES);
JBossConnectionFactory jbcfBackup = new JBossConnectionFactory(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
backupParams),
null,
- ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
- ClientSessionFactoryImpl.DEFAULT_PING_PERIOD,
- ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT,
+ DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
+ DEFAULT_PING_PERIOD,
+ DEFAULT_CALL_TIMEOUT,
null,
- ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE,
- ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_ACKNOWLEDGE,
+ DEFAULT_ACK_BATCH_SIZE,
+ DEFAULT_ACK_BATCH_SIZE,
+ DEFAULT_CONSUMER_WINDOW_SIZE,
+ DEFAULT_CONSUMER_MAX_RATE,
+ DEFAULT_SEND_WINDOW_SIZE,
+ DEFAULT_PRODUCER_MAX_RATE,
+ DEFAULT_MIN_LARGE_MESSAGE_SIZE,
+ DEFAULT_BLOCK_ON_ACKNOWLEDGE,
true,
true,
- ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP,
- ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS,
- ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE);
+ DEFAULT_AUTO_GROUP,
+ DEFAULT_MAX_CONNECTIONS,
+ DEFAULT_PRE_ACKNOWLEDGE,
+ DEFAULT_RETRY_ON_FAILURE,
+ DEFAULT_RETRY_INTERVAL,
+ DEFAULT_RETRY_INTERVAL_MULTIPLIER,
+ DEFAULT_MAX_RETRIES);
Connection connLive = jbcfLive.createConnection();
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/consumer/ConsumerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/consumer/ConsumerTest.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/consumer/ConsumerTest.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -21,6 +21,23 @@
*/
package org.jboss.messaging.tests.integration.jms.consumer;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_ACKNOWLEDGE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_RETRIES;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PING_PERIOD;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_ON_FAILURE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE;
import junit.framework.TestCase;
import org.jboss.messaging.jms.client.JBossConnectionFactory;
import org.jboss.messaging.jms.client.JBossSession;
@@ -72,23 +89,27 @@
serverManager.createQueue(Q_NAME, Q_NAME);
cf = new JBossConnectionFactory(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
null,
- ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
- ClientSessionFactoryImpl.DEFAULT_PING_PERIOD,
- ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT,
+ DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
+ DEFAULT_PING_PERIOD,
+ DEFAULT_CALL_TIMEOUT,
null,
- ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE,
- ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_ACKNOWLEDGE,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND,
+ DEFAULT_ACK_BATCH_SIZE,
+ DEFAULT_ACK_BATCH_SIZE,
+ DEFAULT_CONSUMER_WINDOW_SIZE,
+ DEFAULT_CONSUMER_MAX_RATE,
+ DEFAULT_SEND_WINDOW_SIZE,
+ DEFAULT_PRODUCER_MAX_RATE,
+ DEFAULT_MIN_LARGE_MESSAGE_SIZE,
+ DEFAULT_BLOCK_ON_ACKNOWLEDGE,
+ DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND,
true,
- ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP,
- ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS,
- true);
+ DEFAULT_AUTO_GROUP,
+ DEFAULT_MAX_CONNECTIONS,
+ true,
+ DEFAULT_RETRY_ON_FAILURE,
+ DEFAULT_RETRY_INTERVAL,
+ DEFAULT_RETRY_INTERVAL_MULTIPLIER,
+ DEFAULT_MAX_RETRIES);
}
@Override
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSQueueControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSQueueControlTest.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSQueueControlTest.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -22,6 +22,24 @@
package org.jboss.messaging.tests.integration.jms.management;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_ACKNOWLEDGE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_RETRIES;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PING_PERIOD;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_ON_FAILURE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE;
import static org.jboss.messaging.tests.util.RandomUtil.randomString;
import java.lang.management.ManagementFactory;
@@ -158,23 +176,27 @@
JBossConnectionFactory cf = new JBossConnectionFactory(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
null,
- ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
- ClientSessionFactoryImpl.DEFAULT_PING_PERIOD,
- ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT,
+ DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
+ DEFAULT_PING_PERIOD,
+ DEFAULT_CALL_TIMEOUT,
null,
- ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE,
- ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_ACKNOWLEDGE,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND,
+ DEFAULT_ACK_BATCH_SIZE,
+ DEFAULT_ACK_BATCH_SIZE,
+ DEFAULT_CONSUMER_WINDOW_SIZE,
+ DEFAULT_CONSUMER_MAX_RATE,
+ DEFAULT_SEND_WINDOW_SIZE,
+ DEFAULT_PRODUCER_MAX_RATE,
+ DEFAULT_MIN_LARGE_MESSAGE_SIZE,
+ DEFAULT_BLOCK_ON_ACKNOWLEDGE,
+ DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND,
true,
- ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP,
- ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS,
- ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE);
+ DEFAULT_AUTO_GROUP,
+ DEFAULT_MAX_CONNECTIONS,
+ DEFAULT_PRE_ACKNOWLEDGE,
+ DEFAULT_RETRY_ON_FAILURE,
+ DEFAULT_RETRY_INTERVAL,
+ DEFAULT_RETRY_INTERVAL_MULTIPLIER,
+ DEFAULT_MAX_RETRIES);
Connection conn = cf.createConnection();
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSUtil.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSUtil.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSUtil.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -22,6 +22,24 @@
package org.jboss.messaging.tests.integration.jms.management;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_ACKNOWLEDGE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_RETRIES;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PING_PERIOD;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_ON_FAILURE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE;
import static org.jboss.messaging.tests.util.RandomUtil.randomString;
import javax.jms.Connection;
@@ -59,23 +77,27 @@
{
JBossConnectionFactory cf = new JBossConnectionFactory(new TransportConfiguration(connectorFactory),
null,
- ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
- ClientSessionFactoryImpl.DEFAULT_PING_PERIOD,
- ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT,
+ DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
+ DEFAULT_PING_PERIOD,
+ DEFAULT_CALL_TIMEOUT,
null,
- ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE,
- ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_ACKNOWLEDGE,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND,
+ DEFAULT_ACK_BATCH_SIZE,
+ DEFAULT_ACK_BATCH_SIZE,
+ DEFAULT_CONSUMER_WINDOW_SIZE,
+ DEFAULT_CONSUMER_MAX_RATE,
+ DEFAULT_SEND_WINDOW_SIZE,
+ DEFAULT_PRODUCER_MAX_RATE,
+ DEFAULT_MIN_LARGE_MESSAGE_SIZE,
+ DEFAULT_BLOCK_ON_ACKNOWLEDGE,
+ DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND,
true,
- ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP,
- ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS,
- ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE);
+ DEFAULT_AUTO_GROUP,
+ DEFAULT_MAX_CONNECTIONS,
+ DEFAULT_PRE_ACKNOWLEDGE,
+ DEFAULT_RETRY_ON_FAILURE,
+ DEFAULT_RETRY_INTERVAL,
+ DEFAULT_RETRY_INTERVAL_MULTIPLIER,
+ DEFAULT_MAX_RETRIES);
return cf.createConnection();
}
@@ -84,23 +106,27 @@
{
JBossConnectionFactory cf = new JBossConnectionFactory(new TransportConfiguration(connectorFactory),
null,
- ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
- ClientSessionFactoryImpl.DEFAULT_PING_PERIOD,
- ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT,
+ DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
+ DEFAULT_PING_PERIOD,
+ DEFAULT_CALL_TIMEOUT,
null,
- ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE,
- ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_ACKNOWLEDGE,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND,
+ DEFAULT_ACK_BATCH_SIZE,
+ DEFAULT_ACK_BATCH_SIZE,
+ DEFAULT_CONSUMER_WINDOW_SIZE,
+ DEFAULT_CONSUMER_MAX_RATE,
+ DEFAULT_SEND_WINDOW_SIZE,
+ DEFAULT_PRODUCER_MAX_RATE,
+ DEFAULT_MIN_LARGE_MESSAGE_SIZE,
+ DEFAULT_BLOCK_ON_ACKNOWLEDGE,
+ DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND,
true,
- ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP,
- ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS,
- ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE);
+ DEFAULT_AUTO_GROUP,
+ DEFAULT_MAX_CONNECTIONS,
+ DEFAULT_PRE_ACKNOWLEDGE,
+ DEFAULT_RETRY_ON_FAILURE,
+ DEFAULT_RETRY_INTERVAL,
+ DEFAULT_RETRY_INTERVAL_MULTIPLIER,
+ DEFAULT_MAX_RETRIES);
Connection conn = cf.createConnection();
@@ -125,23 +151,27 @@
{
JBossConnectionFactory cf = new JBossConnectionFactory(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
null,
- ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
- ClientSessionFactoryImpl.DEFAULT_PING_PERIOD,
- ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT,
+ DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
+ DEFAULT_PING_PERIOD,
+ DEFAULT_CALL_TIMEOUT,
null,
- ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE,
- ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_ACKNOWLEDGE,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND,
+ DEFAULT_ACK_BATCH_SIZE,
+ DEFAULT_ACK_BATCH_SIZE,
+ DEFAULT_CONSUMER_WINDOW_SIZE,
+ DEFAULT_CONSUMER_MAX_RATE,
+ DEFAULT_SEND_WINDOW_SIZE,
+ DEFAULT_PRODUCER_MAX_RATE,
+ DEFAULT_MIN_LARGE_MESSAGE_SIZE,
+ DEFAULT_BLOCK_ON_ACKNOWLEDGE,
+ DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND,
true,
- ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP,
- ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS,
- ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE);
+ DEFAULT_AUTO_GROUP,
+ DEFAULT_MAX_CONNECTIONS,
+ DEFAULT_PRE_ACKNOWLEDGE,
+ DEFAULT_RETRY_ON_FAILURE,
+ DEFAULT_RETRY_INTERVAL,
+ DEFAULT_RETRY_INTERVAL_MULTIPLIER,
+ DEFAULT_MAX_RETRIES);
Connection conn = cf.createConnection();
@@ -155,23 +185,27 @@
{
JBossConnectionFactory cf = new JBossConnectionFactory(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
null,
- ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
- ClientSessionFactoryImpl.DEFAULT_PING_PERIOD,
- ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT,
+ DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
+ DEFAULT_PING_PERIOD,
+ DEFAULT_CALL_TIMEOUT,
null,
- ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE,
- ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_ACKNOWLEDGE,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND,
+ DEFAULT_ACK_BATCH_SIZE,
+ DEFAULT_ACK_BATCH_SIZE,
+ DEFAULT_CONSUMER_WINDOW_SIZE,
+ DEFAULT_CONSUMER_MAX_RATE,
+ DEFAULT_SEND_WINDOW_SIZE,
+ DEFAULT_PRODUCER_MAX_RATE,
+ DEFAULT_MIN_LARGE_MESSAGE_SIZE,
+ DEFAULT_BLOCK_ON_ACKNOWLEDGE,
+ DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND,
true,
- ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP,
- ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS,
- ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE);
+ DEFAULT_AUTO_GROUP,
+ DEFAULT_MAX_CONNECTIONS,
+ DEFAULT_PRE_ACKNOWLEDGE,
+ DEFAULT_RETRY_ON_FAILURE,
+ DEFAULT_RETRY_INTERVAL,
+ DEFAULT_RETRY_INTERVAL_MULTIPLIER,
+ DEFAULT_MAX_RETRIES);
Connection conn = cf.createConnection();
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/remoting/PingTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/remoting/PingTest.java 2008-11-28 19:00:25 UTC (rev 5442)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/remoting/PingTest.java 2008-12-01 12:44:59 UTC (rev 5443)
@@ -22,6 +22,25 @@
package org.jboss.messaging.tests.integration.remoting;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_ACKNOWLEDGE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_PERSISTENT_SEND;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_RETRIES;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_ON_FAILURE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE;
+
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@@ -108,21 +127,25 @@
ClientSessionFactory csf = new ClientSessionFactoryImpl(transportConfig,
null,
- ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
+ DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
PING_INTERVAL,
- ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_ACKNOWLEDGE,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_PERSISTENT_SEND,
- ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP,
- ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS,
- ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE,
- ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE);
+ DEFAULT_CALL_TIMEOUT,
+ DEFAULT_CONSUMER_WINDOW_SIZE,
+ DEFAULT_CONSUMER_MAX_RATE,
+ DEFAULT_SEND_WINDOW_SIZE,
+ DEFAULT_PRODUCER_MAX_RATE,
+ DEFAULT_MIN_LARGE_MESSAGE_SIZE,
+ DEFAULT_BLOCK_ON_ACKNOWLEDGE,
+ DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND,
+ DEFAULT_BLOCK_ON_PERSISTENT_SEND,
+ DEFAULT_AUTO_GROUP,
+ DEFAULT_MAX_CONNECTIONS,
+ DEFAULT_PRE_ACKNOWLEDGE,
+ DEFAULT_ACK_BATCH_SIZE,
+ DEFAULT_RETRY_ON_FAILURE,
+ DEFAULT_RETRY_INTERVAL,
+ DEFAULT_RETRY_INTERVAL_MULTIPLIER,
+ DEFAULT_MAX_RETRIES);
ClientSession session = csf.createSession(false, true, true);
@@ -178,21 +201,25 @@
ClientSessionFactory csf = new ClientSessionFactoryImpl(transportConfig,
null,
- ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
+ DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
PING_INTERVAL,
- ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_ACKNOWLEDGE,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_PERSISTENT_SEND,
- ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP,
- ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS,
- ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE,
- ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE);
+ DEFAULT_CALL_TIMEOUT,
+ DEFAULT_CONSUMER_WINDOW_SIZE,
+ DEFAULT_CONSUMER_MAX_RATE,
+ DEFAULT_SEND_WINDOW_SIZE,
+ DEFAULT_PRODUCER_MAX_RATE,
+ DEFAULT_MIN_LARGE_MESSAGE_SIZE,
+ DEFAULT_BLOCK_ON_ACKNOWLEDGE,
+ DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND,
+ DEFAULT_BLOCK_ON_PERSISTENT_SEND,
+ DEFAULT_AUTO_GROUP,
+ DEFAULT_MAX_CONNECTIONS,
+ DEFAULT_PRE_ACKNOWLEDGE,
+ DEFAULT_ACK_BATCH_SIZE,
+ DEFAULT_RETRY_ON_FAILURE,
+ DEFAULT_RETRY_INTERVAL,
+ DEFAULT_RETRY_INTERVAL_MULTIPLIER,
+ DEFAULT_MAX_RETRIES);
ClientSession session = csf.createSession(false, true, true);
@@ -248,21 +275,25 @@
ClientSessionFactory csf = new ClientSessionFactoryImpl(transportConfig,
null,
- ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
+ DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
PING_INTERVAL,
- ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_ACKNOWLEDGE,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_PERSISTENT_SEND,
- ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP,
- ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS,
- ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE,
- ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE);
+ DEFAULT_CALL_TIMEOUT,
+ DEFAULT_CONSUMER_WINDOW_SIZE,
+ DEFAULT_CONSUMER_MAX_RATE,
+ DEFAULT_SEND_WINDOW_SIZE,
+ DEFAULT_PRODUCER_MAX_RATE,
+ DEFAULT_MIN_LARGE_MESSAGE_SIZE,
+ DEFAULT_BLOCK_ON_ACKNOWLEDGE,
+ DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND,
+ DEFAULT_BLOCK_ON_PERSISTENT_SEND,
+ DEFAULT_AUTO_GROUP,
+ DEFAULT_MAX_CONNECTIONS,
+ DEFAULT_PRE_ACKNOWLEDGE,
+ DEFAULT_ACK_BATCH_SIZE,
+ DEFAULT_RETRY_ON_FAILURE,
+ DEFAULT_RETRY_INTERVAL,
+ DEFAULT_RETRY_INTERVAL_MULTIPLIER,
+ DEFAULT_MAX_RETRIES);
Listener clientListener = new Listener();
@@ -339,21 +370,25 @@
ClientSessionFactory csf = new ClientSessionFactoryImpl(transportConfig,
null,
- ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
+ DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
PING_INTERVAL,
- ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE,
- ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE,
- ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_ACKNOWLEDGE,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND,
- ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_PERSISTENT_SEND,
- ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP,
- ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS,
- ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE,
- ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE);
+ DEFAULT_CALL_TIMEOUT,
+ DEFAULT_CONSUMER_WINDOW_SIZE,
+ DEFAULT_CONSUMER_MAX_RATE,
+ DEFAULT_SEND_WINDOW_SIZE,
+ DEFAULT_PRODUCER_MAX_RATE,
+ DEFAULT_MIN_LARGE_MESSAGE_SIZE,
+ DEFAULT_BLOCK_ON_ACKNOWLEDGE,
+ DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND,
+ DEFAULT_BLOCK_ON_PERSISTENT_SEND,
+ DEFAULT_AUTO_GROUP,
+ DEFAULT_MAX_CONNECTIONS,
+ DEFAULT_PRE_ACKNOWLEDGE,
+ DEFAULT_ACK_BATCH_SIZE,
+ DEFAULT_RETRY_ON_FAILURE,
+ DEFAULT_RETRY_INTERVAL,
+ DEFAULT_RETRY_INTERVAL_MULTIPLIER,
+ DEFAULT_MAX_RETRIES);
ClientSession session = csf.createSession(false, true, true);
More information about the jboss-cvs-commits
mailing list