[jboss-cvs] JBoss Messaging SVN: r4466 - in trunk: src/main/org/jboss/messaging/core/client and 15 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jun 13 16:01:20 EDT 2008
Author: timfox
Date: 2008-06-13 16:01:20 -0400 (Fri, 13 Jun 2008)
New Revision: 4466
Modified:
trunk/src/config/jbm-configuration.xml
trunk/src/main/org/jboss/messaging/core/client/ConnectionParams.java
trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionFactoryImpl.java
trunk/src/main/org/jboss/messaging/core/client/impl/ClientConsumerImpl.java
trunk/src/main/org/jboss/messaging/core/client/impl/ClientConsumerPacketHandler.java
trunk/src/main/org/jboss/messaging/core/client/impl/ClientProducerPacketHandler.java
trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionParamsImpl.java
trunk/src/main/org/jboss/messaging/core/config/Configuration.java
trunk/src/main/org/jboss/messaging/core/config/impl/ConfigurationImpl.java
trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/AcceptorFactoryImpl.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingConfigurationValidator.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingServiceImpl.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaAcceptor.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaConnector.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaHandler.java
trunk/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java
trunk/src/main/org/jboss/messaging/core/server/impl/ServerConsumerImpl.java
trunk/src/main/org/jboss/messaging/core/server/impl/ServerPacketHandlerSupport.java
trunk/src/main/org/jboss/messaging/core/server/impl/ServerSessionImpl.java
trunk/tests/src/org/jboss/messaging/tests/integration/CoreClientTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/impl/ClientCrashTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/mina/ClientKeepAliveTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/mina/ServerKeepAliveTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/mina/TestSupport.java
trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/impl/JMSServerManagerimplTest.java
trunk/tests/src/org/jboss/messaging/tests/performance/remoting/impl/MeasureBase.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/client/impl/ClientConsumerPacketHandlerTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/ConfigurationTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactoryImplTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/ConnectorRegistryImplTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/RemotingConfigurationValidatorTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/RemotingConnectionTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/RemotingServiceImplTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/network/ClientNetworkFailureTest.java
Log:
Various changes in configuration
Modified: trunk/src/config/jbm-configuration.xml
===================================================================
--- trunk/src/config/jbm-configuration.xml 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/src/config/jbm-configuration.xml 2008-06-13 20:01:20 UTC (rev 4466)
@@ -78,7 +78,7 @@
<create-journal-dir>true</create-journal-dir>
- <journal-type>asyncio</journal-type>
+ <journal-type>ASYNCIO</journal-type>
<!-- Does the journal sync to disk on each transaction commit, prepare or rollback? -->
<journal-sync-transactional>true</journal-sync-transactional>
@@ -89,7 +89,7 @@
<!-- 10 MB journal file size -->
<journal-file-size>10485760</journal-file-size>
- <journal-min-files>40</journal-min-files>
+ <journal-min-files>10</journal-min-files>
<!-- Maximum simultaneous asynchronous writes accepted by the native layer.
(parameter ignored on NIO)
Modified: trunk/src/main/org/jboss/messaging/core/client/ConnectionParams.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/ConnectionParams.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/src/main/org/jboss/messaging/core/client/ConnectionParams.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -1,3 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.core.client;
import java.io.Serializable;
@@ -5,41 +26,28 @@
/**
* A set of connection params used by the client connection.
*
- * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ * @author <a href="mailto:ataylor at redhat.com">Andy Taylor</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
*/
public interface ConnectionParams extends Serializable
-{
- int DEFAULT_KEEP_ALIVE_INTERVAL = 10000; // in ms
- int DEFAULT_KEEP_ALIVE_TIMEOUT = 5000; // ms
- int DEFAULT_REQRES_TIMEOUT = 5000; // in ms
- boolean DEFAULT_INVM_DISABLED = false;
- boolean DEFAULT_SSL_ENABLED = false;
- public final static String REMOTING_SSL_KEYSTORE_PATH = "remoting.ssl.keystore.path";
- public final static String REMOTING_SSL_KEYSTORE_PASSWORD = "remoting.ssl.keystore.password";
- public final static String REMOTING_SSL_TRUSTSTORE_PATH = "remoting.ssl.truststore.path";
- public final static String REMOTING_SSL_TRUSTSTORE_PASSWORD = "remoting.ssl.truststore.password";
- public final static String REMOTING_ENABLE_SSL = "remoting.enable.ssl";
+{
+ long getBlockingCallTimeout();
- long getTimeout();
+ void setBlockingCallTimeout(long timeout);
- void setTimeout(long timeout);
+ long getPingInterval();
- long getKeepAliveInterval();
+ void setPingInterval(long pingInterval);
- void setKeepAliveInterval(long keepAliveInterval);
+ long getPingTimeout();
- long getKeepAliveTimeout();
+ void setPingTimeout(long pingTimeout);
- void setKeepAliveTimeout(long keepAliveTimeout);
-
boolean isInvmDisabled();
void setInvmDisabled(boolean invmDisabled);
- boolean isInvmDisabledModified();
-
- void setInvmDisabledModified(boolean invmDisabledModified);
-
boolean isTcpNoDelay();
void setTcpNoDelay(boolean tcpNoDelay);
@@ -56,10 +64,6 @@
void setSSLEnabled(boolean sslEnabled);
- boolean isSSLEnabledModified();
-
- void setSSLEnabledModified(boolean sslEnabledModified);
-
String getKeyStorePath();
void setKeyStorePath(String keyStorePath);
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionFactoryImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionFactoryImpl.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionFactoryImpl.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -45,7 +45,7 @@
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
* @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
- * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ * @author <a href="mailto:ataylor at redhat.com">Andy Taylor</a>
*
* @version <tt>$Revision: 3602 $</tt>
*
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientConsumerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientConsumerImpl.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientConsumerImpl.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -230,8 +230,6 @@
throw new MessagingException(MessagingException.ILLEGAL_STATE,"Cannot set MessageHandler - consumer is in receive(...)");
}
- log.info("Setting handler");
-
waitForOnMessageToComplete();
this.handler = handler;
@@ -374,8 +372,6 @@
public void recover(final long lastDeliveryID)
{
- log.info("Calling recover with " + lastDeliveryID);
-
ignoreDeliveryMark = lastDeliveryID;
buffer.clear();
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientConsumerPacketHandler.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientConsumerPacketHandler.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientConsumerPacketHandler.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -36,25 +36,24 @@
public void handle(final Packet packet, final PacketReturner sender)
{
- try
+ byte type = packet.getType();
+
+ if (type == EmptyPacket.RECEIVE_MSG)
{
- byte type = packet.getType();
+ ReceiveMessage message = (ReceiveMessage) packet;
- if (type == EmptyPacket.RECEIVE_MSG)
+ try
{
- ReceiveMessage message = (ReceiveMessage) packet;
-
clientConsumer.handleMessage(message.getClientMessage());
}
- else
+ catch (Exception e)
{
- throw new IllegalStateException("Invalid packet: " + type);
+ log.error("Failed to handle packet " + packet);
}
-
}
- catch (Exception e)
+ else
{
- log.error("Failed to handle message", e);
+ throw new IllegalStateException("Invalid packet: " + type);
}
}
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientProducerPacketHandler.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientProducerPacketHandler.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientProducerPacketHandler.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -35,26 +35,26 @@
}
public void handle(final Packet packet, final PacketReturner sender)
- {
- try
+ {
+ byte type = packet.getType();
+
+ if (type == EmptyPacket.PROD_RECEIVETOKENS)
{
- byte type = packet.getType();
+ ProducerFlowCreditMessage message = (ProducerFlowCreditMessage) packet;
- if (type == EmptyPacket.PROD_RECEIVETOKENS)
+ try
{
- ProducerFlowCreditMessage message = (ProducerFlowCreditMessage) packet;
-
clientProducer.receiveCredits(message.getTokens());
}
- else
+ catch (Exception e)
{
- throw new IllegalStateException("Invalid packet: " + type);
+ log.error("Failed to handle packet " + packet, e);
}
}
- catch (Exception e)
+ else
{
- log.error("Failed to handle packet", e);
- }
+ throw new IllegalStateException("Invalid packet: " + type);
+ }
}
@Override
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionParamsImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionParamsImpl.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionParamsImpl.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -25,54 +25,96 @@
/**
* @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
*/
public class ConnectionParamsImpl implements ConnectionParams
{
+ //Constants ---------------------------------------------------------------------------------------
+
+ public static final int DEFAULT_PING_INTERVAL = 10000; // in ms
+
+ public static final int DEFAULT_PING_TIMEOUT = 5000; // ms
+
+ public static final int DEFAULT_BLOCKING_CALL_TIMEOUT = 5000; // in ms
+
+ public static final boolean DEFAULT_INVM_DISABLED = false;
+
+ public static final boolean DEFAULT_TCP_NODELAY = true;
+
+ public static final int DEFAULT_TCP_RECEIVE_BUFFER_SIZE = 32 * 1024; // in bytes
+
+ public static final int DEFAULT_TCP_SEND_BUFFER_SIZE = 32 * 1024; // in bytes
+
+ public static final boolean DEFAULT_SSL_ENABLED = false;
+
+ public static final String REMOTING_SSL_KEYSTORE_PATH_PROPERTY_NAME = "remoting.ssl.keystore.path";
+
+ public static final String REMOTING_SSL_KEYSTORE_PASSWORD_PROPERTY_NAME = "remoting.ssl.keystore.password";
+
+ public static final String REMOTING_SSL_TRUSTSTORE_PATH_PROPERTY_NAME = "remoting.ssl.truststore.path";
+
+ public static final String REMOTING_SSL_TRUSTSTORE_PASSWORD_PROPERTY_NAME = "remoting.ssl.truststore.password";
+
+ public static final String REMOTING_ENABLE_SSL_PROPERTY_NAME = "remoting.enable.ssl";
+
+
+
private static final long serialVersionUID = 1662480686951551534L;
- protected long timeout = DEFAULT_REQRES_TIMEOUT;
- protected long keepAliveInterval = DEFAULT_KEEP_ALIVE_INTERVAL;
- protected long keepAliveTimeout = DEFAULT_KEEP_ALIVE_TIMEOUT;
- protected boolean invmDisabled = DEFAULT_INVM_DISABLED;
- protected boolean invmDisabledModified = false;
- protected boolean tcpNoDelay;
- protected int tcpReceiveBufferSize = -1;
- protected int tcpSendBufferSize = -1;
- protected boolean sslEnabled = DEFAULT_SSL_ENABLED;
- protected boolean sslEnabledModified = false;
- protected String keyStorePath;
- protected String keyStorePassword;
- protected String trustStorePath;
- protected String trustStorePassword;
+ // Attributes -------------------------------------------------------------------------------------
- public long getTimeout()
+ private long blockingCallTimeout = DEFAULT_BLOCKING_CALL_TIMEOUT;
+
+ private long pingInterval = DEFAULT_PING_INTERVAL;
+
+ private long pingTimeout = DEFAULT_PING_TIMEOUT;
+
+ private boolean invmDisabled = DEFAULT_INVM_DISABLED;
+
+ private boolean tcpNoDelay = DEFAULT_TCP_NODELAY;
+
+ private int tcpReceiveBufferSize = DEFAULT_TCP_RECEIVE_BUFFER_SIZE;
+
+ private int tcpSendBufferSize = DEFAULT_TCP_SEND_BUFFER_SIZE;
+
+ private boolean sslEnabled = DEFAULT_SSL_ENABLED;
+
+ private String keyStorePath;
+
+ private String keyStorePassword;
+
+ private String trustStorePath;
+
+ private String trustStorePassword;
+
+ public long getBlockingCallTimeout()
{
- return timeout;
+ return blockingCallTimeout;
}
- public void setTimeout(long timeout)
+ public void setBlockingCallTimeout(final long timeout)
{
- this.timeout = timeout;
+ this.blockingCallTimeout = timeout;
}
- public long getKeepAliveInterval()
+ public long getPingInterval()
{
- return keepAliveInterval;
+ return pingInterval;
}
- public void setKeepAliveInterval(long keepAliveInterval)
+ public void setPingInterval(final long pingInterval)
{
- this.keepAliveInterval = keepAliveInterval;
+ this.pingInterval = pingInterval;
}
- public long getKeepAliveTimeout()
+ public long getPingTimeout()
{
- return keepAliveTimeout;
+ return pingTimeout;
}
- public void setKeepAliveTimeout(long keepAliveTimeout)
+ public void setPingTimeout(final long pingTimeout)
{
- this.keepAliveTimeout = keepAliveTimeout;
+ this.pingTimeout = pingTimeout;
}
public boolean isInvmDisabled()
@@ -80,27 +122,17 @@
return invmDisabled;
}
- public void setInvmDisabled(boolean invmDisabled)
+ public void setInvmDisabled(final boolean invmDisabled)
{
this.invmDisabled = invmDisabled;
}
- public boolean isInvmDisabledModified()
- {
- return invmDisabledModified;
- }
-
- public void setInvmDisabledModified(boolean invmDisabledModified)
- {
- this.invmDisabledModified = invmDisabledModified;
- }
-
public boolean isTcpNoDelay()
{
return tcpNoDelay;
}
- public void setTcpNoDelay(boolean tcpNoDelay)
+ public void setTcpNoDelay(final boolean tcpNoDelay)
{
this.tcpNoDelay = tcpNoDelay;
}
@@ -110,7 +142,7 @@
return tcpReceiveBufferSize;
}
- public void setTcpReceiveBufferSize(int tcpReceiveBufferSize)
+ public void setTcpReceiveBufferSize(final int tcpReceiveBufferSize)
{
this.tcpReceiveBufferSize = tcpReceiveBufferSize;
}
@@ -120,83 +152,77 @@
return tcpSendBufferSize;
}
- public void setTcpSendBufferSize(int tcpSendBufferSize)
+ public void setTcpSendBufferSize(final int tcpSendBufferSize)
{
this.tcpSendBufferSize = tcpSendBufferSize;
}
public boolean isSSLEnabled()
{
- String sslEnabledProperty = System.getProperty(REMOTING_ENABLE_SSL);
- return sslEnabledProperty==null?sslEnabled:sslEnabledProperty.equalsIgnoreCase("true");
+ String sslEnabledProperty = System.getProperty(REMOTING_ENABLE_SSL_PROPERTY_NAME);
+
+ return sslEnabledProperty == null ? sslEnabled : sslEnabledProperty.equalsIgnoreCase("true");
}
- public void setSSLEnabled(boolean sslEnabled)
+ public void setSSLEnabled(final boolean sslEnabled)
{
this.sslEnabled = sslEnabled;
}
- public boolean isSSLEnabledModified()
- {
- return sslEnabledModified;
- }
-
- public void setSSLEnabledModified(boolean sslEnabledModified)
- {
- this.sslEnabledModified = sslEnabledModified;
- }
-
public String getKeyStorePath()
{
- String sslKeystorePath = System.getProperty(REMOTING_SSL_KEYSTORE_PATH);
- return sslKeystorePath == null?keyStorePath:sslKeystorePath;
+ String sslKeystorePath = System.getProperty(REMOTING_SSL_KEYSTORE_PATH_PROPERTY_NAME);
+
+ return sslKeystorePath == null ? keyStorePath : sslKeystorePath;
}
- public void setKeyStorePath(String keyStorePath)
+ public void setKeyStorePath(final String keyStorePath)
{
this.keyStorePath = keyStorePath;
}
public String getKeyStorePassword()
{
- String keyStorePass = System.getProperty(REMOTING_SSL_KEYSTORE_PASSWORD);
- return keyStorePass == null?keyStorePassword:keyStorePass;
+ String keyStorePass = System.getProperty(REMOTING_SSL_KEYSTORE_PASSWORD_PROPERTY_NAME);
+
+ return keyStorePass == null ? keyStorePassword : keyStorePass;
}
- public void setKeyStorePassword(String keyStorePassword)
+ public void setKeyStorePassword(final String keyStorePassword)
{
this.keyStorePassword = keyStorePassword;
}
public String getTrustStorePath()
{
- String sslTruststorePath = System.getProperty(REMOTING_SSL_TRUSTSTORE_PATH);
- return sslTruststorePath==null?trustStorePath:sslTruststorePath;
+ String sslTruststorePath = System.getProperty(REMOTING_SSL_TRUSTSTORE_PATH_PROPERTY_NAME);
+
+ return sslTruststorePath == null ? trustStorePath : sslTruststorePath;
}
- public void setTrustStorePath(String trustStorePath)
+ public void setTrustStorePath(final String trustStorePath)
{
this.trustStorePath = trustStorePath;
}
public String getTrustStorePassword()
{
- String trustStorePass = System.getProperty(REMOTING_SSL_TRUSTSTORE_PASSWORD);
- return trustStorePass==null?trustStorePassword:trustStorePass;
+ String trustStorePass = System.getProperty(REMOTING_SSL_TRUSTSTORE_PASSWORD_PROPERTY_NAME);
+
+ return trustStorePass == null ? trustStorePassword : trustStorePass;
}
- public void setTrustStorePassword(String trustStorePassword)
+ public void setTrustStorePassword(final String trustStorePassword)
{
this.trustStorePassword = trustStorePassword;
}
-
+
public String getURI()
{
StringBuffer buff = new StringBuffer();
- //buff.append(transport + "://" + host + ":" + port);
- buff.append("?").append("timeout=").append(timeout);
- buff.append("&").append("keepAliveInterval=").append(keepAliveInterval);
- buff.append("&").append("keepAliveTimeout=").append(keepAliveTimeout);
+ buff.append("?").append("blockingCallTimeout=").append(blockingCallTimeout);
+ buff.append("&").append("pingInterval=").append(pingInterval);
+ buff.append("&").append("pingTimeout=").append(pingTimeout);
buff.append("&").append("invmDisabled=").append(invmDisabled);
buff.append("&").append("tcpNoDelay=").append(tcpNoDelay);
buff.append("&").append("tcpReceiveBufferSize=").append(tcpReceiveBufferSize);
@@ -207,6 +233,11 @@
return buff.toString();
}
+ public String toString()
+ {
+ return "ConnectionParamsImpl:" + System.identityHashCode(this) + ":" + getURI();
+ }
+
public boolean equals(Object other)
{
if (other instanceof ConnectionParams == false)
@@ -216,15 +247,13 @@
ConnectionParams cp = (ConnectionParams)other;
- return cp.getTimeout() == timeout &&
- cp.getKeepAliveTimeout() == this.keepAliveTimeout &&
- cp.getKeepAliveInterval() == this.keepAliveInterval &&
+ return cp.getBlockingCallTimeout() == blockingCallTimeout &&
+ cp.getPingTimeout() == this.pingTimeout &&
+ cp.getPingInterval() == this.pingInterval &&
cp.isInvmDisabled() == this.isInvmDisabled() &&
- cp.isInvmDisabledModified() == this.isInvmDisabledModified() &&
cp.isTcpNoDelay() == this.isTcpNoDelay() &&
cp.getTcpReceiveBufferSize() == this.getTcpReceiveBufferSize() &&
cp.getTcpSendBufferSize() == this.getTcpSendBufferSize() &&
- cp.isSSLEnabled() == this.isSSLEnabled() &&
- cp.isSSLEnabledModified() == this.isSSLEnabledModified();
+ cp.isSSLEnabled() == this.isSSLEnabled();
}
}
Modified: trunk/src/main/org/jboss/messaging/core/config/Configuration.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/Configuration.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/src/main/org/jboss/messaging/core/config/Configuration.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -21,12 +21,13 @@
*/
package org.jboss.messaging.core.config;
+import java.io.Serializable;
import java.util.List;
+import org.jboss.messaging.core.client.ConnectionParams;
+import org.jboss.messaging.core.client.Location;
import org.jboss.messaging.core.remoting.TransportType;
import org.jboss.messaging.core.server.JournalType;
-import org.jboss.messaging.core.client.Location;
-import org.jboss.messaging.core.client.ConnectionParams;
/**
*
@@ -35,87 +36,135 @@
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
*
*/
-public interface Configuration
+public interface Configuration extends Serializable
{
+ // General attributes -------------------------------------------------------------------
+
List<String> getDefaultInterceptors();
- Boolean isClustered();
+ boolean isClustered();
+
+ void setClustered(boolean clustered);
- Integer getScheduledThreadPoolMaxSize();
+ int getScheduledThreadPoolMaxSize();
- Integer getThreadPoolMaxSize();
+ void setScheduledThreadPoolMaxSize(int maxSize);
+
+ int getThreadPoolMaxSize();
+
+ void setThreadPoolMaxSize(int maxSize);
long getSecurityInvalidationInterval();
+
+ void setSecurityInvalidationInterval(long interval);
+
+ boolean isSecurityEnabled();
+
+ void setSecurityEnabled(boolean enabled);
+
+ boolean isRequireDestinations();
+
+ void setRequireDestinations(boolean require);
+ // Remoting related attributes ----------------------------------------------------------
+
+ int getServerID();
+
+ void setServerID(int id);
+
+ ConnectionParams getConnectionParams();
+
TransportType getTransport();
+
+ void setTransport(TransportType transport);
String getHost();
+
+ void setHost(String host);
int getPort();
+
+ void setPort(int port);
Location getLocation();
-
- /**
- * The server ID is used only when the messaging server
- * is started in INVM transport.
- */
- int getServerID();
+
+ String getKeyStorePath();
- boolean isTcpNoDelay();
-
- int getTcpReceiveBufferSize();
+ void setKeyStorePath(String path);
- int getTcpSendBufferSize();
-
- long getKeepAliveInterval();
-
- long getKeepAliveTimeout();
-
- long getTimeout();
+ String getKeyStorePassword();
- boolean isSecurityEnabled();
+ void setKeyStorePassword(String password);
- String getKeyStorePath();
-
- String getKeyStorePassword();
-
String getTrustStorePath();
+
+ void setTrustStorePath(String path);
String getTrustStorePassword();
-
- boolean isInvmDisabled();
-
+
+ void setTrustStorePassword(String password);
+
boolean isSSLEnabled();
+
+ void setSSLEnabled(boolean enabled);
+
+ boolean isInVMDisabled();
+
+ void setInVMDisabled(boolean disabled);
- String getURI();
-
+ /**
+ * The server ID is used only when the messaging server
+ * is started in INVM transport.
+ */
+ // int getServerID();
+
+ // Journal related attributes
+
String getBindingsDirectory();
+
+ void setBindingsDirectory(String dir);
String getJournalDirectory();
+
+ void setJournalDirectory(String dir);
JournalType getJournalType();
+
+ void setJournalType(JournalType type);
boolean isJournalSyncTransactional();
+ void setJournalSyncTransactional(boolean sync);
+
boolean isJournalSyncNonTransactional();
+
+ void setJournalSyncNonTransactional(boolean sync);
int getJournalFileSize();
+
+ void setJournalFileSize(int size);
int getJournalMinFiles();
+ void setJournalMinFiles(int files);
+
int getJournalMaxAIO();
+ void setJournalMaxAIO(int maxAIO);
+
long getJournalAIOTimeout();
- void setJournalMaxAIO(int max);
-
+ void setJournalAIOTimeout(long timeout);
+
long getJournalTaskPeriod();
+
+ void setJournalTaskPeriod(long period);
boolean isCreateBindingsDir();
+
+ void setCreateBindingsDir(boolean create);
boolean isCreateJournalDir();
-
- boolean isRequireDestinations();
-
- ConnectionParams getConnectionParams();
+
+ void setCreateJournalDir(boolean create);
}
Modified: trunk/src/main/org/jboss/messaging/core/config/impl/ConfigurationImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/impl/ConfigurationImpl.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/src/main/org/jboss/messaging/core/config/impl/ConfigurationImpl.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -21,7 +21,6 @@
*/
package org.jboss.messaging.core.config.impl;
-import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@@ -37,113 +36,212 @@
* @author <a href="mailto:ataylor at redhat.com>Andy Taylor</a>
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
*/
-public class ConfigurationImpl implements Configuration, Serializable
+public class ConfigurationImpl implements Configuration
{
- private static final long serialVersionUID = 4077088945050267843L;
-
+ // Constants ------------------------------------------------------------------------------
+
public static final String REMOTING_DISABLE_INVM_SYSPROP_KEY = "jbm.remoting.disable.invm";
public static final String REMOTING_ENABLE_SSL_SYSPROP_KEY = "jbm.remoting.enable.ssl";
+ public static final boolean DEFAULT_CLUSTERED = false;
+
+ public static final int DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE = 30;
+
+ public static final int DEFAULT_THREAD_POOL_MAX_SIZE = 30;
+
+ public static final String DEFAULT_HOST = "localhost";
+
+ public static final TransportType DEFAULT_TRANSPORT = TransportType.TCP;
+
public static final int DEFAULT_REMOTING_PORT = 5400;
+
+ public static final long DEFAULT_SECURITY_INVALIDATION_INTERVAL = 10000;
+
+ public static final boolean DEFAULT_REQUIRE_DESTINATIONS = false;
+
+ public static final boolean DEFAULT_SECURITY_ENABLED = true;
+
public static final boolean DEFAULT_INVM_DISABLED = false;
+
public static final boolean DEFAULT_SSL_ENABLED = false;
- public static final int DEFAULT_MAX_AIO = 3000;
- public static final long DEFAULT_AIO_TIMEOUT = 90000; // in ms
+ public static final String DEFAULT_KEYSTORE_PATH = "messaging.keystore";
+
+ public static final String DEFAULT_KEYSTORE_PASSWORD = "secureexample";
+
+ public static final String DEFAULT_TRUSTSTORE_PATH = "messaging.truststore";
+
+ public static final String DEFAULT_TRUSTSTORE_PASSWORD = "secureexample";
+
+ public static final String DEFAULT_BINDINGS_DIRECTORY = "data/bindings";
+
+ public static final boolean DEFAULT_CREATE_BINDINGS_DIR = true;
+
+ public static final String DEFAULT_JOURNAL_DIR = "data/journal";
+
+ public static final boolean DEFAULT_CREATE_JOURNAL_DIR = true;
+
+ public static final JournalType DEFAULT_JOURNAL_TYPE = JournalType.ASYNCIO;
+
+ public static final boolean DEFAULT_JOURNAL_SYNC_TRANSACTIONAL = true;
+
+ public static final boolean DEFAULT_JOURNAL_SYNC_NON_TRANSACTIONAL = false;
+
+ public static final int DEFAULT_JOURNAL_FILE_SIZE = 10485760;
+
+ public static final int DEFAULT_JOURNAL_MIN_FILES = 10;
+
+ public static final int DEFAULT_MAX_AIO = 5000;
+
+ public static final long DEFAULT_AIO_TIMEOUT = 60000; // in ms
+
+ public static final long DEFAULT_JOURNAL_TASK_PERIOD = 5000;
+
+
+
+ private static final long serialVersionUID = 4077088945050267843L;
+
+
+ // Attributes -----------------------------------------------------------------------------
+
protected List<String> defaultInterceptors = new ArrayList<String>();
- protected boolean clustered = false;
+ protected boolean clustered = DEFAULT_CLUSTERED;
- protected int scheduledThreadPoolMaxSize = 30;
+ protected int scheduledThreadPoolMaxSize = DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE;
- protected int threadPoolMaxSize = 30;
+ protected int threadPoolMaxSize = DEFAULT_THREAD_POOL_MAX_SIZE;
- protected long securityInvalidationInterval = 10000;
+ protected long securityInvalidationInterval = DEFAULT_SECURITY_INVALIDATION_INTERVAL;
- protected boolean requireDestinations;
+ protected boolean requireDestinations = DEFAULT_REQUIRE_DESTINATIONS;
- //Persistence config
+ protected boolean securityEnabled = DEFAULT_SECURITY_ENABLED;
+
- protected String bindingsDirectory;
+ // Journal related attributes
- protected boolean createBindingsDir;
+ protected String bindingsDirectory = DEFAULT_BINDINGS_DIRECTORY;
- protected String journalDirectory;
+ protected boolean createBindingsDir = DEFAULT_CREATE_BINDINGS_DIR;
- protected boolean createJournalDir;
+ protected String journalDirectory = DEFAULT_JOURNAL_DIR;
- public JournalType journalType;
+ protected boolean createJournalDir = DEFAULT_CREATE_JOURNAL_DIR;
- protected boolean journalSyncTransactional = true;
+ public JournalType journalType = DEFAULT_JOURNAL_TYPE;
- protected boolean journalSyncNonTransactional = false;
+ protected boolean journalSyncTransactional = DEFAULT_JOURNAL_SYNC_TRANSACTIONAL;
- protected int journalFileSize;
+ protected boolean journalSyncNonTransactional = DEFAULT_JOURNAL_SYNC_NON_TRANSACTIONAL;
- protected int journalMinFiles;
+ protected int journalFileSize = DEFAULT_JOURNAL_FILE_SIZE;
- protected int journalMaxAIO;
+ protected int journalMinFiles = DEFAULT_JOURNAL_MIN_FILES;
- protected long journalAIOTimeout;
+ protected int journalMaxAIO = DEFAULT_MAX_AIO;
- protected long journalTaskPeriod;
+ protected long journalAIOTimeout = DEFAULT_AIO_TIMEOUT;
- protected boolean securityEnabled = true;
-
+ protected long journalTaskPeriod = DEFAULT_JOURNAL_TASK_PERIOD;
+
// remoting config
- protected TransportType transport;
- protected String host;
- protected int port = DEFAULT_REMOTING_PORT;
+ //TODO - do we really need this sever id??? I don't see why
protected int serverID = 0;
+
+ protected TransportType transport = DEFAULT_TRANSPORT;
- protected long timeout = ConnectionParams.DEFAULT_REQRES_TIMEOUT;
- protected long keepAliveInterval = ConnectionParams.DEFAULT_KEEP_ALIVE_INTERVAL;
- protected long keepAliveTimeout = ConnectionParams.DEFAULT_KEEP_ALIVE_TIMEOUT;
- protected boolean invmDisabled = DEFAULT_INVM_DISABLED;
- protected boolean invmDisabledModified = false;
- protected boolean tcpNoDelay;
+ protected String host = DEFAULT_HOST;
+
+ protected int port = DEFAULT_REMOTING_PORT;
+
+ protected boolean inVMDisabled = DEFAULT_INVM_DISABLED;
- protected int tcpReceiveBufferSize = -1;
- protected int tcpSendBufferSize = -1;
+ protected final ConnectionParams defaultConnectionParams = new ConnectionParamsImpl();
+
protected boolean sslEnabled = DEFAULT_SSL_ENABLED;
- protected boolean sslEnabledModified = false;
- protected String keyStorePath;
- protected String keyStorePassword;
- protected String trustStorePath;
- protected String trustStorePassword;
-
+
+ protected String keyStorePath = DEFAULT_KEYSTORE_PATH;
+
+ protected String keyStorePassword = DEFAULT_KEYSTORE_PASSWORD;
+
+ protected String trustStorePath = DEFAULT_TRUSTSTORE_PATH;
+
+ protected String trustStorePassword = DEFAULT_TRUSTSTORE_PASSWORD;
+
+
public List<String> getDefaultInterceptors()
{
return defaultInterceptors;
}
- public Boolean isClustered()
+ public boolean isClustered()
{
return clustered;
}
- public Integer getScheduledThreadPoolMaxSize()
+ public void setClustered(boolean clustered)
{
+ this.clustered = clustered;
+ }
+
+ public int getScheduledThreadPoolMaxSize()
+ {
return scheduledThreadPoolMaxSize;
}
- public Integer getThreadPoolMaxSize()
+ public void setScheduledThreadPoolMaxSize(int maxSize)
{
+ this.scheduledThreadPoolMaxSize = maxSize;
+ }
+
+ public int getThreadPoolMaxSize()
+ {
return threadPoolMaxSize;
}
+
+ public void setThreadPoolMaxSize(int maxSize)
+ {
+ this.threadPoolMaxSize = maxSize;
+ }
public long getSecurityInvalidationInterval()
{
return this.securityInvalidationInterval;
}
+ public void setSecurityInvalidationInterval(long interval)
+ {
+ this.securityInvalidationInterval = interval;
+ }
+
+ public boolean isRequireDestinations()
+ {
+ return requireDestinations;
+ }
+
+ public void setRequireDestinations(boolean require)
+ {
+ this.requireDestinations = require;
+ }
+
+ public int getServerID()
+ {
+ return serverID;
+ }
+
+ public void setServerID(int id)
+ {
+ this.serverID = id;
+ }
+
public TransportType getTransport()
{
return transport;
}
-
+
public void setTransport(TransportType transport)
{
this.transport = transport;
@@ -156,11 +254,9 @@
public void setHost(String host)
{
- assert host != null;
-
this.host = host;
}
-
+
public int getPort()
{
return port;
@@ -170,116 +266,79 @@
{
this.port = port;
}
-
+
public Location getLocation()
{
if (transport == TransportType.INVM)
+ {
return new LocationImpl(serverID);
+ }
else
+ {
return new LocationImpl(transport, host, port);
+ }
}
- public int getServerID()
+ public String getKeyStorePath()
{
- return serverID;
+ return keyStorePath;
}
- public void setServerID(int serverID)
+ public void setKeyStorePath(String path)
{
- this.serverID = serverID;
+ this.keyStorePath = path;
}
-
- public long getKeepAliveInterval()
- {
- return keepAliveInterval;
- }
-
- public void setKeepAliveInterval(long keepAliveInterval)
- {
- this.keepAliveInterval = keepAliveInterval;
- }
- public long getKeepAliveTimeout()
- {
- return keepAliveTimeout;
- }
-
- public void setKeepAliveTimeout(long keepAliveTimeout)
- {
- this.keepAliveTimeout = keepAliveTimeout;
- }
-
- public long getTimeout()
- {
- return timeout;
- }
-
- public String getKeyStorePath()
- {
- return keyStorePath;
- }
-
- public void setKeyStorePath(String keyStorePath)
- {
- this.keyStorePath = keyStorePath;
- }
-
public String getKeyStorePassword()
{
return keyStorePassword;
}
- public void setKeyStorePassword(String keyStorePassword)
+ public void setKeyStorePassword(String password)
{
- this.keyStorePassword = keyStorePassword;
+ this.keyStorePassword = password;
}
public String getTrustStorePath()
{
return trustStorePath;
}
-
- public void setTrustStorePath(String trustStorePath)
+
+ public void setTrustStorePath(String path)
{
- this.trustStorePath = trustStorePath;
+ this.trustStorePath = path;
}
-
+
public String getTrustStorePassword()
{
return trustStorePassword;
}
- public void setTrustStorePassword(String trustStorePassword)
+ public void setTrustStorePassword(String password)
{
- this.trustStorePassword = trustStorePassword;
+ this.trustStorePassword = password;
}
-
- public boolean isInvmDisabled()
+
+ public boolean isInVMDisabled()
{
- if (System.getProperty(REMOTING_DISABLE_INVM_SYSPROP_KEY) != null && !invmDisabledModified)
+ if (System.getProperty(REMOTING_DISABLE_INVM_SYSPROP_KEY) != null)
{
return Boolean.parseBoolean(System.getProperty(REMOTING_DISABLE_INVM_SYSPROP_KEY));
}
else
{
- return invmDisabled;
+ return inVMDisabled;
}
}
- public void setInvmDisabled(boolean invmDisabled)
+ public void setInVMDisabled(boolean disabled)
{
- this.invmDisabled = invmDisabled;
- this.invmDisabledModified = true;
+ this.inVMDisabled = disabled;
}
- public void setSecurityEnabled(final boolean enabled)
- {
- this.securityEnabled = enabled;
- }
-
public boolean isSSLEnabled()
{
- if (System.getProperty(REMOTING_ENABLE_SSL_SYSPROP_KEY) != null && !sslEnabledModified)
+ if (System.getProperty(REMOTING_ENABLE_SSL_SYSPROP_KEY) != null)
{
return Boolean.parseBoolean(System.getProperty(REMOTING_ENABLE_SSL_SYSPROP_KEY));
}
@@ -289,68 +348,30 @@
}
}
- public void setSSLEnabled(boolean sslEnabled)
+ public void setSSLEnabled(boolean enabled)
{
- this.sslEnabled = sslEnabled;
- this.sslEnabledModified = true;
+ this.sslEnabled = enabled;
}
-
- public boolean isTcpNoDelay()
- {
- return this.tcpNoDelay;
- }
-
- public void setTcpNoDelay(boolean tcpNoDelay)
- {
- this.tcpNoDelay = tcpNoDelay;
- }
-
- public int getTcpReceiveBufferSize()
- {
- return this.tcpReceiveBufferSize;
- }
-
- public void setTcpReceiveBufferSize(int size)
- {
- this.tcpReceiveBufferSize = size;
- }
-
- public int getTcpSendBufferSize()
- {
- return this.tcpSendBufferSize;
- }
-
- public void setTcpSendBufferSize(int size)
- {
- this.tcpSendBufferSize = size;
- }
- public String getURI()
- {
- StringBuffer buff = new StringBuffer();
- buff.append(transport + "://" + host + ":" + port);
- buff.append("?").append("timeout=").append(timeout);
- buff.append("&").append("keepAliveInterval=").append(keepAliveInterval);
- buff.append("&").append("keepAliveTimeout=").append(keepAliveTimeout);
- buff.append("&").append("invmDisabled=").append(invmDisabled);
- buff.append("&").append("tcpNoDelay=").append(tcpNoDelay);
- buff.append("&").append("tcpReceiveBufferSize=").append(tcpReceiveBufferSize);
- buff.append("&").append("tcpSendBufferSize=").append(tcpSendBufferSize);
- buff.append("&").append("sslEnabled=").append(sslEnabled);
- buff.append("&").append("keyStorePath=").append(keyStorePath);
- buff.append("&").append("trustStorePath=").append(trustStorePath);
- return buff.toString();
- }
-
public String getBindingsDirectory()
{
return bindingsDirectory;
}
+
+ public void setBindingsDirectory(String dir)
+ {
+ this.bindingsDirectory = dir;
+ }
public String getJournalDirectory()
{
return journalDirectory;
}
+
+ public void setJournalDirectory(String dir)
+ {
+ this.journalDirectory = dir;
+ }
public JournalType getJournalType()
{
@@ -358,85 +379,114 @@
}
public void setJournalType(JournalType type)
- {
- this.journalType = type;
- }
-
+ {
+ this.journalType = type;
+ }
+
public boolean isJournalSyncTransactional()
{
return journalSyncTransactional;
}
+ public void setJournalSyncTransactional(boolean sync)
+ {
+ this.journalSyncTransactional = sync;
+ }
+
public boolean isJournalSyncNonTransactional()
{
return journalSyncNonTransactional;
}
+
+ public void setJournalSyncNonTransactional(boolean sync)
+ {
+ this.journalSyncNonTransactional = sync;
+ }
public int getJournalFileSize()
{
return journalFileSize;
}
+
+ public void setJournalFileSize(int size)
+ {
+ this.journalFileSize = size;
+ }
public int getJournalMaxAIO()
{
return journalMaxAIO;
}
- public void setJournalMaxAIO(int max)
- {
- this.journalMaxAIO = max;
- }
+ public void setJournalMaxAIO(int maxAIO)
+ {
+ this.journalMaxAIO = maxAIO;
+ }
public long getJournalAIOTimeout()
{
return journalAIOTimeout;
}
+
+ public void setJournalAIOTimeout(long timeout)
+ {
+ this.journalAIOTimeout = timeout;
+ }
public int getJournalMinFiles()
{
return journalMinFiles;
}
+
+ public void setJournalMinFiles(int files)
+ {
+ this.journalMinFiles = files;
+ }
public long getJournalTaskPeriod()
{
return journalTaskPeriod;
}
+
+ public void setJournalTaskPeriod(long period)
+ {
+ this.journalTaskPeriod = period;
+ }
public boolean isCreateBindingsDir()
{
return createBindingsDir;
}
- public boolean isCreateJournalDir()
+ public void setCreateBindingsDir(boolean create)
{
- return createJournalDir;
+ this.createBindingsDir = create;
}
- public boolean isRequireDestinations()
+ public boolean isCreateJournalDir()
{
- return requireDestinations;
+ return createJournalDir;
}
+
+ public void setCreateJournalDir(boolean create)
+ {
+ this.createJournalDir = create;
+ }
public boolean isSecurityEnabled()
{
return securityEnabled;
}
+
+ public void setSecurityEnabled(boolean enabled)
+ {
+ this.securityEnabled = enabled;
+ }
public ConnectionParams getConnectionParams()
{
- ConnectionParams connectionParams = new ConnectionParamsImpl();
- connectionParams.setInvmDisabled(invmDisabled);
- connectionParams.setInvmDisabledModified(invmDisabledModified);
- connectionParams.setKeepAliveInterval(keepAliveInterval);
- connectionParams.setKeepAliveTimeout(keepAliveTimeout);
- connectionParams.setSSLEnabled(sslEnabled);
- connectionParams.setSSLEnabledModified(sslEnabledModified);
- connectionParams.setTcpNoDelay(tcpNoDelay);
- connectionParams.setTcpReceiveBufferSize(tcpReceiveBufferSize);
- connectionParams.setTcpSendBufferSize(tcpSendBufferSize);
- connectionParams.setTimeout(timeout);
- return connectionParams;
+ return this.defaultConnectionParams;
}
-
+
}
Modified: trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -21,20 +21,19 @@
*/
package org.jboss.messaging.core.config.impl;
-import org.jboss.messaging.core.client.ConnectionParams;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.Serializable;
+import java.net.URL;
+import java.util.ArrayList;
+
+import org.jboss.messaging.core.client.impl.ConnectionParamsImpl;
import org.jboss.messaging.core.remoting.TransportType;
-import static org.jboss.messaging.core.remoting.TransportType.TCP;
import org.jboss.messaging.core.server.JournalType;
import org.jboss.messaging.util.XMLUtil;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.Serializable;
-import java.net.URL;
-import java.util.ArrayList;
-
/**
* ConfigurationImpl
* This class allows the Configuration class to be configured via a config file.
@@ -45,9 +44,16 @@
{
private static final long serialVersionUID = -4766689627675039596L;
- //default config file location
- private String configurationUrl = "jbm-configuration.xml";
+ // Constants ------------------------------------------------------------------------
+
+ private static final String DEFAULT_CONFIGURATION_URL = "jbm-configuration.xml";
+
+ // Attributes ----------------------------------------------------------------------
+
+ private String configurationUrl = DEFAULT_CONFIGURATION_URL;
+ // Public -------------------------------------------------------------------------
+
public void start() throws Exception
{
URL url = getClass().getClassLoader().getResource(configurationUrl);
@@ -58,34 +64,42 @@
clustered = getBoolean(e, "clustered", clustered);
+ //NOTE! All the defaults come from the super class
+
scheduledThreadPoolMaxSize = getInteger(e, "scheduled-max-pool-size", scheduledThreadPoolMaxSize);
threadPoolMaxSize = getInteger(e, "max-pool-size", threadPoolMaxSize);
+
+ requireDestinations = getBoolean(e, "require-destinations", requireDestinations);
+
+ securityEnabled = getBoolean(e, "security-enabled", securityEnabled);
+
+ transport = TransportType.valueOf(getString(e, "remoting-transport", TransportType.TCP.toString()));
- transport = TransportType.valueOf(getString(e, "remoting-transport", TCP.name()));
+ // Remoting config
+
+ host = getString(e, "remoting-host", host);
- host = getString(e, "remoting-host", "localhost");
-
if (System.getProperty("java.rmi.server.hostname") == null)
System.setProperty("java.rmi.server.hostname", host);
- port = getInteger(e, "remoting-bind-address", DEFAULT_REMOTING_PORT);
+ port = getInteger(e, "remoting-bind-address", port);
- timeout = getInteger(e, "remoting-timeout", ConnectionParams.DEFAULT_REQRES_TIMEOUT);
+ int blockingCallTimeout = getInteger(e, "remoting-timeout", ConnectionParamsImpl.DEFAULT_BLOCKING_CALL_TIMEOUT);
- invmDisabled = getBoolean(e, "remoting-disable-invm", false);
+ boolean invmDisabled = getBoolean(e, "remoting-disable-invm", ConnectionParamsImpl.DEFAULT_INVM_DISABLED);
- tcpNoDelay = getBoolean(e, "remoting-tcp-nodelay", false);
+ boolean tcpNoDelay = getBoolean(e, "remoting-tcp-nodelay", ConnectionParamsImpl.DEFAULT_TCP_NODELAY);
- tcpReceiveBufferSize = getInteger(e, "remoting-tcp-receive-buffer-size", -1);
+ int tcpReceiveBufferSize = getInteger(e, "remoting-tcp-receive-buffer-size", ConnectionParamsImpl.DEFAULT_TCP_RECEIVE_BUFFER_SIZE);
- tcpSendBufferSize = getInteger(e, "remoting-tcp-send-buffer-size", -1);
+ int tcpSendBufferSize = getInteger(e, "remoting-tcp-send-buffer-size", ConnectionParamsImpl.DEFAULT_TCP_SEND_BUFFER_SIZE);
- keepAliveInterval = getInteger(e, "remoting-keep-alive-interval", ConnectionParams.DEFAULT_KEEP_ALIVE_INTERVAL);
+ int pingInterval = getInteger(e, "remoting-keep-alive-interval", ConnectionParamsImpl.DEFAULT_PING_INTERVAL);
- keepAliveTimeout = getInteger(e, "remoting-keep-alive-timeout", ConnectionParams.DEFAULT_KEEP_ALIVE_TIMEOUT);
+ int pingTimeout = getInteger(e, "remoting-keep-alive-timeout", ConnectionParamsImpl.DEFAULT_PING_TIMEOUT);
- sslEnabled = getBoolean(e, "remoting-enable-ssl", false);
+ sslEnabled = getBoolean(e, "remoting-enable-ssl", ConnectionParamsImpl.DEFAULT_SSL_ENABLED);
keyStorePath = getString(e, "remoting-ssl-keystore-path", null);
@@ -95,54 +109,66 @@
trustStorePassword = getString(e, "remoting-ssl-truststore-password", null);
- requireDestinations = getBoolean(e, "require-destinations", requireDestinations);
+ defaultConnectionParams.setBlockingCallTimeout(blockingCallTimeout);
+
+ defaultConnectionParams.setInvmDisabled(invmDisabled);
+
+ defaultConnectionParams.setTcpNoDelay(tcpNoDelay);
+
+ defaultConnectionParams.setTcpReceiveBufferSize(tcpReceiveBufferSize);
+
+ defaultConnectionParams.setTcpSendBufferSize(tcpSendBufferSize);
+
+ defaultConnectionParams.setPingInterval(pingInterval);
+
+ defaultConnectionParams.setPingTimeout(pingTimeout);
+
+ defaultConnectionParams.setSSLEnabled(sslEnabled);
+
+ // Persistence config
- //Persistence config
+ bindingsDirectory = getString(e, "bindings-directory", bindingsDirectory);
- this.bindingsDirectory = getString(e, "bindings-directory", bindingsDirectory);
+ createBindingsDir = getBoolean(e, "create-bindings-dir", createBindingsDir);
- this.createBindingsDir = getBoolean(e, "create-bindings-dir", createBindingsDir);
+ journalDirectory = getString(e, "journal-directory", journalDirectory);
- this.journalDirectory = getString(e, "journal-directory", journalDirectory);
+ createJournalDir = getBoolean(e, "create-journal-dir", createJournalDir);
- this.createJournalDir = getBoolean(e, "create-journal-dir", createJournalDir);
+ String s = getString(e, "journal-type", journalType.toString());
- String s = getString(e, "journal-type", "nio");
-
- if (s == null || (!s.equals("nio") && !s.equals("asyncio") && !s.equals("jdbc")))
+ if (s == null || (!s.equals(JournalType.NIO.toString()) && !s.equals(JournalType.ASYNCIO.toString()) && !s.equals(JournalType.JDBC.toString())))
{
throw new IllegalArgumentException("Invalid journal type " + s);
}
- if (s.equals("nio"))
+ if (s.equals(JournalType.NIO.toString()))
{
journalType = JournalType.NIO;
}
- else if (s.equals("asyncio"))
+ else if (s.equals(JournalType.ASYNCIO.toString()))
{
journalType = JournalType.ASYNCIO;
}
- else if (s.equals("jdbc"))
+ else if (s.equals(JournalType.JDBC.toString()))
{
journalType = JournalType.JDBC;
}
- this.journalSyncTransactional = getBoolean(e, "journal-sync-transactional", true);
+ journalSyncTransactional = getBoolean(e, "journal-sync-transactional", journalSyncTransactional);
- this.journalSyncNonTransactional = getBoolean(e, "journal-sync-non-transactional", false);
+ journalSyncNonTransactional = getBoolean(e, "journal-sync-non-transactional", journalSyncNonTransactional);
- this.journalFileSize = getInteger(e, "journal-file-size", 10 * 1024 * 1024);
+ journalFileSize = getInteger(e, "journal-file-size", journalFileSize);
- this.journalMinFiles = getInteger(e, "journal-min-files", 10);
+ journalMinFiles = getInteger(e, "journal-min-files", journalMinFiles);
- this.journalTaskPeriod = getLong(e, "journal-task-period", 5000L);
+ journalTaskPeriod = getLong(e, "journal-task-period", journalTaskPeriod);
- this.journalMaxAIO = getInteger(e, "journal-max-aio", DEFAULT_MAX_AIO);
+ journalMaxAIO = getInteger(e, "journal-max-aio", journalMaxAIO);
- this.journalAIOTimeout = getLong(e, "journal-aio-timeout", DEFAULT_AIO_TIMEOUT);
-
- this.securityEnabled = getBoolean(e, "security-enabled", true);
-
+ journalAIOTimeout = getLong(e, "journal-aio-timeout", journalAIOTimeout);
+
NodeList defaultInterceptors = e.getElementsByTagName("default-interceptors-config");
ArrayList<String> interceptorList = new ArrayList<String>();
@@ -172,6 +198,8 @@
{
this.configurationUrl = configurationUrl;
}
+
+ // Private -------------------------------------------------------------------------
private Boolean getBoolean(Element e, String name, Boolean def)
{
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/AcceptorFactoryImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/AcceptorFactoryImpl.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/AcceptorFactoryImpl.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -42,7 +42,7 @@
if (TransportType.TCP.equals(configuration.getTransport()))
{
acceptors.add(new MinaAcceptor());
- if (!configuration.isInvmDisabled())
+ if (!configuration.isInVMDisabled())
{
acceptors.add(new INVMAcceptor());
}
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingConfigurationValidator.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingConfigurationValidator.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingConfigurationValidator.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -29,13 +29,8 @@
public static void validate(Configuration configuration)
{
- assert configuration != null;
-
- if (log.isDebugEnabled())
- log.debug("validating " + configuration.getURI());
-
if (configuration.getTransport() == INVM
- && configuration.isInvmDisabled())
+ && configuration.isInVMDisabled())
{
throw new IllegalStateException(
"It is not allowed to disable invm communication when the transport is set to invm.");
@@ -52,7 +47,7 @@
throw new IllegalStateException("Remoting port can not be negative when transport is not INVM");
}
- int receiveBufferSize = configuration.getTcpReceiveBufferSize();
+ int receiveBufferSize = configuration.getConnectionParams().getTcpReceiveBufferSize();
if (receiveBufferSize != -1 && receiveBufferSize <= 0)
{
String message = "Invalid value for TCP receive buffer size: " + receiveBufferSize;
@@ -60,7 +55,7 @@
throw new IllegalStateException(message);
}
- int sendBufferSize = configuration.getTcpSendBufferSize();
+ int sendBufferSize = configuration.getConnectionParams().getTcpSendBufferSize();
if (sendBufferSize != -1 && sendBufferSize <= 0)
{
String message = "Invalid value for TCP send buffer size: " + sendBufferSize;
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -81,6 +81,7 @@
}
connector = ConnectorRegistryFactory.getRegistry().getConnector(location, connectionParams);
+
session = connector.connect();
if (log.isDebugEnabled())
@@ -99,10 +100,16 @@
if (connector != null)
{
if (listener != null)
+ {
connector.removeSessionListener(listener);
+ }
+
RemotingConnector connectorFromRegistry = ConnectorRegistryFactory.getRegistry().removeConnector(location);
+
if (connectorFromRegistry != null)
+ {
connectorFromRegistry.disconnect();
+ }
}
}
catch (Throwable ignore)
@@ -153,7 +160,7 @@
throw new MessagingException(MessagingException.INTERNAL_ERROR);
}
- Packet response = handler.waitForResponse(connectionParams.getTimeout());
+ Packet response = handler.waitForResponse(connectionParams.getBlockingCallTimeout());
if (response == null)
{
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingServiceImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingServiceImpl.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingServiceImpl.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -154,12 +154,14 @@
this.acceptorFactory = acceptorFactory;
}
-
public void registerPinger(RemotingSession session)
{
ResponseHandler pongHandler = new ResponseHandlerImpl(dispatcher.generateID());
- Pinger pinger = new PingerImpl(getDispatcher(), session, config.getKeepAliveTimeout(), pongHandler, RemotingServiceImpl.this);
- ScheduledFuture<?> future = scheduledExecutor.scheduleAtFixedRate(pinger, config.getKeepAliveInterval(), config.getKeepAliveInterval(), TimeUnit.MILLISECONDS);
+ Pinger pinger = new PingerImpl(getDispatcher(), session, config.getConnectionParams().getPingTimeout(), pongHandler, RemotingServiceImpl.this);
+ ScheduledFuture<?> future =
+ scheduledExecutor.scheduleAtFixedRate(pinger, config.getConnectionParams().getPingInterval(),
+ config.getConnectionParams().getPingInterval(),
+ TimeUnit.MILLISECONDS);
currentScheduledPingers.put(session.getID(), future);
currentPingers.put(session.getID(), pinger);
sessions.add(session.getID());
@@ -183,7 +185,10 @@
{
return sessions.contains(sessionID);
}
+
+
// FailureNotifier implementation -------------------------------
+
public void fireCleanup(long sessionID, MessagingException me)
{
if (sessions.contains(sessionID))
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaAcceptor.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaAcceptor.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaAcceptor.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -34,6 +34,7 @@
import org.apache.mina.common.IoServiceListener;
import org.apache.mina.common.IoSession;
import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
+import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.remoting.Acceptor;
import org.jboss.messaging.core.remoting.CleanUpNotifier;
import org.jboss.messaging.core.remoting.RemotingService;
@@ -45,6 +46,8 @@
*/
public class MinaAcceptor implements Acceptor
{
+ private static final Logger log = Logger.getLogger(MinaAcceptor.class);
+
private ExecutorService threadPool;
private NioSocketAcceptor acceptor;
private IoServiceListener acceptorListener;
@@ -60,6 +63,8 @@
acceptor.setSessionDataStructureFactory(new MessagingIOSessionDataStructureFactory());
DefaultIoFilterChainBuilder filterChain = acceptor.getFilterChain();
+
+ log.info(remotingService.getConfiguration().getHost());
// addMDCFilter(filterChain);
if (remotingService.getConfiguration().isSSLEnabled())
@@ -73,13 +78,13 @@
// Bind
acceptor.setDefaultLocalAddress(new InetSocketAddress(remotingService.getConfiguration().getHost(), remotingService.getConfiguration().getPort()));
- acceptor.getSessionConfig().setTcpNoDelay(remotingService.getConfiguration().isTcpNoDelay());
- int receiveBufferSize = remotingService.getConfiguration().getTcpReceiveBufferSize();
+ acceptor.getSessionConfig().setTcpNoDelay(remotingService.getConfiguration().getConnectionParams().isTcpNoDelay());
+ int receiveBufferSize = remotingService.getConfiguration().getConnectionParams().getTcpReceiveBufferSize();
if (receiveBufferSize != -1)
{
acceptor.getSessionConfig().setReceiveBufferSize(receiveBufferSize);
}
- int sendBufferSize = remotingService.getConfiguration().getTcpSendBufferSize();
+ int sendBufferSize = remotingService.getConfiguration().getConnectionParams().getTcpSendBufferSize();
if (sendBufferSize != -1)
{
acceptor.getSessionConfig().setSendBufferSize(sendBufferSize);
@@ -144,7 +149,7 @@
public void sessionCreated(IoSession session)
{
//register pinger
- if (remotingService.getConfiguration().getKeepAliveInterval() > 0)
+ if (remotingService.getConfiguration().getConnectionParams().getPingInterval() > 0)
{
remotingService.registerPinger(new MinaSession(session));
}
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaConnector.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaConnector.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaConnector.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -197,11 +197,11 @@
/**
* if we are a TCP transport start pinging the server
*/
- if (connectionParams.getKeepAliveInterval() > 0 && location.getTransport() == TransportType.TCP)
+ if (connectionParams.getPingInterval() > 0 && location.getTransport() == TransportType.TCP)
{
ResponseHandler pongHandler = new ResponseHandlerImpl(dispatcher.generateID());
- Pinger pinger = new PingerImpl(dispatcher, minaSession, connectionParams.getKeepAliveTimeout(), pongHandler, this);
- scheduledExecutor.scheduleAtFixedRate(pinger, connectionParams.getKeepAliveInterval(), connectionParams.getKeepAliveInterval(), TimeUnit.MILLISECONDS);
+ Pinger pinger = new PingerImpl(dispatcher, minaSession, connectionParams.getPingTimeout(), pongHandler, this);
+ scheduledExecutor.scheduleAtFixedRate(pinger, connectionParams.getPingInterval(), connectionParams.getPingInterval(), TimeUnit.MILLISECONDS);
}
return minaSession;
}
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaHandler.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaHandler.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaHandler.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -113,7 +113,7 @@
throws Exception
{
final Packet packet = (Packet) message;
-
+
if (executorFactory != null)
{
long executorID = packet.getExecutorID();
Modified: trunk/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -169,7 +169,7 @@
lock.lock();
}
try
- {
+ {
return add(ref, false);
}
finally
Modified: trunk/src/main/org/jboss/messaging/core/server/impl/ServerConsumerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/ServerConsumerImpl.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/ServerConsumerImpl.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -163,7 +163,7 @@
}
public HandleStatus handle(MessageReference ref) throws Exception
- {
+ {
if (availableCredits != null && availableCredits.get() <= 0)
{
return HandleStatus.BUSY;
@@ -214,7 +214,7 @@
}
try
- {
+ {
sessionEndpoint.handleDelivery(ref, this);
}
catch (Exception e)
Modified: trunk/src/main/org/jboss/messaging/core/server/impl/ServerPacketHandlerSupport.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/ServerPacketHandlerSupport.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/ServerPacketHandlerSupport.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -51,14 +51,14 @@
{
MessagingException me;
+ log.error("Caught unexpected exception", e);
+
if (e instanceof MessagingException)
{
me = (MessagingException)e;
}
else
- {
- log.error("Caught unexpected exception", e);
-
+ {
me = new MessagingException(MessagingException.INTERNAL_ERROR);
}
Modified: trunk/src/main/org/jboss/messaging/core/server/impl/ServerSessionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/ServerSessionImpl.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/ServerSessionImpl.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -314,12 +314,12 @@
}
msg.setMessageID(persistenceManager.generateMessageID());
-
+
// This allows the no-local consumers to filter out the messages that come
// from the same connection.
msg.setConnectionID(connection.getID());
-
+
if (autoCommitSends)
{
List<MessageReference> refs = postOffice.route(msg);
@@ -328,7 +328,7 @@
{
persistenceManager.storeMessage(msg);
}
-
+
for (MessageReference ref : refs)
{
ref.getQueue().addLast(ref);
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/CoreClientTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/CoreClientTest.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/CoreClientTest.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -84,7 +84,7 @@
{
Location location = new LocationImpl(TransportType.TCP, "localhost", ConfigurationImpl.DEFAULT_REMOTING_PORT);
ConnectionParams connectionParams = new ConnectionParamsImpl();
- connectionParams.setTimeout(500000);
+ connectionParams.setBlockingCallTimeout(500000);
ClientConnectionFactory cf = new ClientConnectionFactoryImpl(location, connectionParams);
ClientConnection conn = cf.createConnection();
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/impl/ClientCrashTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/impl/ClientCrashTest.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/impl/ClientCrashTest.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -155,8 +155,8 @@
super.setUp();
ConfigurationImpl config = ConfigurationHelper.newTCPConfiguration("localhost", ConfigurationImpl.DEFAULT_REMOTING_PORT);
- config.setKeepAliveInterval(2000);
- config.setKeepAliveTimeout(1000);
+ config.getConnectionParams().setPingInterval(2000);
+ config.getConnectionParams().setPingTimeout(1000);
server = new MessagingServerImpl(config);
server.start();
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/mina/ClientKeepAliveTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/mina/ClientKeepAliveTest.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/mina/ClientKeepAliveTest.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -52,8 +52,8 @@
protected void setUp() throws Exception
{
ConfigurationImpl config = ConfigurationHelper.newTCPConfiguration("localhost", TestSupport.PORT);
- config.setKeepAliveInterval(TestSupport.KEEP_ALIVE_INTERVAL);
- config.setKeepAliveTimeout(TestSupport.KEEP_ALIVE_TIMEOUT);
+ config.getConnectionParams().setPingInterval(TestSupport.PING_INTERVAL);
+ config.getConnectionParams().setPingTimeout(TestSupport.PING_TIMEOUT);
messagingServer = new MessagingServerImpl(config);
messagingServer.start();
}
@@ -77,13 +77,13 @@
};
messagingServer.getRemotingService().addRemotingSessionListener(listener);
ConnectionParams connectionParams = new ConnectionParamsImpl();
- connectionParams.setKeepAliveInterval(TestSupport.KEEP_ALIVE_INTERVAL);
- connectionParams.setKeepAliveTimeout(TestSupport.KEEP_ALIVE_TIMEOUT);
+ connectionParams.setPingInterval(TestSupport.PING_INTERVAL);
+ connectionParams.setPingTimeout(TestSupport.PING_TIMEOUT);
MinaConnector connector = new MinaConnector(new LocationImpl(TCP, "localhost", TestSupport.PORT), connectionParams, new PacketDispatcherImpl(null));
connector.connect();
- boolean firedKeepAliveNotification = latch.await(TestSupport.KEEP_ALIVE_INTERVAL
- + TestSupport.KEEP_ALIVE_TIMEOUT + 2000, MILLISECONDS);
+ boolean firedKeepAliveNotification = latch.await(TestSupport.PING_INTERVAL
+ + TestSupport.PING_TIMEOUT + 2000, MILLISECONDS);
assertFalse(firedKeepAliveNotification);
messagingServer.getRemotingService().removeRemotingSessionListener(listener);
@@ -108,8 +108,8 @@
};
messagingServer.getRemotingService().addRemotingSessionListener(listener);
ConnectionParams connectionParams = new ConnectionParamsImpl();
- connectionParams.setKeepAliveInterval(TestSupport.KEEP_ALIVE_INTERVAL);
- connectionParams.setKeepAliveTimeout(TestSupport.KEEP_ALIVE_TIMEOUT);
+ connectionParams.setPingInterval(TestSupport.PING_INTERVAL);
+ connectionParams.setPingTimeout(TestSupport.PING_TIMEOUT);
LocationImpl location = new LocationImpl(TCP, "localhost", TestSupport.PORT);
MinaConnector connector = new MinaConnector(location, connectionParams, new PacketDispatcherImpl(null));
@@ -118,8 +118,8 @@
connector.getDispatcher().register(new NotRespondingPacketHandler());
long clientSessionID = session.getID();
- boolean firedKeepAliveNotification = latch.await(TestSupport.KEEP_ALIVE_INTERVAL
- + TestSupport.KEEP_ALIVE_TIMEOUT + 2000, MILLISECONDS);
+ boolean firedKeepAliveNotification = latch.await(TestSupport.PING_INTERVAL
+ + TestSupport.PING_TIMEOUT + 2000, MILLISECONDS);
assertTrue("notification has not been received", firedKeepAliveNotification);
assertNotNull(clientSessionIDNotResponding[0]);
//assertEquals(clientSessionID, clientSessionIDNotResponding[0]);
@@ -163,8 +163,8 @@
try
{
ConnectionParams connectionParams = new ConnectionParamsImpl();
- connectionParams.setKeepAliveInterval(TestSupport.KEEP_ALIVE_INTERVAL);
- connectionParams.setKeepAliveTimeout(TestSupport.KEEP_ALIVE_TIMEOUT);
+ connectionParams.setPingInterval(TestSupport.PING_INTERVAL);
+ connectionParams.setPingTimeout(TestSupport.PING_TIMEOUT);
LocationImpl location = new LocationImpl(TCP, "localhost", TestSupport.PORT);
MinaConnector connector = new MinaConnector(location, connectionParams,
new PacketDispatcherImpl(null));
@@ -186,8 +186,8 @@
};
messagingServer.getRemotingService().addRemotingSessionListener(listener);
- boolean firedKeepAliveNotification = latch.await(TestSupport.KEEP_ALIVE_INTERVAL
- + TestSupport.KEEP_ALIVE_TIMEOUT + 2000, MILLISECONDS);
+ boolean firedKeepAliveNotification = latch.await(TestSupport.PING_INTERVAL
+ + TestSupport.PING_TIMEOUT + 2000, MILLISECONDS);
assertTrue("notification has not been received", firedKeepAliveNotification);
//assertEquals(clientSessionID, clientSessionIDNotResponding.longValue());
@@ -223,8 +223,8 @@
PacketHandler notRespondingPacketHandler = new NotRespondingPacketHandler();
messagingServer.getRemotingService().addRemotingSessionListener(listener);
ConnectionParams connectionParams = new ConnectionParamsImpl();
- connectionParams.setKeepAliveInterval(TestSupport.KEEP_ALIVE_INTERVAL);
- connectionParams.setKeepAliveTimeout(TestSupport.KEEP_ALIVE_TIMEOUT);
+ connectionParams.setPingInterval(TestSupport.PING_INTERVAL);
+ connectionParams.setPingTimeout(TestSupport.PING_TIMEOUT);
LocationImpl location = new LocationImpl(TCP, "localhost", TestSupport.PORT);
MinaConnector connectorNotResponding = new MinaConnector(location, new PacketDispatcherImpl(null));
MinaConnector connectorResponding = new MinaConnector(location, new PacketDispatcherImpl(null));
@@ -237,8 +237,8 @@
RemotingSession sessionResponding = connectorResponding.connect();
long clientSessionIDResponding = sessionResponding.getID();
- boolean firedKeepAliveNotification = latch.await(TestSupport.KEEP_ALIVE_INTERVAL
- + TestSupport.KEEP_ALIVE_TIMEOUT + 2000, MILLISECONDS);
+ boolean firedKeepAliveNotification = latch.await(TestSupport.PING_INTERVAL
+ + TestSupport.PING_TIMEOUT + 2000, MILLISECONDS);
assertTrue("notification has not been received", firedKeepAliveNotification);
//assertEquals(clientSessionIDNotResponding, sessionIDNotResponding.longValue());
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/mina/ServerKeepAliveTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/mina/ServerKeepAliveTest.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/mina/ServerKeepAliveTest.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -6,7 +6,14 @@
*/
package org.jboss.messaging.tests.integration.core.remoting.mina;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static org.jboss.messaging.core.remoting.impl.wireformat.EmptyPacket.CREATECONNECTION;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicLong;
+
import junit.framework.TestCase;
+
import org.jboss.messaging.core.client.RemotingSessionListener;
import org.jboss.messaging.core.config.impl.ConfigurationImpl;
import org.jboss.messaging.core.exception.MessagingException;
@@ -17,14 +24,9 @@
import org.jboss.messaging.core.remoting.impl.RemotingServiceImpl;
import org.jboss.messaging.core.remoting.impl.mina.MinaConnector;
import org.jboss.messaging.core.remoting.impl.wireformat.EmptyPacket;
-import static org.jboss.messaging.core.remoting.impl.wireformat.EmptyPacket.CREATECONNECTION;
import org.jboss.messaging.core.server.impl.ServerPacketHandlerSupport;
import org.jboss.messaging.tests.unit.core.remoting.impl.ConfigurationHelper;
-import java.util.concurrent.CountDownLatch;
-import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import java.util.concurrent.atomic.AtomicLong;
-
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
* @version <tt>$Revision$</tt>
@@ -60,12 +62,12 @@
//set the server timeouts to be twice that of the server to force failure
ConfigurationImpl config = ConfigurationHelper.newTCPConfiguration(
"localhost", TestSupport.PORT);
- config.setKeepAliveInterval(TestSupport.KEEP_ALIVE_INTERVAL * 2);
- config.setKeepAliveTimeout(TestSupport.KEEP_ALIVE_TIMEOUT * 2);
+ config.getConnectionParams().setPingInterval(TestSupport.PING_INTERVAL * 2);
+ config.getConnectionParams().setPingTimeout(TestSupport.PING_TIMEOUT * 2);
ConfigurationImpl clientConfig = ConfigurationHelper.newTCPConfiguration(
"localhost", TestSupport.PORT);
- clientConfig.setKeepAliveInterval(TestSupport.KEEP_ALIVE_INTERVAL);
- clientConfig.setKeepAliveTimeout(TestSupport.KEEP_ALIVE_TIMEOUT);
+ clientConfig.getConnectionParams().setPingInterval(TestSupport.PING_INTERVAL);
+ clientConfig.getConnectionParams().setPingTimeout(TestSupport.PING_TIMEOUT);
service = new RemotingServiceImpl(config);
service.start();
service.getDispatcher().register(new DummyServePacketHandler());
@@ -85,8 +87,8 @@
connector.addSessionListener(listener);
RemotingSession session = connector.connect();
- boolean firedKeepAliveNotification = latch.await(TestSupport.KEEP_ALIVE_INTERVAL
- + TestSupport.KEEP_ALIVE_TIMEOUT + 2000, MILLISECONDS);
+ boolean firedKeepAliveNotification = latch.await(TestSupport.PING_INTERVAL
+ + TestSupport.PING_TIMEOUT + 2000, MILLISECONDS);
assertTrue(firedKeepAliveNotification);
assertEquals(session.getID(), sessionIDNotResponding.longValue());
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/mina/TestSupport.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/mina/TestSupport.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/mina/TestSupport.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -17,9 +17,9 @@
public static final int MANY_MESSAGES = 50000;
- public static final int KEEP_ALIVE_INTERVAL = 2000; // in seconds
+ public static final int PING_INTERVAL = 2000; // in seconds
- public static final int KEEP_ALIVE_TIMEOUT = 1000; // in seconds
+ public static final int PING_TIMEOUT = 1000; // in seconds
public static final long REQRES_TIMEOUT = 2; // in seconds
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/impl/JMSServerManagerimplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/impl/JMSServerManagerimplTest.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/impl/JMSServerManagerimplTest.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -58,7 +58,7 @@
jmsServerManager = new JMSServerManagerImpl();
MessagingServerManagementImpl messagingServerManagement = new MessagingServerManagementImpl();
ConfigurationImpl conf = new ConfigurationImpl();
- conf.setInvmDisabled(false);
+ conf.setInVMDisabled(false);
conf.setTransport(INVM);
messagingServer = new MessagingServerImpl(conf);
messagingServer.start();
Modified: trunk/tests/src/org/jboss/messaging/tests/performance/remoting/impl/MeasureBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/performance/remoting/impl/MeasureBase.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/tests/src/org/jboss/messaging/tests/performance/remoting/impl/MeasureBase.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -153,7 +153,7 @@
{
ConnectionParamsImpl param = new ConnectionParamsImpl();
param.setTcpNoDelay(true);
- param.setTimeout(50000);
+ param.setBlockingCallTimeout(50000);
return param;
}
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/client/impl/ClientConsumerPacketHandlerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/client/impl/ClientConsumerPacketHandlerTest.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/client/impl/ClientConsumerPacketHandlerTest.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -26,6 +26,7 @@
import org.jboss.messaging.core.client.impl.ClientConsumerInternal;
import org.jboss.messaging.core.client.impl.ClientConsumerPacketHandler;
import org.jboss.messaging.core.remoting.PacketReturner;
+import org.jboss.messaging.core.remoting.impl.wireformat.EmptyPacket;
import org.jboss.messaging.core.remoting.impl.wireformat.ReceiveMessage;
import org.jboss.messaging.tests.util.UnitTestCase;
@@ -59,11 +60,18 @@
handler.handle(rm, EasyMock.createStrictMock(PacketReturner.class));
EasyMock.verify(consumer, msg);
+
+ try
+ {
+ handler.handle(new EmptyPacket(EmptyPacket.CONN_START), EasyMock.createStrictMock(PacketReturner.class));
+ fail("Should throw Exception");
+ }
+ catch (IllegalStateException e)
+ {
+ //Ok
+ }
}
-
-
// Private -----------------------------------------------------------------------------------------------------------
-
}
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/ConfigurationTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/ConfigurationTest.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/ConfigurationTest.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -49,7 +49,7 @@
public void testSetClustered() throws Exception
{
- assertEquals("failed to set clustered", Boolean.TRUE, configuration.isClustered());
+ assertEquals("failed to set clustered", Boolean.TRUE.booleanValue(), configuration.isClustered());
}
public void testSetTransport() throws Exception
@@ -68,36 +68,7 @@
}
- public void testSetRemotingTimeout() throws Exception
- {
- assertEquals(100, configuration.getTimeout());
- }
- public void testRemotingTcpNodelay() throws Exception
- {
- assertEquals(true, configuration.isTcpNoDelay());
- }
-
- public void testRemotingTcpReceiveBufferSize() throws Exception
- {
- assertEquals(8192, configuration.getTcpReceiveBufferSize());
- }
-
- public void testRemotingTcpSendBufferSize() throws Exception
- {
- assertEquals(1024, configuration.getTcpSendBufferSize());
- }
-
- public void testRemotingKeepAliveInterval() throws Exception
- {
- assertEquals(1234, configuration.getKeepAliveInterval());
- }
-
- public void testRemotingKeepAliveTimeout() throws Exception
- {
- assertEquals(5678, configuration.getKeepAliveTimeout());
- }
-
public void testRemotingEnableSSL() throws Exception
{
assertEquals(true, configuration.isSSLEnabled());
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactoryImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactoryImplTest.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactoryImplTest.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -41,7 +41,7 @@
AcceptorFactoryImpl acceptorFactory = new AcceptorFactoryImpl();
ConfigurationImpl config = new ConfigurationImpl();
config.setTransport(TransportType.TCP);
- config.setInvmDisabled(false);
+ config.setInVMDisabled(false);
List<Acceptor> acceptors = acceptorFactory.createAcceptors(config);
assertEquals(2, acceptors.size());
assertEquals(MinaAcceptor.class, acceptors.get(0).getClass());
@@ -53,7 +53,7 @@
AcceptorFactoryImpl acceptorFactory = new AcceptorFactoryImpl();
ConfigurationImpl config = new ConfigurationImpl();
config.setTransport(TransportType.TCP);
- config.setInvmDisabled(true);
+ config.setInVMDisabled(true);
List<Acceptor> acceptors = acceptorFactory.createAcceptors(config);
assertEquals(1, acceptors.size());
assertEquals(MinaAcceptor.class, acceptors.get(0).getClass());
@@ -64,7 +64,7 @@
AcceptorFactoryImpl acceptorFactory = new AcceptorFactoryImpl();
ConfigurationImpl config = new ConfigurationImpl();
config.setTransport(TransportType.INVM);
- config.setInvmDisabled(false);
+ config.setInVMDisabled(false);
List<Acceptor> acceptors = acceptorFactory.createAcceptors(config);
assertEquals(1, acceptors.size());
assertEquals(INVMAcceptor.class, acceptors.get(0).getClass());
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/ConnectorRegistryImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/ConnectorRegistryImplTest.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/ConnectorRegistryImplTest.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -108,7 +108,9 @@
RemotingConnector connector = registry.getConnector(config.getLocation(), config.getConnectionParams());
assertNotNull(connector);
- assertEquals(config.getURI(), connector.getServerURI());
+
+ assertEquals(config.getTransport() + "://" + config.getHost() +
+ ":" + config.getPort() + config.getConnectionParams().getURI(), connector.getServerURI());
assertNotNull(registry.removeConnector(config.getLocation()));
}
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/RemotingConfigurationValidatorTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/RemotingConfigurationValidatorTest.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/RemotingConfigurationValidatorTest.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -53,7 +53,7 @@
public void test_TcpReceiveBufferSize_to_0()
{
ConfigurationImpl config = ConfigurationHelper.newTCPConfiguration("localhost", 9000);
- config.setTcpReceiveBufferSize(0);
+ config.getConnectionParams().setTcpReceiveBufferSize(0);
try
{
validate(config);
@@ -67,14 +67,14 @@
public void test_TcpReceiveBufferSize_to_minusOne()
{
ConfigurationImpl config = ConfigurationHelper.newTCPConfiguration("localhost", 9000);
- config.setTcpReceiveBufferSize(-1);
+ config.getConnectionParams().setTcpReceiveBufferSize(-1);
validate(config);
}
public void test_TcpReceiveBufferSize_to_NegativeNumber()
{
ConfigurationImpl config = ConfigurationHelper.newTCPConfiguration("localhost", 9000);
- config.setTcpReceiveBufferSize(-2);
+ config.getConnectionParams().setTcpReceiveBufferSize(-2);
try
{
validate(config);
@@ -88,7 +88,7 @@
public void test_TcpSendBufferSize_to_0()
{
ConfigurationImpl config = ConfigurationHelper.newTCPConfiguration("localhost", 9000);
- config.setTcpSendBufferSize(0);
+ config.getConnectionParams().setTcpSendBufferSize(0);
try
{
validate(config);
@@ -102,14 +102,14 @@
public void test_TcpSendBufferSize_to_minusOne()
{
ConfigurationImpl config = ConfigurationHelper.newTCPConfiguration("localhost", 9000);
- config.setTcpSendBufferSize(-1);
+ config.getConnectionParams().setTcpSendBufferSize(-1);
validate(config);
}
public void test_TcpSendBufferSize_to_NegativeNumber()
{
ConfigurationImpl config = ConfigurationHelper.newTCPConfiguration("localhost", 9000);
- config.setTcpSendBufferSize(-2);
+ config.getConnectionParams().setTcpSendBufferSize(-2);
try
{
validate(config);
@@ -124,7 +124,7 @@
{
ConfigurationImpl config = new ConfigurationImpl();
config.setTransport(INVM);
- config.setInvmDisabled(true);
+ config.setInVMDisabled(true);
try
{
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/RemotingConnectionTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/RemotingConnectionTest.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/RemotingConnectionTest.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -209,7 +209,7 @@
});
Location location = EasyMock.createNiceMock(Location.class);
ConnectionParams connectionParams = new ConnectionParamsImpl();
- connectionParams.setTimeout(1000);
+ connectionParams.setBlockingCallTimeout(1000);
DummyDispatcher dispatcher = new DummyDispatcher();
DummySession nioSession = new DummySession(dispatcher, 0, null, false);
PacketHandler handler = null;
@@ -251,7 +251,7 @@
});
Location location = EasyMock.createNiceMock(Location.class);
ConnectionParams connectionParams = new ConnectionParamsImpl();
- connectionParams.setTimeout(1000);
+ connectionParams.setBlockingCallTimeout(1000);
DummyDispatcher dispatcher = new DummyDispatcher();
DummySession nioSession = new DummySession(dispatcher, 2000, null, false);
PacketHandler handler = null;
@@ -300,7 +300,7 @@
});
Location location = EasyMock.createNiceMock(Location.class);
ConnectionParams connectionParams = new ConnectionParamsImpl();
- connectionParams.setTimeout(1000);
+ connectionParams.setBlockingCallTimeout(1000);
DummyDispatcher dispatcher = new DummyDispatcher();
DummySession nioSession = new DummySession(dispatcher, 0, new Exception(), false);
PacketHandler handler = null;
@@ -350,7 +350,7 @@
});
Location location = EasyMock.createNiceMock(Location.class);
ConnectionParams connectionParams = new ConnectionParamsImpl();
- connectionParams.setTimeout(1000);
+ connectionParams.setBlockingCallTimeout(1000);
DummyDispatcher dispatcher = new DummyDispatcher();
DummySession nioSession = new DummySession(dispatcher, 0, null, true);
PacketHandler handler = null;
@@ -388,7 +388,7 @@
});
Location location = EasyMock.createNiceMock(Location.class);
ConnectionParams connectionParams = new ConnectionParamsImpl();
- connectionParams.setTimeout(1000);
+ connectionParams.setBlockingCallTimeout(1000);
DummyDispatcher dispatcher = new DummyDispatcher();
DummySession nioSession = new DummySession(dispatcher, 0, new Exception(), true);
PacketHandler handler = null;
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/RemotingServiceImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/RemotingServiceImplTest.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/RemotingServiceImplTest.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -272,7 +272,7 @@
{
ConfigurationImpl config = new ConfigurationImpl();
config.setTransport(TransportType.INVM);
- config.setKeepAliveInterval(100);
+ config.getConnectionParams().setPingInterval(100);
RemotingServiceImpl remotingService = new RemotingServiceImpl(config);
DummySession dummySession = new DummySession(remotingService.getDispatcher());
remotingService.registerPinger(dummySession);
@@ -292,7 +292,7 @@
{
ConfigurationImpl config = new ConfigurationImpl();
config.setTransport(TransportType.INVM);
- config.setKeepAliveInterval(100);
+ config.getConnectionParams().setPingInterval(100);
RemotingServiceImpl remotingService = new RemotingServiceImpl(config);
DummySession dummySession = new DummySession(remotingService.getDispatcher());
remotingService.registerPinger(dummySession);
@@ -308,7 +308,7 @@
int count = dummySession.count;
try
{
- Thread.sleep(config.getKeepAliveInterval() + 2);
+ Thread.sleep(config.getConnectionParams().getPingInterval() + 2);
}
catch (InterruptedException e)
{
@@ -322,7 +322,7 @@
RemotingSessionListener listener = EasyMock.createStrictMock(RemotingSessionListener.class);
ConfigurationImpl config = new ConfigurationImpl();
config.setTransport(TransportType.INVM);
- config.setKeepAliveInterval(100);
+ config.getConnectionParams().setPingInterval(100);
RemotingServiceImpl remotingService = new RemotingServiceImpl(config);
remotingService.getSessions().add(1l);
@@ -341,7 +341,7 @@
RemotingSessionListener listener3 = EasyMock.createStrictMock(RemotingSessionListener.class);
ConfigurationImpl config = new ConfigurationImpl();
config.setTransport(TransportType.INVM);
- config.setKeepAliveInterval(100);
+ config.getConnectionParams().setPingInterval(100);
RemotingServiceImpl remotingService = new RemotingServiceImpl(config);
remotingService.getSessions().add(1l);
@@ -364,7 +364,7 @@
RemotingSessionListener listener = EasyMock.createStrictMock(RemotingSessionListener.class);
ConfigurationImpl config = new ConfigurationImpl();
config.setTransport(TransportType.INVM);
- config.setKeepAliveInterval(100);
+ config.getConnectionParams().setPingInterval(100);
RemotingServiceImpl remotingService = new RemotingServiceImpl(config);
remotingService.getSessions().add(1l);
@@ -383,7 +383,7 @@
RemotingSessionListener listener3 = EasyMock.createStrictMock(RemotingSessionListener.class);
ConfigurationImpl config = new ConfigurationImpl();
config.setTransport(TransportType.INVM);
- config.setKeepAliveInterval(100);
+ config.getConnectionParams().setPingInterval(100);
RemotingServiceImpl remotingService = new RemotingServiceImpl(config);
remotingService.getSessions().add(1l);
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/network/ClientNetworkFailureTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/network/ClientNetworkFailureTest.java 2008-06-13 13:12:54 UTC (rev 4465)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/network/ClientNetworkFailureTest.java 2008-06-13 20:01:20 UTC (rev 4466)
@@ -38,8 +38,8 @@
import org.jboss.messaging.core.server.ConnectionManager;
import org.jboss.messaging.core.server.MessagingServer;
import org.jboss.messaging.core.server.impl.MessagingServerImpl;
-import static org.jboss.messaging.tests.integration.core.remoting.mina.TestSupport.KEEP_ALIVE_INTERVAL;
-import static org.jboss.messaging.tests.integration.core.remoting.mina.TestSupport.KEEP_ALIVE_TIMEOUT;
+import static org.jboss.messaging.tests.integration.core.remoting.mina.TestSupport.PING_INTERVAL;
+import static org.jboss.messaging.tests.integration.core.remoting.mina.TestSupport.PING_TIMEOUT;
import java.io.IOException;
import java.util.List;
@@ -75,12 +75,12 @@
{
super.setUp();
ConfigurationImpl newConfig = new ConfigurationImpl();
- newConfig.setInvmDisabled(true);
+ newConfig.setInVMDisabled(true);
newConfig.setHost("localhost");
newConfig.setPort(5400);
newConfig.setTransport(TransportType.TCP);
- newConfig.setKeepAliveInterval(KEEP_ALIVE_INTERVAL);
- newConfig.setKeepAliveTimeout(KEEP_ALIVE_TIMEOUT);
+ newConfig.getConnectionParams().setPingInterval(PING_INTERVAL);
+ newConfig.getConnectionParams().setPingTimeout(PING_TIMEOUT);
server = new MessagingServerImpl(newConfig);
server.start();
minaService = (RemotingServiceImpl) server.getRemotingService();
@@ -130,10 +130,10 @@
networkFailureFilter.messageReceivedDropsPacket = true;
boolean gotExceptionsOnTheServerAndTheClient = exceptionLatch.await(
- KEEP_ALIVE_INTERVAL + KEEP_ALIVE_TIMEOUT + 5000, MILLISECONDS);
+ PING_INTERVAL + PING_TIMEOUT + 5000, MILLISECONDS);
assertTrue(gotExceptionsOnTheServerAndTheClient);
//now we need to wait for the server to detect the client failover
- //Thread.sleep((KEEP_ALIVE_INTERVAL + KEEP_ALIVE_TIMEOUT) * 1000);
+ //Thread.sleep((PING_INTERVAL + PING_TIMEOUT) * 1000);
assertActiveConnectionsOnTheServer(0);
try
@@ -166,10 +166,10 @@
networkFailureFilter.messageReceivedDropsPacket = true;
boolean gotExceptionOnTheServer = exceptionLatch.await(
- KEEP_ALIVE_INTERVAL + KEEP_ALIVE_TIMEOUT + 5000, MILLISECONDS);
+ PING_INTERVAL + PING_TIMEOUT + 5000, MILLISECONDS);
assertTrue(gotExceptionOnTheServer);
//now we need to wait for the server to detect the client failover
- //Thread.sleep((KEEP_ALIVE_INTERVAL + KEEP_ALIVE_TIMEOUT) * 1000);
+ //Thread.sleep((PING_INTERVAL + PING_TIMEOUT) * 1000);
assertActiveConnectionsOnTheServer(0);
try
More information about the jboss-cvs-commits
mailing list