[hornetq-commits] JBoss hornetq SVN: r8111 - in trunk: src/main/org/hornetq/core/management/impl and 10 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Oct 15 09:37:52 EDT 2009
Author: timfox
Date: 2009-10-15 09:37:51 -0400 (Thu, 15 Oct 2009)
New Revision: 8111
Modified:
trunk/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java
trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java
trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptorFactory.java
trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMConnectorFactory.java
trunk/src/main/org/hornetq/core/remoting/impl/invm/TransportConstants.java
trunk/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java
trunk/src/main/org/hornetq/core/remoting/spi/AcceptorFactory.java
trunk/src/main/org/hornetq/core/remoting/spi/Connector.java
trunk/src/main/org/hornetq/core/remoting/spi/ConnectorFactory.java
trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptorFactory.java
trunk/src/main/org/hornetq/integration/transports/netty/NettyConnector.java
trunk/src/main/org/hornetq/integration/transports/netty/NettyConnectorFactory.java
trunk/src/main/org/hornetq/integration/transports/netty/TransportConstants.java
trunk/src/main/org/hornetq/utils/ConfigurationHelper.java
trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
trunk/tests/src/org/hornetq/tests/integration/largemessage/mock/MockConnectorFactory.java
trunk/tests/src/org/hornetq/tests/integration/management/ManagementServiceImplTest.java
trunk/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java
Log:
added checks for valid remoting properties also removed special management acceptor
Modified: trunk/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java 2009-10-14 13:42:12 UTC (rev 8110)
+++ trunk/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java 2009-10-15 13:37:51 UTC (rev 8111)
@@ -49,6 +49,7 @@
import org.hornetq.core.remoting.spi.HornetQBuffer;
import org.hornetq.core.version.Version;
import org.hornetq.utils.ConcurrentHashSet;
+import org.hornetq.utils.ConfigurationHelper;
import org.hornetq.utils.ExecutorFactory;
import org.hornetq.utils.OrderedExecutorFactory;
import org.hornetq.utils.UUIDGenerator;
@@ -142,19 +143,19 @@
// ---------------------------------------------------------------------------------
public FailoverManagerImpl(final ClientSessionFactory sessionFactory,
- final TransportConfiguration connectorConfig,
- final TransportConfiguration backupConfig,
- final boolean failoverOnServerShutdown,
- final long callTimeout,
- final long clientFailureCheckPeriod,
- final long connectionTTL,
- final long retryInterval,
- final double retryIntervalMultiplier,
- final long maxRetryInterval,
- final int reconnectAttempts,
- final ExecutorService threadPool,
- final ScheduledExecutorService scheduledThreadPool,
- final List<Interceptor> interceptors)
+ final TransportConfiguration connectorConfig,
+ final TransportConfiguration backupConfig,
+ final boolean failoverOnServerShutdown,
+ final long callTimeout,
+ final long clientFailureCheckPeriod,
+ final long connectionTTL,
+ final long retryInterval,
+ final double retryIntervalMultiplier,
+ final long maxRetryInterval,
+ final int reconnectAttempts,
+ final ExecutorService threadPool,
+ final ScheduledExecutorService scheduledThreadPool,
+ final List<Interceptor> interceptors)
{
this.sessionFactory = sessionFactory;
@@ -168,11 +169,15 @@
transportParams = connectorConfig.getParams();
+ checkTransportKeys(connectorFactory, transportParams);
+
if (backupConfig != null)
{
backupConnectorFactory = instantiateConnectorFactory(backupConfig.getFactoryClassName());
backupTransportParams = backupConfig.getParams();
+
+ checkTransportKeys(backupConnectorFactory, backupTransportParams);
}
else
{
@@ -483,7 +488,7 @@
private void failoverOrReconnect(final Object connectionID, final HornetQException me)
{
synchronized (failoverLock)
- {
+ {
if (connection == null || connection.getID() != connectionID)
{
// We already failed over/reconnected - probably the first failure came in, all the connections were failed
@@ -534,7 +539,7 @@
{
attemptReconnect = reconnectAttempts != 0;
}
-
+
if (attemptFailover || attemptReconnect)
{
lockChannel1();
@@ -609,13 +614,13 @@
{
reconnectSessions(reconnectAttempts);
}
-
+
oldConnection.destroy();
}
else
{
connection.destroy();
-
+
connection = null;
}
@@ -673,10 +678,10 @@
}
backupConnection.setFailureListeners(newListeners);
-
+
for (ClientSessionInternal session : sessions)
{
- session.handleFailover(backupConnection);
+ session.handleFailover(backupConnection);
}
}
@@ -884,9 +889,9 @@
{
pingRunnable.run();
}
- }
- }
-
+ }
+ }
+
return connection;
}
@@ -926,6 +931,23 @@
channel1.returnBlocking();
}
+ private void checkTransportKeys(final ConnectorFactory factory, final Map<String, Object> params)
+ {
+ if (params != null)
+ {
+ Set<String> invalid = ConfigurationHelper.checkKeys(factory.getAllowableProperties(), params.keySet());
+
+ if (!invalid.isEmpty())
+ {
+ String msg = ConfigurationHelper.stringSetToCommaListString("The following keys are invalid for configuring a connector: ",
+ invalid);
+
+ throw new IllegalStateException(msg);
+
+ }
+ }
+ }
+
private class Channel0Handler implements ChannelHandler
{
private final RemotingConnection conn;
Modified: trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java 2009-10-14 13:42:12 UTC (rev 8110)
+++ trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java 2009-10-15 13:37:51 UTC (rev 8111)
@@ -68,7 +68,6 @@
import org.hornetq.core.server.cluster.Bridge;
import org.hornetq.core.server.cluster.BroadcastGroup;
import org.hornetq.core.server.cluster.ClusterConnection;
-import org.hornetq.core.server.impl.RoutingContextImpl;
import org.hornetq.core.server.impl.ServerMessageImpl;
import org.hornetq.core.settings.HierarchicalRepository;
import org.hornetq.core.settings.impl.AddressSettings;
@@ -146,8 +145,7 @@
// Constructor ----------------------------------------------------
public ManagementServiceImpl(final MBeanServer mbeanServer,
- final Configuration configuration,
- final int managementConnectorID)
+ final Configuration configuration)
{
this.mbeanServer = mbeanServer;
this.jmxManagementEnabled = configuration.isJMXManagementEnabled();
Modified: trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptorFactory.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptorFactory.java 2009-10-14 13:42:12 UTC (rev 8110)
+++ trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptorFactory.java 2009-10-15 13:37:51 UTC (rev 8111)
@@ -13,6 +13,7 @@
package org.hornetq.core.remoting.impl.invm;
import java.util.Map;
+import java.util.Set;
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;
@@ -29,13 +30,18 @@
*/
public class InVMAcceptorFactory implements AcceptorFactory
{
-
public Acceptor createAcceptor(final Map<String, Object> configuration,
- final BufferHandler handler, final ConnectionLifeCycleListener listener,
- final Executor threadPool,
- final ScheduledExecutorService scheduledThreadPool)
+ final BufferHandler handler,
+ final ConnectionLifeCycleListener listener,
+ final Executor threadPool,
+ final ScheduledExecutorService scheduledThreadPool)
{
return new InVMAcceptor(configuration, handler, listener, threadPool);
}
+ public Set<String> getAllowableProperties()
+ {
+ return TransportConstants.ALLOWABLE_ACCEPTOR_KEYS;
+ }
+
}
Modified: trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMConnectorFactory.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMConnectorFactory.java 2009-10-14 13:42:12 UTC (rev 8110)
+++ trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMConnectorFactory.java 2009-10-15 13:37:51 UTC (rev 8111)
@@ -13,6 +13,7 @@
package org.hornetq.core.remoting.impl.invm;
import java.util.Map;
+import java.util.Set;
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;
@@ -46,5 +47,10 @@
return connector;
}
}
+
+ public Set<String> getAllowableProperties()
+ {
+ return TransportConstants.ALLOWABLE_CONNECTOR_KEYS;
+ }
}
Modified: trunk/src/main/org/hornetq/core/remoting/impl/invm/TransportConstants.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/impl/invm/TransportConstants.java 2009-10-14 13:42:12 UTC (rev 8110)
+++ trunk/src/main/org/hornetq/core/remoting/impl/invm/TransportConstants.java 2009-10-15 13:37:51 UTC (rev 8111)
@@ -12,6 +12,10 @@
*/
package org.hornetq.core.remoting.impl.invm;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
/**
* A TransportConstants
*
@@ -21,4 +25,21 @@
public class TransportConstants
{
public static final String SERVER_ID_PROP_NAME = "hornetq.remoting.invm.serverid";
+
+ public static final Set<String> ALLOWABLE_CONNECTOR_KEYS;
+
+ public static final Set<String> ALLOWABLE_ACCEPTOR_KEYS;
+
+ static
+ {
+ Set<String> allowableAcceptorKeys = new HashSet<String>();
+ allowableAcceptorKeys.add(SERVER_ID_PROP_NAME);
+
+ ALLOWABLE_CONNECTOR_KEYS = Collections.unmodifiableSet(allowableAcceptorKeys);
+
+ Set<String> allowableConnectorKeys = new HashSet<String>();
+ allowableConnectorKeys.add(SERVER_ID_PROP_NAME);
+
+ ALLOWABLE_ACCEPTOR_KEYS = Collections.unmodifiableSet(allowableConnectorKeys);
+ }
}
Modified: trunk/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java 2009-10-14 13:42:12 UTC (rev 8110)
+++ trunk/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java 2009-10-15 13:37:51 UTC (rev 8111)
@@ -15,7 +15,6 @@
import static org.hornetq.core.remoting.impl.wireformat.PacketImpl.DISCONNECT;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -52,6 +51,7 @@
import org.hornetq.core.remoting.spi.HornetQBuffer;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.impl.HornetQPacketHandler;
+import org.hornetq.utils.ConfigurationHelper;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
@@ -93,8 +93,6 @@
private final ScheduledExecutorService scheduledThreadPool;
- private final int managementConnectorID;
-
private FailureCheckThread failureCheckThread;
// Static --------------------------------------------------------
@@ -105,8 +103,7 @@
final HornetQServer server,
final ManagementService managementService,
final Executor threadPool,
- final ScheduledExecutorService scheduledThreadPool,
- final int managementConnectorID)
+ final ScheduledExecutorService scheduledThreadPool)
{
transportConfigs = config.getAcceptorConfigurations();
@@ -129,7 +126,6 @@
this.managementService = managementService;
this.threadPool = threadPool;
this.scheduledThreadPool = scheduledThreadPool;
- this.managementConnectorID = managementConnectorID;
}
// RemotingService implementation -------------------------------
@@ -151,6 +147,22 @@
AcceptorFactory factory = (AcceptorFactory)clazz.newInstance();
+ // Check valid properties
+
+ if (info.getParams() != null)
+ {
+ Set<String> invalid = ConfigurationHelper.checkKeys(factory.getAllowableProperties(), info.getParams()
+ .keySet());
+
+ if (!invalid.isEmpty())
+ {
+ log.warn(ConfigurationHelper.stringSetToCommaListString("The following keys are invalid for configuring the acceptor: ",
+ invalid) + " the acceptor will not be started.");
+
+ continue;
+ }
+ }
+
Acceptor acceptor = factory.createAcceptor(info.getParams(),
bufferHandler,
this,
@@ -170,32 +182,6 @@
}
}
- // We now create a "special" acceptor used by management to send/receive management messages - this is an invm
- // acceptor with a -ve server id
- // TODO this is not the best solution, management should send/receive management messages direct.
- // Remove this code when this is implemented without having to require a special acceptor
- // https://jira.jboss.org/jira/browse/JBMESSAGING-1649
-
- if (config.isJMXManagementEnabled())
- {
- Map<String, Object> params = new HashMap<String, Object>();
-
- params.put(TransportConstants.SERVER_ID_PROP_NAME, managementConnectorID);
-
- AcceptorFactory factory = new InVMAcceptorFactory();
-
- Acceptor acceptor = factory.createAcceptor(params, bufferHandler, this, threadPool, scheduledThreadPool);
-
- acceptors.add(acceptor);
-
- if (managementService != null)
- {
- TransportConfiguration info = new TransportConfiguration(InVMAcceptorFactory.class.getName(), params);
-
- managementService.registerAcceptor(acceptor, info);
- }
- }
-
for (Acceptor a : acceptors)
{
a.start();
@@ -233,23 +219,23 @@
}
failureCheckThread.close();
-
+
// We need to stop them accepting first so no new connections are accepted after we send the disconnect message
for (Acceptor acceptor : acceptors)
{
acceptor.pause();
}
-
+
for (ConnectionEntry entry : connections.values())
- {
+ {
entry.connection.getChannel(0, -1, false).sendAndFlush(new PacketImpl(DISCONNECT));
}
-
+
for (Acceptor acceptor : acceptors)
{
acceptor.stop();
}
-
+
acceptors.clear();
connections.clear();
@@ -303,9 +289,9 @@
{
throw new IllegalStateException("Unable to create connection, server hasn't finished starting up");
}
-
+
RemotingConnection rc = new RemotingConnectionImpl(connection,
- interceptors,
+ interceptors,
server.getConfiguration().isAsyncConnectionExecutionEnabled() ? server.getExecutorFactory()
.getExecutor()
: null);
@@ -321,9 +307,7 @@
{
ttl = config.getConnectionTTLOverride();
}
- final ConnectionEntry entry = new ConnectionEntry(rc,
- System.currentTimeMillis(),
- ttl);
+ final ConnectionEntry entry = new ConnectionEntry(rc, System.currentTimeMillis(), ttl);
connections.put(connection.getID(), entry);
@@ -467,7 +451,7 @@
}
public void run()
- {
+ {
while (!closed)
{
long now = System.currentTimeMillis();
@@ -499,9 +483,9 @@
RemotingConnection conn = removeConnection(id);
HornetQException me = new HornetQException(HornetQException.CONNECTION_TIMEDOUT,
- "Did not receive ping from " + conn.getRemoteAddress() +
- ". It is likely the client has exited or crashed without " +
- "closing its connection, or the network between the server and client has failed. The connection will now be closed.");
+ "Did not receive ping from " + conn.getRemoteAddress() +
+ ". It is likely the client has exited or crashed without " +
+ "closing its connection, or the network between the server and client has failed. The connection will now be closed.");
conn.fail(me);
}
Modified: trunk/src/main/org/hornetq/core/remoting/spi/AcceptorFactory.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/spi/AcceptorFactory.java 2009-10-14 13:42:12 UTC (rev 8110)
+++ trunk/src/main/org/hornetq/core/remoting/spi/AcceptorFactory.java 2009-10-15 13:37:51 UTC (rev 8111)
@@ -14,6 +14,7 @@
package org.hornetq.core.remoting.spi;
import java.util.Map;
+import java.util.Set;
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;
@@ -29,4 +30,6 @@
ConnectionLifeCycleListener listener,
Executor threadPool,
ScheduledExecutorService scheduledThreadPool);
+
+ Set<String> getAllowableProperties();
}
Modified: trunk/src/main/org/hornetq/core/remoting/spi/Connector.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/spi/Connector.java 2009-10-14 13:42:12 UTC (rev 8110)
+++ trunk/src/main/org/hornetq/core/remoting/spi/Connector.java 2009-10-15 13:37:51 UTC (rev 8111)
@@ -12,6 +12,7 @@
*/
package org.hornetq.core.remoting.spi;
+
/**
*
* A Connector
Modified: trunk/src/main/org/hornetq/core/remoting/spi/ConnectorFactory.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/spi/ConnectorFactory.java 2009-10-14 13:42:12 UTC (rev 8110)
+++ trunk/src/main/org/hornetq/core/remoting/spi/ConnectorFactory.java 2009-10-15 13:37:51 UTC (rev 8111)
@@ -14,6 +14,7 @@
package org.hornetq.core.remoting.spi;
import java.util.Map;
+import java.util.Set;
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;
@@ -30,4 +31,6 @@
ConnectionLifeCycleListener listener,
Executor threadPool,
ScheduledExecutorService scheduledThreadPool);
+
+ Set<String> getAllowableProperties();
}
Modified: trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2009-10-14 13:42:12 UTC (rev 8110)
+++ trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2009-10-15 13:37:51 UTC (rev 8111)
@@ -28,7 +28,6 @@
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
import javax.management.MBeanServer;
@@ -183,10 +182,6 @@
private boolean initialised;
- private int managementConnectorID;
-
- private static AtomicInteger managementConnectorSequence = new AtomicInteger(0);
-
private FailoverManager replicatingFailoverManager;
private final Set<ActivateCallback> activateCallbacks = new HashSet<ActivateCallback>();
@@ -243,7 +238,7 @@
addressSettingsRepository.setDefault(new AddressSettings());
- this.managementConnectorID = managementConnectorSequence.decrementAndGet();
+ // this.managementConnectorID = managementConnectorSequence.decrementAndGet();
}
// lifecycle methods
@@ -932,14 +927,13 @@
scheduledPool = new ScheduledThreadPoolExecutor(configuration.getScheduledThreadPoolMaxSize(),
new HornetQThreadFactory("HornetQ-scheduled-threads", false));
- managementService = new ManagementServiceImpl(mbeanServer, configuration, managementConnectorID);
+ managementService = new ManagementServiceImpl(mbeanServer, configuration);
remotingService = new RemotingServiceImpl(configuration,
this,
managementService,
threadPool,
- scheduledPool,
- managementConnectorID);
+ scheduledPool);
if (configuration.getMemoryMeasureInterval() != -1)
{
Modified: trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptorFactory.java
===================================================================
--- trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptorFactory.java 2009-10-14 13:42:12 UTC (rev 8110)
+++ trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptorFactory.java 2009-10-15 13:37:51 UTC (rev 8111)
@@ -14,6 +14,7 @@
package org.hornetq.integration.transports.netty;
import java.util.Map;
+import java.util.Set;
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;
@@ -37,4 +38,9 @@
{
return new NettyAcceptor(configuration, handler, listener, threadPool, scheduledThreadPool);
}
+
+ public Set<String> getAllowableProperties()
+ {
+ return TransportConstants.ALLOWABLE_ACCEPTOR_KEYS;
+ }
}
Modified: trunk/src/main/org/hornetq/integration/transports/netty/NettyConnector.java
===================================================================
--- trunk/src/main/org/hornetq/integration/transports/netty/NettyConnector.java 2009-10-14 13:42:12 UTC (rev 8110)
+++ trunk/src/main/org/hornetq/integration/transports/netty/NettyConnector.java 2009-10-15 13:37:51 UTC (rev 8111)
@@ -154,7 +154,7 @@
{
throw new IllegalArgumentException("Invalid argument null handler");
}
-
+
this.listener = listener;
this.handler = handler;
Modified: trunk/src/main/org/hornetq/integration/transports/netty/NettyConnectorFactory.java
===================================================================
--- trunk/src/main/org/hornetq/integration/transports/netty/NettyConnectorFactory.java 2009-10-14 13:42:12 UTC (rev 8110)
+++ trunk/src/main/org/hornetq/integration/transports/netty/NettyConnectorFactory.java 2009-10-15 13:37:51 UTC (rev 8111)
@@ -14,6 +14,7 @@
package org.hornetq.integration.transports.netty;
import java.util.Map;
+import java.util.Set;
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;
@@ -37,4 +38,10 @@
{
return new NettyConnector(configuration, handler, listener, threadPool, scheduledThreadPool);
}
+
+ public Set<String> getAllowableProperties()
+ {
+ return TransportConstants.ALLOWABLE_CONNECTOR_KEYS;
+ }
+
}
Modified: trunk/src/main/org/hornetq/integration/transports/netty/TransportConstants.java
===================================================================
--- trunk/src/main/org/hornetq/integration/transports/netty/TransportConstants.java 2009-10-14 13:42:12 UTC (rev 8110)
+++ trunk/src/main/org/hornetq/integration/transports/netty/TransportConstants.java 2009-10-15 13:37:51 UTC (rev 8111)
@@ -12,6 +12,10 @@
*/
package org.hornetq.integration.transports.netty;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
/**
* A TransportConstants
*
@@ -100,4 +104,49 @@
public static final String DEFAULT_SERVLET_PATH = "/messaging/HornetQServlet";
+ public static final Set<String> ALLOWABLE_CONNECTOR_KEYS;
+
+ public static final Set<String> ALLOWABLE_ACCEPTOR_KEYS;
+
+ static
+ {
+ Set<String> allowableAcceptorKeys = new HashSet<String>();
+ allowableAcceptorKeys.add(SSL_ENABLED_PROP_NAME);
+ allowableAcceptorKeys.add(HTTP_ENABLED_PROP_NAME);
+ allowableAcceptorKeys.add(HTTP_RESPONSE_TIME_PROP_NAME);
+ allowableAcceptorKeys.add(HTTP_SERVER_SCAN_PERIOD_PROP_NAME);
+ allowableAcceptorKeys.add(USE_NIO_PROP_NAME);
+ allowableAcceptorKeys.add(USE_INVM_PROP_NAME);
+ allowableAcceptorKeys.add(HOST_PROP_NAME);
+ allowableAcceptorKeys.add(PORT_PROP_NAME);
+ allowableAcceptorKeys.add(KEYSTORE_PATH_PROP_NAME);
+ allowableAcceptorKeys.add(KEYSTORE_PASSWORD_PROP_NAME);
+ allowableAcceptorKeys.add(TRUSTSTORE_PATH_PROP_NAME);
+ allowableAcceptorKeys.add(TRUSTSTORE_PASSWORD_PROP_NAME);
+ allowableAcceptorKeys.add(TCP_NODELAY_PROPNAME);
+ allowableAcceptorKeys.add(TCP_SENDBUFFER_SIZE_PROPNAME);
+ allowableAcceptorKeys.add(TCP_RECEIVEBUFFER_SIZE_PROPNAME);
+
+ ALLOWABLE_CONNECTOR_KEYS = Collections.unmodifiableSet(allowableAcceptorKeys);
+
+ Set<String> allowableConnectorKeys = new HashSet<String>();
+ allowableConnectorKeys.add(SSL_ENABLED_PROP_NAME);
+ allowableConnectorKeys.add(HTTP_ENABLED_PROP_NAME);
+ allowableConnectorKeys.add(HTTP_CLIENT_IDLE_PROP_NAME);
+ allowableConnectorKeys.add(HTTP_CLIENT_IDLE_SCAN_PERIOD);
+ allowableConnectorKeys.add(HTTP_REQUIRES_SESSION_ID);
+ allowableConnectorKeys.add(USE_SERVLET_PROP_NAME);
+ allowableConnectorKeys.add(SERVLET_PATH);
+ allowableConnectorKeys.add(USE_NIO_PROP_NAME);
+ allowableConnectorKeys.add(HOST_PROP_NAME);
+ allowableConnectorKeys.add(PORT_PROP_NAME);
+ allowableConnectorKeys.add(KEYSTORE_PATH_PROP_NAME);
+ allowableConnectorKeys.add(KEYSTORE_PASSWORD_PROP_NAME);
+ allowableConnectorKeys.add(TCP_NODELAY_PROPNAME);
+ allowableConnectorKeys.add(TCP_SENDBUFFER_SIZE_PROPNAME);
+ allowableConnectorKeys.add(TCP_RECEIVEBUFFER_SIZE_PROPNAME);
+
+ ALLOWABLE_ACCEPTOR_KEYS = Collections.unmodifiableSet(allowableConnectorKeys);
+ }
+
}
Modified: trunk/src/main/org/hornetq/utils/ConfigurationHelper.java
===================================================================
--- trunk/src/main/org/hornetq/utils/ConfigurationHelper.java 2009-10-14 13:42:12 UTC (rev 8110)
+++ trunk/src/main/org/hornetq/utils/ConfigurationHelper.java 2009-10-15 13:37:51 UTC (rev 8111)
@@ -12,7 +12,9 @@
*/
package org.hornetq.utils;
+import java.util.HashSet;
import java.util.Map;
+import java.util.Set;
import org.hornetq.core.logging.Logger;
@@ -116,7 +118,7 @@
}
}
}
-
+
public static boolean getBooleanProperty(final String propName, final boolean def, final Map<String, Object> props)
{
if (props == null)
@@ -149,4 +151,36 @@
}
}
}
+
+ public static Set<String> checkKeys(final Set<String> allowableKeys, final Set<String> keys)
+ {
+ Set<String> invalid = new HashSet<String>();
+
+ for (String key : keys)
+ {
+ if (!allowableKeys.contains(key))
+ {
+ invalid.add(key);
+ }
+ }
+ return invalid;
+ }
+
+ public static String stringSetToCommaListString(final String msg, final Set<String> invalid)
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append(msg);
+ int count = 0;
+ for (String key : invalid)
+ {
+ sb.append(key);
+ if (count != invalid.size() - 1)
+ {
+ sb.append(", ");
+ }
+ count++;
+ }
+ return sb.toString();
+ }
+
}
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2009-10-14 13:42:12 UTC (rev 8110)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2009-10-15 13:37:51 UTC (rev 8111)
@@ -1091,14 +1091,17 @@
protected Map<String, Object> generateParams(int node, boolean netty)
{
- Map<String, Object> params = new HashMap<String, Object>();
- params.put(SERVER_ID_PROP_NAME, node);
+ Map<String, Object> params = new HashMap<String, Object>();
if (netty)
{
params.put(org.hornetq.integration.transports.netty.TransportConstants.PORT_PROP_NAME,
org.hornetq.integration.transports.netty.TransportConstants.DEFAULT_PORT + node);
}
+ else
+ {
+ params.put(SERVER_ID_PROP_NAME, node);
+ }
return params;
}
Modified: trunk/tests/src/org/hornetq/tests/integration/largemessage/mock/MockConnectorFactory.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/largemessage/mock/MockConnectorFactory.java 2009-10-14 13:42:12 UTC (rev 8110)
+++ trunk/tests/src/org/hornetq/tests/integration/largemessage/mock/MockConnectorFactory.java 2009-10-15 13:37:51 UTC (rev 8111)
@@ -13,7 +13,9 @@
package org.hornetq.tests.integration.largemessage.mock;
+import java.util.Collections;
import java.util.Map;
+import java.util.Set;
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;
@@ -54,6 +56,14 @@
return new MockConnector(configuration, handler, listener);
}
+ /* (non-Javadoc)
+ * @see org.hornetq.core.remoting.spi.ConnectorFactory#getAllowableProperties()
+ */
+ public Set<String> getAllowableProperties()
+ {
+ return Collections.EMPTY_SET;
+ }
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Modified: trunk/tests/src/org/hornetq/tests/integration/management/ManagementServiceImplTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/ManagementServiceImplTest.java 2009-10-14 13:42:12 UTC (rev 8110)
+++ trunk/tests/src/org/hornetq/tests/integration/management/ManagementServiceImplTest.java 2009-10-15 13:37:51 UTC (rev 8111)
@@ -157,7 +157,7 @@
{
Configuration conf = new ConfigurationImpl();
conf.setJMXManagementEnabled(false);
- ManagementServiceImpl managementService = new ManagementServiceImpl(null, conf, -1);
+ ManagementServiceImpl managementService = new ManagementServiceImpl(null, conf);
SimpleString address = randomSimpleString();
managementService.registerAddress(address);
Modified: trunk/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java 2009-10-14 13:42:12 UTC (rev 8110)
+++ trunk/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java 2009-10-15 13:37:51 UTC (rev 8111)
@@ -366,8 +366,7 @@
HornetQResourceAdapter ra = new HornetQResourceAdapter();
- ra.setConnectorClassName("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory");
- ra.setConnectionParameters("bm.remoting.invm.serverid=0");
+ ra.setConnectorClassName("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory");
ra.setUserName("userGlobal");
ra.setPassword("passwordGlobal");
ra.start(fakeCTX);
More information about the hornetq-commits
mailing list