[jboss-cvs] JBoss Messaging SVN: r6217 - in trunk: examples/messaging/src/org/jboss/messaging/example and 78 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Mar 30 13:50:08 EDT 2009


Author: timfox
Date: 2009-03-30 13:50:06 -0400 (Mon, 30 Mar 2009)
New Revision: 6217

Added:
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/NettyFileStorageSymmetricClusterTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/NettyFileStorageSymmetricClusterWithDiscoveryTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/NettySymmetricClusterWithBackupTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/SymmetricClusterWithBackupTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java
Removed:
   trunk/src/main/org/jboss/messaging/core/server/MessagingService.java
   trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServiceImpl.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/SymmetricClusterTestWithBackup.java
Modified:
   trunk/examples/jms/src/org/jboss/jms/example/InVMExample.java
   trunk/examples/messaging/src/org/jboss/messaging/example/SimpleExample.java
   trunk/src/config/ra.xml
   trunk/src/main/org/jboss/messaging/core/asyncio/impl/AsynchronousFileImpl.java
   trunk/src/main/org/jboss/messaging/core/client/impl/ClientConsumerImpl.java
   trunk/src/main/org/jboss/messaging/core/client/impl/ClientProducerImpl.java
   trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java
   trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java
   trunk/src/main/org/jboss/messaging/core/config/Configuration.java
   trunk/src/main/org/jboss/messaging/core/config/cluster/BridgeConfiguration.java
   trunk/src/main/org/jboss/messaging/core/config/cluster/ClusterConnectionConfiguration.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/exception/MessagingException.java
   trunk/src/main/org/jboss/messaging/core/journal/impl/AbstractSequentialFactory.java
   trunk/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java
   trunk/src/main/org/jboss/messaging/core/management/AcceptorControlMBean.java
   trunk/src/main/org/jboss/messaging/core/management/BridgeControlMBean.java
   trunk/src/main/org/jboss/messaging/core/management/ClusterConnectionControlMBean.java
   trunk/src/main/org/jboss/messaging/core/management/impl/AcceptorControl.java
   trunk/src/main/org/jboss/messaging/core/management/impl/BridgeControl.java
   trunk/src/main/org/jboss/messaging/core/management/impl/ClusterConnectionControl.java
   trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java
   trunk/src/main/org/jboss/messaging/core/management/impl/ReplicationOperationInvokerImpl.java
   trunk/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java
   trunk/src/main/org/jboss/messaging/core/persistence/impl/nullpm/NullStorageManager.java
   trunk/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java
   trunk/src/main/org/jboss/messaging/core/remoting/Channel.java
   trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java
   trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMAcceptor.java
   trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnection.java
   trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateSessionMessage.java
   trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketImpl.java
   trunk/src/main/org/jboss/messaging/core/remoting/server/RemotingService.java
   trunk/src/main/org/jboss/messaging/core/remoting/server/impl/RemotingServiceImpl.java
   trunk/src/main/org/jboss/messaging/core/remoting/spi/Acceptor.java
   trunk/src/main/org/jboss/messaging/core/remoting/spi/Connection.java
   trunk/src/main/org/jboss/messaging/core/security/JBMSecurityManager.java
   trunk/src/main/org/jboss/messaging/core/security/impl/JBMSecurityManagerImpl.java
   trunk/src/main/org/jboss/messaging/core/security/impl/SecurityStoreImpl.java
   trunk/src/main/org/jboss/messaging/core/server/Messaging.java
   trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BridgeImpl.java
   trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterConnectionImpl.java
   trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterManagerImpl.java
   trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
   trunk/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java
   trunk/src/main/org/jboss/messaging/core/server/impl/ServerSessionImpl.java
   trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyAcceptor.java
   trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnection.java
   trunk/src/main/org/jboss/messaging/jms/bridge/QualityOfServiceMode.java
   trunk/src/main/org/jboss/messaging/jms/bridge/impl/BridgeImpl.java
   trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java
   trunk/src/main/org/jboss/messaging/jms/client/JBossMessage.java
   trunk/src/main/org/jboss/messaging/jms/client/JBossMessageConsumer.java
   trunk/src/main/org/jboss/messaging/jms/server/JMSServerManager.java
   trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java
   trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java
   trunk/src/main/org/jboss/messaging/jms/server/management/ConnectionFactoryControlMBean.java
   trunk/src/main/org/jboss/messaging/jms/server/management/JMSServerControlMBean.java
   trunk/src/main/org/jboss/messaging/jms/server/management/impl/ConnectionFactoryControl.java
   trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSServerControl.java
   trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareConnectionFactoryControlWrapper.java
   trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSServerControlWrapper.java
   trunk/src/main/org/jboss/messaging/ra/JBMRAProperties.java
   trunk/src/main/org/jboss/messaging/ra/JBMResourceAdapter.java
   trunk/src/main/org/jboss/messaging/ra/inflow/JBMActivation.java
   trunk/src/main/org/jboss/messaging/ra/inflow/JBMActivationSpec.java
   trunk/src/schemas/jbm-configuration.xsd
   trunk/tests/config/ConfigurationTest-full-config.xml
   trunk/tests/jms-tests/src/org/jboss/test/messaging/JBMServerTestCase.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/BrowserTest.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/DeliveryOrderTest.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/DurableSubscriptionTest.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/JMSTest.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/JMSTestCase.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/MessageProducerTest.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/MiscellaneousTest.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/PersistenceTest.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/QueueReceiverTest.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/QueueTest.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/TemporaryDestinationTest.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/TopicTest.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/TransactedSessionTest.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/XATest.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/message/JMSXDeliveryCountTest.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/message/MapMessageTest.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/message/MessageHeaderTest.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/selector/SelectorTest.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/ServerManagement.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/Server.java
   trunk/tests/joram-tests/src/org/jboss/test/jms/SpawnedJMSServer.java
   trunk/tests/src/org/jboss/messaging/tests/integration/DuplicateDetectionTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/String64KLimitTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/chunkmessage/ChunkCleanupTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/chunkmessage/ChunkTestBase.java
   trunk/tests/src/org/jboss/messaging/tests/integration/chunkmessage/mock/MockConnector.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/AddressSettingsTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientAckBatchSizeTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientAcknowledgeTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientAutogroupIdTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientCommitRollbackTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientConsumerCloseTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientConsumerRoundRobinTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientConsumerTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientDeliveryOrderTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientFileMessageTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientLargeMessageTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientMessageCounterTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientMessageHandlerTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientProducerCloseTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientQueueBrowserTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientReceiveTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientRequestorTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientRoutingTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSendTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCloseTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCreateAndDeleteQueueTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCreateConsumerTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCreateProducerTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionFactoryTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionSendAcknowledgementHandlerTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionStopStartTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ConsumerWindowSizeTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/CoreClientTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/DeadLetterAddressTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/DurableQueueTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ExpiryAddressTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/HeuristicXATest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/MessageChunkTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/MessageDurabilityTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/MessageExpirationTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/MessageGroupingTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/MessagePriorityTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/MessageRateTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/PagingTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/RedeliveryConsumerTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/SelfExpandingBufferTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/TemporaryQueueTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/TransactionDurabilityTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/client/WildCardRoutingTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientCrashTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientTestBase.java
   trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/CrashClient.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeReconnectTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeStartTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeTestBase.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusterTestBase.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusterWithBackupTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/MessageRedistributionTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/OneWayChainClusterTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/SymmetricClusterTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ActivationTimeoutTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/AutomaticFailoverWithDiscoveryTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ClusterWithBackupFailoverTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailBackupServerTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverExpiredMessageTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverManagementTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverNoSessionsFailoverTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverPreAcknowledgeTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverScheduledMessageTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverTestBase.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailureListenerOnFailoverTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailureOnCreateConnectionTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/LargeMessageMultiThreadFailoverTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadFailoverSupport.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTestBase.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PageOrderingOnBackupTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PagingFailoverMultiThreadTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PagingFailoverTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PreserveOrderDuringFailoverTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/RandomFailoverTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectWithBackupTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReplicateConnectionFailureTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleAutomaticFailoverTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleManualFailoverTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SplitBrainTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/XALargeMessageMultiThreadFailoverTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/XAMultiThreadRandomFailoverTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareQueueControlWrapperTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareTestBase.java
   trunk/tests/src/org/jboss/messaging/tests/integration/divert/DivertTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/divert/PersistentDivertTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/http/CoreClientOverHttpTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/jms/bridge/BridgeReconnectionTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/jms/bridge/BridgeTestBase.java
   trunk/tests/src/org/jboss/messaging/tests/integration/jms/cluster/JMSFailoverTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/jms/cluster/management/ReplicationAwareJMSQueueControlWrapperTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/jms/consumer/ConsumerTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSQueueControlTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSServerControl2Test.java
   trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSServerControlTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSServerControlUsingJMSTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSUtil.java
   trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/TopicControlTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/AcceptorControlTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/AddressControlTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/BridgeControlTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/BroadcastGroupControlTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/ClusterConnectionControlTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/DiscoveryGroupControlTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/DivertControlTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/MessagingServerControlTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/NotificationTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/QueueControlTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementTestBase.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementWithConfiguredAdminUserTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementWithDefaultConfigurationTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementWithModifiedConfigurationTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityNotificationTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/paging/PageCrashTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/persistence/DeleteQueueRestartTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/persistence/JournalStorageManagerIntegrationTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/remoting/DestroyConsumerTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/remoting/NetworkAddressTestBase.java
   trunk/tests/src/org/jboss/messaging/tests/integration/remoting/PingTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/scheduling/DelayedMessageTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/scheduling/ScheduledMessageTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/security/NettySecurityClientTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/security/SecurityTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/server/ExpiryRunnerTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/server/PredefinedQueueTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/server/SoloQueueRecoveryTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/server/SoloQueueTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSLTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaRecoveryTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/xa/XaTimeoutTest.java
   trunk/tests/src/org/jboss/messaging/tests/performance/paging/MeasurePagingMultiThreadTest.java
   trunk/tests/src/org/jboss/messaging/tests/stress/paging/PageStressTest.java
   trunk/tests/src/org/jboss/messaging/tests/stress/remote/PingStressTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/BasicSecurityDeployerTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/SequentialFileFactoryTestBase.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory1.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory2.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory3.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java
   trunk/tests/src/org/jboss/messaging/tests/util/ServiceTestBase.java
   trunk/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java
Log:
more stuff on clustering, fixes, tweaks etc

Modified: trunk/examples/jms/src/org/jboss/jms/example/InVMExample.java
===================================================================
--- trunk/examples/jms/src/org/jboss/jms/example/InVMExample.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/examples/jms/src/org/jboss/jms/example/InVMExample.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -21,17 +21,6 @@
  */
 package org.jboss.jms.example;
 
-import org.jboss.messaging.core.config.TransportConfiguration;
-import org.jboss.messaging.core.config.impl.ConfigurationImpl;
-import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
-import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
-import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
-import org.jboss.messaging.jms.JBossQueue;
-import org.jboss.messaging.jms.JBossTopic;
-import org.jboss.messaging.jms.client.JBossConnectionFactory;
-import org.jboss.messaging.jms.server.impl.JMSServerManagerImpl;
-
 import javax.jms.Connection;
 import javax.jms.ConnectionFactory;
 import javax.jms.MessageConsumer;
@@ -44,6 +33,18 @@
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 
+import org.jboss.messaging.core.config.TransportConfiguration;
+import org.jboss.messaging.core.config.impl.ConfigurationImpl;
+import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
+import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
+import org.jboss.messaging.core.server.Messaging;
+import org.jboss.messaging.core.server.MessagingServer;
+import org.jboss.messaging.jms.JBossQueue;
+import org.jboss.messaging.jms.JBossTopic;
+import org.jboss.messaging.jms.client.JBossConnectionFactory;
+import org.jboss.messaging.jms.server.JMSServerManager;
+import org.jboss.messaging.jms.server.impl.JMSServerManagerImpl;
+
 /**
  * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
  */
@@ -51,22 +52,22 @@
 {
    public static void main(String[] args) throws Exception
    {
-      MessagingService messagingService = null;
+      MessagingServer server = null;
       ConfigurationImpl configuration = new ConfigurationImpl();
       configuration.setSecurityEnabled(false);
       configuration.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
-      messagingService = Messaging.newNullStorageMessagingService(configuration);
-      //start the server
-      messagingService.start();
-      JMSServerManagerImpl serverManager = JMSServerManagerImpl.newJMSServerManagerImpl(messagingService.getServer());
+      server = Messaging.newNullStorageMessagingServer(configuration);
+      // start the server
+      server.start();
+      JMSServerManager serverManager = JMSServerManagerImpl.newJMSServerManagerImpl(server);
       serverManager.start();
-      //if you want to lookup the objects via jndi, use a proper context
+      // if you want to lookup the objects via jndi, use a proper context
       serverManager.setContext(new NullInitialContext());
       ConnectionFactory cf = new JBossConnectionFactory(new TransportConfiguration(InVMConnectorFactory.class.getName()));
 
       Connection conn = cf.createConnection();
       conn.setClientID("myid");
-      //some queue stuff
+      // some queue stuff
       Queue q = new JBossQueue("queueA");
       serverManager.createQueue(q.getQueueName(), q.getQueueName());
       Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -74,10 +75,10 @@
       prod.send(sess.createTextMessage("hello"));
       MessageConsumer cons = sess.createConsumer(q, null, false);
       conn.start();
-      TextMessage message = (TextMessage) cons.receive(5000);
+      TextMessage message = (TextMessage)cons.receive(5000);
       System.out.println("message.getText() = " + message.getText());
 
-      //some topic stuff
+      // some topic stuff
       Topic topic = new JBossTopic("topicA");
       serverManager.createTopic(topic.getTopicName(), topic.getTopicName());
       prod = sess.createProducer(topic);
@@ -87,8 +88,8 @@
       System.out.println("message.getText() = " + message.getText());
 
       conn.close();
-      //stop the server
-      messagingService.stop();
+      // stop the server
+      server.stop();
    }
 
    static class NullInitialContext extends InitialContext

Modified: trunk/examples/messaging/src/org/jboss/messaging/example/SimpleExample.java
===================================================================
--- trunk/examples/messaging/src/org/jboss/messaging/example/SimpleExample.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/examples/messaging/src/org/jboss/messaging/example/SimpleExample.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -31,7 +31,7 @@
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.utils.SimpleString;
 
 /**
@@ -43,7 +43,7 @@
 {
    public static void main(final String[] args) throws Exception
    {
-      MessagingService messagingService = null;
+      MessagingServer server = null;
       ClientSession clientSession = null;
 
       try
@@ -52,9 +52,9 @@
          ConfigurationImpl configuration = new ConfigurationImpl();
          configuration.setSecurityEnabled(false);
          configuration.getAcceptorConfigurations().add(new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory"));
-         messagingService = Messaging.newNullStorageMessagingService(configuration);
+         server = Messaging.newNullStorageMessagingServer(configuration);
          //start the server
-         messagingService.start();
+         server.start();
 
          //then we create a client as normal       
          ClientSessionFactory sessionFactory = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory"));
@@ -88,11 +88,11 @@
                //
             }
          }
-         if (messagingService != null && messagingService.isStarted())
+         if (server != null && server.isStarted())
          {
             try
             {
-               messagingService.stop();
+               server.stop();
             }
             catch (Exception e1)
             {

Modified: trunk/src/config/ra.xml
===================================================================
--- trunk/src/config/ra.xml	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/config/ra.xml	2009-03-30 17:50:06 UTC (rev 6217)
@@ -55,7 +55,7 @@
          <config-property-value>jbm.remoting.invm.serverid:0:Integer</config-property-value>
       </config-property>
        <config-property>
-        <description>Use XA methods to obtain connections</description>
+        <description>Use XA methods to obtain connections?</description>
         <config-property-name>UseXA</config-property-name>
         <config-property-type>java.lang.Boolean</config-property-type>
         <config-property-value>true</config-property-value>
@@ -223,15 +223,15 @@
         <config-property-value></config-property-value>
       </config-property>
       <config-property>
-        <description>The maximum number of initial connection attempts</description>
-        <config-property-name>InitialConnectAttempts</config-property-name>
+        <description>The maximum number of reconnect attempts</description>
+        <config-property-name>ReconnectAttempts</config-property-name>
         <config-property-type>java.lang.Integer</config-property-type>
         <config-property-value></config-property-value>
       </config-property>
       <config-property>
-        <description>The maximum number of reconnection attempts after failure is detected</description>
-        <config-property-name>ReconnectAttempts</config-property-name>
-        <config-property-type>java.lang.Integer</config-property-type>
+        <description>Should clean server shutdown trigger failover?</description>
+        <config-property-name>FailoverOnServerShutdown</config-property-name>
+        <config-property-type>java.lang.Boolean</config-property-type>
         <config-property-value></config-property-value>
       </config-property>
       <config-property>

Modified: trunk/src/main/org/jboss/messaging/core/asyncio/impl/AsynchronousFileImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/asyncio/impl/AsynchronousFileImpl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/asyncio/impl/AsynchronousFileImpl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -56,7 +56,7 @@
 
    private static int EXPECTED_NATIVE_VERSION = 17;
 
-   static void addMax(final int io)
+   public static void addMax(final int io)
    {
       totalMaxIO.addAndGet(io);
    }
@@ -67,6 +67,11 @@
       return totalMaxIO.get();
    }
 
+   public static void resetMaxAIO()
+   {
+      totalMaxIO.set(0);
+   }
+
    private static boolean loadLibrary(final String name)
    {
       try
@@ -159,6 +164,7 @@
          writeSemaphore = new Semaphore(this.maxIO);
 
          this.fileName = fileName;
+
          handler = init(fileName, this.maxIO, log);
          opened = true;
          addMax(this.maxIO);

Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientConsumerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientConsumerImpl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientConsumerImpl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -176,6 +176,7 @@
             {
                while ((stopped || (m = buffer.removeFirst()) == null) &&
                       !closed && toWait > 0)
+
                {
                   if (start == -1)
                   {
@@ -275,17 +276,16 @@
 
       handler = theHandler;
 
-      //if no previous handler existed queue up messages for delivery
+      // if no previous handler existed queue up messages for delivery
       if (handler != null && noPreviousHandler)
       {
-         for (int i = 0; i < buffer.size(); i++)
-         {
-            queueExecutor();
-         }
+
+         requeueExecutors();
       }
-      //if unsetting a previous handler may be in onMessage so wait for completion
+      // if unsetting a previous handler may be in onMessage so wait for completion
       else if (handler == null && !noPreviousHandler)
       {
+
          waitForOnMessageToComplete();
       }
    }
@@ -323,12 +323,14 @@
    public void stop() throws MessagingException
    {
       waitForOnMessageToComplete();
+      
       synchronized (this)
       {
          if (stopped)
          {
             return;
          }
+         
          stopped = true;
       }
    }
@@ -336,10 +338,8 @@
    public synchronized void start()
    {
       stopped = false;
-      for (int i = 0; i < buffer.size(); i++)
-      {
-         queueExecutor();
-      }
+
+      requeueExecutors();
    }
 
    public Exception getLastException()
@@ -419,7 +419,7 @@
 
       if (isFileConsumer())
       {
-         ClientFileMessageInternal fileMessage = (ClientFileMessageInternal) currentChunkMessage;
+         ClientFileMessageInternal fileMessage = (ClientFileMessageInternal)currentChunkMessage;
          addBytesBody(fileMessage, chunk.getBody());
       }
       else
@@ -439,7 +439,7 @@
          // Close the file that was being generated
          if (isFileConsumer())
          {
-            ((ClientFileMessageInternal) currentChunkMessage).closeChannel();
+            ((ClientFileMessageInternal)currentChunkMessage).closeChannel();
          }
 
          currentChunkMessage.setFlowControlSize(chunk.getPacketSize());
@@ -511,6 +511,14 @@
    // Private
    // ---------------------------------------------------------------------------------------
 
+   private void requeueExecutors()
+   {
+      for (int i = 0; i < buffer.size(); i++)
+      {
+         queueExecutor();
+      }
+   }
+
    private void queueExecutor()
    {
       sessionExecutor.execute(runner);
@@ -527,7 +535,8 @@
 
             if (isLargeMessage)
             {
-               // Flowcontrol on largeMessages continuations needs to be done in a separate thread or failover would block
+               // Flowcontrol on largeMessages continuations needs to be done in a separate thread or failover would
+               // block
                final int credits = creditsToSend;
 
                creditsToSend = 0;
@@ -616,8 +625,7 @@
       MessageHandler theHandler = handler;
 
       if (theHandler != null)
-      {
-         
+      {         
          if (rateLimiter != null)
          {
             rateLimiter.limit();
@@ -718,7 +726,7 @@
          {
             if (message instanceof ClientFileMessage)
             {
-               ((ClientFileMessage) message).getFile().delete();
+               ((ClientFileMessage)message).getFile().delete();
             }
          }
       }

Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientProducerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientProducerImpl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientProducerImpl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -256,7 +256,7 @@
       SessionSendMessage initialChunk = new SessionSendMessage(headerBuffer.array(), false);
 
       channel.send(initialChunk);
-
+      
       for (int pos = 0; pos < bodySize;)
       {
          final boolean lastChunk;
@@ -281,8 +281,7 @@
          else
          {
             channel.send(chunk);
-         }
-
+         }         
       }
 
       // Note: This could be either a regular message, with a huge body,

Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -89,10 +89,11 @@
 
    public static final double DEFAULT_RETRY_INTERVAL_MULTIPLIER = 1d;
 
-   public static final int DEFAULT_INITIAL_CONNECT_ATTEMPTS = 1;
-
    public static final int DEFAULT_RECONNECT_ATTEMPTS = 0;
+   
+   public static final boolean DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN = false;
 
+
    // Attributes
    // -----------------------------------------------------------------------------------
 
@@ -147,9 +148,9 @@
 
    private final double retryIntervalMultiplier; // For exponential backoff
 
-   private final int initialConnectAttempts;
-
    private final int reconnectAttempts;
+   
+   private final boolean failoverOnServerShutdown;
 
    // Static
    // ---------------------------------------------------------------------------------------
@@ -201,8 +202,8 @@
       this.preAcknowledge = DEFAULT_PRE_ACKNOWLEDGE;
       this.retryInterval = DEFAULT_RETRY_INTERVAL;
       this.retryIntervalMultiplier = DEFAULT_RETRY_INTERVAL_MULTIPLIER;
-      this.initialConnectAttempts = DEFAULT_INITIAL_CONNECT_ATTEMPTS;
       this.reconnectAttempts = DEFAULT_RECONNECT_ATTEMPTS;
+      this.failoverOnServerShutdown = DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN;
    }
 
    public ClientSessionFactoryImpl(final String discoveryGroupAddress,
@@ -227,8 +228,8 @@
                                    final int ackBatchSize,
                                    final long retryInterval,
                                    final double retryIntervalMultiplier,
-                                   final int initialConnectAttempts,
-                                   final int reconnectAttempts) throws MessagingException
+                                   final int reconnectAttempts,
+                                   final boolean failoverOnServerShutdown) throws MessagingException
    {
       try
       {
@@ -269,8 +270,8 @@
       this.preAcknowledge = preAcknowledge;
       this.retryInterval = retryInterval;
       this.retryIntervalMultiplier = retryIntervalMultiplier;
-      this.initialConnectAttempts = initialConnectAttempts;
       this.reconnectAttempts = reconnectAttempts;
+      this.failoverOnServerShutdown = failoverOnServerShutdown;
    }
 
    public ClientSessionFactoryImpl(final List<Pair<TransportConfiguration, TransportConfiguration>> connectors,
@@ -292,8 +293,8 @@
                                    final int ackBatchSize,
                                    final long retryInterval,
                                    final double retryIntervalMultiplier,
-                                   final int initialConnectAttempts,
-                                   final int reconnectAttempts)
+                                   final int reconnectAttempts,
+                                   final boolean failoverOnServerShutdown)
    {
       this.loadBalancingPolicy = instantiateLoadBalancingPolicy(connectionloadBalancingPolicyClassName);
       this.pingPeriod = pingPeriod;
@@ -313,8 +314,8 @@
       this.preAcknowledge = preAcknowledge;
       this.retryInterval = retryInterval;
       this.retryIntervalMultiplier = retryIntervalMultiplier;
-      this.initialConnectAttempts = initialConnectAttempts;
       this.reconnectAttempts = reconnectAttempts;
+      this.failoverOnServerShutdown = failoverOnServerShutdown;
 
       this.initialWaitTimeout = -1;
 
@@ -322,13 +323,13 @@
       {
          ConnectionManager cm = new ConnectionManagerImpl(pair.a,
                                                           pair.b,
+                                                          failoverOnServerShutdown,
                                                           maxConnections,
                                                           callTimeout,
                                                           pingPeriod,
                                                           connectionTTL,
                                                           retryInterval,
                                                           retryIntervalMultiplier,
-                                                          initialConnectAttempts,
                                                           reconnectAttempts);
 
          connectionManagerMap.put(pair, cm);
@@ -341,9 +342,9 @@
 
    public ClientSessionFactoryImpl(final TransportConfiguration connectorConfig,
                                    final TransportConfiguration backupConnectorConfig,
+                                   final boolean failoverOnServerShutdown,
                                    final long retryInterval,
                                    final double retryIntervalMultiplier,
-                                   final int initialConnectAttempts,
                                    final int reconnectAttempts)
    {
       this.loadBalancingPolicy = new FirstElementConnectionLoadBalancingPolicy();
@@ -364,8 +365,8 @@
       this.preAcknowledge = DEFAULT_PRE_ACKNOWLEDGE;
       this.retryInterval = retryInterval;
       this.retryIntervalMultiplier = retryIntervalMultiplier;
-      this.initialConnectAttempts = initialConnectAttempts;
       this.reconnectAttempts = reconnectAttempts;
+      this.failoverOnServerShutdown = failoverOnServerShutdown;
 
       this.initialWaitTimeout = -1;
 
@@ -374,13 +375,13 @@
 
       ConnectionManager cm = new ConnectionManagerImpl(pair.a,
                                                        pair.b,
+                                                       failoverOnServerShutdown,
                                                        maxConnections,
                                                        callTimeout,
                                                        pingPeriod,
                                                        connectionTTL,
                                                        retryInterval,
                                                        retryIntervalMultiplier,
-                                                       initialConnectAttempts,
                                                        reconnectAttempts);
 
       connectionManagerMap.put(pair, cm);
@@ -393,7 +394,6 @@
    public ClientSessionFactoryImpl(final TransportConfiguration connectorConfig,
                                    final long retryInterval,
                                    final double retryIntervalMultiplier,
-                                   final int initialConnectAttempts,
                                    final int reconnectAttempts)
    {
       this.loadBalancingPolicy = new FirstElementConnectionLoadBalancingPolicy();
@@ -414,8 +414,8 @@
       this.preAcknowledge = DEFAULT_PRE_ACKNOWLEDGE;
       this.retryInterval = retryInterval;
       this.retryIntervalMultiplier = retryIntervalMultiplier;
-      this.initialConnectAttempts = initialConnectAttempts;
       this.reconnectAttempts = reconnectAttempts;
+      this.failoverOnServerShutdown = DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN;
 
       this.initialWaitTimeout = -1;
 
@@ -424,13 +424,13 @@
 
       ConnectionManager cm = new ConnectionManagerImpl(pair.a,
                                                        pair.b,
+                                                       failoverOnServerShutdown,
                                                        maxConnections,
                                                        callTimeout,
                                                        pingPeriod,
                                                        connectionTTL,
                                                        retryInterval,
                                                        retryIntervalMultiplier,
-                                                       initialConnectAttempts,
                                                        reconnectAttempts);
 
       connectionManagerMap.put(pair, cm);
@@ -461,8 +461,8 @@
       this.preAcknowledge = DEFAULT_PRE_ACKNOWLEDGE;
       this.retryInterval = DEFAULT_RETRY_INTERVAL;
       this.retryIntervalMultiplier = DEFAULT_RETRY_INTERVAL_MULTIPLIER;
-      this.initialConnectAttempts = DEFAULT_INITIAL_CONNECT_ATTEMPTS;
       this.reconnectAttempts = DEFAULT_RECONNECT_ATTEMPTS;
+      this.failoverOnServerShutdown = DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN;
 
       this.initialWaitTimeout = -1;
 
@@ -471,13 +471,13 @@
 
       ConnectionManager cm = new ConnectionManagerImpl(pair.a,
                                                        pair.b,
+                                                       failoverOnServerShutdown,
                                                        maxConnections,
                                                        callTimeout,
                                                        pingPeriod,
                                                        connectionTTL,
                                                        retryInterval,
                                                        retryIntervalMultiplier,
-                                                       initialConnectAttempts,
                                                        reconnectAttempts);
 
       connectionManagerMap.put(pair, cm);
@@ -489,6 +489,7 @@
 
    public ClientSessionFactoryImpl(final TransportConfiguration connectorConfig,
                                    final TransportConfiguration backupConfig,
+                                   final boolean failoverOnServerShutdown,
                                    final String connectionloadBalancingPolicyClassName,
                                    final long pingPeriod,
                                    final long connectionTTL,
@@ -507,7 +508,6 @@
                                    final int ackBatchSize,
                                    final long retryInterval,
                                    final double retryIntervalMultiplier,
-                                   final int initialConnectAttempts,
                                    final int reconnectAttempts)
    {
       this.loadBalancingPolicy = instantiateLoadBalancingPolicy(connectionloadBalancingPolicyClassName);
@@ -528,8 +528,8 @@
       this.preAcknowledge = preAcknowledge;
       this.retryInterval = retryInterval;
       this.retryIntervalMultiplier = retryIntervalMultiplier;
-      this.initialConnectAttempts = initialConnectAttempts;
       this.reconnectAttempts = reconnectAttempts;
+      this.failoverOnServerShutdown = failoverOnServerShutdown;
 
       this.initialWaitTimeout = -1;
 
@@ -537,13 +537,13 @@
                                                                                                                            backupConfig);
       ConnectionManager cm = new ConnectionManagerImpl(pair.a,
                                                        pair.b,
+                                                       failoverOnServerShutdown,
                                                        maxConnections,
                                                        callTimeout,
                                                        pingPeriod,
                                                        connectionTTL,
                                                        retryInterval,
                                                        retryIntervalMultiplier,
-                                                       initialConnectAttempts,
                                                        reconnectAttempts);
 
       connectionManagerMap.put(pair, cm);
@@ -560,9 +560,9 @@
    {
       this(connectorConfig,
            null,
+           DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN,
            DEFAULT_RETRY_INTERVAL,
            DEFAULT_RETRY_INTERVAL_MULTIPLIER,
-           DEFAULT_INITIAL_CONNECT_ATTEMPTS,
            DEFAULT_RECONNECT_ATTEMPTS);
    }
 
@@ -810,13 +810,13 @@
 
             ConnectionManager connectionManager = new ConnectionManagerImpl(connectorPair.a,
                                                                             connectorPair.b,
+                                                                            failoverOnServerShutdown,
                                                                             maxConnections,
                                                                             callTimeout,
                                                                             pingPeriod,
                                                                             connectionTTL,
                                                                             retryInterval,
                                                                             retryIntervalMultiplier,
-                                                                            initialConnectAttempts,
                                                                             reconnectAttempts);
 
             connectionManagerMap.put(connectorPair, connectionManager);

Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -25,6 +25,7 @@
 import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.EARLY_RESPONSE;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -113,12 +114,10 @@
    private static final ScheduledThreadPoolExecutor pingExecutor = new ScheduledThreadPoolExecutor(5,
                                                                                                    new org.jboss.messaging.utils.JBMThreadFactory("jbm-pinger-threads"));
 
-   private final Map<Object, ConnectionEntry> connections = new LinkedHashMap<Object, ConnectionEntry>();
+   private final Map<Object, ConnectionEntry> connections = Collections.synchronizedMap(new LinkedHashMap<Object, ConnectionEntry>());
 
    private int refCount;
 
-   private boolean connected;
-
    private Iterator<ConnectionEntry> mapIterator;
 
    private Object failConnectionLock = new Object();
@@ -127,14 +126,16 @@
 
    private final double retryIntervalMultiplier; // For exponential backoff
 
-   private final int initialConnectAttempts;
-
    private final int reconnectAttempts;
 
+   private boolean failoverOnServerShutdown;
+
    private volatile boolean closed;
 
    private boolean inFailoverOrReconnect;
 
+   private volatile boolean failureSignalled;
+
    // debug
 
    private static Map<TransportConfiguration, Set<RemotingConnection>> debugConns;
@@ -156,19 +157,21 @@
 
    public ConnectionManagerImpl(final TransportConfiguration connectorConfig,
                                 final TransportConfiguration backupConfig,
+                                final boolean failoverOnServerShutdown,
                                 final int maxConnections,
                                 final long callTimeout,
                                 final long pingPeriod,
                                 final long connectionTTL,
                                 final long retryInterval,
                                 final double retryIntervalMultiplier,
-                                final int initialConnectAttempts,
                                 final int reconnectAttempts)
-   {
+   {      
       this.connectorConfig = connectorConfig;
 
       this.backupConfig = backupConfig;
 
+      this.failoverOnServerShutdown = failoverOnServerShutdown;
+
       connectorFactory = instantiateConnectorFactory(connectorConfig.getFactoryClassName());
 
       transportParams = connectorConfig.getParams();
@@ -198,9 +201,7 @@
 
       this.retryIntervalMultiplier = retryIntervalMultiplier;
 
-      this.initialConnectAttempts = initialConnectAttempts;
-
-      this.reconnectAttempts = reconnectAttempts;          
+      this.reconnectAttempts = reconnectAttempts;
    }
 
    // ConnectionLifeCycleListener implementation --------------------
@@ -211,15 +212,12 @@
 
    public void connectionDestroyed(final Object connectionID)
    {
-      MessagingException me = new MessagingException(MessagingException.OBJECT_CLOSED,
-                                                     "The connection has been closed by the server");
-
-      failoverOrReconnect(me, connectionID);
+      failConnection(connectionID, new MessagingException(MessagingException.NOT_CONNECTED, "Channel disconnected"));
    }
 
    public void connectionException(final Object connectionID, final MessagingException me)
    {
-      failoverOrReconnect(me, connectionID);
+      failConnection(connectionID, me);
    }
 
    // ConnectionManager implementation ------------------------------------------------------------------
@@ -260,14 +258,28 @@
 
                synchronized (failoverLock)
                {
-                  connection = getConnectionForCreateSession();
-
+                  connection = getConnectionWithRetry(1, reconnectAttempts);
+                  
                   if (connection == null)
-                  {
-                     // This can happen if the connection manager gets closed - e.g. the server gets shut down
-                     return null;
+                  {                     
+                     if (!failureSignalled)
+                     {
+                        // This can happen if the connection manager gets closed - e.g. the server gets shut down
+                        //return null;
+                        
+                        throw new MessagingException(MessagingException.NOT_CONNECTED, "Unable to connect to server");
+                     }
+                     else
+                     {                        
+                        // This means an async failure came in while getConnectionForCreateSession was executing, we
+                        // need
+                        // to allow the failover/reconnection to occur and let the create session retry after
+                        retry = true;
+
+                        continue;
+                     }
                   }
-                  
+
                   channel1 = connection.getChannel(1, -1, false);
 
                   // Lock it - this must be done while the failoverLock is held
@@ -340,8 +352,6 @@
 
                   sessionChannel.setHandler(handler);
 
-                  connected = true;
-
                   return session;
                }
             }
@@ -393,7 +403,7 @@
       }
 
       // Should never get here
-      throw new IllegalStateException("Oh my God it's full of stars");
+      throw new IllegalStateException("Oh my God it's full of stars!");
    }
 
    // Must be synchronized to prevent it happening concurrently with failover which can lead to
@@ -430,13 +440,6 @@
       closed = true;
    }
 
-   private boolean handleConnectionFailed(final MessagingException me, final Object connectionID)
-   {     
-      boolean callNext = !failoverOrReconnect(me, connectionID);
-      
-      return callNext;
-   }
-
    // Public
    // ---------------------------------------------------------------------------------------
 
@@ -449,69 +452,11 @@
    // Private
    // --------------------------------------------------------------------------------------
 
-   private RemotingConnection getConnectionForCreateSession() throws MessagingException
+   private boolean handleConnectionFailure(final MessagingException me, final Object connectionID)
    {
-      int connectAttempts = connected ? 2 : initialConnectAttempts;
-      
-      int count = 0;
+      boolean callNext = !failoverOrReconnect(me, connectionID);
 
-      if (connectAttempts != 0)
-      {
-         while (true)
-         {
-            if (closed)
-            {
-               return null;
-            }
-
-            RemotingConnection connection = getConnection(1);
-
-            if (connection == null)
-            {
-               // We failed to get a connection
-
-               // We now call failover() - this will attempt to reconnect/failover any pre-existing connections
-               // If there are no pre-existing connections it will just return true, so we need to continue in a loop
-               // here
-
-               MessagingException me = new MessagingException(MessagingException.NOT_CONNECTED,
-                                                              "Unabled to create session - server is unavailable and no backup server or backup is unavailable");
-
-               boolean failedOver = failoverOrReconnect(me, null);
-
-               if (!failedOver)
-               {
-                  // Nothing we can do here
-                  throw me;
-               }
-
-               if (connectAttempts != -1)
-               {
-                  count++;
-
-                  if (count == connectAttempts)
-                  {
-                     break;
-                  }
-               }
-
-               try
-               {
-                  Thread.sleep(retryInterval);
-               }
-               catch (Exception ignore)
-               {
-               }
-            }
-            else
-            {
-               return connection;
-            }
-         }
-      }
-
-      throw new MessagingException(MessagingException.NOT_CONNECTED,
-                                   "Unabled to create session after " + connectAttempts + " attempts");
+      return callNext;
    }
 
    private boolean failoverOrReconnect(final MessagingException me, final Object connectionID)
@@ -521,19 +466,23 @@
       {
          return false;
       }
-      
-      synchronized (failoverLock)
+
+      if (connectionID != null && !connections.containsKey(connectionID))
       {
-         if (connectionID != null && !connections.containsKey(connectionID))
-         {
-            // We already failed over - probably the first failure came in, all the connetions were failed over then a
-            // async connection exception or disconnect
-            // came in for one of the already closed connections, so we return true - we don't want to call the
-            // listeners again
+         // We already failed over/reconnected - probably the first failure came in, all the connections were failed
+         // over then a async connection exception or disconnect
+         // came in for one of the already closed connections, so we return true - we don't want to call the
+         // listeners again
 
-            return true;
-         }
+         return true;
+      }
 
+      failureSignalled = true;
+
+      synchronized (failoverLock)
+      {
+         failureSignalled = false;
+
          inFailoverOrReconnect = true;
 
          // Now get locks on all channel 1s, whilst holding the failoverLock - this makes sure
@@ -561,21 +510,19 @@
          // It can then release the channel 1 lock, and retry (which will cause locking on failoverLock
          // until failover is complete
 
-         boolean done = false;
+         boolean attemptFailover = (backupConnectorFactory) != null && (failoverOnServerShutdown || me.getCode() != MessagingException.SERVER_DISCONNECTED);
 
-         int connectAttempts;
+//         log.info(System.identityHashCode(this) + " in failover or reconnect, attemptFailover is " +
+//                  attemptFailover +
+//                  " failoveronservers:" +
+//                  failoverOnServerShutdown +
+//                  " me.getcode " +
+//                  me.getCode());
 
-         if (!connected)
+         boolean done = false;
+
+         if (attemptFailover || reconnectAttempts != 0)
          {
-            connectAttempts = initialConnectAttempts;
-         }
-         else
-         {
-            connectAttempts = backupConnectorFactory == null ? reconnectAttempts : 0;
-         }
-         
-         if (backupConnectorFactory != null || connectAttempts != 0)
-         {
             lockAllChannel1s();
 
             final boolean needToInterrupt;
@@ -629,16 +576,10 @@
 
             mapIterator = null;
 
-            if (connectAttempts != 0)
+            if (attemptFailover)
             {
-               // First try reconnecting to current node if configured to do this
-
-               done = reattachSessions(connectAttempts);
-            }
-            else
-            {
                // Now try failing over to backup
-               
+
                connectorFactory = backupConnectorFactory;
 
                transportParams = backupTransportParams;
@@ -647,8 +588,12 @@
 
                backupTransportParams = null;
 
-               done = reattachSessions(connectAttempts);
+               done = reattachSessions(reconnectAttempts == -1 ? -1 : reconnectAttempts + 1);
             }
+            else if (reconnectAttempts != 0)
+            {              
+               done = reattachSessions(reconnectAttempts);
+            }
 
             if (done)
             {
@@ -683,7 +628,7 @@
    /*
     * Re-attach sessions all pre-existing sessions to new remoting connections
     */
-   private boolean reattachSessions(final int connectAttempts)
+   private boolean reattachSessions(final int reconnectAttempts)
    {
       // We re-attach sessions per connection to ensure there is the same mapping of channel id
       // on live and backup connections
@@ -714,7 +659,7 @@
       {
          List<ClientSessionInternal> theSessions = entry.getValue();
 
-         RemotingConnection backupConnection = getConnectionWithRetry(theSessions, connectAttempts);
+         RemotingConnection backupConnection = getConnectionWithRetry(theSessions.size(), reconnectAttempts);
 
          if (backupConnection == null)
          {
@@ -767,33 +712,32 @@
       return ok;
    }
 
-   private RemotingConnection getConnectionWithRetry(final List<ClientSessionInternal> sessions,
-                                                     final int connectAttempts)
+   private RemotingConnection getConnectionWithRetry(final int initialRefCount, final int reconnectAttempts)
    {
       long interval = retryInterval;
 
       int count = 0;
-
+      
       while (true)
       {
-         if (closed)
+         if (closed || failureSignalled)
          {
             return null;
          }
 
-         RemotingConnection connection = getConnection(sessions.size());
-
+         RemotingConnection connection = getConnection(initialRefCount);
+         
          if (connection == null)
          {
-            // Failed to get backup connection
+            // Failed to get connection
 
-            if (connectAttempts != 0)
+            if (reconnectAttempts != 0)
             {
                count++;
 
-               if (connectAttempts != -1 && count == connectAttempts)
+               if (reconnectAttempts != -1 && count == reconnectAttempts)
                {
-                  log.warn("Retried " + connectAttempts + " times to reconnect. Now giving up.");
+                  log.warn("Tried " + reconnectAttempts + " times to connect. Now giving up.");
 
                   return null;
                }
@@ -853,7 +797,7 @@
       }
    }
 
-   private RemotingConnection getConnection(final int count)
+   private RemotingConnection getConnection(final int initialRefCount)
    {
       RemotingConnection conn;
 
@@ -870,13 +814,13 @@
          try
          {
             connector = connectorFactory.createConnector(transportParams, handler, this);
-            
+
             if (connector != null)
             {
                connector.start();
-               
+
                tc = connector.createConnection();
-                
+
                if (tc == null)
                {
                   try
@@ -884,8 +828,9 @@
                      connector.close();
                   }
                   catch (Throwable t)
-                  {}
-                  
+                  {
+                  }
+
                }
 
             }
@@ -893,10 +838,10 @@
          catch (Exception e)
          {
             // Sanity catch for badly behaved remoting plugins
-            
+
             log.warn("connector.create or connectorFactory.createConnector should never throw an exception, implementation is badly behaved, but we'll deal with it anyway.",
                      e);
-            
+
             if (tc != null)
             {
                try
@@ -904,9 +849,10 @@
                   tc.close();
                }
                catch (Throwable t)
-               {}
+               {
+               }
             }
-            
+
             if (connector != null)
             {
                try
@@ -914,14 +860,15 @@
                   connector.close();
                }
                catch (Throwable t)
-               {}
+               {
+               }
             }
 
             tc = null;
 
             connector = null;
          }
-  
+
          if (tc == null)
          {
             return null;
@@ -956,7 +903,7 @@
          conn = entry.connection;
       }
 
-      refCount += count;
+      refCount += initialRefCount;
 
       return conn;
    }
@@ -1042,9 +989,21 @@
          channel1.returnBlocking();
       }
    }
-
-   private class ConnectionEntry
+   
+   private void failConnection(final Object connectionID, final MessagingException me)
    {
+      ConnectionEntry entry = connections.get(connectionID);
+      
+      if (entry != null)
+      {
+         RemotingConnection conn = entry.connection;
+         
+         conn.fail(me);
+      }     
+   }
+   
+   private static class ConnectionEntry
+   {
       ConnectionEntry(final RemotingConnection connection, final Connector connector)
       {
          this.connection = connection;
@@ -1078,7 +1037,7 @@
 
       public boolean connectionFailed(final MessagingException me)
       {
-         return handleConnectionFailed(me, connectionID);
+         return handleConnectionFailure(me, connectionID);
       }
    }
 

Modified: trunk/src/main/org/jboss/messaging/core/config/Configuration.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/Configuration.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/config/Configuration.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -34,6 +34,7 @@
 import org.jboss.messaging.core.config.cluster.DivertConfiguration;
 import org.jboss.messaging.core.config.cluster.QueueConfiguration;
 import org.jboss.messaging.core.server.JournalType;
+import org.jboss.messaging.core.server.MessagingComponent;
 import org.jboss.messaging.utils.SimpleString;
 
 /**
@@ -43,7 +44,7 @@
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
  *
  */
-public interface Configuration extends Serializable
+public interface Configuration extends Serializable, MessagingComponent
 {
    // General attributes -------------------------------------------------------------------
 

Modified: trunk/src/main/org/jboss/messaging/core/config/cluster/BridgeConfiguration.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/cluster/BridgeConfiguration.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/config/cluster/BridgeConfiguration.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -57,9 +57,9 @@
 
    private final double retryIntervalMultiplier;
 
-   private final int initialConnectAttempts;
-
    private final int reconnectAttempts;
+   
+   private final boolean failoverOnServerShutdown;
 
    private final boolean useDuplicateDetection;
 
@@ -70,8 +70,8 @@
                               final String transformerClassName,
                               final long retryInterval,
                               final double retryIntervalMultiplier,
-                              final int initialConnectAttempts,
                               final int reconnectAttempts,
+                              final boolean failoverOnServerShutdown,
                               final boolean useDuplicateDetection,
                               final Pair<String, String> connectorPair)
    {
@@ -82,8 +82,8 @@
       this.transformerClassName = transformerClassName;
       this.retryInterval = retryInterval;
       this.retryIntervalMultiplier = retryIntervalMultiplier;
-      this.initialConnectAttempts = initialConnectAttempts;
       this.reconnectAttempts = reconnectAttempts;
+      this.failoverOnServerShutdown = failoverOnServerShutdown;
       this.useDuplicateDetection = useDuplicateDetection;
       this.connectorPair = connectorPair;
       this.discoveryGroupName = null;
@@ -96,8 +96,8 @@
                               final String transformerClassName,
                               final long retryInterval,
                               final double retryIntervalMultiplier,
-                              final int initialConnectAttempts,
                               final int reconnectAttempts,
+                              final boolean failoverOnServerShutdown,
                               final boolean useDuplicateDetection,
                               final String discoveryGroupName)
    {
@@ -108,8 +108,8 @@
       this.transformerClassName = transformerClassName;
       this.retryInterval = retryInterval;
       this.retryIntervalMultiplier = retryIntervalMultiplier;
-      this.initialConnectAttempts = initialConnectAttempts;
       this.reconnectAttempts = reconnectAttempts;
+      this.failoverOnServerShutdown = failoverOnServerShutdown;
       this.useDuplicateDetection = useDuplicateDetection;
       this.connectorPair = null;
       this.discoveryGroupName = discoveryGroupName;
@@ -160,14 +160,14 @@
       return retryIntervalMultiplier;
    }
 
-   public int getInitialConnectAttempts()
+   public int getReconnectAttempts()
    {
-      return initialConnectAttempts;
+      return reconnectAttempts;
    }
 
-   public int getReconnectAttempts()
+   public boolean isFailoverOnServerShutdown()
    {
-      return reconnectAttempts;
+      return failoverOnServerShutdown;
    }
 
    public boolean isUseDuplicateDetection()

Modified: trunk/src/main/org/jboss/messaging/core/config/cluster/ClusterConnectionConfiguration.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/cluster/ClusterConnectionConfiguration.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/config/cluster/ClusterConnectionConfiguration.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -46,28 +46,19 @@
 
    private final long retryInterval;
 
-   private final double retryIntervalMultiplier;
-
-   private final int initialConnectAttempts;
-
-   private final int reconnectAttempts;
-
    private final boolean duplicateDetection;
-   
+
    private final boolean forwardWhenNoConsumers;
 
    private final List<Pair<String, String>> staticConnectorNamePairs;
 
    private final String discoveryGroupName;
-   
+
    private final int maxHops;
 
    public ClusterConnectionConfiguration(final String name,
                                          final String address,
                                          final long retryInterval,
-                                         final double retryIntervalMultiplier,
-                                         final int initialConnectAttempts,
-                                         final int reconnectAttempts,
                                          final boolean duplicateDetection,
                                          final boolean forwardWhenNoConsumers,
                                          final int maxHops,
@@ -76,9 +67,6 @@
       this.name = name;
       this.address = address;
       this.retryInterval = retryInterval;
-      this.retryIntervalMultiplier = retryIntervalMultiplier;
-      this.initialConnectAttempts = initialConnectAttempts;
-      this.reconnectAttempts = reconnectAttempts;
       this.staticConnectorNamePairs = staticConnectorNamePairs;
       this.duplicateDetection = duplicateDetection;
       this.forwardWhenNoConsumers = forwardWhenNoConsumers;
@@ -89,9 +77,6 @@
    public ClusterConnectionConfiguration(final String name,
                                          final String address,
                                          final long retryInterval,
-                                         final double retryIntervalMultiplier,
-                                         final int initialConnectAttempts,
-                                         final int reconnectAttempts,
                                          final boolean duplicateDetection,
                                          final boolean forwardWhenNoConsumers,
                                          final int maxHops,
@@ -100,9 +85,6 @@
       this.name = name;
       this.address = address;
       this.retryInterval = retryInterval;
-      this.retryIntervalMultiplier = retryIntervalMultiplier;
-      this.initialConnectAttempts = initialConnectAttempts;
-      this.reconnectAttempts = reconnectAttempts;
       this.duplicateDetection = duplicateDetection;
       this.forwardWhenNoConsumers = forwardWhenNoConsumers;
       this.discoveryGroupName = discoveryGroupName;
@@ -124,12 +106,12 @@
    {
       return duplicateDetection;
    }
-   
+
    public boolean isForwardWhenNoConsumers()
    {
       return forwardWhenNoConsumers;
    }
-   
+
    public int getMaxHops()
    {
       return maxHops;
@@ -149,20 +131,4 @@
    {
       return retryInterval;
    }
-
-   public double getRetryIntervalMultiplier()
-   {
-      return retryIntervalMultiplier;
-   }
-
-   public int getInitialConnectAttempts()
-   {
-      return initialConnectAttempts;
-   }
-
-   public int getReconnectAttempts()
-   {
-      return reconnectAttempts;
-   }
-
 }

Modified: trunk/src/main/org/jboss/messaging/core/config/impl/ConfigurationImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/impl/ConfigurationImpl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/config/impl/ConfigurationImpl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -236,7 +236,24 @@
    protected String managementClusterPassword = DEFAULT_MANAGEMENT_CLUSTER_PASSWORD;
 
    protected long managementRequestTimeout = DEFAULT_MANAGEMENT_REQUEST_TIMEOUT;
-
+   
+   // MessagingComponent implementation ----------------------------------------------
+   
+   public void start() throws Exception
+   {      
+   }
+   
+   public void stop() throws Exception
+   {      
+   }
+   
+   public boolean isStarted()
+   {
+      return true;
+   }
+   
+   // Public -------------------------------------------------------------------------
+   
    public boolean isClustered()
    {
       return clustered;
@@ -630,7 +647,7 @@
    }
 
    public void setSecurityEnabled(final boolean enabled)
-   {
+   {      
       securityEnabled = enabled;
    }
 

Modified: trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -22,8 +22,6 @@
 
 package org.jboss.messaging.core.config.impl;
 
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
 
@@ -78,7 +76,7 @@
    // Public -------------------------------------------------------------------------
 
    public void start() throws Exception
-   {
+   {      
       URL url = getClass().getClassLoader().getResource(configurationUrl);
       Reader reader = new InputStreamReader(url.openStream());
       String xml = org.jboss.messaging.utils.XMLUtil.readerToString(reader);
@@ -545,12 +543,6 @@
 
       long retryInterval = DEFAULT_RETRY_INTERVAL;
 
-      double retryIntervalMultiplier = DEFAULT_RETRY_INTERVAL_MULTIPLIER;
-
-      int initialConnectAttempts = ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS;
-
-      int reconnectAttempts = ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
-
       List<Pair<String, String>> connectorPairs = new ArrayList<Pair<String, String>>();
 
       name = brNode.getAttribute("name");
@@ -564,19 +556,7 @@
          if (child.getNodeName().equals("retry-interval"))
          {
             retryInterval = XMLUtil.parseLong(child);
-         }
-         else if (child.getNodeName().equals("retry-interval-multiplier"))
-         {
-            retryIntervalMultiplier = org.jboss.messaging.utils.XMLUtil.parseDouble(child);
-         }
-         else if (child.getNodeName().equals("initial-connect-attempts"))
-         {
-            initialConnectAttempts = org.jboss.messaging.utils.XMLUtil.parseInt(child);
-         }
-         else if (child.getNodeName().equals("reconnect-attempts"))
-         {
-            reconnectAttempts = org.jboss.messaging.utils.XMLUtil.parseInt(child);
-         }
+         }        
          else if (child.getNodeName().equals("use-duplicate-detection"))
          {
             duplicateDetection = org.jboss.messaging.utils.XMLUtil.parseBoolean(child);
@@ -609,11 +589,8 @@
       if (discoveryGroupName == null)
       {
          config = new ClusterConnectionConfiguration(name,
-                                                     address,
-                                                     retryInterval,
-                                                     retryIntervalMultiplier,
-                                                     initialConnectAttempts,
-                                                     reconnectAttempts,
+                                                     address,                                                   
+                                                     retryInterval,                                                     
                                                      duplicateDetection,
                                                      forwardWhenNoConsumers,
                                                      maxHops,
@@ -623,10 +600,7 @@
       {
          config = new ClusterConnectionConfiguration(name,
                                                      address,
-                                                     retryInterval,
-                                                     retryIntervalMultiplier,
-                                                     initialConnectAttempts,
-                                                     reconnectAttempts,
+                                                     retryInterval,                                                     
                                                      duplicateDetection,
                                                      forwardWhenNoConsumers,
                                                      maxHops,
@@ -656,9 +630,9 @@
 
       double retryIntervalMultiplier = DEFAULT_RETRY_INTERVAL_MULTIPLIER;
 
-      int initialConnectAttempts = DEFAULT_INITIAL_CONNECT_ATTEMPTS;
+      int reconnectAttempts = ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
 
-      int reconnectAttempts = DEFAULT_RECONNECT_ATTEMPTS;
+      boolean failoverOnServerShutdown = ClientSessionFactoryImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN;
 
       boolean useDuplicateDetection = DEFAULT_BRIDGE_DUPLICATE_DETECTION;
 
@@ -694,13 +668,13 @@
          {
             retryIntervalMultiplier = XMLUtil.parseDouble(child);
          }
-         else if (child.getNodeName().equals("max-retries-before-failover"))
+         else if (child.getNodeName().equals("reconnect-attempts"))
          {
-            initialConnectAttempts = XMLUtil.parseInt(child);
+            reconnectAttempts = org.jboss.messaging.utils.XMLUtil.parseInt(child);
          }
-         else if (child.getNodeName().equals("max-retries-after-failover"))
+         else if (child.getNodeName().equals("failover-on-server-shutdown"))
          {
-            reconnectAttempts = org.jboss.messaging.utils.XMLUtil.parseInt(child);
+            failoverOnServerShutdown = org.jboss.messaging.utils.XMLUtil.parseBoolean(child);
          }
          else if (child.getNodeName().equals("use-duplicate-detection"))
          {
@@ -738,8 +712,8 @@
                                           transformerClassName,
                                           retryInterval,
                                           retryIntervalMultiplier,
-                                          initialConnectAttempts,
                                           reconnectAttempts,
+                                          failoverOnServerShutdown,
                                           useDuplicateDetection,
                                           connectorPair);
       }
@@ -752,8 +726,8 @@
                                           transformerClassName,
                                           retryInterval,
                                           retryIntervalMultiplier,
-                                          initialConnectAttempts,
                                           reconnectAttempts,
+                                          failoverOnServerShutdown,
                                           useDuplicateDetection,
                                           discoveryGroupName);
       }

Modified: trunk/src/main/org/jboss/messaging/core/exception/MessagingException.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/exception/MessagingException.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/exception/MessagingException.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -44,6 +44,8 @@
    public static final int CONNECTION_TIMEDOUT = 003;
 
    public static final int INTERRUPTED = 004;
+   
+   public static final int SERVER_DISCONNECTED = 005;
 
    public static final int QUEUE_DOES_NOT_EXIST = 100;
 

Modified: trunk/src/main/org/jboss/messaging/core/journal/impl/AbstractSequentialFactory.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/journal/impl/AbstractSequentialFactory.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/journal/impl/AbstractSequentialFactory.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -70,7 +70,7 @@
       FilenameFilter fnf = new FilenameFilter()
       {
          public boolean accept(final File file, final String name)
-         {
+         {        
             return name.endsWith("." + extension);
          }
       };

Modified: trunk/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -873,7 +873,7 @@
       Map<Long, TransactionHolder> transactions = new LinkedHashMap<Long, TransactionHolder>();
 
       List<JournalFile> orderedFiles = orderFiles();
-
+   
       int lastDataPos = SIZE_HEADER;
 
       long maxID = -1;
@@ -1366,7 +1366,7 @@
       while (iter.hasNext())
       {
          currentFile = iter.next();
-
+         
          if (!iter.hasNext())
          {
             iter.remove();
@@ -1937,11 +1937,11 @@
       List<String> fileNames = fileFactory.listFiles(fileExtension);
 
       List<JournalFile> orderedFiles = new ArrayList<JournalFile>(fileNames.size());
-
+      
       for (String fileName : fileNames)
       {
          SequentialFile file = fileFactory.createSequentialFile(fileName, maxAIO);
-
+ 
          file.open(1);
 
          ByteBuffer bb = fileFactory.newBuffer(SIZE_INT);
@@ -1959,7 +1959,7 @@
 
          file.close();
       }
-
+      
       // Now order them by ordering id - we can't use the file name for ordering
       // since we can re-use dataFiles
 

Modified: trunk/src/main/org/jboss/messaging/core/management/AcceptorControlMBean.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/AcceptorControlMBean.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/management/AcceptorControlMBean.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -32,6 +32,10 @@
  */
 public interface AcceptorControlMBean extends MessagingComponentControlMBean
 {
+   void pause();
+   
+   void resume();
+   
    String getName();
 
    String getFactoryClassName();

Modified: trunk/src/main/org/jboss/messaging/core/management/BridgeControlMBean.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/BridgeControlMBean.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/management/BridgeControlMBean.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -50,9 +50,9 @@
 
    double getRetryIntervalMultiplier();
 
-   int getInitialConnectAttempts();
-
    int getReconnectAttempts();
 
+   boolean isFailoverOnServerShutdown();
+
    boolean isUseDuplicateDetection();
 }

Modified: trunk/src/main/org/jboss/messaging/core/management/ClusterConnectionControlMBean.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/ClusterConnectionControlMBean.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/management/ClusterConnectionControlMBean.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -47,10 +47,4 @@
    String getDiscoveryGroupName();
 
    long getRetryInterval();
-
-   double getRetryIntervalMultiplier();
-
-   int getInitialConnectAttempts();
-
-   int getReconnectAttempts();
 }

Modified: trunk/src/main/org/jboss/messaging/core/management/impl/AcceptorControl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/AcceptorControl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/AcceptorControl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -83,6 +83,16 @@
    {
       acceptor.start();
    }
+   
+   public void pause()
+   {
+      acceptor.pause();
+   }
+   
+   public void resume()
+   {
+      acceptor.resume();
+   }
 
    public void stop() throws Exception
    {

Modified: trunk/src/main/org/jboss/messaging/core/management/impl/BridgeControl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/BridgeControl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/BridgeControl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -89,9 +89,9 @@
       return configuration.getReconnectAttempts();
    }
 
-   public int getInitialConnectAttempts()
+   public boolean isFailoverOnServerShutdown()
    {
-      return configuration.getInitialConnectAttempts();
+      return configuration.isFailoverOnServerShutdown();
    }
 
    public String getName()

Modified: trunk/src/main/org/jboss/messaging/core/management/impl/ClusterConnectionControl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/ClusterConnectionControl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/ClusterConnectionControl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -72,17 +72,7 @@
    {
       return configuration.getMaxHops();
    }
-
-   public int getInitialConnectAttempts()
-   {
-      return configuration.getInitialConnectAttempts();
-   }
-
-   public int getReconnectAttempts()
-   {
-      return configuration.getReconnectAttempts();
-   }
-
+   
    public String getName()
    {
       return configuration.getName();
@@ -93,11 +83,6 @@
       return configuration.getRetryInterval();
    }
 
-   public double getRetryIntervalMultiplier()
-   {
-      return configuration.getRetryIntervalMultiplier();
-   }
-
    public TabularData getStaticConnectorNamePairs()
    {
       return PairsInfo.toTabularData(configuration.getStaticConnectorNamePairs());

Modified: trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -513,10 +513,7 @@
          unregisterResource(objectName);
       }
 
-      // FIXME the replicationInvoker should be properly stopped.
-      // the code is commented since stopping the invoker will interact
-      // with the remoting service which is stopped first when stopping the server
-      // replicationInvoker.stop();
+      replicationInvoker.stop();
 
       started = false;
    }

Modified: trunk/src/main/org/jboss/messaging/core/management/impl/ReplicationOperationInvokerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/ReplicationOperationInvokerImpl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/ReplicationOperationInvokerImpl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -121,7 +121,7 @@
          }
          catch (Exception e)
          {
-            // this will happen if the remoting service is stopped before this method is called
+            // this will happen if the remoting server is stopped before this method is called
             log.warn("Got Exception while closing requestor", e);
          }                 
       }

Modified: trunk/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -152,7 +152,7 @@
       {
          throw new IllegalArgumentException("Only NIO and AsyncIO are supported journals");
       }
-
+      
       String bindingsDir = config.getBindingsDirectory();
 
       if (bindingsDir == null)
@@ -230,7 +230,7 @@
    }
    
    public UUID getPersistentID()
-   {
+   {   
       return persistentID;
    }
    
@@ -465,7 +465,7 @@
                                   final Map<Long, Queue> queues,
                                   final ResourceManager resourceManager,
                                   final Map<SimpleString, List<Pair<byte[], Long>>> duplicateIDMap) throws Exception
-   {
+   {      
       List<RecordInfo> records = new ArrayList<RecordInfo>();
 
       List<PreparedTransactionInfo> preparedTransactions = new ArrayList<PreparedTransactionInfo>();
@@ -906,7 +906,7 @@
    }
 
    public void loadBindingJournal(final List<QueueBindingInfo> queueBindingInfos) throws Exception
-   {
+   {      
       List<RecordInfo> records = new ArrayList<RecordInfo>();
 
       List<PreparedTransactionInfo> preparedTransactions = new ArrayList<PreparedTransactionInfo>();
@@ -996,6 +996,8 @@
       messageJournal.stop();
 
       executor.awaitTermination(60, TimeUnit.SECONDS);
+      
+      persistentID = null;
 
       started = false;
    }

Modified: trunk/src/main/org/jboss/messaging/core/persistence/impl/nullpm/NullStorageManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/persistence/impl/nullpm/NullStorageManager.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/persistence/impl/nullpm/NullStorageManager.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -212,6 +212,10 @@
       {
          throw new IllegalStateException("Not started");
       }
+      
+      id = null;
+      
+      idGenerator.set(0);
 
       started = false;
    }

Modified: trunk/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -509,7 +509,7 @@
       {
          props.putStringProperty(ManagementHelper.HDR_FILTERSTRING, filter.getFilterString());
       }
-
+         
       managementService.sendNotification(new Notification(NotificationType.BINDING_ADDED, props));
    }
 
@@ -576,7 +576,7 @@
    public void route(final ServerMessage message, Transaction tx) throws Exception
    {                      
       SimpleString address = message.getDestination();
-      
+       
       byte[] duplicateID = (byte[])message.getProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID);
 
       DuplicateIDCache cache = null;
@@ -639,13 +639,12 @@
          }
       }
 
+      
       Bindings bindings = addressManager.getBindings(address);
 
       if (bindings != null)
-      {
+      { 
          bindings.route(message, tx);
-         
-        // idsAdded.add(message.getMessageID());
       }
 
       if (startedTx)

Modified: trunk/src/main/org/jboss/messaging/core/remoting/Channel.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/Channel.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/remoting/Channel.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -26,6 +26,8 @@
 
    void send(Packet packet);
    
+   void sendAndFlush(Packet packet);
+   
    Packet sendBlocking(Packet packet) throws MessagingException;
 
    void replicatePacket(Packet packet, long replicatedChannelID, Runnable action);

Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -16,6 +16,7 @@
 import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.CREATESESSION_RESP;
 import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.CREATE_QUEUE;
 import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.DELETE_QUEUE;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.DISCONNECT;
 import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.EARLY_RESPONSE;
 import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.EXCEPTION;
 import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.NULL_RESPONSE;
@@ -510,7 +511,7 @@
    public void bufferReceived(final Object connectionID, final MessagingBuffer buffer)
    {
       final Packet packet = decode(buffer);
-
+      
       synchronized (transferLock)
       {
          if (!frozen)
@@ -610,6 +611,11 @@
             packet = new PacketImpl(PacketImpl.PONG);
             break;
          }
+         case DISCONNECT:
+         {
+            packet = new PacketImpl(DISCONNECT);
+            break;
+         }
          case EXCEPTION:
          {
             packet = new MessagingExceptionMessage();
@@ -1007,9 +1013,19 @@
             lock.unlock();
          }
       }
+      
+      public void sendAndFlush(final Packet packet)
+      {
+         send(packet, true);
+      }
+      
+      public void send(final Packet packet)
+      {
+         send(packet, false);
+      }
 
       // This must never called by more than one thread concurrently
-      public void send(final Packet packet)
+      public void send(final Packet packet, final boolean flush)
       {
          synchronized (sendLock)
          {
@@ -1055,7 +1071,7 @@
 
                if (connection.active || packet.isWriteAlways())
                {
-                  connection.transportConnection.write(buffer);
+                  connection.transportConnection.write(buffer, flush);
                }
             }
             finally
@@ -1124,7 +1140,7 @@
                }
 
                connection.transportConnection.write(buffer);
-
+               
                long toWait = connection.blockingCallTimeout;
 
                long start = System.currentTimeMillis();
@@ -1612,6 +1628,8 @@
                                                                           " client " +
                                                                           client);
 
+            future.cancel(true);
+            
             fail(me);
          }
 
@@ -1655,6 +1673,10 @@
 
             pingChannel.send(pong);
          }
+         else if (type == PacketImpl.DISCONNECT)
+         {
+            fail(new MessagingException(MessagingException.SERVER_DISCONNECTED, "The connection was closed by the server"));
+         }
          else
          {
             throw new IllegalArgumentException("Invalid packet: " + packet);

Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMAcceptor.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMAcceptor.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMAcceptor.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -52,6 +52,8 @@
    private ConcurrentMap<String, Connection> connections = new ConcurrentHashMap<String, Connection>();
 
    private volatile boolean started;
+      
+   private boolean paused;
 
    public InVMAcceptor(final Map<String, Object> configuration,
                        final BufferHandler handler,
@@ -71,30 +73,65 @@
          return;
       }
 
-      InVMRegistry registry = InVMRegistry.instance;
-
-      registry.registerAcceptor(id, this);
+      InVMRegistry.instance.registerAcceptor(id, this);
       
       started = true;
+      
+      paused = false;
    }
 
+   /*
+    * Stop accepting new connections
+    */
+   public synchronized void pause()
+   {      
+      if (!started)
+      {
+         return;
+      }
+      
+      if (paused)
+      {
+         return;
+      }
+      
+      InVMRegistry.instance.unregisterAcceptor(id);   
+      
+      paused = true;
+   }
+   
+   public synchronized void resume()
+   {
+      if (!paused)
+      {
+         return;
+      }
+      
+      InVMRegistry.instance.registerAcceptor(id, this);
+      
+      paused = false;
+   }
+   
    public synchronized void stop()
    {
       if (!started)
       {
          return;
       }
+      
+      if (!paused)
+      {
+         InVMRegistry.instance.unregisterAcceptor(id);  
+      }
 
-      InVMRegistry.instance.unregisterAcceptor(id);
-
       for (Connection connection : connections.values())
       {
          listener.connectionDestroyed(connection.getID());
       }
 
       connections.clear();
-
-      started = true;
+      
+      started = false;
    }
 
    public boolean isStarted()
@@ -126,7 +163,7 @@
    {
       if (!started)
       {
-         throw new IllegalStateException("Acceptor is not started");
+         return;
       }
 
       Connection conn = connections.get(connectionID);

Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnection.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnection.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnection.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -32,6 +32,7 @@
 import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
 import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
 import org.jboss.messaging.utils.ExecutorFactory;
+import org.jboss.messaging.utils.Future;
 import org.jboss.messaging.utils.JBMThreadFactory;
 import org.jboss.messaging.utils.OrderedExecutorFactory;
 import org.jboss.messaging.utils.UUIDGenerator;
@@ -88,14 +89,21 @@
          return;
       }
       
-      //We can't wait for the executor to finish processing, since if the connection is closed on failover on the server
-      //and there are other replication requests still in progress and blocked because of the failover
-      //then it will time out waiting for close.
-      //Instead we let the executor complete after close but ignore the actions
+      //Must execute this on the executor, to ensure connection destroyed doesn't get fired before the last DISCONNECT
+      //packet is processed
+      
+      executor.execute(new Runnable()
+      {
+         public void run()
+         {
+            if (!closed)
+            {
+               listener.connectionDestroyed(id);
 
-      listener.connectionDestroyed(id);
-
-      closed = true;
+               closed = true;
+            }
+         }
+      }); 
    }
 
    public MessagingBuffer createBuffer(final int size)
@@ -136,6 +144,7 @@
             }
          }
       });
+      
    }
 
    public String getRemoteAddress()

Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateSessionMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateSessionMessage.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateSessionMessage.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -159,17 +159,25 @@
 
    public int getRequiredBufferSize()
    {
-      return BASIC_PACKET_SIZE + 
-             stringEncodeSize(name) + // buffer.writeString(name);
-             DataConstants.SIZE_LONG + // buffer.writeLong(sessionChannelID);
-             DataConstants.SIZE_INT + // buffer.writeInt(version);
-             nullableStringEncodeSize(username) + // buffer.writeNullableString(username);
-             nullableStringEncodeSize(password) + // buffer.writeNullableString(password);
-             DataConstants.SIZE_INT + // buffer.writeInt(minLargeMessageSize);
-             DataConstants.SIZE_BOOLEAN + // buffer.writeBoolean(xa);
-             DataConstants.SIZE_BOOLEAN + // buffer.writeBoolean(autoCommitSends);
-             DataConstants.SIZE_BOOLEAN + // buffer.writeBoolean(autoCommitAcks);
-             DataConstants.SIZE_INT + // buffer.writeInt(windowSize);
+      return BASIC_PACKET_SIZE + stringEncodeSize(name) + // buffer.writeString(name);
+             DataConstants.SIZE_LONG +
+             // buffer.writeLong(sessionChannelID);
+             DataConstants.SIZE_INT +
+             // buffer.writeInt(version);
+             nullableStringEncodeSize(username) +
+             // buffer.writeNullableString(username);
+             nullableStringEncodeSize(password) +
+             // buffer.writeNullableString(password);
+             DataConstants.SIZE_INT +
+             // buffer.writeInt(minLargeMessageSize);
+             DataConstants.SIZE_BOOLEAN +
+             // buffer.writeBoolean(xa);
+             DataConstants.SIZE_BOOLEAN +
+             // buffer.writeBoolean(autoCommitSends);
+             DataConstants.SIZE_BOOLEAN +
+             // buffer.writeBoolean(autoCommitAcks);
+             DataConstants.SIZE_INT +
+             // buffer.writeInt(windowSize);
              DataConstants.SIZE_BOOLEAN; // buffer.writeBoolean(preAcknowledge);
 
    }

Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketImpl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketImpl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -43,6 +43,8 @@
    public static final byte PING = 10;
 
    public static final byte PONG = 11;
+   
+   public static final byte DISCONNECT = 12;
 
    // Miscellaneous
    public static final byte EXCEPTION = 20;

Modified: trunk/src/main/org/jboss/messaging/core/remoting/server/RemotingService.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/server/RemotingService.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/remoting/server/RemotingService.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -48,7 +48,5 @@
    
    boolean removeInterceptor(Interceptor interceptor);
    
-   void setBackup(boolean backup);
-
    void setManagementService(ManagementService managementService);
 }

Modified: trunk/src/main/org/jboss/messaging/core/remoting/server/impl/RemotingServiceImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/server/impl/RemotingServiceImpl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/remoting/server/impl/RemotingServiceImpl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -12,6 +12,18 @@
 
 package org.jboss.messaging.core.remoting.server.impl;
 
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.DISCONNECT;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.concurrent.ConcurrentHashMap;
+
 import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.config.TransportConfiguration;
 import org.jboss.messaging.core.exception.MessagingException;
@@ -24,7 +36,7 @@
 import org.jboss.messaging.core.remoting.impl.AbstractBufferHandler;
 import org.jboss.messaging.core.remoting.impl.RemotingConnectionImpl;
 import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
-import org.jboss.messaging.core.remoting.impl.invm.TransportConstants;
+import org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl;
 import org.jboss.messaging.core.remoting.server.RemotingService;
 import org.jboss.messaging.core.remoting.spi.Acceptor;
 import org.jboss.messaging.core.remoting.spi.AcceptorFactory;
@@ -34,17 +46,8 @@
 import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
 import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.impl.MessagingServerPacketHandler;
+import org.jboss.messaging.utils.UUIDGenerator;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.concurrent.ConcurrentHashMap;
-
 /**
  * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
  * @author <a href="mailto:ataylor at redhat.com">Andy Taylor</a>
@@ -73,16 +76,10 @@
 
    private TimerTask failedConnectionsTask;
 
-   private final long connectionScanPeriod;
-
-   private final long connectionTTL;
-
-   private final boolean jmxEnabled;
-
    private final BufferHandler bufferHandler = new DelegatingBufferHandler();
+   
+   private final Configuration config;
 
-   private volatile boolean backup;
-
    private volatile MessagingServer server;
 
    private ManagementService managementService;
@@ -109,13 +106,7 @@
          }
       }
 
-      connectionScanPeriod = config.getConnectionScanPeriod();
-
-      connectionTTL = config.getConnectionTTLOverride();
-
-      backup = config.isBackup();
-
-      jmxEnabled = config.isJMXManagementEnabled();
+      this.config = config;
    }
 
    // RemotingService implementation -------------------------------
@@ -134,7 +125,7 @@
 
       // when JMX is enabled, it requires a INVM acceptor to send the core messages
       // corresponding to the JMX management operations (@see ReplicationAwareStandardMBeanWrapper)
-      if (jmxEnabled)
+      if (config.isJMXManagementEnabled())
       {
          boolean invmAcceptorConfigured = false;
          for (TransportConfiguration config : transportConfigs)
@@ -186,12 +177,12 @@
 
       failedConnectionsTask = new FailedConnectionsTask();
       
-      failedConnectionTimer.schedule(failedConnectionsTask, connectionScanPeriod, connectionScanPeriod);
+      failedConnectionTimer.schedule(failedConnectionsTask, config.getConnectionScanPeriod(), config.getConnectionScanPeriod());
 
       started = true;
    }
    
-   public synchronized void stop()
+   public synchronized void stop() throws Exception
    {
       if (!started)
       {
@@ -208,6 +199,17 @@
 
          failedConnectionTimer = null;
       }
+      
+      //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 (RemotingConnection connection: connections.values())
+      {                    
+         connection.getChannel(0, -1, false).sendAndFlush(new PacketImpl(DISCONNECT));
+      }
 
       for (Acceptor acceptor : acceptors)
       {
@@ -241,11 +243,6 @@
       this.server = server;
    }
 
-   public void setBackup(final boolean backup)
-   {
-      this.backup = backup;
-   }
-
    // ConnectionLifeCycleListener implementation -----------------------------------
 
    public void connectionCreated(final Connection connection)
@@ -255,7 +252,7 @@
          throw new IllegalStateException("Unable to create connection, server hasn't finished starting up");
       }
 
-      RemotingConnection rc = new RemotingConnectionImpl(connection, interceptors, !backup, connectionTTL);
+      RemotingConnection rc = new RemotingConnectionImpl(connection, interceptors, !config.isBackup(), config.getConnectionTTLOverride());
 
       Channel channel1 = rc.getChannel(1, -1, false);
 
@@ -269,7 +266,7 @@
    }
 
    public void connectionDestroyed(final Object connectionID)
-   {
+   {  
       RemotingConnection conn = connections.remove(connectionID);
       if (conn != null)
       {

Modified: trunk/src/main/org/jboss/messaging/core/remoting/spi/Acceptor.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/spi/Acceptor.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/remoting/spi/Acceptor.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -33,5 +33,7 @@
  */
 public interface Acceptor extends MessagingComponent
 {
-   void stop();
+   void pause();
+   
+   void resume();
 }

Modified: trunk/src/main/org/jboss/messaging/core/remoting/spi/Connection.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/spi/Connection.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/remoting/spi/Connection.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -38,6 +38,8 @@
    Object getID();
 
    void write(MessagingBuffer buffer);
+   
+   void write(MessagingBuffer buffer, boolean flush);
 
    void close();
 

Modified: trunk/src/main/org/jboss/messaging/core/security/JBMSecurityManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/security/JBMSecurityManager.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/security/JBMSecurityManager.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -24,11 +24,13 @@
 
 import java.util.Set;
 
+import org.jboss.messaging.core.server.MessagingComponent;
+
 /**
  * USe to validate whether a user has is valid to connect to the server and perform certain functions
  * @author <a href="ataylor at redhat.com">Andy Taylor</a>
  */
-public interface JBMSecurityManager
+public interface JBMSecurityManager extends MessagingComponent
 {
    /**
     * is this a valid user.

Modified: trunk/src/main/org/jboss/messaging/core/security/impl/JBMSecurityManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/security/impl/JBMSecurityManagerImpl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/security/impl/JBMSecurityManagerImpl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -59,7 +59,29 @@
     */
    private Map<String, List<String>> roles = new HashMap<String, List<String>>();
 
+   
+   // MessagingComponent implementation ------------------------------------------
+   
+   public void start()
+   {      
+   }
+   
+   public void stop()
+   {   
+      users.clear();
+      
+      roles.clear();
+      
+      defaultUser = null;
+   }
+   
+   public boolean isStarted()
+   {
+      return true;
+   }
 
+   // Public ---------------------------------------------------------------------
+   
    public boolean validateUser(final String user, final String password)
    {
       if(user == null && defaultUser == null)

Modified: trunk/src/main/org/jboss/messaging/core/security/impl/SecurityStoreImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/security/impl/SecurityStoreImpl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/security/impl/SecurityStoreImpl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -97,13 +97,13 @@
    {
    	this.invalidationInterval = invalidationInterval;
    	
-   	this.securityEnabled = securityEnabled;
+   	this.securityEnabled = securityEnabled;   	   
    }
 
    // SecurityManager implementation --------------------------------
 
    public void authenticate(final String user, final String password) throws Exception
-   {
+   {     
       if (securityEnabled)
       {
          if (CLUSTER_ADMIN_USER.equals(user))

Modified: trunk/src/main/org/jboss/messaging/core/server/Messaging.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/Messaging.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/server/Messaging.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -20,11 +20,15 @@
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 
-
 package org.jboss.messaging.core.server;
 
+import java.lang.management.ManagementFactory;
+
+import javax.management.MBeanServer;
+
 import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
+import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.management.ManagementService;
 import org.jboss.messaging.core.management.impl.ManagementServiceImpl;
 import org.jboss.messaging.core.persistence.StorageManager;
@@ -35,11 +39,7 @@
 import org.jboss.messaging.core.security.JBMSecurityManager;
 import org.jboss.messaging.core.security.impl.JBMSecurityManagerImpl;
 import org.jboss.messaging.core.server.impl.MessagingServerImpl;
-import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
 
-import javax.management.MBeanServer;
-import java.lang.management.ManagementFactory;
-
 /**
  * A Messaging
  *
@@ -51,12 +51,14 @@
  */
 public class Messaging
 {
-   public static MessagingServiceImpl newNullStorageMessagingService()
+   private static final Logger log = Logger.getLogger(Messaging.class);
+
+   public static MessagingServer newNullStorageMessagingServer()
    {
-      return newNullStorageMessagingService(new ConfigurationImpl());
+      return newNullStorageMessagingServer(new ConfigurationImpl());
    }
 
-   public static MessagingServiceImpl newNullStorageMessagingService(final Configuration config)
+   public static MessagingServer newNullStorageMessagingServer(final Configuration config)
    {
       StorageManager storageManager = new NullStorageManager();
 
@@ -66,9 +68,9 @@
 
       ManagementService managementService = new ManagementServiceImpl(ManagementFactory.getPlatformMBeanServer(),
                                                                       config.isJMXManagementEnabled());
-      
+
       remotingService.setManagementService(managementService);
-      
+
       MessagingServer server = new MessagingServerImpl();
 
       server.setConfiguration(config);
@@ -81,10 +83,10 @@
 
       server.setManagementService(managementService);
 
-      return new MessagingServiceImpl(server, storageManager, remotingService);
+      return server;
    }
 
-   public static MessagingServiceImpl newMessagingService(final Configuration config, StorageManager storageManager)
+   public static MessagingServer newMessagingServer(final Configuration config, final StorageManager storageManager)
    {
       RemotingService remotingService = new RemotingServiceImpl(config);
 
@@ -107,10 +109,10 @@
 
       server.setManagementService(managementService);
 
-      return new MessagingServiceImpl(server, storageManager, remotingService);
+      return server;
    }
 
-   public static MessagingServiceImpl newNullStorageMessagingService(final Configuration config, MBeanServer mbeanServer)
+   public static MessagingServer newNullStorageMessagingServer(final Configuration config, final MBeanServer mbeanServer)
    {
       StorageManager storageManager = new NullStorageManager();
 
@@ -118,11 +120,10 @@
 
       JBMSecurityManager securityManager = new JBMSecurityManagerImpl();
 
-      ManagementService managementService = new ManagementServiceImpl(mbeanServer,
-                                                                      config.isJMXManagementEnabled());
-      
+      ManagementService managementService = new ManagementServiceImpl(mbeanServer, config.isJMXManagementEnabled());
+
       remotingService.setManagementService(managementService);
-      
+
       MessagingServer server = new MessagingServerImpl();
 
       server.setConfiguration(config);
@@ -135,23 +136,27 @@
 
       server.setManagementService(managementService);
 
-      return new MessagingServiceImpl(server, storageManager, remotingService);
+      return server;
    }
 
-   public static MessagingServiceImpl newMessagingService(final Configuration config)
-   {      
+   public static MessagingServer newMessagingServer(final Configuration config)
+   {
       StorageManager storageManager = new JournalStorageManager(config);
 
       RemotingService remotingService = new RemotingServiceImpl(config);
 
       JBMSecurityManager securityManager = new JBMSecurityManagerImpl();
 
-      ManagementService managementService = new ManagementServiceImpl(ManagementFactory.getPlatformMBeanServer(), config.isJMXManagementEnabled());
+      ManagementService managementService = new ManagementServiceImpl(ManagementFactory.getPlatformMBeanServer(),
+                                                                      config.isJMXManagementEnabled());
 
       remotingService.setManagementService(managementService);
-      
+
       MessagingServer server = new MessagingServerImpl();
 
+      log.info("** creating server with security enabled " + config.isSecurityEnabled() + 
+               " " + System.identityHashCode(config));
+
       server.setConfiguration(config);
 
       server.setStorageManager(storageManager);
@@ -162,11 +167,11 @@
 
       server.setManagementService(managementService);
 
-      return new MessagingServiceImpl(server, storageManager, remotingService);
+      return server;
    }
 
-   public static MessagingServiceImpl newMessagingService(final Configuration config, final MBeanServer mbeanService)
-   {      
+   public static MessagingServer newMessagingServer(final Configuration config, final MBeanServer mbeanService)
+   {
       StorageManager storageManager = new JournalStorageManager(config);
 
       RemotingService remotingService = new RemotingServiceImpl(config);
@@ -176,7 +181,7 @@
       ManagementService managementService = new ManagementServiceImpl(mbeanService, config.isJMXManagementEnabled());
 
       remotingService.setManagementService(managementService);
-      
+
       MessagingServer server = new MessagingServerImpl();
 
       server.setConfiguration(config);
@@ -189,8 +194,6 @@
 
       server.setManagementService(managementService);
 
-      return new MessagingServiceImpl(server, storageManager, remotingService);
+      return server;
    }
-
-
 }

Deleted: trunk/src/main/org/jboss/messaging/core/server/MessagingService.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/MessagingService.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/server/MessagingService.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -1,38 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
-package org.jboss.messaging.core.server;
-
-/**
- * 
- * MessagingServiceImpl is a convenience class typically used when you are embedding JBM into your own application
- * It provides various convenient static methods for creating different kinds of Messaging servers
- * And has convenience start and stop methods that handle starting stopping of the dependent components.
- * This would not normally be used when using JBM inside a dependency injection framework such as Spring
- * or JBoss MC, since that would be handle dependency injection in that case
- * 
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- */
-public interface MessagingService extends MessagingComponent
-{
-   public MessagingServer getServer();
-}

Modified: trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BridgeImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BridgeImpl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BridgeImpl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -137,9 +137,9 @@
 
    private final double retryIntervalMultiplier;
 
-   private final int initialConnectAttempts;
-
    private final int reconnectAttempts;
+   
+   private final boolean failoverOnServerShutdown;
 
    private final SimpleString idsHeaderName;
 
@@ -151,8 +151,6 @@
 
    private final String clusterPassword;
 
-   private final StorageManager storageManager;
-
    private Channel replicatingChannel;
 
    private boolean activated;
@@ -174,8 +172,8 @@
                      final Transformer transformer,
                      final long retryInterval,
                      final double retryIntervalMultiplier,
-                     final int initialConnectAttempts,
                      final int reconnectAttempts,
+                     final boolean failoverOnServerShutdown,
                      final boolean useDuplicateDetection,
                      final SimpleString managementAddress,
                      final SimpleString managementNotificationAddress,
@@ -195,8 +193,8 @@
            transformer,
            retryInterval,
            retryIntervalMultiplier,
-           initialConnectAttempts,
            reconnectAttempts,
+           failoverOnServerShutdown,
            useDuplicateDetection,
            managementAddress,
            managementNotificationAddress,
@@ -218,8 +216,8 @@
                      final Transformer transformer,
                      final long retryInterval,
                      final double retryIntervalMultiplier,
-                     final int initialConnectAttempts,
                      final int reconnectAttempts,
+                     final boolean failoverOnServerShutdown,
                      final boolean useDuplicateDetection,
                      final SimpleString managementAddress,
                      final SimpleString managementNotificationAddress,
@@ -260,10 +258,10 @@
 
       this.retryIntervalMultiplier = retryIntervalMultiplier;
 
-      this.initialConnectAttempts = initialConnectAttempts;
-
       this.reconnectAttempts = reconnectAttempts;
 
+      this.failoverOnServerShutdown = failoverOnServerShutdown;
+
       this.idsHeaderName = MessageImpl.HDR_ROUTE_TO_IDS.concat(name);
 
       this.managementAddress = managementAddress;
@@ -276,9 +274,7 @@
 
       this.replicatingChannel = replicatingChannel;
 
-      this.activated = activated;
-
-      this.storageManager = storageManager;   
+      this.activated = activated;   
    }
 
    public synchronized void start() throws Exception
@@ -293,7 +289,7 @@
       if (activated)
       {
          executor.execute(new CreateObjectsRunnable());
-      }
+      }           
    }
 
    private void cancelRefs() throws Exception
@@ -326,9 +322,9 @@
             csf.close();
          }
       }
-
+      
       executor.execute(new StopRunnable());
-
+           
       waitForRunnablesToComplete();
    }
 
@@ -518,7 +514,7 @@
             // Preserve the original address
             dest = message.getDestination();
          }
-
+         
          producer.send(dest, message);
 
          return HandleStatus.HANDLED;
@@ -576,6 +572,7 @@
 
          csf = new ClientSessionFactoryImpl(connectorPair.a,
                                             connectorPair.b,
+                                            failoverOnServerShutdown,
                                             DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
                                             DEFAULT_PING_PERIOD,
                                             DEFAULT_CONNECTION_TTL,
@@ -594,15 +591,15 @@
                                             DEFAULT_ACK_BATCH_SIZE,
                                             retryInterval,
                                             retryIntervalMultiplier,
-                                            initialConnectAttempts,
                                             reconnectAttempts);
 
+         //Session is pre-acknowledge
          session = (ClientSessionInternal)csf.createSession(SecurityStoreImpl.CLUSTER_ADMIN_USER,
                                                             clusterPassword,
                                                             false,
                                                             true,
                                                             true,
-                                                            false,
+                                                            true,
                                                             1);
          
          if (session == null)
@@ -696,7 +693,7 @@
          active = true;
 
          queue.deliverAsync(executor);
-
+         
          return true;
       }
       catch (Exception e)
@@ -723,8 +720,8 @@
                }
 
                if (session != null)
-               {
-                  session.close();
+               {              
+                  session.close();               
                }
 
                started = false;

Modified: trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterConnectionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterConnectionImpl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterConnectionImpl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -34,6 +34,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.Executor;
 import java.util.concurrent.ScheduledExecutorService;
 
 import org.jboss.messaging.core.client.ClientMessage;
@@ -45,6 +46,7 @@
 import org.jboss.messaging.core.management.ManagementService;
 import org.jboss.messaging.core.management.Notification;
 import org.jboss.messaging.core.management.NotificationType;
+import org.jboss.messaging.core.persistence.StorageManager;
 import org.jboss.messaging.core.postoffice.Binding;
 import org.jboss.messaging.core.postoffice.Bindings;
 import org.jboss.messaging.core.postoffice.PostOffice;
@@ -61,6 +63,7 @@
 import org.jboss.messaging.core.server.cluster.ClusterConnection;
 import org.jboss.messaging.core.server.cluster.MessageFlowRecord;
 import org.jboss.messaging.core.server.cluster.RemoteQueueBinding;
+import org.jboss.messaging.core.server.cluster.Transformer;
 import org.jboss.messaging.utils.ExecutorFactory;
 import org.jboss.messaging.utils.Pair;
 import org.jboss.messaging.utils.SimpleString;
@@ -92,14 +95,8 @@
 
    private final SimpleString address;
 
-   private final long retryInterval;
-
-   private final double retryIntervalMultiplier;
-
-   private final int initialConnectAttempts;
-
-   private final int reconnectAttempts;
-
+   private final long retryInterval;  
+   
    private final boolean useDuplicateDetection;
 
    private final boolean routeWhenNoConsumers;
@@ -128,9 +125,6 @@
    public ClusterConnectionImpl(final SimpleString name,
                                 final SimpleString address,
                                 final long retryInterval,
-                                final double retryIntervalMultiplier,
-                                final int initialConnectAttempts,
-                                final int reconnectAttempts,
                                 final boolean useDuplicateDetection,
                                 final boolean routeWhenNoConsumers,
                                 final org.jboss.messaging.utils.ExecutorFactory executorFactory,
@@ -150,12 +144,6 @@
 
       this.retryInterval = retryInterval;
 
-      this.retryIntervalMultiplier = retryIntervalMultiplier;
-
-      this.initialConnectAttempts = initialConnectAttempts;
-
-      this.reconnectAttempts = reconnectAttempts;
-
       this.useDuplicateDetection = useDuplicateDetection;
 
       this.routeWhenNoConsumers = routeWhenNoConsumers;
@@ -199,9 +187,6 @@
    public ClusterConnectionImpl(final SimpleString name,
                                 final SimpleString address,
                                 final long retryInterval,
-                                final double retryIntervalMultiplier,
-                                final int initialConnectAttempts,
-                                final int reconnectAttempts,
                                 final boolean useDuplicateDetection,
                                 final boolean routeWhenNoConsumers,
                                 final ExecutorFactory executorFactory,
@@ -220,13 +205,7 @@
       this.address = address;
 
       this.retryInterval = retryInterval;
-
-      this.retryIntervalMultiplier = retryIntervalMultiplier;
-
-      this.initialConnectAttempts = initialConnectAttempts;
-
-      this.reconnectAttempts = reconnectAttempts;
-
+      
       this.executorFactory = executorFactory;
 
       this.server = server;
@@ -444,9 +423,9 @@
                                      scheduledExecutor,
                                      null,
                                      retryInterval,
-                                     retryIntervalMultiplier,
-                                     initialConnectAttempts,
-                                     reconnectAttempts,
+                                     1d,
+                                     -1,
+                                     false,
                                      useDuplicateDetection,
                                      managementService.getManagementAddress(),
                                      managementService.getManagementNotificationAddress(),
@@ -549,12 +528,14 @@
          this.bridge = bridge;
       }
 
-      public void reset() throws Exception
+      public synchronized void reset() throws Exception
       {
          clearBindings();
+         
+         firstReset = false;
       }
 
-      public void onMessage(final ClientMessage message)
+      public synchronized void onMessage(final ClientMessage message)
       {
          try
          {                        
@@ -668,7 +649,7 @@
          {
             throw new IllegalStateException("queueID is null");
          }
-
+         
          if (replChannel != null)
          {
             Packet packet = new ReplicateRemoteBindingAddedMessage(name,
@@ -679,13 +660,13 @@
                                                                    filterString,
                                                                    queue.getName(),
                                                                    distance + 1);
-
+            
             replChannel.replicatePacket(packet, 1, new Runnable()
             {
                public void run()
                {
                   try
-                  {
+                  {                     
                      doBindingAdded(message, null);
                   }
                   catch (Exception e)

Modified: trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterManagerImpl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterManagerImpl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -31,6 +31,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.Executor;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ScheduledFuture;
 
@@ -55,6 +56,7 @@
 import org.jboss.messaging.core.server.cluster.BroadcastGroup;
 import org.jboss.messaging.core.server.cluster.ClusterConnection;
 import org.jboss.messaging.core.server.cluster.ClusterManager;
+import org.jboss.messaging.core.server.cluster.MessageFlowRecord;
 import org.jboss.messaging.core.server.cluster.Transformer;
 import org.jboss.messaging.utils.Pair;
 import org.jboss.messaging.utils.SimpleString;
@@ -417,7 +419,6 @@
 
          Pair<TransportConfiguration, TransportConfiguration> pair = new Pair<TransportConfiguration, TransportConfiguration>(connector,
                                                                                                                               backupConnector);
-
          bridge = new BridgeImpl(nodeUUID,
                                  new SimpleString(config.getName()),
                                  queue,
@@ -429,8 +430,8 @@
                                  transformer,
                                  config.getRetryInterval(),
                                  config.getRetryIntervalMultiplier(),
-                                 config.getInitialConnectAttempts(),
                                  config.getReconnectAttempts(),
+                                 config.isFailoverOnServerShutdown(),
                                  config.isUseDuplicateDetection(),
                                  managementService.getManagementAddress(),
                                  managementService.getManagementNotificationAddress(),
@@ -504,10 +505,7 @@
 
          clusterConnection = new ClusterConnectionImpl(new SimpleString(config.getName()),
                                                        new SimpleString(config.getAddress()),
-                                                       config.getRetryInterval(),
-                                                       config.getRetryIntervalMultiplier(),
-                                                       config.getInitialConnectAttempts(),
-                                                       config.getReconnectAttempts(),
+                                                       config.getRetryInterval(),                                                       
                                                        config.isDuplicateDetection(),
                                                        config.isForwardWhenNoConsumers(),
                                                        executorFactory,
@@ -533,10 +531,7 @@
 
          clusterConnection = new ClusterConnectionImpl(new SimpleString(config.getName()),
                                                        new SimpleString(config.getAddress()),
-                                                       config.getRetryInterval(),
-                                                       config.getRetryIntervalMultiplier(),
-                                                       config.getInitialConnectAttempts(),
-                                                       config.getReconnectAttempts(),
+                                                       config.getRetryInterval(),                                                      
                                                        config.isDuplicateDetection(),
                                                        config.isForwardWhenNoConsumers(),
                                                        executorFactory,

Modified: trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -150,11 +150,11 @@
    private Channel replicatingChannel;
 
    private Object replicatingChannelLock = new Object();
-   
+
    private final Object initialiseLock = new Object();
-      
-   private boolean initialised;   
 
+   private boolean initialised;
+
    // plugins
 
    private StorageManager storageManager;
@@ -174,14 +174,14 @@
    {
       // We need to hard code the version information into a source file
 
-      version = VersionLoader.getVersion();            
+      version = VersionLoader.getVersion();
    }
 
    // lifecycle methods
    // ----------------------------------------------------------------
-   
+
    private void doStart() throws Exception
-   {         
+   {
       asyncDeliveryPool = Executors.newCachedThreadPool(new org.jboss.messaging.utils.JBMThreadFactory("JBM-async-session-delivery-threads"));
 
       executorFactory = new org.jboss.messaging.utils.OrderedExecutorFactory(asyncDeliveryPool);
@@ -219,23 +219,24 @@
          throw new IllegalStateException("Must inject ManagementRegistration before starting MessagingServer");
       }
 
-      if (!storageManager.isStarted())
-      {
-         throw new IllegalStateException("StorageManager must be started before MessagingServer is started");
-      }
+      configuration.start();
+      
+      storageManager.start();
+      
+      securityManager.start();
 
       managementService.start();
 
       // The rest of the components are not pluggable and created and started
       // here
-      
+
       initialised = !configuration.isBackup();
 
       securityStore = new SecurityStoreImpl(configuration.getSecurityInvalidationInterval(),
                                             configuration.isSecurityEnabled());
       securityStore.setManagementClusterPassword(configuration.getManagementClusterPassword());
       securityStore.setNotificationService(managementService);
-      
+
       addressSettingsRepository.setDefault(new AddressSettings());
       scheduledExecutor = new ScheduledThreadPoolExecutor(configuration.getScheduledThreadPoolMaxSize(),
                                                           new org.jboss.messaging.utils.JBMThreadFactory("JBM-scheduled-threads"));
@@ -276,19 +277,19 @@
       List<QueueBindingInfo> queueBindingInfos = new ArrayList<QueueBindingInfo>();
 
       storageManager.loadBindingJournal(queueBindingInfos);
-             
-      //TODO - this logic could be simplified
+
+      // TODO - this logic could be simplified
       if (uuid == null)
       {
          uuid = storageManager.getPersistentID();
-          
+         
          if (uuid == null && !configuration.isBackup())
-         {         
-            uuid = UUIDGenerator.getInstance().generateUUID();   
-            
-            storageManager.setPersistentID(uuid);         
+         {
+            uuid = UUIDGenerator.getInstance().generateUUID();
+
+            storageManager.setPersistentID(uuid);
          }
-              
+
          if (uuid != null)
          {
             nodeID = new SimpleString(uuid.toString());
@@ -297,15 +298,15 @@
       else
       {
          UUID theUUID = storageManager.getPersistentID();
-         
+
          if (theUUID == null)
          {
-            //Backup being initialised
+            // Backup being initialised
             storageManager.setPersistentID(uuid);
          }
-         
+
       }
-
+      
       serverManagement = managementService.registerServer(postOffice,
                                                           storageManager,
                                                           configuration,
@@ -316,7 +317,7 @@
                                                           this,
                                                           queueFactory,
                                                           configuration.isBackup());
-      
+
       Map<Long, Queue> queues = new HashMap<Long, Queue>();
 
       for (QueueBindingInfo queueBindingInfo : queueBindingInfos)
@@ -372,7 +373,7 @@
       deployDiverts();
 
       String backupConnectorName = configuration.getBackupConnectorName();
-      
+
       if (backupConnectorName != null)
       {
          TransportConfiguration backupConnector = configuration.getConnectorConfigurations().get(backupConnectorName);
@@ -400,26 +401,26 @@
             backupConnectorParams = backupConnector.getParams();
          }
       }
-    
+
       Channel replicatingChannel = getReplicatingChannel();
-            
+
       if (replicatingChannel == null && backupConnectorFactory != null)
       {
          log.warn("Please start backup server before starting live server");
-         
+
          remotingService.stop();
-         
+
          return;
       }
 
       if (configuration.isClustered())
       {
          clusterManager = new ClusterManagerImpl(executorFactory,
-                                                 this,                               
+                                                 this,
                                                  postOffice,
                                                  scheduledExecutor,
                                                  managementService,
-                                                 configuration,                            
+                                                 configuration,
                                                  uuid,
                                                  replicatingChannel,
                                                  configuration.isBackup());
@@ -431,29 +432,36 @@
       // during last stop
       // This is the last thing done at the start, after everything else is up and running
       pagingManager.startGlobalDepage();
+
+      if (!configuration.isBackup())
+      {
+         //Once we ready we can start the remoting service so we can start accepting connections
+         remotingService.start();
+      }
       
       started = true;
    }
 
    public synchronized void start() throws Exception
-   {
+   {      
       if (started)
       {
          return;
       }
-       
-      //Need to start remoting service otherwise live node will never be able to connect to backup
+   
       remotingService.setMessagingServer(this);
-      
+
       if (configuration.isBackup())
       {
-         //We defer actually initialisation until the live node has contacted the backup
+         remotingService.start();
+         
+         // We defer actually initialisation until the live node has contacted the backup
          log.info("Backup server will await live server before becoming operational");
       }
       else
       {
          doStart();
-      }      
+      }
    }
 
    public synchronized void stop() throws Exception
@@ -462,12 +470,20 @@
       {
          return;
       }
-
+      
       if (clusterManager != null)
-      {
-         clusterManager.stop();
+      {       
+         clusterManager.stop();         
       }
-
+      
+      remotingService.stop();
+      
+      managementService.stop();
+      
+      storageManager.stop();
+      
+      securityManager.stop();
+      
       asyncDeliveryPool.shutdown();
 
       try
@@ -495,7 +511,7 @@
          replicatingConnection = null;
          replicatingChannel = null;
       }
-      
+
       pagingManager.stop();
       pagingManager = null;
       securityStore = null;
@@ -510,10 +526,12 @@
       resourceManager = null;
       serverManagement = null;
 
-      sessions.clear();
+      sessions.clear();      
 
-      managementService.stop();
       started = false;
+      initialised = false;
+      uuid = null;
+      nodeID = null;
    }
 
    // MessagingServer implementation
@@ -540,7 +558,7 @@
    {
       if (started)
       {
-         throw new IllegalStateException("Cannot set remoting service when started");
+         throw new IllegalStateException("Cannot set remoting server when started");
       }
       this.remotingService = remotingService;
    }
@@ -583,7 +601,7 @@
    {
       if (started)
       {
-         throw new IllegalStateException("Cannot set management service when started");
+         throw new IllegalStateException("Cannot set management server when started");
       }
       this.managementService = managementService;
    }
@@ -628,7 +646,7 @@
    private synchronized void checkActivate(final RemotingConnection connection)
    {
       if (configuration.isBackup())
-      {
+      {      
          freezeBackupConnection();
 
          List<Queue> toActivate = postOffice.activate();
@@ -642,8 +660,6 @@
 
          configuration.setBackup(false);
 
-         remotingService.setBackup(false);
-
          if (clusterManager != null)
          {
             clusterManager.activate();
@@ -803,11 +819,11 @@
    {
       return new HashSet<ServerSession>(sessions.values());
    }
-   
+
    public boolean isInitialised()
    {
       synchronized (initialiseLock)
-      {
+      {         
          return initialised;
       }
    }
@@ -818,34 +834,44 @@
       {
          if (initialised)
          {
-            throw new IllegalStateException("Server is already initialised");
+            if (uuid == null)
+            {
+               throw new IllegalStateException("Server is already initialised but has no id");
+            }
+
+            if (!uuid.toString().equals(theUUID.toString()))
+            {
+               throw new IllegalStateException("Backup node already has a unique id but it's not the same as the live node id");
+            }
+            
+            return;
          }
-               
+
          if (uuid != null && !uuid.toString().equals(theUUID.toString()))
          {
             throw new IllegalStateException("Backup node already has a unique id but it's not the same as the live node id");
          }
-         
+
          if (theUUID == null)
          {
             throw new IllegalArgumentException("node id is null");
-         }         
-         
+         }
+
          this.uuid = theUUID;
-   
+
          this.nodeID = new SimpleString(uuid.toString());
-               
+
          doStart();
-      
+
          if (currentMessageID != this.storageManager.getCurrentUniqueID())
          {
             throw new IllegalStateException("Backup node current unique id != live node current unique id " + this.storageManager.getCurrentUniqueID() +
                                             ", " +
                                             currentMessageID);
          }
-         
-         initialised = true;      
-         
+
+         initialised = true;
+
          log.info("Backup server is now operational");
       }
    }
@@ -865,7 +891,7 @@
                                                                                                     ClientSessionFactoryImpl.DEFAULT_CONNECTION_TTL,
                                                                                                     scheduledExecutor,
                                                                                                     listener);
-            
+
             if (replicatingConnection == null)
             {
                return null;
@@ -893,7 +919,7 @@
             Packet packet = new ReplicateStartupInfoMessage(uuid, storageManager.getCurrentUniqueID());
 
             final Future future = new Future();
-            
+
             replicatingChannel.replicatePacket(packet, 1, new Runnable()
             {
                public void run()
@@ -901,9 +927,9 @@
                   future.run();
                }
             });
-            
+
             boolean ok = future.await(10000);
-            
+
             if (!ok)
             {
                throw new IllegalStateException("Timed out waiting for response from backup for initialisation");
@@ -938,8 +964,12 @@
    {
       return nodeID;
    }
-   
-   public Queue createQueue(final SimpleString address, final SimpleString queueName, final SimpleString filterString, final boolean durable, final boolean temporary) throws Exception
+
+   public Queue createQueue(final SimpleString address,
+                            final SimpleString queueName,
+                            final SimpleString filterString,
+                            final boolean durable,
+                            final boolean temporary) throws Exception
    {
       Binding binding = postOffice.getBinding(queueName);
 
@@ -967,10 +997,10 @@
       }
 
       postOffice.addBinding(binding);
-      
-      return queue;     
+
+      return queue;
    }
-     
+
    // Public
    // ---------------------------------------------------------------------------------------
 
@@ -1042,7 +1072,7 @@
             if (config.isDurable())
             {
                storageManager.addQueueBinding(queueBinding);
-            }
+            }                      
          }
       }
    }
@@ -1105,7 +1135,7 @@
          Binding binding = new DivertBinding(sAddress, divert);
 
          postOffice.addBinding(binding);
-         
+
          managementService.registerDivert(divert, config);
       }
    }
@@ -1141,7 +1171,7 @@
       // some other people
       // security my be screwed up, on account of thread local security stack
       // being corrupted.
-
+      
       securityStore.authenticate(username, password);
 
       ServerSession currentSession = sessions.remove(name);

Deleted: trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServiceImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServiceImpl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServiceImpl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -1,81 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
-package org.jboss.messaging.core.server.impl;
-
-import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.persistence.StorageManager;
-import org.jboss.messaging.core.remoting.server.RemotingService;
-import org.jboss.messaging.core.server.MessagingServer;
-import org.jboss.messaging.core.server.MessagingService;
-
-/**
- * 
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
- *
- */
-public class MessagingServiceImpl implements MessagingService
-{
-   private static final Logger log = Logger.getLogger(MessagingServiceImpl.class);
-
-   private final MessagingServer server;
-
-   private final StorageManager storageManager;
-
-   private final RemotingService remotingService;
-
-   public MessagingServiceImpl(final MessagingServer server,
-                               final StorageManager storageManager,
-                               final RemotingService remotingService)
-   {
-      this.server = server;
-      this.storageManager = storageManager;
-      this.remotingService = remotingService;
-   }
-
-   public void start() throws Exception
-   {
-      storageManager.start();
-      server.start();
-      // Remoting service should always be started last, otherwise create session packets can be received before the
-      // message server packet handler has been registered
-      // resulting in create session attempts to "hang" since response will never be sent back.
-      remotingService.start();
-   }
-
-   public void stop() throws Exception
-   {
-      remotingService.stop();
-      server.stop();
-      storageManager.stop();
-   }
-
-   public MessagingServer getServer()
-   {
-      return server;
-   }
-
-   public boolean isStarted()
-   {
-      return server.isStarted();
-   }
-}

Modified: trunk/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -357,7 +357,7 @@
    }
 
    public void addLast(final MessageReference ref)
-   {            
+   {               
       add(ref, false);
    }
 

Modified: trunk/src/main/org/jboss/messaging/core/server/impl/ServerSessionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/ServerSessionImpl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/ServerSessionImpl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -377,14 +377,15 @@
    {
       if (replicatingChannel == null)
       {
+         
          doHandleCreateQueue(packet);
       }
       else
-      {
+      {       
          replicatingChannel.replicatePacket(packet, oppositeChannelID, new Runnable()
          {
             public void run()
-            {
+            {              
                doHandleCreateQueue(packet);
             }
          });
@@ -868,11 +869,11 @@
    }
 
    public void handleCloseConsumer(final SessionConsumerCloseMessage packet)
-   {
+   {      
       final ServerConsumer consumer = consumers.get(packet.getConsumerID());
            
       if (replicatingChannel == null)
-      {
+      {         
          doHandleCloseConsumer(packet, consumer);
       }
       else
@@ -1323,8 +1324,6 @@
       }
       catch (Exception e)
       {
-         log.error("Failed to create queue", e);
-
          if (e instanceof MessagingException)
          {
             response = new MessagingExceptionMessage((MessagingException)e);

Modified: trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyAcceptor.java
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyAcceptor.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyAcceptor.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -83,7 +83,9 @@
 
    private ChannelFactory channelFactory;
 
-   volatile ChannelGroup channelGroup;
+   private volatile ChannelGroup serverChannelGroup;
+   
+   private volatile ChannelGroup channelGroup;
 
    private ServerBootstrap bootstrap;
 
@@ -126,6 +128,8 @@
    private final HttpKeepAliveTask httpKeepAliveTask;
 
    private ConcurrentMap<Object, Connection> connections = new ConcurrentHashMap<Object, Connection>();
+   
+   private boolean paused;
 
    public NettyAcceptor(final Map<String, Object> configuration,
                         final BufferHandler handler,
@@ -290,8 +294,17 @@
       bootstrap.setOption("child.reuseAddress", true);
       bootstrap.setOption("child.keepAlive", true);
 
-      channelGroup = new DefaultChannelGroup("jbm-acceptor");
+      channelGroup = new DefaultChannelGroup("jbm-accepted-channels");
+      
+      serverChannelGroup = new DefaultChannelGroup("jbm-acceptor-channels");
 
+      startServerChannels();
+      
+      paused = false;
+   }
+   
+   private void startServerChannels()
+   {
       String[] hosts = TransportConfiguration.splitHosts(host);
       for (String h : hosts)
       {
@@ -305,17 +318,78 @@
             address = new InetSocketAddress(h, port);
          }
          Channel serverChannel = bootstrap.bind(address);
-         channelGroup.add(serverChannel);
+         serverChannelGroup.add(serverChannel);
       }
    }
+   
+   public synchronized void pause()
+   {      
+      if (paused)
+      {
+         return;
+      }
+      
+      if (channelFactory == null)
+      {
+         return;
+      }
 
+      //We *pause* the acceptor so no new connections are made
+      
+      serverChannelGroup.close().awaitUninterruptibly();     
+      
+//      //We also need to wait for workers to complete, otherwise requests could still sneak in after we have returned
+//      //from this method
+//      workerExecutor.shutdown();
+//      
+//      log.info("Waiting for worker to complete************************");
+//      try
+//      {
+//         boolean ok = workerExecutor.awaitTermination(5000, TimeUnit.MILLISECONDS);
+//         
+//         if (!ok)
+//         {
+//            log.warn("Timed out in waiting for worker to complete");
+//         }
+//      }
+//      catch (InterruptedException e)
+//      {         
+//      }
+      
+      try
+      {
+         Thread.sleep(500);
+      }
+      catch (Exception e)
+      {         
+      }
+      
+      paused = true;         
+   }
+   
+   public synchronized void resume()
+   {
+      if (!paused)
+      {
+         return;
+      }
+            
+      startServerChannels();
+      
+      paused = false;
+   }
+   
    public synchronized void stop()
    {
-
       if (channelFactory == null)
       {
          return;
       }
+      
+      if (!paused)
+      {
+         serverChannelGroup.close().awaitUninterruptibly(); 
+      }
 
       if (httpKeepAliveTimer != null)
       {
@@ -323,10 +397,11 @@
 
          httpKeepAliveTimer.cancel();
       }
+      
       channelGroup.close().awaitUninterruptibly();
       channelFactory.releaseExternalResources();
-      channelFactory = null;
-
+      channelFactory = null;  
+      
       for (Connection connection : connections.values())
       {
          listener.connectionDestroyed(connection.getID());

Modified: trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnection.java
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnection.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnection.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -28,6 +28,7 @@
 import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
 import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
 import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelFuture;
 import org.jboss.netty.channel.ChannelFutureListener;
 import org.jboss.netty.handler.ssl.SslHandler;
 
@@ -122,11 +123,37 @@
    {
       return channel.getId();
    }
-
+   
    public void write(final MessagingBuffer buffer)
    {
-      channel.write(buffer.getUnderlyingBuffer());
+      write(buffer, false);
    }
+   
+   public void write(final MessagingBuffer buffer, final boolean flush)
+   {
+      ChannelFuture future = channel.write(buffer.getUnderlyingBuffer());
+      
+      if (flush)
+      {
+         while (true)
+         {
+            try
+            {
+               boolean ok = future.await(10000);
+               
+               if (!ok)
+               {
+                  log.warn("Timed out waiting for packet to be flushed");
+               }
+               
+               break;
+            }
+            catch (InterruptedException ignore)
+            {            
+            }
+         }
+      }
+   }
 
    public String getRemoteAddress()
    {

Modified: trunk/src/main/org/jboss/messaging/jms/bridge/QualityOfServiceMode.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/bridge/QualityOfServiceMode.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/jms/bridge/QualityOfServiceMode.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -23,7 +23,7 @@
 package org.jboss.messaging.jms.bridge;
 
 /**
- * <h3>Quality of service (QoS) levels</h3>
+ * <h3>Quality of server (QoS) levels</h3>
  * 
  * <h4>QOS_AT_MOST_ONCE</h4>
  * 

Modified: trunk/src/main/org/jboss/messaging/jms/bridge/impl/BridgeImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/bridge/impl/BridgeImpl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/jms/bridge/impl/BridgeImpl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -1004,7 +1004,7 @@
       }
       catch (Exception e)
       {
-         log.warn("Failed to set up connections", e);
+         log.warn("Failed to set up bridge connections");
          
          //If this fails we should attempt to cleanup or we might end up in some weird state
          
@@ -1583,7 +1583,7 @@
    {
 		public void onException(JMSException e)
 		{
-			log.warn("Detected failure on connection", e);
+			log.warn("Detected failure on bridge connection");
 			
 			synchronized (lock)
 			{

Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -114,10 +114,10 @@
 
    private final double retryIntervalMultiplier; // For exponential backoff
 
-   private final int initialConnectAttempts;
-
    private final int reconnectAttempts;
 
+   private final boolean failoverOnServerShutdown;
+
    // Constructors ---------------------------------------------------------------------------------
 
    public JBossConnectionFactory(final String discoveryGroupAddress,
@@ -144,8 +144,8 @@
                                  final boolean preAcknowledge,
                                  final long retryInterval,
                                  final double retryIntervalMultiplier,
-                                 final int initialConnectAttempts,
-                                 final int reconnectAttempts)
+                                 final int reconnectAttempts,
+                                 final boolean failoverOnServerShutdown)
    {
       this.connectorConfigs = null;
       this.discoveryGroupAddress = discoveryGroupAddress;
@@ -172,8 +172,8 @@
       this.preAcknowledge = preAcknowledge;
       this.retryInterval = retryInterval;
       this.retryIntervalMultiplier = retryIntervalMultiplier;
-      this.initialConnectAttempts = initialConnectAttempts;
       this.reconnectAttempts = reconnectAttempts;
+      this.failoverOnServerShutdown = failoverOnServerShutdown;
    }
 
    public JBossConnectionFactory(final String discoveryGroupAddress,
@@ -206,8 +206,8 @@
       this.preAcknowledge = ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
       this.retryInterval = ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
       this.retryIntervalMultiplier = ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
-      this.initialConnectAttempts = ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS;
       this.reconnectAttempts = ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
+      this.failoverOnServerShutdown = ClientSessionFactoryImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN;
    }
 
    public JBossConnectionFactory(final String discoveryGroupName, final int discoveryGroupPort)
@@ -239,8 +239,8 @@
                                  final boolean preAcknowledge,
                                  final long retryInterval,
                                  final double retryIntervalMultiplier,
-                                 final int initialConnectAttempts,
-                                 final int reconnectAttempts)
+                                 final int reconnectAttempts,
+                                 final boolean failoverOnServerShutdown)
    {
       this.discoveryGroupAddress = null;
       this.discoveryGroupPort = -1;
@@ -267,8 +267,8 @@
       this.preAcknowledge = preAcknowledge;
       this.retryInterval = retryInterval;
       this.retryIntervalMultiplier = retryIntervalMultiplier;
-      this.initialConnectAttempts = initialConnectAttempts;
       this.reconnectAttempts = reconnectAttempts;
+      this.failoverOnServerShutdown = failoverOnServerShutdown;
    }
 
    public JBossConnectionFactory(final TransportConfiguration transportConfig,
@@ -293,8 +293,8 @@
                                  final boolean preAcknowledge,
                                  final long retryInterval,
                                  final double retryIntervalMultiplier,
-                                 final int initialConnectAttempts,
-                                 final int reconnectAttempts)
+                                 final int reconnectAttempts,
+                                 final boolean failoverOnServerShutdown)
    {
       this.discoveryGroupAddress = null;
       this.discoveryGroupPort = -1;
@@ -323,8 +323,8 @@
       this.preAcknowledge = preAcknowledge;
       this.retryInterval = retryInterval;
       this.retryIntervalMultiplier = retryIntervalMultiplier;
-      this.initialConnectAttempts = initialConnectAttempts;
       this.reconnectAttempts = reconnectAttempts;
+      this.failoverOnServerShutdown = failoverOnServerShutdown;
    }
 
    public JBossConnectionFactory(final List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs)
@@ -354,8 +354,8 @@
       this.preAcknowledge = ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
       this.retryInterval = ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
       this.retryIntervalMultiplier = ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
-      this.initialConnectAttempts = ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS;
       this.reconnectAttempts = ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
+      this.failoverOnServerShutdown = ClientSessionFactoryImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN;
    }
 
    
@@ -390,8 +390,8 @@
       this.preAcknowledge = preAcknowledge;
       this.retryInterval = ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
       this.retryIntervalMultiplier = ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;      
-      this.initialConnectAttempts = ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS;
       this.reconnectAttempts = ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
+      this.failoverOnServerShutdown = ClientSessionFactoryImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN;
    }
    
    public JBossConnectionFactory(final TransportConfiguration connectorConfig)
@@ -425,8 +425,8 @@
       this.preAcknowledge = ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
       this.retryInterval = ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
       this.retryIntervalMultiplier = ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
-      this.initialConnectAttempts = ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS;
       this.reconnectAttempts = ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
+      this.failoverOnServerShutdown = ClientSessionFactoryImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN;
    }
 
    // ConnectionFactory implementation -------------------------------------------------------------
@@ -573,14 +573,14 @@
       return maxConnections;
    }
    
-   public int getInitialConnectAttempts()
+   public int getReconnectAttempts()
    {
-      return initialConnectAttempts;
+      return reconnectAttempts;
    }
    
-   public int getReconnectAttempts()
+   public boolean isFailoverOnServerShutdown()
    {
-      return reconnectAttempts;
+      return failoverOnServerShutdown;
    }
    
    public boolean isBlockOnAcknowledge()
@@ -673,8 +673,8 @@
                                                        dupsOKBatchSize,
                                                        retryInterval,
                                                        retryIntervalMultiplier,
-                                                       initialConnectAttempts,
-                                                       reconnectAttempts);
+                                                       reconnectAttempts,
+                                                       failoverOnServerShutdown);
       }
       else
       {
@@ -700,8 +700,8 @@
                                                        dupsOKBatchSize,
                                                        retryInterval,
                                                        retryIntervalMultiplier,
-                                                       initialConnectAttempts,
-                                                       reconnectAttempts);
+                                                       reconnectAttempts,
+                                                       failoverOnServerShutdown);
       }
    }
 

Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossMessage.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossMessage.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -890,14 +890,17 @@
 
    public void acknowledge() throws JMSException
    {
-      try
+      if (session != null)
       {
-         session.commit();
+         try
+         {
+            session.commit();
+         }
+         catch (MessagingException e)
+         {
+            throw JMSExceptionHelper.convertFromMessagingException(e);
+         }
       }
-      catch (MessagingException e)
-      {
-         throw JMSExceptionHelper.convertFromMessagingException(e);
-      }
    }
 
    // Public --------------------------------------------------------
@@ -926,11 +929,6 @@
       return JBossMessage.TYPE;
    }
 
-   public ClientSession getSession()
-   {
-      return session;
-   }
-
    public String toString()
    {
       StringBuffer sb = new StringBuffer("JBossMessage[");

Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossMessageConsumer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossMessageConsumer.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossMessageConsumer.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -18,7 +18,7 @@
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */ 
+ */
 
 package org.jboss.messaging.jms.client;
 
@@ -29,6 +29,7 @@
 import javax.jms.MessageListener;
 import javax.jms.Queue;
 import javax.jms.QueueReceiver;
+import javax.jms.Session;
 import javax.jms.Topic;
 import javax.jms.TopicSubscriber;
 
@@ -47,51 +48,54 @@
  * $Id$
  */
 public class JBossMessageConsumer implements MessageConsumer, QueueReceiver, TopicSubscriber
-{   
-   // Constants -----------------------------------------------------  
-   
+{
+   // Constants -----------------------------------------------------
+
    private static final Logger log = Logger.getLogger(JBossMessageConsumer.class);
-   
+
    // Static --------------------------------------------------------
 
    // Attributes ----------------------------------------------------
 
    private final ClientConsumer consumer;
-   
+
    private MessageListener listener;
-   
+
    private MessageHandler coreListener;
-   
+
    private final JBossSession session;
-   
+
    private final int ackMode;
-   
+
    private final boolean noLocal;
-   
+
    private final JBossDestination destination;
-   
+
    private final String selector;
-   
+
    private final SimpleString autoDeleteQueueName;
-     
+
    // Constructors --------------------------------------------------
 
-   public JBossMessageConsumer(final JBossSession session, final ClientConsumer consumer, final boolean noLocal,
-                               final JBossDestination destination, final String selector,
+   public JBossMessageConsumer(final JBossSession session,
+                               final ClientConsumer consumer,
+                               final boolean noLocal,
+                               final JBossDestination destination,
+                               final String selector,
                                final SimpleString autoDeleteQueueName) throws JMSException
-   {      
+   {
       this.session = session;
-      
+
       this.consumer = consumer;
-      
+
       this.ackMode = session.getAcknowledgeMode();
-      
+
       this.noLocal = noLocal;
-      
+
       this.destination = destination;
-      
-      this.selector = selector;      
-      
+
+      this.selector = selector;
+
       this.autoDeleteQueueName = autoDeleteQueueName;
    }
 
@@ -100,30 +104,30 @@
    public String getMessageSelector() throws JMSException
    {
       checkClosed();
-      
+
       return selector;
    }
 
    public MessageListener getMessageListener() throws JMSException
    {
       checkClosed();
-      
+
       return listener;
    }
 
    public void setMessageListener(MessageListener listener) throws JMSException
    {
       this.listener = listener;
-      
+
       coreListener = new JMSMessageListenerWrapper(session, consumer, listener, ackMode);
-      
+
       try
       {
          consumer.setMessageHandler(coreListener);
       }
       catch (MessagingException e)
       {
-         throw JMSExceptionHelper.convertFromMessagingException(e);     
+         throw JMSExceptionHelper.convertFromMessagingException(e);
       }
    }
 
@@ -141,24 +145,24 @@
    {
       return getMessage(-1);
    }
-     
+
    public void close() throws JMSException
    {
       try
-      {         
-         consumer.close();                 
-         
+      {
+         consumer.close();
+
          if (autoDeleteQueueName != null)
          {
-            //If non durable subscriber need to delete subscription too
+            // If non durable subscriber need to delete subscription too
             session.deleteQueue(autoDeleteQueueName);
          }
-         
+
          session.removeConsumer(this);
       }
       catch (MessagingException e)
       {
-         throw JMSExceptionHelper.convertFromMessagingException(e);     
+         throw JMSExceptionHelper.convertFromMessagingException(e);
       }
    }
 
@@ -176,7 +180,6 @@
       return (Topic)destination;
    }
 
-
    public boolean getNoLocal() throws JMSException
    {
       return noLocal;
@@ -194,7 +197,7 @@
    // Protected -----------------------------------------------------
 
    // Private -------------------------------------------------------
-   
+
    private void checkClosed() throws JMSException
    {
       if (session.getCoreSession().isClosed())
@@ -202,21 +205,22 @@
          throw new IllegalStateException("Consumer is closed");
       }
    }
-   
+
    private JBossMessage getMessage(long timeout) throws JMSException
    {
       try
       {
-         ClientMessage message =  consumer.receive(timeout);
-               
+         ClientMessage message = consumer.receive(timeout);
+
          JBossMessage jbm = null;
-         
+
          if (message != null)
-         {         
-            message.acknowledge();            
-                     
-            jbm = JBossMessage.createMessage(message, session.getCoreSession());
-            
+         {
+            message.acknowledge();
+
+            jbm = JBossMessage.createMessage(message, ackMode == Session.CLIENT_ACKNOWLEDGE ? session.getCoreSession()
+                                                                                           : null);
+
             try
             {
                jbm.doBeforeReceive();
@@ -224,16 +228,16 @@
             catch (Exception e)
             {
                log.error("Failed to prepare message", e);
-               
+
                return null;
             }
          }
-         
+
          return jbm;
       }
       catch (MessagingException e)
       {
-         throw JMSExceptionHelper.convertFromMessagingException(e);     
+         throw JMSExceptionHelper.convertFromMessagingException(e);
       }
    }
 

Modified: trunk/src/main/org/jboss/messaging/jms/server/JMSServerManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/JMSServerManager.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/jms/server/JMSServerManager.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -24,8 +24,11 @@
 
 import java.util.List;
 
+import javax.naming.Context;
+
 import org.jboss.messaging.core.config.TransportConfiguration;
 import org.jboss.messaging.core.config.cluster.DiscoveryGroupConfiguration;
+import org.jboss.messaging.core.server.MessagingComponent;
 import org.jboss.messaging.utils.Pair;
 
 /**
@@ -34,7 +37,7 @@
  * @author <a href="ataylor at redhat.com">Andy Taylor</a>
  * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
  */
-public interface JMSServerManager
+public interface JMSServerManager extends MessagingComponent
 {
    String getVersion();
 
@@ -141,8 +144,8 @@
                                    boolean preAcknowledge,                               
                                    final long retryInterval,
                                    final double retryIntervalMultiplier,                                   
-                                   final int initialConnectAttempts,
                                    final int reconnectAttempts,
+                                   final boolean failoverOnNodeShutdown,
                                    List<String> jndiBindings) throws Exception;
    
    boolean createConnectionFactory(String name,
@@ -168,8 +171,8 @@
                                    boolean preAcknowledge,                            
                                    final long retryInterval,
                                    final double retryIntervalMultiplier,                                   
-                                   final int initialConnectAttempts,
                                    final int reconnectAttempts,
+                                   final boolean failoverOnNodeShutdown,
                                    List<String> jndiBindings) throws Exception;
 
    /**
@@ -193,5 +196,5 @@
 
    String[] listSessions(String connectionID) throws Exception;
 
-
+   void setContext(final Context context);
 }

Modified: trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -79,9 +79,9 @@
 
    private static final String RETRY_INTERVAL_MULTIPLIER = "retry-interval-multiplier";
 
-   private static final String INITIAL_CONNECT_ATTEMPTS = "initial-connect-attempts";
+   private static final String CONNECT_ATTEMPTS = "reconnect-attempts";
    
-   private static final String RECONNECT_ATTEMPTS = "reconnect-attempts";
+   private static final String FAILOVER_ON_NODE_SHUTDOWN = "failover-on-node-shutdown";
 
    private static final String CONNECTOR_LINK_ELEMENT = "connector-ref";
 
@@ -171,8 +171,8 @@
          boolean preAcknowledge = ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
          long retryInterval = ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
          double retryIntervalMultiplier = ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;         
-         int initialConnectAttempts = ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS;
          int reconnectAttempts = ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
+         boolean failoverOnNodeShutdown = ClientSessionFactoryImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN;
 
          List<String> jndiBindings = new ArrayList<String>();
          List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs = new ArrayList<Pair<TransportConfiguration, TransportConfiguration>>();
@@ -264,13 +264,13 @@
             {
                retryIntervalMultiplier = org.jboss.messaging.utils.XMLUtil.parseDouble(child);
             }
-            else if (INITIAL_CONNECT_ATTEMPTS.equals(child.getNodeName()))
+            else if (CONNECT_ATTEMPTS.equals(child.getNodeName()))
             {
-               initialConnectAttempts = org.jboss.messaging.utils.XMLUtil.parseInt(child);;
+               reconnectAttempts = org.jboss.messaging.utils.XMLUtil.parseInt(child);;
             }
-            else if (RECONNECT_ATTEMPTS.equals(child.getNodeName()))
+            else if (FAILOVER_ON_NODE_SHUTDOWN.equals(child.getNodeName()))
             {
-               reconnectAttempts = org.jboss.messaging.utils.XMLUtil.parseInt(child);;
+               failoverOnNodeShutdown = org.jboss.messaging.utils.XMLUtil.parseBoolean(child);;
             }            
             else if (ENTRY_NODE_NAME.equals(child.getNodeName()))
             {
@@ -361,8 +361,8 @@
                                                      preAcknowledge,                                                   
                                                      retryInterval,
                                                      retryIntervalMultiplier,                                                     
-                                                     initialConnectAttempts,
                                                      reconnectAttempts,
+                                                     failoverOnNodeShutdown,
                                                      jndiBindings);
          }
          else
@@ -389,8 +389,8 @@
                                                      preAcknowledge,                                                
                                                      retryInterval,
                                                      retryIntervalMultiplier,                                                     
-                                                     initialConnectAttempts,
                                                      reconnectAttempts,
+                                                     failoverOnNodeShutdown,
                                                      jndiBindings);
          }
       }

Modified: trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -89,8 +89,6 @@
 
    public static JMSServerManagerImpl newJMSServerManagerImpl(final MessagingServer server) throws Exception
    {
-      log.info("Creating new msc with po " + server.getPostOffice());
-      
       MessagingServerControlMBean control = new MessagingServerControl(server.getPostOffice(),
                                                                        server.getStorageManager(),
                                                                        server.getConfiguration(),                                                                    
@@ -133,14 +131,25 @@
       }
       managementService.registerJMSServer(this);
    }
-
-   // JMSServerManager implementation -------------------------------
-
+   
+   // MessagingComponent implementation -----------------------------------
+   
+   public void stop()
+   {      
+   }
+   
    public boolean isStarted()
    {
       return messagingServer.isStarted();
    }
 
+   // JMSServerManager implementation -------------------------------
+   
+   public void setContext(final Context context)
+   {
+      this.context = context;
+   }
+   
    public String getVersion()
    {
       return messagingServer.getVersion();
@@ -238,8 +247,8 @@
                                           final boolean preAcknowledge,                                        
                                           final long retryInterval,
                                           final double retryIntervalMultiplier,                                          
-                                          final int initialConnectAttempts,
                                           final int reconnectAttempts,
+                                          final boolean failoverOnNodeShutdown,
                                           final List<String> jndiBindings) throws Exception
    {
       JBossConnectionFactory cf = connectionFactories.get(name);
@@ -266,8 +275,8 @@
                                          preAcknowledge,                                     
                                          retryInterval,
                                          retryIntervalMultiplier,                                         
-                                         initialConnectAttempts,
-                                         reconnectAttempts);
+                                         reconnectAttempts,
+                                         failoverOnNodeShutdown);
       }
 
       bindConnectionFactory(cf, name, jndiBindings);
@@ -332,8 +341,8 @@
                                           final boolean preAcknowledge,                                 
                                           final long retryInterval,
                                           final double retryIntervalMultiplier,                                          
-                                          final int initialConnectAttempts,
                                           final int reconnectAttempts,
+                                          final boolean failoverOnNodeShutdown,
                                           final List<String> jndiBindings) throws Exception
    {
       JBossConnectionFactory cf = connectionFactories.get(name);
@@ -363,8 +372,8 @@
                                          preAcknowledge,                                   
                                          retryInterval,
                                          retryIntervalMultiplier,                                         
-                                         initialConnectAttempts,
-                                         reconnectAttempts);
+                                         reconnectAttempts,
+                                         failoverOnNodeShutdown);
       }
 
       bindConnectionFactory(cf, name, jndiBindings);
@@ -425,11 +434,6 @@
 
    // Public --------------------------------------------------------
 
-   public void setContext(final Context context)
-   {
-      this.context = context;
-   }
-
    // Private -------------------------------------------------------
 
    private void bindConnectionFactory(final JBossConnectionFactory cf,

Modified: trunk/src/main/org/jboss/messaging/jms/server/management/ConnectionFactoryControlMBean.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/ConnectionFactoryControlMBean.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/ConnectionFactoryControlMBean.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -75,7 +75,7 @@
 
    double getRetryIntervalMultiplier();
 
-   int getInitialConnectAttempts();
+   int getReconnectAttempts();
 
-   int getReconnectAttempts();
+   boolean isFailoverOnNodeShutdown();
 }

Modified: trunk/src/main/org/jboss/messaging/jms/server/management/JMSServerControlMBean.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/JMSServerControlMBean.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/JMSServerControlMBean.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -50,63 +50,60 @@
 
    @Operation(desc = "Create a JMS Queue", impact = ACTION)
    boolean createQueue(@Parameter(name = "name", desc = "Name of the queue to create")
-                       String name,
-                       @Parameter(name = "jndiBinding", desc = "the name of the binding for JNDI")
-                       String jndiBinding) throws Exception;
+   String name, @Parameter(name = "jndiBinding", desc = "the name of the binding for JNDI")
+   String jndiBinding) throws Exception;
 
    @Operation(desc = "Destroy a JMS Queue", impact = ACTION)
    boolean destroyQueue(@Parameter(name = "name", desc = "Name of the queue to destroy")
-                        String name) throws Exception;
+   String name) throws Exception;
 
    @Operation(desc = "Create a JMS Topic", impact = ACTION)
    boolean createTopic(@Parameter(name = "name", desc = "Name of the topic to create")
-                       String name,
-                       @Parameter(name = "jndiBinding", desc = "the name of the binding for JNDI")
-                       String jndiBinding) throws Exception;
+   String name, @Parameter(name = "jndiBinding", desc = "the name of the binding for JNDI")
+   String jndiBinding) throws Exception;
 
    @Operation(desc = "Destroy a JMS Topic", impact = ACTION)
-   boolean destroyTopic(@Parameter(name = "name", desc = "Name of the topic to destroy") String name) throws Exception;
+   boolean destroyTopic(@Parameter(name = "name", desc = "Name of the topic to destroy")
+   String name) throws Exception;
 
+   void createConnectionFactory(String name, String connectorFactoryClassName, String jndiBinding) throws Exception;
+
    void createConnectionFactory(String name,
                                 String connectorFactoryClassName,
+                                boolean blockOnAcknowledge,
+                                boolean blockOnNonPersistentSend,
+                                boolean blockOnPersistentSend,
+                                boolean preAcknowledge,
                                 String jndiBinding) throws Exception;
 
-   void createConnectionFactory(String name,
+   void createSimpleConnectionFactory(String name,
                                       String connectorFactoryClassName,
+                                      String connectionLoadBalancingPolicyClassName,
+                                      long pingPeriod,
+                                      long connectionTTL,
+                                      long callTimeout,
+                                      String clientID,
+                                      int dupsOKBatchSize,
+                                      int transactionBatchSize,
+                                      int consumerWindowSize,
+                                      int consumerMaxRate,
+                                      int producerWindowSize,
+                                      int producerMaxRate,
+                                      int minLargeMessageSize,
                                       boolean blockOnAcknowledge,
                                       boolean blockOnNonPersistentSend,
                                       boolean blockOnPersistentSend,
+                                      boolean autoGroup,
+                                      int maxConnections,
                                       boolean preAcknowledge,
+                                      long retryInterval,
+                                      double retryIntervalMultiplier,
+                                      int reconnectAttempts,
+                                      boolean failoverOnNodeShutdown,
                                       String jndiBinding) throws Exception;
 
-   void createSimpleConnectionFactory(String name,
-                                String connectorFactoryClassName,
-                                String connectionLoadBalancingPolicyClassName,
-                                long pingPeriod,
-                                long connectionTTL,
-                                long callTimeout,
-                                String clientID,
-                                int dupsOKBatchSize,
-                                int transactionBatchSize,
-                                int consumerWindowSize,
-                                int consumerMaxRate,
-                                int producerWindowSize,
-                                int producerMaxRate,
-                                int minLargeMessageSize,
-                                boolean blockOnAcknowledge,
-                                boolean blockOnNonPersistentSend,
-                                boolean blockOnPersistentSend,
-                                boolean autoGroup,
-                                int maxConnections,
-                                boolean preAcknowledge,
-                                long retryInterval,
-                                double retryIntervalMultiplier,
-                                int maxRetriesBeforeFailover,
-                                int maxRetriesAfterFailover,
-                                String jndiBinding) throws Exception;
-
    @Operation(desc = "Create a JMS ConnectionFactory with a static list of servers", impact = ACTION)
-   void createConnectionFactory(@Parameter(name = "name", desc = "Name of the ConnectionFactory to create") 
+   void createConnectionFactory(@Parameter(name = "name", desc = "Name of the ConnectionFactory to create")
                                 String name,
                                 @Parameter(name = "connectorConfigs", desc = "List of pairs of live configuration, backup configuration")
                                 List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs,
@@ -122,119 +119,120 @@
                                 String clientID,
                                 @Parameter(name = "dupsOKBatchSize", desc = "Size of the batch in bytes when using DUPS_OK")
                                 int dupsOKBatchSize,
-                                @Parameter(name = "transactionBatchSize", desc = "Size of the batch in bytes when using transacted session") 
+                                @Parameter(name = "transactionBatchSize", desc = "Size of the batch in bytes when using transacted session")
                                 int transactionBatchSize,
-                                @Parameter(name = "consumerWindowSize", desc = "Consumer's window size") 
+                                @Parameter(name = "consumerWindowSize", desc = "Consumer's window size")
                                 int consumerWindowSize,
-                                @Parameter(name = "consumerMaxRate", desc = "Consumer's max rate") 
+                                @Parameter(name = "consumerMaxRate", desc = "Consumer's max rate")
                                 int consumerMaxRate,
                                 @Parameter(name = "producerWindowSize", desc = "Producer's window size")
                                 int producerWindowSize,
-                                @Parameter(name = "producerMaxRate", desc = "Producer's max rate") 
+                                @Parameter(name = "producerMaxRate", desc = "Producer's max rate")
                                 int producerMaxRate,
-                                @Parameter(name = "minLargeMessageSize", desc = "Size of what is considered a big message requiring sending in chunks") int minLargeMessageSize,
-                                @Parameter(name = "blockOnAcknowledge", desc = "Does acknowlegment block?") 
+                                @Parameter(name = "minLargeMessageSize", desc = "Size of what is considered a big message requiring sending in chunks")
+                                int minLargeMessageSize,
+                                @Parameter(name = "blockOnAcknowledge", desc = "Does acknowlegment block?")
                                 boolean blockOnAcknowledge,
-                                @Parameter(name = "blockOnNonPersistentSend", desc = "Does sending non persistent messages block?") 
+                                @Parameter(name = "blockOnNonPersistentSend", desc = "Does sending non persistent messages block?")
                                 boolean blockOnNonPersistentSend,
-                                @Parameter(name = "blockOnPersistentSend", desc = "Does sending persistent messages block?") 
+                                @Parameter(name = "blockOnPersistentSend", desc = "Does sending persistent messages block?")
                                 boolean blockOnPersistentSend,
-                                @Parameter(name = "autoGroup", desc = "Any Messages sent via this factories connections will automatically set the property 'JBM_GroupID'") 
+                                @Parameter(name = "autoGroup", desc = "Any Messages sent via this factories connections will automatically set the property 'JBM_GroupID'")
                                 boolean autoGroup,
-                                @Parameter(name = "maxConnections", desc = "The maximum number of physical connections created per client using this connection factory. Sessions created will be assigned a connection in a round-robin fashion") 
+                                @Parameter(name = "maxConnections", desc = "The maximum number of physical connections created per client using this connection factory. Sessions created will be assigned a connection in a round-robin fashion")
                                 int maxConnections,
-                                @Parameter(name = "preAcknowledge", desc = "If the server will acknowledge delivery of a message before it is delivered") 
+                                @Parameter(name = "preAcknowledge", desc = "If the server will acknowledge delivery of a message before it is delivered")
                                 boolean preAcknowledge,
                                 @Parameter(name = "retryInterval", desc = "The retry interval in ms when retrying connecting to same server")
                                 long retryInterval,
-                                @Parameter(name = "retryIntervalMultiplier", desc = "The retry interval multiplier when retrying connecting to same server") 
+                                @Parameter(name = "retryIntervalMultiplier", desc = "The retry interval multiplier when retrying connecting to same server")
                                 double retryIntervalMultiplier,
-                                @Parameter(name = "initialConnectAttempts", desc = "The maximum number of attempts to make to establish a first connection. -1 means no maximum") 
-                                int initialConnectAttempts,
-                                @Parameter(name = "reconnectAttempts", desc = "The maximum number of re-connection attempts to a server after failure has been detected. -1 means no maximum")
+                                @Parameter(name = "reconnectAttempts", desc = "The maximum number of attempts to make to establish a connection to the server. -1 means no maximum")
                                 int reconnectAttempts,
-                                @Parameter(name = "jndiBinding", desc = "JNDI Binding") 
-                                String jndiBinding) 
-   throws Exception;
+                                @Parameter(name = "failoverOnNodeShutdown", desc = "If the server is cleanly shutdown, should the client attempt failover to backup (if specified)?")
+                                boolean failoverOnNodeShutdown,
+                                @Parameter(name = "jndiBinding", desc = "JNDI Binding")
+                                String jndiBinding) throws Exception;
 
-   
    @Operation(desc = "Create a JMS ConnectionFactory specifying a discovery group to obtain list of servers from", impact = ACTION)
-   void createConnectionFactory(@Parameter(name = "name", desc = "Name of the ConnectionFactory to create") 
+   void createConnectionFactory(@Parameter(name = "name", desc = "Name of the ConnectionFactory to create")
                                 String name,
                                 @Parameter(name = "discoveryGroupName", desc = "Name of the Discovery group configuration")
                                 String discoveryGroupName,
-                                @Parameter(name = "discoveryGroupAddress", desc = "Address of the Discovery group") 
+                                @Parameter(name = "discoveryGroupAddress", desc = "Address of the Discovery group")
                                 String discoveryGroupAddress,
                                 @Parameter(name = "discoveryGroupPort", desc = "port of the Discovery group")
                                 int discoveryGroupPort,
-                                @Parameter(name = "discoveryGroupRefreshTimeout", desc = "Refresh timeout of the discovery group") 
+                                @Parameter(name = "discoveryGroupRefreshTimeout", desc = "Refresh timeout of the discovery group")
                                 long discoveryGroupRefreshTimeout,
-                                @Parameter(name = "discoveryInitialWait", desc = "The amount of time in ms to wait for initial discovery information to arrive at first using connection factory") 
+                                @Parameter(name = "discoveryInitialWait", desc = "The amount of time in ms to wait for initial discovery information to arrive at first using connection factory")
                                 long discoveryInitialWait,
                                 @Parameter(name = "connectionLoadBalancingPolicyClassName", desc = "The name of the class to use for client side connection load-balancing")
                                 String connectionLoadBalancingPolicyClassName,
-                                @Parameter(name = "pingPeriod", desc = "The ping period in m") 
+                                @Parameter(name = "pingPeriod", desc = "The ping period in m")
                                 long pingPeriod,
-                                @Parameter(name = "connectionTTL", desc = "The connection TTL in ms") 
+                                @Parameter(name = "connectionTTL", desc = "The connection TTL in ms")
                                 long connectionTTL,
-                                @Parameter(name = "callTimeout", desc = "The call timeout in m") 
+                                @Parameter(name = "callTimeout", desc = "The call timeout in m")
                                 long callTimeout,
-                                @Parameter(name = "clientID", desc = "ClientID for created connections") 
+                                @Parameter(name = "clientID", desc = "ClientID for created connections")
                                 String clientID,
-                                @Parameter(name = "dupsOKBatchSize", desc = "Size of the batch in bytes when using DUPS_OK") 
+                                @Parameter(name = "dupsOKBatchSize", desc = "Size of the batch in bytes when using DUPS_OK")
                                 int dupsOKBatchSize,
-                                @Parameter(name = "transactionBatchSize", desc = "Size of the batch in bytes when using transacted session") 
+                                @Parameter(name = "transactionBatchSize", desc = "Size of the batch in bytes when using transacted session")
                                 int transactionBatchSize,
-                                @Parameter(name = "consumerWindowSize", desc = "Consumer's window size") 
+                                @Parameter(name = "consumerWindowSize", desc = "Consumer's window size")
                                 int consumerWindowSize,
-                                @Parameter(name = "consumerMaxRate", desc = "Consumer's max rate") 
+                                @Parameter(name = "consumerMaxRate", desc = "Consumer's max rate")
                                 int consumerMaxRate,
-                                @Parameter(name = "producerWindowSize", desc = "Producer's window size") 
+                                @Parameter(name = "producerWindowSize", desc = "Producer's window size")
                                 int producerWindowSize,
                                 @Parameter(name = "producerMaxRate", desc = "Producer's max rate")
                                 int producerMaxRate,
-                                @Parameter(name = "minLargeMessageSize", desc = "Size of what is considered a big message requiring sending in chunks") 
+                                @Parameter(name = "minLargeMessageSize", desc = "Size of what is considered a big message requiring sending in chunks")
                                 int minLargeMessageSize,
-                                @Parameter(name = "blockOnAcknowledge", desc = "Does acknowlegment block?") 
+                                @Parameter(name = "blockOnAcknowledge", desc = "Does acknowlegment block?")
                                 boolean blockOnAcknowledge,
-                                @Parameter(name = "blockOnNonPersistentSend", desc = "Does sending non persistent messages block?") 
+                                @Parameter(name = "blockOnNonPersistentSend", desc = "Does sending non persistent messages block?")
                                 boolean blockOnNonPersistentSend,
                                 @Parameter(name = "blockOnPersistentSend", desc = "Does sending persistent messages block?")
                                 boolean blockOnPersistentSend,
                                 @Parameter(name = "autoGroup", desc = "Any Messages sent via this factories connections will automatically set the property 'JBM_GroupID'")
                                 boolean autoGroup,
-                                @Parameter(name = "maxConnections", desc = "The maximum number of physical connections created per client using this connection factory. Sessions created will be assigned a connection in a round-robin fashion") 
+                                @Parameter(name = "maxConnections", desc = "The maximum number of physical connections created per client using this connection factory. Sessions created will be assigned a connection in a round-robin fashion")
                                 int maxConnections,
-                                @Parameter(name = "preAcknowledge", desc = "If the server will acknowledge delivery of a message before it is delivered") 
+                                @Parameter(name = "preAcknowledge", desc = "If the server will acknowledge delivery of a message before it is delivered")
                                 boolean preAcknowledge,
-                                @Parameter(name = "retryInterval", desc = "The retry interval in ms when retrying connecting to same server") 
+                                @Parameter(name = "retryInterval", desc = "The retry interval in ms when retrying connecting to same server")
                                 long retryInterval,
-                                @Parameter(name = "retryIntervalMultiplier", desc = "The retry interval multiplier when retrying connecting to same server") 
+                                @Parameter(name = "retryIntervalMultiplier", desc = "The retry interval multiplier when retrying connecting to same server")
                                 double retryIntervalMultiplier,
-                                @Parameter(name = "initialConnectAttempts", desc = "The maximum number of attempts to make to establish a first connection. -1 means no maximum") 
-                                int initialConnectAttempts,
-                                @Parameter(name = "reconnectAttempts", desc = "The maximum number of re-connection attempts to a server after failure has been detected. -1 means no maximum")
+                                @Parameter(name = "reconnectAttempts", desc = "The maximum number of attempts to make to establish a connection to the server. -1 means no maximum")
                                 int reconnectAttempts,
-                                @Parameter(name = "jndiBinding", desc = "JNDI Binding") 
-                                String jndiBinding) 
-   throws Exception;
+                                @Parameter(name = "failoverOnNodeShutdown", desc = "If the server is cleanly shutdown, should the client attempt failover to backup (if specified)?")
+                                boolean failoverOnNodeShutdown,
+                                @Parameter(name = "jndiBinding", desc = "JNDI Binding")
+                                String jndiBinding) throws Exception;
 
    @Operation(desc = "Create a JMS ConnectionFactory", impact = ACTION)
-   void destroyConnectionFactory(@Parameter(name = "name", desc = "Name of the ConnectionFactory to create") String name) throws Exception;
+   void destroyConnectionFactory(@Parameter(name = "name", desc = "Name of the ConnectionFactory to create")
+   String name) throws Exception;
 
    @Operation(desc = "List the client addresses", impact = INFO)
    String[] listRemoteAddresses() throws Exception;
 
    @Operation(desc = "List the client addresses which match the given IP Address", impact = INFO)
-   String[] listRemoteAddresses(@Parameter(desc = "an IP address", name = "ipAddress") String ipAddress) throws Exception;
+   String[] listRemoteAddresses(@Parameter(desc = "an IP address", name = "ipAddress")
+   String ipAddress) throws Exception;
 
    @Operation(desc = "Closes all the connections for the given IP Address", impact = INFO)
-   boolean closeConnectionsForAddress(@Parameter(desc = "an IP address", name = "ipAddress") String ipAddress) throws Exception;
+   boolean closeConnectionsForAddress(@Parameter(desc = "an IP address", name = "ipAddress")
+   String ipAddress) throws Exception;
 
    @Operation(desc = "List all the connection IDs", impact = INFO)
    String[] listConnectionIDs() throws Exception;
 
    @Operation(desc = "List the sessions for the given connectionID", impact = INFO)
-
-   String[] listSessions(@Parameter(desc = "a connection ID", name = "connectionID") String connectionID) throws Exception;
+   String[] listSessions(@Parameter(desc = "a connection ID", name = "connectionID")
+   String connectionID) throws Exception;
 }

Modified: trunk/src/main/org/jboss/messaging/jms/server/management/impl/ConnectionFactoryControl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/impl/ConnectionFactoryControl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/impl/ConnectionFactoryControl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -144,14 +144,14 @@
       return cf.getMaxConnections();
    }
 
-   public int getInitialConnectAttempts()
+   public int getReconnectAttempts()
    {
-      return cf.getInitialConnectAttempts();
+      return cf.getReconnectAttempts();
    }
 
-   public int getReconnectAttempts()
+   public boolean isFailoverOnNodeShutdown()
    {
-      return cf.getReconnectAttempts();
+      return cf.isFailoverOnServerShutdown();
    }
 
    public long getMinLargeMessageSize()

Modified: trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSServerControl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSServerControl.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSServerControl.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -100,8 +100,8 @@
                                        boolean preAcknowledge,                                   
                                        long retryInterval,
                                        double retryIntervalMultiplier,                                       
-                                       int initialConnectAttempts,
                                        int reconnectAttempts,
+                                       boolean failoverOnNodeShutdown,
                                        String jndiBinding) throws Exception
    {
       List<String> bindings = new ArrayList<String>();
@@ -132,8 +132,8 @@
                                                        preAcknowledge,                                                 
                                                        retryInterval,
                                                        retryIntervalMultiplier,                                                       
-                                                       initialConnectAttempts,
                                                        reconnectAttempts,
+                                                       failoverOnNodeShutdown,
                                                        bindings);
       if (created)
       {
@@ -209,8 +209,8 @@
                                        boolean preAcknowledge,                                   
                                        long retryInterval,
                                        double retryIntervalMultiplier,                                       
-                                       int initialConnectAttempts,
                                        int reconnectAttempts,
+                                       boolean failoverOnNodeShutdown,
                                        String jndiBinding) throws Exception
    {
       List<String> bindings = new ArrayList<String>();
@@ -238,8 +238,8 @@
                                                        preAcknowledge,                                                 
                                                        retryInterval,
                                                        retryIntervalMultiplier,                                                       
-                                                       initialConnectAttempts,
                                                        reconnectAttempts,
+                                                       failoverOnNodeShutdown,
                                                        bindings);
       if (created)
       {
@@ -273,8 +273,8 @@
                                        final boolean preAcknowledge,
                                        final long retryInterval,
                                        final double retryIntervalMultiplier,
-                                       final int initialConnectAttempts,
                                        final int reconnectAttempts,
+                                       final boolean failoverOnNodeShutdown,
                                        final String jndiBinding) throws Exception
    {      
       List<String> bindings = new ArrayList<String>();
@@ -305,8 +305,8 @@
                                                        preAcknowledge,                                               
                                                        retryInterval,
                                                        retryIntervalMultiplier,                                                       
-                                                       initialConnectAttempts,
                                                        reconnectAttempts,
+                                                       failoverOnNodeShutdown,
                                                        bindings);
       if (created)
       {

Modified: trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareConnectionFactoryControlWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareConnectionFactoryControlWrapper.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareConnectionFactoryControlWrapper.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -142,14 +142,14 @@
       return localControl.getMaxConnections();
    }
 
-   public int getInitialConnectAttempts()
+   public int getReconnectAttempts()
    {
-      return localControl.getInitialConnectAttempts();
+      return localControl.getReconnectAttempts();
    }
 
-   public int getReconnectAttempts()
+   public boolean isFailoverOnNodeShutdown()
    {
-      return localControl.getReconnectAttempts();
+      return localControl.isFailoverOnNodeShutdown();
    }
 
    public long getMinLargeMessageSize()

Modified: trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSServerControlWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSServerControlWrapper.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSServerControlWrapper.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -116,8 +116,8 @@
                                        final boolean preAcknowledge,
                                        final long retryInterval,
                                        final double retryIntervalMultiplier,
-                                       final int initialConnectAttempts,
                                        final int reconnectAttempts,
+                                       final boolean failoverOnServerShutdown,
                                        final String jndiBinding) throws Exception
    {
       replicationAwareInvoke("createSimpleConnectionFactory",
@@ -143,8 +143,8 @@
                              preAcknowledge,
                              retryInterval,
                              retryIntervalMultiplier,
-                             initialConnectAttempts,
                              reconnectAttempts,
+                             failoverOnServerShutdown,
                              jndiBinding);
    }
 
@@ -170,8 +170,8 @@
                                        final boolean preAcknowledge,
                                        final long retryInterval,
                                        final double retryIntervalMultiplier,
-                                       final int initialConnectAttempts,
                                        final int reconnectAttempts,
+                                       final boolean failoverOnServerShutdown,
                                        final String jndiBinding) throws Exception
    {
       // FIXME need to store correctly the connector configs
@@ -198,8 +198,8 @@
                              preAcknowledge,
                              retryInterval,
                              retryIntervalMultiplier,
-                             initialConnectAttempts,
                              reconnectAttempts,
+                             failoverOnServerShutdown,
                              jndiBinding);
    }
 
@@ -229,8 +229,8 @@
                                        final boolean preAcknowledge,
                                        final long retryInterval,
                                        final double retryIntervalMultiplier,
-                                       final int initialConnectAttempts,
                                        final int reconnectAttempts,
+                                       final boolean failoverOnServerShutdown,
                                        final String jndiBinding) throws Exception
    {
       replicationAwareInvoke("createConnectionFactory",
@@ -260,8 +260,8 @@
                              preAcknowledge,
                              retryInterval,
                              retryIntervalMultiplier,
-                             initialConnectAttempts,
                              reconnectAttempts,
+                             failoverOnServerShutdown,
                              jndiBinding);
    }
 

Modified: trunk/src/main/org/jboss/messaging/ra/JBMRAProperties.java
===================================================================
--- trunk/src/main/org/jboss/messaging/ra/JBMRAProperties.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/ra/JBMRAProperties.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -116,10 +116,10 @@
    private Double retryIntervalMultiplier;
 
    /** */
-   private Integer initialConnectAttempts;
+   private Integer reconnectAttempts;
 
    /** */
-   private Integer reconnectAttempts;
+   private Boolean failoverOnServerShutdown;
 
    /** The user name */
    private String userName;
@@ -173,8 +173,8 @@
       preAcknowledge = null;
       retryInterval = null;
       retryIntervalMultiplier = null;
-      initialConnectAttempts = null;
       reconnectAttempts = null;
+      failoverOnServerShutdown = null;
       userName = null;
       password = null;
       clientID = null;
@@ -734,51 +734,51 @@
    }
 
    /**
-    * Get initial connect attempts
+    * Get reconnect attempts
     * @return The value
     */
-   public Integer getInitialConnectAttempts()
+   public Integer getReconnectAttempts()
    {
       if (trace)
-         log.trace("getInitialConnectAttempts()");
+         log.trace("getReconnectAttempts()");
 
-      return initialConnectAttempts;
+      return reconnectAttempts;
    }
 
    /**
-    * Set initial connect attempts
-    * @param initialConnectAttempts The value
+    * Set reconnect attempts
+    * @param reconnectAttempts The value
     */
-   public void setInitialConnectAttempts(Integer initialConnectAttempts)
+   public void setReconnectAttempts(Integer reconnectAttempts)
    {
       if (trace)
-         log.trace("setInitialConnectAttempts(" + initialConnectAttempts + ")");
+         log.trace("setReconnectAttempts(" + reconnectAttempts + ")");
 
-      this.initialConnectAttempts = initialConnectAttempts;
+      this.reconnectAttempts = reconnectAttempts;
    }
 
    /**
-    * Get reconnect attempts
+    * Get failover on server shutdowns
     * @return The value
     */
-   public Integer getReconnectAttempts()
+   public Boolean isFailoverOnServerShutdown()
    {
       if (trace)
-         log.trace("getReconnectAttempts()");
+         log.trace("isFailoverOnServerShutdown()");
 
-      return reconnectAttempts;
+      return failoverOnServerShutdown;
    }
 
    /**
-    * Set reconnect attempts
-    * @param reconnectAttempts The value
+    * Set failover on server shutdown
+    * @param failoverOnServerShutdown The value
     */
-   public void setReconnectAttempts(Integer reconnectAttempts)
+   public void setFailoverOnServerShutdown(Boolean failoverOnServerShutdown)
    {
       if (trace)
-         log.trace("setReconnectAttempts(" + reconnectAttempts + ")");
+         log.trace("setFailoverOnServerShutdown(" + failoverOnServerShutdown + ")");
 
-      this.reconnectAttempts = reconnectAttempts;
+      this.failoverOnServerShutdown = failoverOnServerShutdown;
    }
 
    /**
@@ -931,8 +931,8 @@
                  Util.compare(preAcknowledge, you.getPreAcknowledge()) &&
                  Util.compare(retryInterval, you.getRetryInterval()) &&
                  Util.compare(retryIntervalMultiplier, you.getRetryIntervalMultiplier()) &&
-                 Util.compare(initialConnectAttempts, you.getInitialConnectAttempts()) &&
                  Util.compare(reconnectAttempts, you.getReconnectAttempts()) &&
+                 Util.compare(failoverOnServerShutdown, you.isFailoverOnServerShutdown()) &&
                  Util.compare(userName, you.getUserName()) &&
                  Util.compare(password, you.getPassword()) &&
                  Util.compare(clientID, you.getClientID()) &&
@@ -976,8 +976,8 @@
       hash += 31 * hash + (preAcknowledge != null ? preAcknowledge.hashCode() : 0);
       hash += 31 * hash + (retryInterval != null ? retryInterval.hashCode() : 0);
       hash += 31 * hash + (retryIntervalMultiplier != null ? retryIntervalMultiplier.hashCode() : 0);
-      hash += 31 * hash + (initialConnectAttempts != null ? initialConnectAttempts.hashCode() : 0);
       hash += 31 * hash + (reconnectAttempts != null ? reconnectAttempts.hashCode() : 0);
+      hash += 31 * hash + (failoverOnServerShutdown != null ? failoverOnServerShutdown.hashCode() : 0);
       hash += 31 * hash + (userName != null ? userName.hashCode() : 0);
       hash += 31 * hash + (password != null ? password.hashCode() : 0);
       hash += 31 * hash + (clientID != null ? clientID.hashCode() : 0);

Modified: trunk/src/main/org/jboss/messaging/ra/JBMResourceAdapter.java
===================================================================
--- trunk/src/main/org/jboss/messaging/ra/JBMResourceAdapter.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/ra/JBMResourceAdapter.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -193,7 +193,7 @@
 
       this.ctx = ctx;
 
-      log.info("JBoss Messaging resource adapter started");
+      log.info("JBoss Messaging 2.0 resource adapter started");
    }
 
    /**
@@ -1013,63 +1013,63 @@
    }
 
    /**
-    * Get max number of initial connect attempts
+    * Get number of reconnect attempts
     *
     * @return The value
     */
-   public Integer getInitialConnectAttempts()
+   public Integer getReconnectAttempts()
    {
       if (trace)
       {
-         log.trace("getInitialConnectAttempts()");
+         log.trace("getReconnectAttempts()");
       }
 
-      return raProperties.getInitialConnectAttempts();
+      return raProperties.getReconnectAttempts();
    }
 
    /**
-    * Set max number of initial connect attempts
+    * Set number of reconnect attempts
     *
-    * @param initialConnectAttempts The value
+    * @param reconnectAttempts The value
     */
-   public void setInitialConnectAttempts(Integer initialConnectAttempts)
+   public void setReconnectAttempts(Integer reconnectAttempts)
    {
       if (trace)
       {
-         log.trace("setInitialConnectAttempts(" + initialConnectAttempts + ")");
+         log.trace("setReconnectAttempts(" + reconnectAttempts + ")");
       }
 
-      raProperties.setInitialConnectAttempts(initialConnectAttempts);
+      raProperties.setReconnectAttempts(reconnectAttempts);
    }
 
    /**
-    * Get reconnect attempts
+    * Get failover on server shutdown
     *
     * @return The value
     */
-   public Integer getReconnectAttempts()
+   public Boolean isFailoverOnServerShutdown()
    {
       if (trace)
       {
-         log.trace("getReconnectAttempts()");
+         log.trace("isFailoverOnServerShutdown()");
       }
 
-      return raProperties.getReconnectAttempts();
+      return raProperties.isFailoverOnServerShutdown();
    }
 
    /**
-    * Set reconnect attempts
+    * Set failover on server shutdown
     *
-    * @param reconnectAttempts The value
+    * @param failoverOnServerShutdown The value
     */
-   public void setReconnectAttempts(Integer reconnectAttempts)
+   public void setFailoverOnServerShutdown(Boolean failoverOnServerShutdown)
    {
       if (trace)
       {
-         log.trace("setReconnectAttempts(" + reconnectAttempts + ")");
+         log.trace("setFailoverOnServerShutdown(" + failoverOnServerShutdown + ")");
       }
 
-      raProperties.setReconnectAttempts(reconnectAttempts);
+      raProperties.setFailoverOnServerShutdown(failoverOnServerShutdown);
    }
 
    /**
@@ -1396,10 +1396,10 @@
                                                                                        : getRetryInterval(),
                                                              getRetryIntervalMultiplier() == null ? ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER
                                                                                                  : getRetryIntervalMultiplier(),
-                                                             getInitialConnectAttempts() == null ? ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS
-                                                                                                : getInitialConnectAttempts(),
                                                              getReconnectAttempts() == null ? ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS
-                                                                                           : getReconnectAttempts());
+                                                                                         : getReconnectAttempts(),
+                                                             isFailoverOnServerShutdown() == null ? ClientSessionFactoryImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN
+                                                                                                 : isFailoverOnServerShutdown());
       }
       else if (getDiscoveryGroupAddress() != null && getDiscoveryGroupPort() != null)
       {
@@ -1448,10 +1448,10 @@
                                                                                        : getRetryInterval(),
                                                              getRetryIntervalMultiplier() == null ? ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER
                                                                                                  : getRetryIntervalMultiplier(),
-                                                             getInitialConnectAttempts() == null ? ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS
-                                                                                                : getInitialConnectAttempts(),
                                                              getReconnectAttempts() == null ? ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS
-                                                                                           : getReconnectAttempts());
+                                                                                         : getReconnectAttempts(),
+                                                             isFailoverOnServerShutdown() == null ? ClientSessionFactoryImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN
+                                                                                                 : isFailoverOnServerShutdown());
       }
       else
       {

Modified: trunk/src/main/org/jboss/messaging/ra/inflow/JBMActivation.java
===================================================================
--- trunk/src/main/org/jboss/messaging/ra/inflow/JBMActivation.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/ra/inflow/JBMActivation.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -311,7 +311,7 @@
 
       try
       {
-         while (deliveryActive.get() && reconnectCount < spec.getReconnectAttempts())
+         while (deliveryActive.get() && reconnectCount < spec.getRereconnectAttempts())
          {
             teardown();
 

Modified: trunk/src/main/org/jboss/messaging/ra/inflow/JBMActivationSpec.java
===================================================================
--- trunk/src/main/org/jboss/messaging/ra/inflow/JBMActivationSpec.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/main/org/jboss/messaging/ra/inflow/JBMActivationSpec.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -96,7 +96,7 @@
    private Boolean sessionTransacted;
 
    /** The number of reconnection attempts */
-   private Integer reconnectAttempts;
+   private Integer rereconnectAttempts;
 
    /** Unspecified redelivery */
    private Boolean redeliverUnspecified;
@@ -140,7 +140,7 @@
       maxSession = Integer.valueOf(15);
       keepAlive = Long.valueOf(60000);
       sessionTransacted = Boolean.TRUE;
-      reconnectAttempts = Integer.valueOf(5);
+      rereconnectAttempts = Integer.valueOf(5);
       redeliverUnspecified = Boolean.TRUE;
       transactionTimeout = Integer.valueOf(0);
       isSameRMOverrideValue = null;
@@ -495,7 +495,7 @@
       if (trace)
          log.trace("setMaxMessages(" + value + ")");
 
-      this.maxMessages = maxMessages;
+      this.maxMessages = value;
    }
 
    /**
@@ -670,27 +670,27 @@
    }
 
    /**
-    * Get the reconnect attempts
+    * Get the rereconnect attempts
     * @return The value
     */
-   public Integer getReconnectAttempts()
+   public Integer getRereconnectAttempts()
    {
       if (trace)
-         log.trace("getReconnectAttempts()");
+         log.trace("getRereconnectAttempts()");
 
-      return reconnectAttempts;
+      return rereconnectAttempts;
    }
 
    /**
-    * Set the reconnect attempts
+    * Set the rereconnect attempts
     * @param value The value
     */
-   public void setReconnectAttempts(Integer value)
+   public void setRereconnectAttempts(Integer value)
    {
       if (trace)
-         log.trace("setReconnectAttempts(" + value + ")");
+         log.trace("setRereconnectAttempts(" + value + ")");
 
-      this.reconnectAttempts = value;
+      this.rereconnectAttempts = value;
    }
 
    /**

Modified: trunk/src/schemas/jbm-configuration.xsd
===================================================================
--- trunk/src/schemas/jbm-configuration.xsd	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/src/schemas/jbm-configuration.xsd	2009-03-30 17:50:06 UTC (rev 6217)
@@ -324,11 +324,11 @@
 			<xsd:element name="retry-interval-multiplier"
 				type="xsd:double" maxOccurs="1" minOccurs="0">
 			</xsd:element>
-			<xsd:element name="max-retries-before-failover"
+			<xsd:element name="reconnect-attempts"
 				type="xsd:nonNegativeInteger" maxOccurs="1" minOccurs="0">
 			</xsd:element>
-			<xsd:element name="max-retries-after-failover"
-				type="xsd:nonNegativeInteger" maxOccurs="1" minOccurs="0">
+			<xsd:element name="failover-on-server-shutdown"
+				type="xsd:boolean" maxOccurs="1" minOccurs="0">
 			</xsd:element>
 			<xsd:element name="use-duplicate-detection"
 				type="xsd:boolean" maxOccurs="1" minOccurs="0">
@@ -357,16 +357,7 @@
 			</xsd:element>
 			<xsd:element name="retry-interval" type="period"
 				maxOccurs="1" minOccurs="0">
-			</xsd:element>
-			<xsd:element name="retry-interval-multiplier"
-				type="xsd:double" maxOccurs="1" minOccurs="0">
-			</xsd:element>
-			<xsd:element name="max-retries-before-failover"
-				type="xsd:nonNegativeInteger" maxOccurs="1" minOccurs="0">
-			</xsd:element>
-			<xsd:element name="max-retries-after-failover"
-				type="xsd:nonNegativeInteger" maxOccurs="1" minOccurs="0">
-			</xsd:element>
+			</xsd:element>			
 			<xsd:element name="use-duplicate-detection"
 				type="xsd:boolean" maxOccurs="1" minOccurs="0">
 			</xsd:element>

Modified: trunk/tests/config/ConfigurationTest-full-config.xml
===================================================================
--- trunk/tests/config/ConfigurationTest-full-config.xml	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/config/ConfigurationTest-full-config.xml	2009-03-30 17:50:06 UTC (rev 6217)
@@ -117,8 +117,8 @@
           <transformer-class-name>org.foo.BridgeTransformer</transformer-class-name>
           <retry-interval>3</retry-interval>
           <retry-interval-multiplier>0.2</retry-interval-multiplier>
-          <max-retries-before-failover>2</max-retries-before-failover>
-          <max-retries-after-failover>5</max-retries-after-failover>
+          <reconnect-attempts>2</reconnect-attempts>
+          <failover-on-server-shutdown>false</failover-on-server-shutdown>
           <use-duplicate-detection>true</use-duplicate-detection>
           <connector-ref connector-name="connector"/>
       </bridge>
@@ -131,9 +131,6 @@
       <cluster-connection name="cluster-connection1">
           <address>queues</address>
           <retry-interval>3</retry-interval>
-          <retry-interval-multiplier>0.2</retry-interval-multiplier>
-          <max-retries-before-failover>2</max-retries-before-failover>
-          <max-retries-after-failover>5</max-retries-after-failover>
           <use-duplicate-detection>true</use-duplicate-detection>
           <forward-when-no-consumers>true</forward-when-no-consumers>
           <max-hops>1</max-hops>
@@ -144,9 +141,6 @@
       <cluster-connection name="cluster-connection2">
           <address>queues2</address>
           <retry-interval>3</retry-interval>
-          <retry-interval-multiplier>0.2</retry-interval-multiplier>
-          <max-retries-before-failover>2</max-retries-before-failover>
-          <max-retries-after-failover>5</max-retries-after-failover>
           <use-duplicate-detection>true</use-duplicate-detection>
           <forward-when-no-consumers>true</forward-when-no-consumers>
           <max-hops>1</max-hops>
@@ -171,7 +165,7 @@
    </configuration>
    
    <settings>
-    <queue name="foo3" address="bar" />
+      <queue name="foo3" address="bar" />
    </settings>
 
 </deployment>
\ No newline at end of file

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/JBMServerTestCase.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/JBMServerTestCase.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/JBMServerTestCase.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -117,7 +117,6 @@
 
       log.info(banner);
 
-
       try
       {
          //create any new server we need
@@ -135,16 +134,7 @@
          }
          if (!started)
          {
-            //                  try
-            //                  {
             servers.get(0).start(getContainerConfig(), getConfiguration(), true);
-            //                  }
-            //                  catch (Exception e)
-            //                  {
-            //                     //if we are remote we will need recreating if we get here
-            //                     servers.set(i, ServerManagement.create(i));
-            //                     servers.get(i).start(getContainerConfig(), getConfiguration(), getClearDatabase() && i == 0);
-            //                  }
          }
          //deploy the objects for this test
          deployAdministeredObjects();

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/BrowserTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/BrowserTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/BrowserTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -202,8 +202,6 @@
 
 			final int numMessages = 100;
 
-			log.info("****** sending messages");
-			
 			for (int i = 0; i < numMessages; i++)
 			{
 				Message m = session.createMessage();
@@ -211,8 +209,6 @@
 				producer.send(m);
 			}
 
-			log.info(" ****** Sent messages");
-
 			QueueBrowser browser = session.createBrowser(queue1, "test_counter > 30");
 
 			Enumeration en = browser.getEnumeration();

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -22,8 +22,8 @@
 package org.jboss.test.messaging.jms;
 
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_TTL;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
 
@@ -102,8 +102,8 @@
                                                        ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE,                                                       
                                                        DEFAULT_RETRY_INTERVAL,
                                                        DEFAULT_RETRY_INTERVAL_MULTIPLIER,
-                                                       DEFAULT_INITIAL_CONNECT_ATTEMPTS,
                                                        DEFAULT_RECONNECT_ATTEMPTS,
+                                                       DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN,
                                                        jndiBindings);
 
          cf = (JBossConnectionFactory)getInitialContext().lookup("/StrictTCKConnectionFactory");

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -229,19 +229,10 @@
 
                TextMessage tm = (TextMessage)msg;
 
-               try
-               {
-                  log.info("Fast listener got message " + tm.getText());
-               }
-               catch (JMSException e)
-               {
-               }
-
                if (processed == numMessages - 2)
                {
                   synchronized (waitLock)
                   {
-                     log.info("Notifying");
                      waitLock.notifyAll();
                   }
                }
@@ -259,21 +250,12 @@
                TextMessage tm = (TextMessage)msg;
                
                processed++;
-
-               try
-               {
-                  log.info("Slow listener got message " + tm.getText());
-               }
-               catch (JMSException e)
-               {
-               }
-
+              
                synchronized (waitLock)
                {
                   //Should really cope with spurious wakeups
                   while (fast.processed != numMessages - 2)
-                  {
-                     log.info("Waiting");
+                  {                
                      try
                      {
                         waitLock.wait(20000);
@@ -281,7 +263,6 @@
                      catch (InterruptedException e)
                      {
                      }
-                     log.info("Waited");
                   }
                   
                   waitLock.notify();
@@ -320,16 +301,12 @@
             //Should really cope with spurious wakeups
             while (fast.processed != numMessages - 2)
             {
-               log.info("Waiting");
                waitLock.wait(20000);
-               log.info("Waited");
             }
             
             while (slow.processed != 2)
             {
-               log.info("Waiting");
                waitLock.wait(20000);
-               log.info("Waited");
             }
          }
 
@@ -342,9 +319,7 @@
          {
             if (conn != null)
             {
-               log.info("Closing connection");
                conn.close();
-               log.info("Closed connection");
             }
          }
          catch (Exception e)

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/DeliveryOrderTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/DeliveryOrderTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/DeliveryOrderTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -140,9 +140,7 @@
             }
             
             c++;
-            
-            //log.info("Got message " + c);
-            
+ 
             if (c == num)
             {
                latch.countDown();

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/DurableSubscriptionTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/DurableSubscriptionTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/DurableSubscriptionTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -107,9 +107,7 @@
 	
 	      TextMessage tm = (TextMessage)durable.receive(1000);
 	      assertEquals("k", tm.getText());
-	
-	      log.info("*** consuming");
-	      
+	   
 	      Message m = durable.receive(1000);
 	      assertNull(m);
 	      

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/JMSTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/JMSTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/JMSTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -57,11 +57,6 @@
 
    // Public --------------------------------------------------------
 
-   public void testNoop() throws Exception
-   {
-      log.info("noop");
-   }
-
    public void test_NonPersistent_NonTransactional() throws Exception
    {
       Connection conn = null;

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/JMSTestCase.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/JMSTestCase.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/JMSTestCase.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -1,8 +1,8 @@
 package org.jboss.test.messaging.jms;
 
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_TTL;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
 
@@ -78,8 +78,8 @@
                                                     ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE,                                   
                                                     DEFAULT_RETRY_INTERVAL,
                                                     DEFAULT_RETRY_INTERVAL_MULTIPLIER,
-                                                    DEFAULT_INITIAL_CONNECT_ATTEMPTS,
                                                     DEFAULT_RECONNECT_ATTEMPTS,
+                                                    DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN,
                                                     jndiBindings);
       
       cf = (JBossConnectionFactory)getInitialContext().lookup("/testsuitecf");

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -254,8 +254,7 @@
          MessageConsumer cons2 = sessConsume2.createConsumer(queue1);
 
          // this should cancel message and cause delivery to other consumer
-
-         log.info("**clsosing consumer");
+;
          sessConsume1.close();
 
          TextMessage tm3 = (TextMessage) cons2.receive(1000);
@@ -2602,15 +2601,10 @@
          {
             queueProducer.send(producerSession.createTextMessage("Message #" + Integer.toString(i)));
          }
-
-         log.info("sent messages");
-         
+   
          consumerConnection.stop();
 
-         log.info("Closing connection");
          consumerConnection.close();
-         log.info("Connection closed");
-         
 
          consumerConnection = null;
       }
@@ -4114,14 +4108,11 @@
          {
             TextMessage tm = (TextMessage) m;
 
-            log.info("Got message:" + tm.getText() + " count is " + count);
-
             messageOrder += tm.getText() + " ";
             if (count == 0)
             {
                if (!("a".equals(tm.getText())))
                {
-                  log.info("Should be a but was " + tm.getText());
                   failed = true;
                   latch.countDown();
                }
@@ -4129,14 +4120,11 @@
                {
                   sess.rollback();
                   messageOrder += "RB ";
-                  log.info("rollback() called");
                }
                else
                {
-                  log.info("Calling recover");
                   messageOrder += "RC ";
                   sess.recover();
-                  log.info("recover() called");
                }
             }
 
@@ -4144,7 +4132,6 @@
             {
                if (!("a".equals(tm.getText())))
                {
-                  log.info("Should be a but was " + tm.getText());
                   failed = true;
                   latch.countDown();
                }
@@ -4158,7 +4145,6 @@
             {
                if (!("b".equals(tm.getText())))
                {
-                  log.info("Should be b but was " + tm.getText());
                   failed = true;
                   latch.countDown();
                }
@@ -4167,7 +4153,6 @@
             {
                if (!("c".equals(tm.getText())))
                {
-                  log.info("Should be c but was " + tm.getText());
                   failed = true;
                   latch.countDown();
                }
@@ -4177,7 +4162,6 @@
                }
                else
                {
-                  log.info("Acknowledging session");
                   tm.acknowledge();
                }
                latch.countDown();
@@ -4186,7 +4170,6 @@
          }
          catch (JMSException e)
          {
-            log.info("Caught JMSException", e);
             failed = true;
             latch.countDown();
          }

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/MessageProducerTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/MessageProducerTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/MessageProducerTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -123,8 +123,6 @@
          TextMessage m = ps.createTextMessage("test");
          p.send(m);
          
-         log.info("** sent message");
-
          TextMessage r = (TextMessage)c.receive(3000);
 
          assertEquals(m.getJMSMessageID(), r.getJMSMessageID());

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/MiscellaneousTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/MiscellaneousTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/MiscellaneousTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -248,7 +248,6 @@
             // close the connection on the same thread that processed the message
             try
             {
-               log.info("** closing");
                conn.close();
                result.setSuccess();
             }
@@ -299,8 +298,6 @@
          }
       }
       
-      log.info("sent message");
-   
       final Result result = new Result();
       Connection conn = cf.createConnection();
       Session s = conn.createSession(true, Session.SESSION_TRANSACTED);
@@ -312,9 +309,7 @@
             // close the connection on the same thread that processed the message
             try
             {
-               log.info("Closing consumer");
                cons.close();
-               log.info("closed consumer");
                result.setSuccess();
             }
             catch(Exception e)

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/PersistenceTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/PersistenceTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/PersistenceTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -89,8 +89,7 @@
 	      for (int i = 0; i < 10; i++)
 	      {
 	         TextMessage tm = (TextMessage)cons.receive(3000);
-	         log.info("Got message " + tm);
-	         
+  
 	         assertNotNull(tm);
 	         if (tm == null)
 	         {
@@ -129,16 +128,12 @@
 	         prod.send(tm);
 	      }
 	      
-	      log.info("Sent messages");
-
 	      Session sess2 = conn.createSession(true, Session.SESSION_TRANSACTED);
 
 	      MessageConsumer cons = sess2.createConsumer(queue1);
 
 	      conn.start();
 	      
-	      log.info("Started connection");
-
 	      for (int i = 0; i < 10; i++)
 	      {
 	         TextMessage tm = (TextMessage)cons.receive(1000);
@@ -152,8 +147,6 @@
 	         assertEquals(1, tm.getIntProperty("JMSXDeliveryCount"));
 	      }
 	      
-	      log.info("** got messages");
-
 	      //rollback
 	      sess2.rollback();
 
@@ -174,8 +167,6 @@
 
 	      stop();
 
-	      log.info("************ RESTARTING");
-	      
 	      startNoDelete();
 
 	      // Messaging server restart implies new ConnectionFactory lookup
@@ -206,385 +197,384 @@
       	}
       }
    }
-//
-//
-//   /**
-//    * First test that message order survives a restart
-//    */
-//   public void testMessageOrderPersistence_1() throws Exception
-//   {
-//      Connection conn = null;
-//
-//      try
-//      {
-//	      conn = cf.createConnection();
-//	      Session sessSend = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-//	      MessageProducer prod = sessSend.createProducer(queue1);
-//
-//	      TextMessage m0 = sessSend.createTextMessage("a");
-//	      TextMessage m1 = sessSend.createTextMessage("b");
-//	      TextMessage m2 = sessSend.createTextMessage("c");
-//	      TextMessage m3 = sessSend.createTextMessage("d");
-//	      TextMessage m4 = sessSend.createTextMessage("e");
-//	      TextMessage m5 = sessSend.createTextMessage("f");
-//	      TextMessage m6 = sessSend.createTextMessage("g");
-//	      TextMessage m7 = sessSend.createTextMessage("h");
-//	      TextMessage m8 = sessSend.createTextMessage("i");
-//	      TextMessage m9 = sessSend.createTextMessage("j");
-//
-//	      prod.send(m0, DeliveryMode.PERSISTENT, 0, 0);
-//	      prod.send(m1, DeliveryMode.PERSISTENT, 1, 0);
-//	      prod.send(m2, DeliveryMode.PERSISTENT, 2, 0);
-//	      prod.send(m3, DeliveryMode.PERSISTENT, 3, 0);
-//	      prod.send(m4, DeliveryMode.PERSISTENT, 4, 0);
-//	      prod.send(m5, DeliveryMode.PERSISTENT, 5, 0);
-//	      prod.send(m6, DeliveryMode.PERSISTENT, 6, 0);
-//	      prod.send(m7, DeliveryMode.PERSISTENT, 7, 0);
-//	      prod.send(m8, DeliveryMode.PERSISTENT, 8, 0);
-//	      prod.send(m9, DeliveryMode.PERSISTENT, 9, 0);
-//
-//	      conn.close();
-//
-//	      stop();
-//
-//	      startNoDelete();
-//
-//	      // Messaging server restart implies new ConnectionFactory lookup
-//	      deployAndLookupAdministeredObjects();
-//
-//	      conn = cf.createConnection();
-//	      Session sessReceive = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-//	      conn.start();
-//	      MessageConsumer cons = sessReceive.createConsumer(queue1);
-//
-//	      {
-//	         TextMessage t = (TextMessage)cons.receive(1000);
-//	         assertNotNull(t);
-//	         assertEquals("j", t.getText());
-//	      }
-//	      {
-//	         TextMessage t = (TextMessage)cons.receive(1000);
-//	         assertNotNull(t);
-//	         assertEquals("i", t.getText());
-//	      }
-//	      {
-//	         TextMessage t = (TextMessage)cons.receive(1000);
-//	         assertNotNull(t);
-//	         assertEquals("h", t.getText());
-//	      }
-//	      {
-//	         TextMessage t = (TextMessage)cons.receive(1000);
-//	         assertNotNull(t);
-//	         assertEquals("g", t.getText());
-//	      }
-//	      {
-//	         TextMessage t = (TextMessage)cons.receive(1000);
-//	         assertNotNull(t);
-//	         assertEquals("f", t.getText());
-//	      }
-//	      {
-//	         TextMessage t = (TextMessage)cons.receive(1000);
-//	         assertNotNull(t);
-//	         assertEquals("e", t.getText());
-//	      }
-//	      {
-//	         TextMessage t = (TextMessage)cons.receive(1000);
-//	         assertNotNull(t);
-//	         assertEquals("d", t.getText());
-//	      }
-//	      {
-//	         TextMessage t = (TextMessage)cons.receive(1000);
-//	         assertNotNull(t);
-//	         assertEquals("c", t.getText());
-//	      }
-//	      {
-//	         TextMessage t = (TextMessage)cons.receive(1000);
-//	         assertNotNull(t);
-//	         assertEquals("b", t.getText());
-//	      }
-//	      {
-//	         TextMessage t = (TextMessage)cons.receive(1000);
-//	         assertNotNull(t);
-//	         assertEquals("a", t.getText());
-//	      }
-//	      {
-//	         TextMessage t = (TextMessage)cons.receive(500);
-//	         assertNull(t);
-//	      }
-//      }
-//      finally
-//      {
-//      	if (conn != null)
-//      	{
-//      		conn.close();
-//      	}
-//      }
-//   }
-//
-//
-//   /**
-//    * Second test that message order survives a restart
-//    */
-//   public void testMessageOrderPersistence_2() throws Exception
-//   {
-//      Connection conn = null;
-//
-//      try
-//      {
-//	      conn = cf.createConnection();
-//	      Session sessSend = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-//	      MessageProducer prod = sessSend.createProducer(queue1);
-//
-//	      TextMessage m0 = sessSend.createTextMessage("a");
-//	      TextMessage m1 = sessSend.createTextMessage("b");
-//	      TextMessage m2 = sessSend.createTextMessage("c");
-//	      TextMessage m3 = sessSend.createTextMessage("d");
-//	      TextMessage m4 = sessSend.createTextMessage("e");
-//	      TextMessage m5 = sessSend.createTextMessage("f");
-//	      TextMessage m6 = sessSend.createTextMessage("g");
-//	      TextMessage m7 = sessSend.createTextMessage("h");
-//	      TextMessage m8 = sessSend.createTextMessage("i");
-//	      TextMessage m9 = sessSend.createTextMessage("j");
-//
-//
-//	      prod.send(m0, DeliveryMode.PERSISTENT, 0, 0);
-//	      prod.send(m1, DeliveryMode.PERSISTENT, 0, 0);
-//	      prod.send(m2, DeliveryMode.PERSISTENT, 0, 0);
-//	      prod.send(m3, DeliveryMode.PERSISTENT, 3, 0);
-//	      prod.send(m4, DeliveryMode.PERSISTENT, 3, 0);
-//	      prod.send(m5, DeliveryMode.PERSISTENT, 4, 0);
-//	      prod.send(m6, DeliveryMode.PERSISTENT, 4, 0);
-//	      prod.send(m7, DeliveryMode.PERSISTENT, 5, 0);
-//	      prod.send(m8, DeliveryMode.PERSISTENT, 5, 0);
-//	      prod.send(m9, DeliveryMode.PERSISTENT, 6, 0);
-//
-//	      conn.close();
-//
-//	      stop();
-//
-//	      startNoDelete();
-//
-//	      deployAndLookupAdministeredObjects();
-//
-//	      conn = cf.createConnection();
-//	      Session sessReceive = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-//	      conn.start();
-//	      MessageConsumer cons = sessReceive.createConsumer(queue1);
-//
-//	      {
-//	         TextMessage t = (TextMessage)cons.receive(1000);
-//	         assertNotNull(t);
-//	         assertEquals("j", t.getText());
-//	      }
-//	      {
-//	         TextMessage t = (TextMessage)cons.receive(1000);
-//	         assertNotNull(t);
-//	         assertEquals("h", t.getText());
-//	      }
-//	      {
-//	         TextMessage t = (TextMessage)cons.receive(1000);
-//	         assertNotNull(t);
-//	         assertEquals("i", t.getText());
-//	      }
-//	      {
-//	         TextMessage t = (TextMessage)cons.receive(1000);
-//	         assertNotNull(t);
-//	         assertEquals("f", t.getText());
-//	      }
-//	      {
-//	         TextMessage t = (TextMessage)cons.receive(1000);
-//	         assertNotNull(t);
-//	         assertEquals("g", t.getText());
-//	      }
-//	      {
-//	         TextMessage t = (TextMessage)cons.receive(1000);
-//	         assertNotNull(t);
-//	         assertEquals("d", t.getText());
-//	      }
-//	      {
-//	         TextMessage t = (TextMessage)cons.receive(1000);
-//	         assertNotNull(t);
-//	         assertEquals("e", t.getText());
-//	      }
-//	      {
-//	         TextMessage t = (TextMessage)cons.receive(1000);
-//	         assertNotNull(t);
-//	         assertEquals("a", t.getText());
-//	      }
-//	      {
-//	         TextMessage t = (TextMessage)cons.receive(1000);
-//	         assertNotNull(t);
-//	         assertEquals("b", t.getText());
-//	      }
-//	      {
-//	         TextMessage t = (TextMessage)cons.receive(1000);
-//	         assertNotNull(t);
-//	         assertEquals("c", t.getText());
-//	      }
-//	      {
-//	         TextMessage t = (TextMessage)cons.receiveNoWait();
-//	         assertNull(t);
-//	      }
-//      }
-//      finally
-//      {
-//      	if (conn != null)
-//      	{
-//      		conn.close();
-//      	}
-//      }
-//   }
-//
-//   /*
-//    * Test durable subscription state survives a server crash
-//    */
-//   public void testDurableSubscriptionPersistence_1() throws Exception
-//   {
-//      Connection conn = null;
-//
-//      try
-//      {
-//	      conn = cf.createConnection();
-//	      conn.setClientID("five");
-//
-//	      Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-//
-//	      MessageConsumer ds = s.createDurableSubscriber(topic1, "sub", null, false);
-//
-//	      MessageProducer p = s.createProducer(topic1);
-//	      p.setDeliveryMode(DeliveryMode.PERSISTENT);
-//	      TextMessage tm = s.createTextMessage("thebody");
-//
-//	      p.send(tm);
-//	      log.debug("message sent");
-//
-//	      conn.close();
-//
-//	      stop();
-//
-//	      startNoDelete();
-//
-//	      deployAndLookupAdministeredObjects();
-//
-//	      conn = cf.createConnection();
-//	      conn.setClientID("five");
-//
-//	      s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-//	      conn.start();
-//
-//	      ds = s.createDurableSubscriber(topic1, "sub", null, false);
-//
-//	      TextMessage rm = (TextMessage)ds.receive(3000);
-//	      assertNotNull(rm);
-//	      assertEquals("thebody", rm.getText());
-//
-//	      ds.close();
-//
-//	      log.info("************* UNSUBSCRIBE CALLED");
-//	      s.unsubscribe("sub");
-//      }
-//      finally
-//      {
-//      	if (conn != null)
-//      	{
-//      		conn.close();
-//      	}
-//      }
-//   }
-//
-//   /*
-//    * Test durable subscription state survives a restart
-//    */
-//   public void testDurableSubscriptionPersistence_2() throws Exception
-//   {
-//      Connection conn = null;
-//
-//      try
-//      {
-//	      conn = cf.createConnection();
-//	      conn.setClientID("Sausages");
-//
-//	      Session sessConsume = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-//
-//	      MessageConsumer sub1 = sessConsume.createDurableSubscriber(topic1, "sub1", null, false);
-//	      MessageConsumer sub2 = sessConsume.createDurableSubscriber(topic1, "sub2", null, false);
-//	      MessageConsumer sub3 = sessConsume.createDurableSubscriber(topic1, "sub3", null, false);
-//
-//
-//	      Session sessSend = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-//	      MessageProducer prod = sessSend.createProducer(topic1);
-//	      prod.setDeliveryMode(DeliveryMode.PERSISTENT);
-//
-//	      for (int i = 0; i < 10; i++)
-//	      {
-//	         TextMessage tm = sessSend.createTextMessage("message" + i);
-//	         prod.send(tm);
-//	      }
-//
-//	      conn.close();
-//
-//	      stop();
-//
-//	      startNoDelete();
-//
-//         // Messaging server restart implies new ConnectionFactory lookup
-//	      deployAndLookupAdministeredObjects();
-//
-//	      conn = cf.createConnection();
-//	      conn.setClientID("Sausages");
-//
-//	      sessConsume = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-//	      conn.start();
-//
-//	      sub1 = sessConsume.createDurableSubscriber(topic1, "sub1", null, false);
-//	      sub2 = sessConsume.createDurableSubscriber(topic1, "sub2", null, false);
-//	      sub3 = sessConsume.createDurableSubscriber(topic1, "sub3", null, false);
-//
-//	      for (int i = 0; i < 10; i++)
-//	      {
-//	         TextMessage tm1 = (TextMessage)sub1.receive(3000);
-//	         assertNotNull(tm1);
-//	         if (tm1 == null)
-//	         {
-//	            break;
-//	         }
-//	         assertEquals("message" + i, tm1.getText());
-//
-//	         TextMessage tm2 = (TextMessage)sub2.receive(3000);
-//	         assertNotNull(tm2);
-//	         if (tm2 == null)
-//	         {
-//	            break;
-//	         }
-//	         assertEquals("message" + i, tm2.getText());
-//
-//	         TextMessage tm3 = (TextMessage)sub3.receive(3000);
-//	         assertNotNull(tm3);
-//	         if (tm3 == null)
-//	         {
-//	            break;
-//	         }
-//	         assertEquals("message" + i, tm3.getText());
-//	      }
-//
-//	      sub1.close();
-//	      sub2.close();
-//	      sub3.close();
-//
-//	      sessConsume.unsubscribe("sub1");
-//	      sessConsume.unsubscribe("sub2");
-//	      sessConsume.unsubscribe("sub3");
-//      }
-//      finally
-//      {
-//      	if (conn != null)
-//      	{
-//      		conn.close();
-//      	}
-//      }
-//   }
 
 
+   /**
+    * First test that message order survives a restart
+    */
+   public void testMessageOrderPersistence_1() throws Exception
+   {
+      Connection conn = null;
+
+      try
+      {
+	      conn = cf.createConnection();
+	      Session sessSend = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+	      MessageProducer prod = sessSend.createProducer(queue1);
+
+	      TextMessage m0 = sessSend.createTextMessage("a");
+	      TextMessage m1 = sessSend.createTextMessage("b");
+	      TextMessage m2 = sessSend.createTextMessage("c");
+	      TextMessage m3 = sessSend.createTextMessage("d");
+	      TextMessage m4 = sessSend.createTextMessage("e");
+	      TextMessage m5 = sessSend.createTextMessage("f");
+	      TextMessage m6 = sessSend.createTextMessage("g");
+	      TextMessage m7 = sessSend.createTextMessage("h");
+	      TextMessage m8 = sessSend.createTextMessage("i");
+	      TextMessage m9 = sessSend.createTextMessage("j");
+
+	      prod.send(m0, DeliveryMode.PERSISTENT, 0, 0);
+	      prod.send(m1, DeliveryMode.PERSISTENT, 1, 0);
+	      prod.send(m2, DeliveryMode.PERSISTENT, 2, 0);
+	      prod.send(m3, DeliveryMode.PERSISTENT, 3, 0);
+	      prod.send(m4, DeliveryMode.PERSISTENT, 4, 0);
+	      prod.send(m5, DeliveryMode.PERSISTENT, 5, 0);
+	      prod.send(m6, DeliveryMode.PERSISTENT, 6, 0);
+	      prod.send(m7, DeliveryMode.PERSISTENT, 7, 0);
+	      prod.send(m8, DeliveryMode.PERSISTENT, 8, 0);
+	      prod.send(m9, DeliveryMode.PERSISTENT, 9, 0);
+
+	      conn.close();
+
+	      stop();
+
+	      startNoDelete();
+
+	      // Messaging server restart implies new ConnectionFactory lookup
+	      deployAndLookupAdministeredObjects();
+
+	      conn = cf.createConnection();
+	      Session sessReceive = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+	      conn.start();
+	      MessageConsumer cons = sessReceive.createConsumer(queue1);
+
+	      {
+	         TextMessage t = (TextMessage)cons.receive(1000);
+	         assertNotNull(t);
+	         assertEquals("j", t.getText());
+	      }
+	      {
+	         TextMessage t = (TextMessage)cons.receive(1000);
+	         assertNotNull(t);
+	         assertEquals("i", t.getText());
+	      }
+	      {
+	         TextMessage t = (TextMessage)cons.receive(1000);
+	         assertNotNull(t);
+	         assertEquals("h", t.getText());
+	      }
+	      {
+	         TextMessage t = (TextMessage)cons.receive(1000);
+	         assertNotNull(t);
+	         assertEquals("g", t.getText());
+	      }
+	      {
+	         TextMessage t = (TextMessage)cons.receive(1000);
+	         assertNotNull(t);
+	         assertEquals("f", t.getText());
+	      }
+	      {
+	         TextMessage t = (TextMessage)cons.receive(1000);
+	         assertNotNull(t);
+	         assertEquals("e", t.getText());
+	      }
+	      {
+	         TextMessage t = (TextMessage)cons.receive(1000);
+	         assertNotNull(t);
+	         assertEquals("d", t.getText());
+	      }
+	      {
+	         TextMessage t = (TextMessage)cons.receive(1000);
+	         assertNotNull(t);
+	         assertEquals("c", t.getText());
+	      }
+	      {
+	         TextMessage t = (TextMessage)cons.receive(1000);
+	         assertNotNull(t);
+	         assertEquals("b", t.getText());
+	      }
+	      {
+	         TextMessage t = (TextMessage)cons.receive(1000);
+	         assertNotNull(t);
+	         assertEquals("a", t.getText());
+	      }
+	      {
+	         TextMessage t = (TextMessage)cons.receive(500);
+	         assertNull(t);
+	      }
+      }
+      finally
+      {
+      	if (conn != null)
+      	{
+      		conn.close();
+      	}
+      }
+   }
+
+
+   /**
+    * Second test that message order survives a restart
+    */
+   public void testMessageOrderPersistence_2() throws Exception
+   {
+      Connection conn = null;
+
+      try
+      {
+	      conn = cf.createConnection();
+	      Session sessSend = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+	      MessageProducer prod = sessSend.createProducer(queue1);
+
+	      TextMessage m0 = sessSend.createTextMessage("a");
+	      TextMessage m1 = sessSend.createTextMessage("b");
+	      TextMessage m2 = sessSend.createTextMessage("c");
+	      TextMessage m3 = sessSend.createTextMessage("d");
+	      TextMessage m4 = sessSend.createTextMessage("e");
+	      TextMessage m5 = sessSend.createTextMessage("f");
+	      TextMessage m6 = sessSend.createTextMessage("g");
+	      TextMessage m7 = sessSend.createTextMessage("h");
+	      TextMessage m8 = sessSend.createTextMessage("i");
+	      TextMessage m9 = sessSend.createTextMessage("j");
+
+
+	      prod.send(m0, DeliveryMode.PERSISTENT, 0, 0);
+	      prod.send(m1, DeliveryMode.PERSISTENT, 0, 0);
+	      prod.send(m2, DeliveryMode.PERSISTENT, 0, 0);
+	      prod.send(m3, DeliveryMode.PERSISTENT, 3, 0);
+	      prod.send(m4, DeliveryMode.PERSISTENT, 3, 0);
+	      prod.send(m5, DeliveryMode.PERSISTENT, 4, 0);
+	      prod.send(m6, DeliveryMode.PERSISTENT, 4, 0);
+	      prod.send(m7, DeliveryMode.PERSISTENT, 5, 0);
+	      prod.send(m8, DeliveryMode.PERSISTENT, 5, 0);
+	      prod.send(m9, DeliveryMode.PERSISTENT, 6, 0);
+
+	      conn.close();
+
+	      stop();
+
+	      startNoDelete();
+
+	      deployAndLookupAdministeredObjects();
+
+	      conn = cf.createConnection();
+	      Session sessReceive = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+	      conn.start();
+	      MessageConsumer cons = sessReceive.createConsumer(queue1);
+
+	      {
+	         TextMessage t = (TextMessage)cons.receive(1000);
+	         assertNotNull(t);
+	         assertEquals("j", t.getText());
+	      }
+	      {
+	         TextMessage t = (TextMessage)cons.receive(1000);
+	         assertNotNull(t);
+	         assertEquals("h", t.getText());
+	      }
+	      {
+	         TextMessage t = (TextMessage)cons.receive(1000);
+	         assertNotNull(t);
+	         assertEquals("i", t.getText());
+	      }
+	      {
+	         TextMessage t = (TextMessage)cons.receive(1000);
+	         assertNotNull(t);
+	         assertEquals("f", t.getText());
+	      }
+	      {
+	         TextMessage t = (TextMessage)cons.receive(1000);
+	         assertNotNull(t);
+	         assertEquals("g", t.getText());
+	      }
+	      {
+	         TextMessage t = (TextMessage)cons.receive(1000);
+	         assertNotNull(t);
+	         assertEquals("d", t.getText());
+	      }
+	      {
+	         TextMessage t = (TextMessage)cons.receive(1000);
+	         assertNotNull(t);
+	         assertEquals("e", t.getText());
+	      }
+	      {
+	         TextMessage t = (TextMessage)cons.receive(1000);
+	         assertNotNull(t);
+	         assertEquals("a", t.getText());
+	      }
+	      {
+	         TextMessage t = (TextMessage)cons.receive(1000);
+	         assertNotNull(t);
+	         assertEquals("b", t.getText());
+	      }
+	      {
+	         TextMessage t = (TextMessage)cons.receive(1000);
+	         assertNotNull(t);
+	         assertEquals("c", t.getText());
+	      }
+	      {
+	         TextMessage t = (TextMessage)cons.receiveNoWait();
+	         assertNull(t);
+	      }
+      }
+      finally
+      {
+      	if (conn != null)
+      	{
+      		conn.close();
+      	}
+      }
+   }
+
+   /*
+    * Test durable subscription state survives a server crash
+    */
+   public void testDurableSubscriptionPersistence_1() throws Exception
+   {
+      Connection conn = null;
+
+      try
+      {
+	      conn = cf.createConnection();
+	      conn.setClientID("five");
+
+	      Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+	      MessageConsumer ds = s.createDurableSubscriber(topic1, "sub", null, false);
+
+	      MessageProducer p = s.createProducer(topic1);
+	      p.setDeliveryMode(DeliveryMode.PERSISTENT);
+	      TextMessage tm = s.createTextMessage("thebody");
+
+	      p.send(tm);
+	      log.debug("message sent");
+
+	      conn.close();
+
+	      stop();
+
+	      startNoDelete();
+
+	      deployAndLookupAdministeredObjects();
+
+	      conn = cf.createConnection();
+	      conn.setClientID("five");
+
+	      s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+	      conn.start();
+
+	      ds = s.createDurableSubscriber(topic1, "sub", null, false);
+
+	      TextMessage rm = (TextMessage)ds.receive(3000);
+	      assertNotNull(rm);
+	      assertEquals("thebody", rm.getText());
+
+	      ds.close();
+
+	      s.unsubscribe("sub");
+      }
+      finally
+      {
+      	if (conn != null)
+      	{
+      		conn.close();
+      	}
+      }
+   }
+
+   /*
+    * Test durable subscription state survives a restart
+    */
+   public void testDurableSubscriptionPersistence_2() throws Exception
+   {
+      Connection conn = null;
+
+      try
+      {
+	      conn = cf.createConnection();
+	      conn.setClientID("Sausages");
+
+	      Session sessConsume = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+	      MessageConsumer sub1 = sessConsume.createDurableSubscriber(topic1, "sub1", null, false);
+	      MessageConsumer sub2 = sessConsume.createDurableSubscriber(topic1, "sub2", null, false);
+	      MessageConsumer sub3 = sessConsume.createDurableSubscriber(topic1, "sub3", null, false);
+
+
+	      Session sessSend = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+	      MessageProducer prod = sessSend.createProducer(topic1);
+	      prod.setDeliveryMode(DeliveryMode.PERSISTENT);
+
+	      for (int i = 0; i < 10; i++)
+	      {
+	         TextMessage tm = sessSend.createTextMessage("message" + i);
+	         prod.send(tm);
+	      }
+
+	      conn.close();
+
+	      stop();
+
+	      startNoDelete();
+
+         // Messaging server restart implies new ConnectionFactory lookup
+	      deployAndLookupAdministeredObjects();
+
+	      conn = cf.createConnection();
+	      conn.setClientID("Sausages");
+
+	      sessConsume = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+	      conn.start();
+
+	      sub1 = sessConsume.createDurableSubscriber(topic1, "sub1", null, false);
+	      sub2 = sessConsume.createDurableSubscriber(topic1, "sub2", null, false);
+	      sub3 = sessConsume.createDurableSubscriber(topic1, "sub3", null, false);
+
+	      for (int i = 0; i < 10; i++)
+	      {
+	         TextMessage tm1 = (TextMessage)sub1.receive(3000);
+	         assertNotNull(tm1);
+	         if (tm1 == null)
+	         {
+	            break;
+	         }
+	         assertEquals("message" + i, tm1.getText());
+
+	         TextMessage tm2 = (TextMessage)sub2.receive(3000);
+	         assertNotNull(tm2);
+	         if (tm2 == null)
+	         {
+	            break;
+	         }
+	         assertEquals("message" + i, tm2.getText());
+
+	         TextMessage tm3 = (TextMessage)sub3.receive(3000);
+	         assertNotNull(tm3);
+	         if (tm3 == null)
+	         {
+	            break;
+	         }
+	         assertEquals("message" + i, tm3.getText());
+	      }
+
+	      sub1.close();
+	      sub2.close();
+	      sub3.close();
+
+	      sessConsume.unsubscribe("sub1");
+	      sessConsume.unsubscribe("sub2");
+	      sessConsume.unsubscribe("sub3");
+      }
+      finally
+      {
+      	if (conn != null)
+      	{
+      		conn.close();
+      	}
+      }
+   }
+
+
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/QueueReceiverTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/QueueReceiverTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/QueueReceiverTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -84,7 +84,6 @@
             qc.close();
          }
          Thread.sleep(2000);
-         log.info("****** removing merssages");
          removeAllMessages(queue1.getQueueName(), true);
          checkEmpty(queue1);
       }

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/QueueTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/QueueTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/QueueTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -106,20 +106,13 @@
 	      
 	      conn.close();
 	      
-	      log.info("**** stopping");
 	      stop();
 	      
-	      	      
-	      log.info("*** restarting");
 	      startNoDelete();
 	      
-	      log.info("Redeploying objects");
-	      
 	      // Messaging server restart implies new ConnectionFactory lookup
 	      deployAndLookupAdministeredObjects();
 	      
-	      log.info("**** redeployed objects");
-	      
 	      conn = cf.createConnection();
 	      sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
 	      conn.start();
@@ -155,8 +148,6 @@
       // This loop is to increase chances of a failure.
       for (int counter = 0; counter < 20; counter++)
       {
-         log.info("Iteration = " + counter);
-
          Connection conn1 = null;
          
          Connection conn2 = null;

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/TemporaryDestinationTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/TemporaryDestinationTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/TemporaryDestinationTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -91,18 +91,11 @@
 	      catch (javax.jms.IllegalStateException e)
 	      {
 	         //Can't delete temp dest if there are open consumers
-	         log.info("got exception ok");
 	      }
 	
-	      log.info("closing consumer");
-	      
 	      consumer.close();
 	      
-	      log.info("closed consumer");
-	      
 	      tempTopic.delete();      
-	      
-	      log.info("deleted temp topic");
    	}
    	finally
    	{

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/TopicTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/TopicTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/TopicTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -48,19 +48,6 @@
 
    // Constructors --------------------------------------------------
    
-   protected void setUp() throws Exception
-   {
-      
-      log.info("______________________Test starting");
-      super.setUp();
-   }
-
-   protected void tearDown() throws Exception
-   {      
-      super.tearDown();
-      log.info("~~~~~~~~~~~~~~~~~~~~~~~~~~~ Test endded");
-   }
-   
    // Public --------------------------------------------------------
 
    /**

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/TransactedSessionTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/TransactedSessionTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/TransactedSessionTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -510,12 +510,9 @@
          assertFalse(tm.getJMSRedelivered());
          assertEquals(1, tm.getIntProperty("JMSXDeliveryCount"));
 
-         log.info("rolling back");
          sess.rollback();
          
-         log.info("closing");
          sess.close();
-         log.info("Closed");
 
          Session sess2 = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
 
@@ -617,8 +614,6 @@
             producer.send(m);
          }
 
-         log.info("Sent messages");
-
          checkEmpty(queue1);
       }
       finally
@@ -764,14 +759,10 @@
          assertEquals(NUM_MESSAGES, count);
 
          conn.stop();
-         log.info("closing consumer");
          consumer.close();
-         log.info("closed consumer");
-         
-         log.info("closing connection");
+   
          conn.close();
-         log.info("closed connection");
-         
+   
          conn = cf.createConnection();
 
          consumerSess = conn.createSession(true, Session.CLIENT_ACKNOWLEDGE);
@@ -780,8 +771,7 @@
 
          count = 0;
          
-         log.info("Receiving...");
-         
+
          while (true)
          {
             Message m = consumer.receive(500);
@@ -789,8 +779,6 @@
             count++;
          }
          
-         log.info("Done receive");
-
          assertEquals(NUM_MESSAGES, count);
       }
       finally
@@ -847,9 +835,7 @@
 
          assertEquals(NUM_MESSAGES, count);
 
-         log.info("Comitting sesion");
          consumerSess.commit();
-         log.info("Committed session");
 
          conn.stop();
          consumer.close();

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -691,9 +691,7 @@
          stopServerPeer();
 
          startServerPeer();
-         
-         log.info("Restarted the server");
-         
+             
          deployAndLookupAdministeredObjects();
                   
          conn3 = cf.createXAConnection();

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/XATest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/XATest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/XATest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -210,13 +210,8 @@
 
          Transaction tx = tm.getTransaction();
          
-         log.info("res is " + res);
-         log.info("res2 is " + res2);
-         
-         log.info("Enlisting reousrce1");
          tx.enlistResource(res);
                            
-         log.info("enlisting resource2");
          tx.enlistResource(res2);
 
          MessageProducer prod = sess.createProducer(queue1);
@@ -229,10 +224,8 @@
          tx.delistResource(res, XAResource.TMSUCCESS);
          tx.delistResource(res2, XAResource.TMSUCCESS);
 
-         log.info("Committing***");
          tm.commit();
-         log.info("Committed****");
-
+ 
          conn2 = cf.createConnection();
          conn2.start();
          Session sessReceiver = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -639,7 +632,6 @@
          tx.delistResource(res, XAResource.TMSUCCESS);
          tx.delistResource(res2, XAResource.TMSUCCESS);
 
-         log.info("rolling back");
          tm.rollback();
 
          //Message should be redelivered
@@ -1939,10 +1931,8 @@
          tx1.delistResource(res1, XAResource.TMSUCCESS);
 
          //suspend the tx
-         log.info("Calling suspend");
          Transaction suspended = tm.suspend();
-         log.info("Called suspend");
-
+ 
          tm.begin();
 
          Transaction tx2 = tm.getTransaction();
@@ -1971,8 +1961,6 @@
          tm.resume(suspended);
 
          tm.commit();
-         
-         log.info("Got to end");
       }
       finally
       {
@@ -2274,28 +2262,9 @@
    // Protected -----------------------------------------------------
 
    // Private -------------------------------------------------------
-
-   private void assertEqualByteArrays(byte[] b1, byte[] b2)
-   {
-      log.info("b1 length: " + b1.length + " b2 length " + b2.length);
-
-      if (b1.length != b2.length)
-      {
-         fail("Lengths not the same");
-      }
-
-      for (int i = 0; i < b1.length; i++)
-      {
-         if (b1[i] != b2[i])
-         {
-            fail("Not same at index " + i);
-         }
-      }
-   }
-
+   
    // Inner classes -------------------------------------------------
 
-
    static class DummyListener implements MessageListener
    {
 
@@ -2305,7 +2274,6 @@
 
       public void onMessage(Message message)
       {
-         log.info("Message received on DummyListener " + message);
          messages.add(message);
       }
    }

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/message/JMSXDeliveryCountTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/message/JMSXDeliveryCountTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/message/JMSXDeliveryCountTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -540,7 +540,6 @@
          
          tx.delistResource(consumerSess.getXAResource(), XAResource.TMSUCCESS);
          
-         log.info("*** rolling back");
          mgr.rollback();         
          
          mgr.begin();

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/message/MapMessageTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/message/MapMessageTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/message/MapMessageTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -70,12 +70,8 @@
 
       MapMessage rm = (MapMessage)queueCons.receive(2000);
       
-      log.info("Got rm:" + rm);
-      
       assertNotNull(rm);
       
-      log.info("String is " + rm.getString("nullValue"));
-
       assertNull(rm.getString("nullValue"));
    }
 

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/message/MessageHeaderTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/message/MessageHeaderTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/message/MessageHeaderTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -306,8 +306,6 @@
       {
          String propName = (String)en.nextElement();
          
-         log.info("Prop name is " + propName);
-         
          propNames.add(propName);
       }
 
@@ -577,12 +575,9 @@
          fail();
       } catch (MessageFormatException e) {}
 
-      log.info("** clearing props");
       m2.clearProperties();
 
-      log.info("** getting prop names");
       Enumeration en2 = m2.getPropertyNames();
-      log.info("** got prop names");
       assertTrue(en2.hasMoreElements());
       en2.nextElement();
       assertFalse(en2.hasMoreElements());

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/selector/SelectorTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/selector/SelectorTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/selector/SelectorTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -431,8 +431,6 @@
 	         {
 	            Message m = cons1.receive(1000);
 	            
-	          //  log.info("Got message " + m);
-
 	            assertNotNull(m);
 	         }
 

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/ServerManagement.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/ServerManagement.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/ServerManagement.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -68,7 +68,6 @@
     */
    public static synchronized Server create() throws Exception
    {
-      log.info("Attempting to create local server ");
       return new LocalTestServer();
    }
 
@@ -79,29 +78,17 @@
 
    /**
     * When this method correctly completes, the server (local or remote) is started and fully
-    * operational (the service container and the server peer are created and started).
+    * operational (the server container and the server peer are created and started).
     */
    public static void start(int i, String config,
                              boolean clearDatabase,
                              boolean startMessagingServer) throws Exception
    {
-      log.info("Attempting to start server " + i);
-
-      //servers.get(i).start(config,  attrOverrides, clearDatabase, startMessagingServer);
-
-      /*Server s = create(i);
-
-      s.start(config, attrOverrides, clearDatabase, startMessagingServer);
-*/
       throw new IllegalStateException("Method to start a server is not implemented");
-
-      //log.info("server " + i + " started");
    }
 
    public static synchronized void kill(int i) throws Exception
    {
-      log.info("Attempting to kill server " + i);
-
       if (i == 0)
       {
          //Cannot kill server 0 if there are any other servers since it has the rmi registry in it
@@ -116,7 +103,7 @@
 
       if (i > servers.size())
       {
-         log.info("server " + i + " has not been created or has already been killed, so it cannot be killed");
+         log.error("server " + i + " has not been created or has already been killed, so it cannot be killed");
       }
       else
       {

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -22,8 +22,8 @@
 package org.jboss.test.messaging.tools.container;
 
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_TTL;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
 
@@ -119,8 +119,6 @@
          return;
       }
 
-      log.info("** deleting journal?" + clearJournal);
-
       if (clearJournal)
       {
          // Delete the Journal environment
@@ -133,7 +131,6 @@
       }
 
       PropertyKernelConfig propertyKernelConfig = new PropertyKernelConfig(System.getProperties());
-      // propertyKernelConfig.setServerID(getServerID());
       bootstrap = new JBMBootstrapServer(containerConfig, propertyKernelConfig);
       System.setProperty(Constants.SERVER_INDEX_PROPERTY_NAME, "" + getServerID());
       bootstrap.run();
@@ -304,8 +301,6 @@
                                        int dupsOkBatchSize,
                                        boolean blockOnAcknowledge) throws Exception
    {
-      log.info("deploying connection factory with name: " + objectName + " and dupsok: " + dupsOkBatchSize);
-
       List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs = new ArrayList<Pair<TransportConfiguration, TransportConfiguration>>();
 
       connectorConfigs.add(new Pair<TransportConfiguration, TransportConfiguration>(new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory"),
@@ -333,8 +328,8 @@
                                                     false,
                                                     DEFAULT_RETRY_INTERVAL,
                                                     DEFAULT_RETRY_INTERVAL_MULTIPLIER,
-                                                    DEFAULT_INITIAL_CONNECT_ATTEMPTS,
                                                     DEFAULT_RECONNECT_ATTEMPTS,
+                                                    DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN,
                                                     jndiBindings);
    }
 
@@ -443,7 +438,7 @@
                                                                                                  false);
       TabularData subInfos = topic.listAllSubscriptions();
       List<String> subs = new ArrayList<String>();
-      for (Object o: subInfos.values())
+      for (Object o : subInfos.values())
       {
          CompositeData data = (CompositeData)o;
          subs.add((String)data.get("name"));

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/Server.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/Server.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/Server.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -45,7 +45,7 @@
    int getServerID() throws Exception;
 
    /**
-    * @param attrOverrides - service attribute overrides that will take precedence over values
+    * @param attrOverrides - server attribute overrides that will take precedence over values
     *        read from configuration files.
     */
    void start(String[] containerConfig,

Modified: trunk/tests/joram-tests/src/org/jboss/test/jms/SpawnedJMSServer.java
===================================================================
--- trunk/tests/joram-tests/src/org/jboss/test/jms/SpawnedJMSServer.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/joram-tests/src/org/jboss/test/jms/SpawnedJMSServer.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -32,8 +32,9 @@
 import org.jboss.messaging.core.config.TransportConfiguration;
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory;
+import org.jboss.messaging.jms.server.JMSServerManager;
 import org.jboss.messaging.jms.server.impl.JMSServerManagerImpl;
 import org.jnp.server.Main;
 import org.jnp.server.NamingBeanImpl;
@@ -74,10 +75,10 @@
          Configuration conf = new ConfigurationImpl();
          conf.getAcceptorConfigurations().add(new TransportConfiguration(NettyAcceptorFactory.class.getName()));
          conf.setSecurityEnabled(false);
-         final MessagingServiceImpl server = Messaging.newNullStorageMessagingService(conf);
+         final MessagingServer server = Messaging.newNullStorageMessagingServer(conf);
          server.start();
 
-         JMSServerManagerImpl serverManager = JMSServerManagerImpl.newJMSServerManagerImpl(server.getServer());
+         JMSServerManager serverManager = JMSServerManagerImpl.newJMSServerManagerImpl(server);
          serverManager.start();
 
          Hashtable<String, String> env = new Hashtable<String, String>();

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/DuplicateDetectionTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/DuplicateDetectionTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/DuplicateDetectionTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -36,7 +36,7 @@
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.message.impl.MessageImpl;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.transaction.impl.XidImpl;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
@@ -55,7 +55,7 @@
 {
    private static final Logger log = Logger.getLogger(DuplicateDetectionTest.class);
 
-   private MessagingService messagingService;
+   private MessagingServer messagingService;
 
    private final SimpleString propKey = new SimpleString("propkey");
 
@@ -810,7 +810,7 @@
 
       conf.setIDCacheSize(cacheSize);
       
-      MessagingService messagingService2 = Messaging.newMessagingService(conf);
+      MessagingServer messagingService2 = Messaging.newMessagingServer(conf);
 
       messagingService2.start();
 
@@ -848,7 +848,7 @@
       
       messagingService2.stop();
       
-      messagingService2 = Messaging.newMessagingService(conf);
+      messagingService2 = Messaging.newMessagingServer(conf);
 
       messagingService2.start();
 
@@ -893,7 +893,7 @@
       
       conf.setIDCacheSize(theCacheSize);
       
-      MessagingService messagingService2 = Messaging.newMessagingService(conf);
+      MessagingServer messagingService2 = Messaging.newMessagingServer(conf);
 
       messagingService2.start();
 
@@ -927,7 +927,7 @@
       
       messagingService2.stop();
       
-      messagingService2 = Messaging.newMessagingService(conf);
+      messagingService2 = Messaging.newMessagingServer(conf);
 
       messagingService2.start();
 
@@ -971,7 +971,7 @@
       
       conf.setIDCacheSize(initialCacheSize);
       
-      MessagingService messagingService2 = Messaging.newMessagingService(conf);
+      MessagingServer messagingService2 = Messaging.newMessagingServer(conf);
 
       messagingService2.start();
 
@@ -1007,7 +1007,7 @@
       
       conf.setIDCacheSize(subsequentCacheSize);
       
-      messagingService2 = Messaging.newMessagingService(conf);
+      messagingService2 = Messaging.newMessagingServer(conf);
 
       messagingService2.start();
 
@@ -1060,7 +1060,7 @@
       
       conf.setIDCacheSize(initialCacheSize);
       
-      MessagingService messagingService2 = Messaging.newMessagingService(conf);
+      MessagingServer messagingService2 = Messaging.newMessagingServer(conf);
 
       messagingService2.start();
 
@@ -1096,7 +1096,7 @@
       
       conf.setIDCacheSize(subsequentCacheSize);
       
-      messagingService2 = Messaging.newMessagingService(conf);
+      messagingService2 = Messaging.newMessagingServer(conf);
 
       messagingService2.start();
       
@@ -1106,7 +1106,7 @@
       
       conf.setIDCacheSize(initialCacheSize);
       
-      messagingService2 = Messaging.newMessagingService(conf);
+      messagingService2 = Messaging.newMessagingServer(conf);
 
       messagingService2.start();
       
@@ -1159,7 +1159,7 @@
       
       conf.setPersistIDCache(false);
       
-      MessagingService messagingService2 = Messaging.newMessagingService(conf);
+      MessagingServer messagingService2 = Messaging.newMessagingServer(conf);
 
       messagingService2.start();
 
@@ -1197,7 +1197,7 @@
       
       messagingService2.stop();
       
-      messagingService2 = Messaging.newMessagingService(conf);
+      messagingService2 = Messaging.newMessagingServer(conf);
 
       messagingService2.start();
 
@@ -1242,7 +1242,7 @@
       
       conf.setPersistIDCache(false);
       
-      MessagingService messagingService2 = Messaging.newMessagingService(conf);
+      MessagingServer messagingService2 = Messaging.newMessagingServer(conf);
 
       messagingService2.start();
 
@@ -1282,7 +1282,7 @@
       
       messagingService2.stop();
       
-      messagingService2 = Messaging.newMessagingService(conf);
+      messagingService2 = Messaging.newMessagingServer(conf);
 
       messagingService2.start();
 
@@ -1327,7 +1327,7 @@
 
       conf.setIDCacheSize(cacheSize);
       
-      MessagingService messagingService2 = Messaging.newMessagingService(conf);
+      MessagingServer messagingService2 = Messaging.newMessagingServer(conf);
 
       messagingService2.start();
 
@@ -1371,7 +1371,7 @@
       
       messagingService2.stop();
       
-      messagingService2 = Messaging.newMessagingService(conf);
+      messagingService2 = Messaging.newMessagingServer(conf);
 
       messagingService2.start();
 
@@ -1418,7 +1418,7 @@
       
       conf.setPersistIDCache(false);
       
-      MessagingService messagingService2 = Messaging.newMessagingService(conf);
+      MessagingServer messagingService2 = Messaging.newMessagingServer(conf);
 
       messagingService2.start();
 
@@ -1460,7 +1460,7 @@
       
       messagingService2.stop();
       
-      messagingService2 = Messaging.newMessagingService(conf);
+      messagingService2 = Messaging.newMessagingServer(conf);
 
       messagingService2.start();
 
@@ -1517,7 +1517,7 @@
 
       conf.setIDCacheSize(cacheSize);
       
-      MessagingService messagingService2 = Messaging.newMessagingService(conf);
+      MessagingServer messagingService2 = Messaging.newMessagingServer(conf);
 
       messagingService2.start();
 
@@ -1557,7 +1557,7 @@
       
       messagingService2.stop();
       
-      messagingService2 = Messaging.newMessagingService(conf);
+      messagingService2 = Messaging.newMessagingServer(conf);
 
       messagingService2.start();
 
@@ -1614,7 +1614,7 @@
 
       conf.setIDCacheSize(cacheSize);
       
-      MessagingService messagingService2 = Messaging.newMessagingService(conf);
+      MessagingServer messagingService2 = Messaging.newMessagingServer(conf);
 
       messagingService2.start();
 
@@ -1656,7 +1656,7 @@
       
       messagingService2.stop();
       
-      messagingService2 = Messaging.newMessagingService(conf);
+      messagingService2 = Messaging.newMessagingServer(conf);
 
       messagingService2.start();
 
@@ -1713,7 +1713,7 @@
 
       conf.setIDCacheSize(cacheSize);
       
-      MessagingService messagingService2 = Messaging.newMessagingService(conf);
+      MessagingServer messagingService2 = Messaging.newMessagingServer(conf);
 
       messagingService2.start();
 
@@ -1754,7 +1754,7 @@
       
       messagingService2.stop();
       
-      messagingService2 = Messaging.newMessagingService(conf);
+      messagingService2 = Messaging.newMessagingServer(conf);
 
       messagingService2.start();
 
@@ -1814,7 +1814,7 @@
 
       conf.setIDCacheSize(cacheSize);
 
-      messagingService = Messaging.newNullStorageMessagingService(conf);
+      messagingService = Messaging.newNullStorageMessagingServer(conf);
 
       messagingService.start();
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/String64KLimitTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/String64KLimitTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/String64KLimitTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -35,7 +35,7 @@
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -60,7 +60,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingServiceImpl service;
+   private MessagingServer server;
 
    private ClientSession session;
 
@@ -212,8 +212,8 @@
 
       Configuration config = new ConfigurationImpl();
       config.setSecurityEnabled(false);
-      service = Messaging.newNullStorageMessagingService(config);
-      service.start();
+      server = Messaging.newNullStorageMessagingServer(config);
+      server.start();
 
       ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));
       session = sf.createSession(false, true, true);
@@ -224,7 +224,7 @@
    {
       session.close();
 
-      service.stop();
+      server.stop();
 
       super.tearDown();
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/chunkmessage/ChunkCleanupTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/chunkmessage/ChunkCleanupTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/chunkmessage/ChunkCleanupTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -20,7 +20,6 @@
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 
-
 package org.jboss.messaging.tests.integration.chunkmessage;
 
 import java.io.File;
@@ -38,6 +37,7 @@
 import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.config.TransportConfiguration;
 import org.jboss.messaging.core.exception.MessagingException;
+import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.remoting.impl.RemotingConnectionImpl;
 import org.jboss.messaging.core.remoting.server.impl.RemotingServiceImpl;
 import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
@@ -55,9 +55,11 @@
  */
 public class ChunkCleanupTest extends ChunkTestBase
 {
-
    // Constants -----------------------------------------------------
+   
+   private static final Logger log = Logger.getLogger(ChunkCleanupTest.class);
 
+
    // Attributes ----------------------------------------------------
 
    // Static --------------------------------------------------------
@@ -73,9 +75,9 @@
 
       Configuration config = createDefaultConfig();
 
-      messagingService = createService(true, config, new HashMap<String, AddressSettings>());
+      server = createServer(true, config, new HashMap<String, AddressSettings>());
 
-      messagingService.start();
+      server.start();
 
       try
       {
@@ -86,7 +88,7 @@
       }
       finally
       {
-         messagingService.stop();
+         server.stop();
       }
    }
 
@@ -99,9 +101,9 @@
       config.setPagingMaxGlobalSizeBytes(20 * 1024);
       config.setPagingGlobalWatermarkSize(10 * 1024);
 
-      messagingService = createService(true, config, new HashMap<String, AddressSettings>());
+      server = createServer(true, config, new HashMap<String, AddressSettings>());
 
-      messagingService.start();
+      server.start();
 
       final int numberOfIntegersBigMessage = 150000;
 
@@ -109,25 +111,23 @@
 
       class LocalCallback implements MockConnector.MockCallback
       {
-
          AtomicInteger counter = new AtomicInteger(0);
 
          ClientSession session;
 
          public void onWrite(final MessagingBuffer buffer)
          {
+            log.info("calling cb onwrite** ");
             if (counter.incrementAndGet() == 5)
             {
                RemotingConnectionImpl conn = (RemotingConnectionImpl)((ClientSessionImpl)session).getConnection();
-               RemotingServiceImpl remotingServiceImpl = (RemotingServiceImpl)messagingService.getServer()
-                                                                                              .getRemotingService();
+               RemotingServiceImpl remotingServiceImpl = (RemotingServiceImpl)server.getRemotingService();
                remotingServiceImpl.connectionException(conn.getID(),
                                                        new MessagingException(MessagingException.NOT_CONNECTED, "blah!"));
                conn.fail(new MessagingException(MessagingException.NOT_CONNECTED, "blah"));
                throw new IllegalStateException("blah");
             }
          }
-
       }
 
       LocalCallback callback = new LocalCallback();
@@ -159,6 +159,7 @@
          try
          {
             producer.send(clientLarge);
+            
             fail("Exception was expected!");
          }
          catch (Exception e)
@@ -172,7 +173,7 @@
       {
          try
          {
-            messagingService.stop();
+            server.stop();
          }
          catch (Exception ignored)
          {
@@ -196,8 +197,8 @@
    {
       clearData();
 
-      messagingService = createService(true);
-      messagingService.start();
+      server = createServer(true);
+      server.start();
 
       final int numberOfIntegers = 10;
       final int numberOfMessages = 100;
@@ -214,7 +215,7 @@
 
          session.createQueue(ADDRESS, ADDRESS, null, true);
 
-         messagingService.getServer().getPostOffice().getPagingManager().getGlobalSize();
+         server.getPostOffice().getPagingManager().getGlobalSize();
 
          ClientProducer producer = session.createProducer(ADDRESS);
 
@@ -260,7 +261,7 @@
       {
          try
          {
-            messagingService.stop();
+            server.stop();
          }
          catch (Throwable ignored)
          {
@@ -272,12 +273,12 @@
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------
-   
+
    protected void setUp() throws Exception
    {
       super.setUp();
    }
-   
+
    protected void tearDown() throws Exception
    {
       super.tearDown();

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/chunkmessage/ChunkTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/chunkmessage/ChunkTestBase.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/chunkmessage/ChunkTestBase.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -43,7 +43,7 @@
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.message.impl.MessageImpl;
 import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.Queue;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.DataConstants;
@@ -66,7 +66,7 @@
 
    protected final SimpleString ADDRESS = new SimpleString("SimpleAddress");
 
-   protected MessagingService messagingService;
+   protected MessagingServer server;
 
    // Attributes ----------------------------------------------------
 
@@ -124,8 +124,8 @@
    {
       clearData();
 
-      messagingService = createService(realFiles);
-      messagingService.start();
+      server = createServer(realFiles);
+      server.start();
 
       try
       {
@@ -142,21 +142,20 @@
          {
             sf.setSendWindowSize(producerWindow);
          }
-         
+
          sf.setMinLargeMessageSize(minSizeProducer);
-         
 
          ClientSession session;
 
          Xid xid = null;
          session = sf.createSession(null, null, isXA, false, false, preAck, 0);
-         
+
          if (isXA)
          {
             xid = newXID();
             session.start(xid, XAResource.TMNOFLAGS);
          }
-         
+
          session.createQueue(ADDRESS, ADDRESS, null, true);
 
          ClientProducer producer = session.createProducer(ADDRESS);
@@ -195,19 +194,18 @@
 
          if (realFiles)
          {
-            messagingService.stop();
+            server.stop();
 
-            messagingService = createService(realFiles);
-            messagingService.start();
+            server = createServer(realFiles);
+            server.start();
 
             sf = createInVMFactory();
          }
 
-         
          sf.setMinLargeMessageSize(minSizeConsumer);
 
          session = sf.createSession(null, null, isXA, false, false, preAck, 0);
-         
+
          if (isXA)
          {
             xid = newXID();
@@ -278,7 +276,6 @@
                   session.commit();
                }
 
-
                assertNotNull(message);
 
                if (delayDelivery <= 0)
@@ -326,12 +323,10 @@
 
          session.close();
 
-         long globalSize = messagingService.getServer().getPostOffice().getPagingManager().getGlobalSize();
+         long globalSize = server.getPostOffice().getPagingManager().getGlobalSize();
          assertEquals(0l, globalSize);
-         assertEquals(0,
-                      ((Queue)messagingService.getServer().getPostOffice().getBinding(ADDRESS).getBindable()).getDeliveringCount());
-         assertEquals(0,
-                      ((Queue)messagingService.getServer().getPostOffice().getBinding(ADDRESS).getBindable()).getMessageCount());
+         assertEquals(0, ((Queue)server.getPostOffice().getBinding(ADDRESS).getBindable()).getDeliveringCount());
+         assertEquals(0, ((Queue)server.getPostOffice().getBinding(ADDRESS).getBindable()).getMessageCount());
 
          validateNoFilesOnLargeDir();
 
@@ -340,7 +335,7 @@
       {
          try
          {
-            messagingService.stop();
+            server.stop();
          }
          catch (Throwable ignored)
          {
@@ -395,8 +390,7 @@
                System.out.println("Message sent in " + (System.currentTimeMillis() - timeStart));
             }
          }
-         
-         
+
       }
       else
       {
@@ -418,7 +412,7 @@
             {
                producer.send(message);
             }
- 
+
             if (testTime)
             {
                System.out.println("Message sent in " + (System.currentTimeMillis() - timeStart));
@@ -429,7 +423,7 @@
 
    protected MessagingBuffer createLargeBuffer(final int numberOfIntegers)
    {
-      MessagingBuffer body = ChannelBuffers.buffer(DataConstants.SIZE_INT * numberOfIntegers); 
+      MessagingBuffer body = ChannelBuffers.buffer(DataConstants.SIZE_INT * numberOfIntegers);
 
       for (int i = 0; i < numberOfIntegers; i++)
       {
@@ -445,7 +439,9 @@
       return createLargeClientMessage(session, numberOfIntegers, true);
    }
 
-   protected ClientFileMessage createLargeClientMessage(final ClientSession session, final int numberOfIntegers, boolean persistent) throws Exception
+   protected ClientFileMessage createLargeClientMessage(final ClientSession session,
+                                                        final int numberOfIntegers,
+                                                        boolean persistent) throws Exception
    {
 
       ClientFileMessage clientMessage = session.createFileMessage(persistent);

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/chunkmessage/mock/MockConnector.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/chunkmessage/mock/MockConnector.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/chunkmessage/mock/MockConnector.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -88,7 +88,6 @@
 
    class MockConnection extends InVMConnection
    {
-
       /**
        * @param handler
        * @param listener
@@ -101,6 +100,7 @@
       @Override
       public void write(final MessagingBuffer buffer)
       {
+         log.info("calling mock connection write");
          if (callback != null)
          {
             callback.onWrite(buffer);

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/AddressSettingsTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/AddressSettingsTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/AddressSettingsTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -26,12 +26,11 @@
 import org.jboss.messaging.core.client.ClientProducer;
 import org.jboss.messaging.core.client.ClientSession;
 import org.jboss.messaging.core.client.ClientSessionFactory;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.settings.HierarchicalRepository;
 import org.jboss.messaging.core.settings.impl.AddressSettings;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
-
 /**
  * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
  */
@@ -69,17 +68,17 @@
 
    public void testSimpleHierarchyWithDLA() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         messagingService.start();
+         server.start();
          AddressSettings addressSettings = new AddressSettings();
          addressSettings.setDeadLetterAddress(dlaA);
          addressSettings.setMaxDeliveryAttempts(1);
          AddressSettings addressSettings2 = new AddressSettings();
          addressSettings2.setDeadLetterAddress(dlaB);
          addressSettings2.setMaxDeliveryAttempts(1);
-         HierarchicalRepository<AddressSettings> repos = messagingService.getServer().getAddressSettingsRepository();
+         HierarchicalRepository<AddressSettings> repos = server.getAddressSettingsRepository();
          repos.addMatch(addressA.toString(), addressSettings);
          repos.addMatch(addressB.toString(), addressSettings2);
          ClientSessionFactory sf = createInVMFactory();
@@ -123,26 +122,26 @@
       }
       finally
       {
-         if(messagingService.isStarted())
+         if(server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
 
    public void test2LevelHierarchyWithDLA() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         messagingService.start();
+         server.start();
          AddressSettings addressSettings = new AddressSettings();
          addressSettings.setDeadLetterAddress(dlaA);
          addressSettings.setMaxDeliveryAttempts(1);
          AddressSettings addressSettings2 = new AddressSettings();
          addressSettings2.setDeadLetterAddress(dlaB);
          addressSettings2.setMaxDeliveryAttempts(1);
-         HierarchicalRepository<AddressSettings> repos = messagingService.getServer().getAddressSettingsRepository();
+         HierarchicalRepository<AddressSettings> repos = server.getAddressSettingsRepository();
          repos.addMatch(addressA.toString(), addressSettings);
          repos.addMatch("#", addressSettings2);
          ClientSessionFactory sf = createInVMFactory();
@@ -186,26 +185,26 @@
       }
       finally
       {
-         if(messagingService.isStarted())
+         if(server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
 
    public void test2LevelWordHierarchyWithDLA() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         messagingService.start();
+         server.start();
          AddressSettings addressSettings = new AddressSettings();
          addressSettings.setDeadLetterAddress(dlaA);
          addressSettings.setMaxDeliveryAttempts(1);
          AddressSettings addressSettings2 = new AddressSettings();
          addressSettings2.setDeadLetterAddress(dlaB);
          addressSettings2.setMaxDeliveryAttempts(1);
-         HierarchicalRepository<AddressSettings> repos = messagingService.getServer().getAddressSettingsRepository();
+         HierarchicalRepository<AddressSettings> repos = server.getAddressSettingsRepository();
          repos.addMatch(addressA.toString(), addressSettings);
          repos.addMatch("*", addressSettings2);
          ClientSessionFactory sf = createInVMFactory();
@@ -249,19 +248,19 @@
       }
       finally
       {
-         if(messagingService.isStarted())
+         if(server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
 
    public void test3LevelHierarchyWithDLA() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         messagingService.start();
+         server.start();
          AddressSettings addressSettings = new AddressSettings();
          addressSettings.setDeadLetterAddress(dlaA);
          addressSettings.setMaxDeliveryAttempts(1);
@@ -271,7 +270,7 @@
          AddressSettings addressSettings3 = new AddressSettings();
          addressSettings3.setDeadLetterAddress(dlaC);
          addressSettings3.setMaxDeliveryAttempts(1);
-         HierarchicalRepository<AddressSettings> repos = messagingService.getServer().getAddressSettingsRepository();
+         HierarchicalRepository<AddressSettings> repos = server.getAddressSettingsRepository();
          repos.addMatch(addressA2.toString(), addressSettings);
          repos.addMatch("add.*", addressSettings2);
          repos.addMatch("#", addressSettings3);
@@ -331,19 +330,19 @@
       }
       finally
       {
-         if(messagingService.isStarted())
+         if(server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
 
    public void testOverrideHierarchyWithDLA() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         messagingService.start();
+         server.start();
          AddressSettings addressSettings = new AddressSettings();
          addressSettings.setMaxDeliveryAttempts(1);
          AddressSettings addressSettings2 = new AddressSettings();
@@ -351,7 +350,7 @@
          AddressSettings addressSettings3 = new AddressSettings();
          addressSettings3.setDeadLetterAddress(dlaC);
          addressSettings3.setMaxDeliveryAttempts(1);
-         HierarchicalRepository<AddressSettings> repos = messagingService.getServer().getAddressSettingsRepository();
+         HierarchicalRepository<AddressSettings> repos = server.getAddressSettingsRepository();
          repos.addMatch(addressA2.toString(), addressSettings);
          repos.addMatch("add.*", addressSettings2);
          repos.addMatch("#", addressSettings3);
@@ -403,9 +402,9 @@
       }
       finally
       {
-         if(messagingService.isStarted())
+         if(server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientAckBatchSizeTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientAckBatchSizeTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientAckBatchSizeTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -26,7 +26,7 @@
 import org.jboss.messaging.core.client.ClientProducer;
 import org.jboss.messaging.core.client.ClientSession;
 import org.jboss.messaging.core.client.ClientSessionFactory;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.Queue;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
@@ -52,11 +52,11 @@
 
    public void testAckBatchSize() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
 
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession sendSession = cf.createSession(false, true, true);
          ClientMessage message = sendSession.createClientMessage(false);
@@ -83,7 +83,7 @@
          }
 
          ClientMessage m = consumer.receive(5000);
-         Queue q = (Queue) messagingService.getServer().getPostOffice().getBinding(queueA).getBindable();
+         Queue q = (Queue) server.getPostOffice().getBinding(queueA).getBindable();
          assertEquals(numMessages, q.getDeliveringCount());
          m.acknowledge();
          assertEquals(0, q.getDeliveringCount());
@@ -92,9 +92,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
@@ -104,11 +104,11 @@
    * */
    public void testAckBatchSizeZero() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
 
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession sendSession = cf.createSession(false, true, true);
          ClientMessage message = sendSession.createClientMessage(false);
@@ -126,7 +126,7 @@
 
          ClientConsumer consumer = session.createConsumer(queueA);
          session.start();
-         Queue q = (Queue) messagingService.getServer().getPostOffice().getBinding(queueA).getBindable();
+         Queue q = (Queue) server.getPostOffice().getBinding(queueA).getBindable();
          ClientMessage[] messages = new ClientMessage[numMessages];
          for (int i = 0; i < numMessages; i++)
          {
@@ -143,9 +143,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientAcknowledgeTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientAcknowledgeTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientAcknowledgeTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -28,7 +28,7 @@
 import org.jboss.messaging.core.client.ClientSessionFactory;
 import org.jboss.messaging.core.client.MessageHandler;
 import org.jboss.messaging.core.exception.MessagingException;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.Queue;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
@@ -52,10 +52,10 @@
 
    public void testReceiveAckLastMessageOnly() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          cf.setAckBatchSize(0);
          cf.setBlockOnAcknowledge(true);
@@ -77,7 +77,7 @@
             assertNotNull(cm);
          }
          cm.acknowledge();
-         Queue q = (Queue) messagingService.getServer().getPostOffice().getBinding(queueA).getBindable();
+         Queue q = (Queue) server.getPostOffice().getBinding(queueA).getBindable();
 
          assertEquals(0, q.getDeliveringCount());
          session.close();
@@ -85,19 +85,19 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
 
    public void testAsyncConsumerNoAck() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession sendSession = cf.createSession(false, true, true);
          ClientSession session = cf.createSession(false, true, true);
@@ -119,26 +119,26 @@
             }
          });
          assertTrue(latch.await(5, TimeUnit.SECONDS));
-         Queue q = (Queue) messagingService.getServer().getPostOffice().getBinding(queueA).getBindable();
+         Queue q = (Queue) server.getPostOffice().getBinding(queueA).getBindable();
          assertEquals(numMessages, q.getDeliveringCount());
          sendSession.close();
          session.close();
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
 
    public void testAsyncConsumerAck() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          cf.setBlockOnAcknowledge(true);
          cf.setAckBatchSize(0);
@@ -177,26 +177,26 @@
             }
          });
          assertTrue(latch.await(5, TimeUnit.SECONDS));
-         Queue q = (Queue) messagingService.getServer().getPostOffice().getBinding(queueA).getBindable();
+         Queue q = (Queue) server.getPostOffice().getBinding(queueA).getBindable();
          assertEquals(0, q.getDeliveringCount());
          sendSession.close();
          session.close();
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
 
    public void testAsyncConsumerAckLastMessageOnly() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          cf.setBlockOnAcknowledge(true);
          cf.setAckBatchSize(0);
@@ -238,16 +238,16 @@
             }
          });
          assertTrue(latch.await(5, TimeUnit.SECONDS));
-         Queue q = (Queue) messagingService.getServer().getPostOffice().getBinding(queueA).getBindable();
+         Queue q = (Queue) server.getPostOffice().getBinding(queueA).getBindable();
          assertEquals(0, q.getDeliveringCount());
          sendSession.close();
          session.close();
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientAutogroupIdTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientAutogroupIdTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientAutogroupIdTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -28,7 +28,7 @@
 import org.jboss.messaging.core.client.ClientSessionFactory;
 import org.jboss.messaging.core.client.MessageHandler;
 import org.jboss.messaging.core.exception.MessagingException;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.impl.GroupingRoundRobinDistributor;
 import org.jboss.messaging.core.settings.impl.AddressSettings;
 import org.jboss.messaging.tests.util.ServiceTestBase;
@@ -59,13 +59,13 @@
 
    public void testGroupIdAutomaticallySet() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
          AddressSettings qs = new AddressSettings();
          qs.setDistributionPolicyClass(GroupingRoundRobinDistributor.class.getName());
-         messagingService.getServer().getAddressSettingsRepository().addMatch(groupTestQ.toString(), qs);
-         messagingService.start();
+         server.getAddressSettingsRepository().addMatch(groupTestQ.toString(), qs);
+         server.start();
 
          ClientSessionFactory sf = createInVMFactory();
          sf.setAutoGroup(true);
@@ -102,9 +102,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
 
@@ -115,13 +115,13 @@
   * */
    public void testGroupIdAutomaticallySetMultipleProducers() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
          AddressSettings qs = new AddressSettings();
          qs.setDistributionPolicyClass(GroupingRoundRobinDistributor.class.getName());
-         messagingService.getServer().getAddressSettingsRepository().addMatch(groupTestQ.toString(), qs);
-         messagingService.start();
+         server.getAddressSettingsRepository().addMatch(groupTestQ.toString(), qs);
+         server.start();
 
          ClientSessionFactory sf = createInVMFactory();
          sf.setAutoGroup(true);
@@ -167,9 +167,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
 
@@ -180,14 +180,14 @@
   * */
    public void testGroupIdAutomaticallyNotSet() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
          AddressSettings qs = new AddressSettings();
          qs.setDistributionPolicyClass(GroupingRoundRobinDistributor.class.getName());
 
-         messagingService.getServer().getAddressSettingsRepository().addMatch(groupTestQ.toString(), qs);
-         messagingService.start();
+         server.getAddressSettingsRepository().addMatch(groupTestQ.toString(), qs);
+         server.start();
 
          ClientSessionFactory sf = createInVMFactory();
 
@@ -224,9 +224,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientCommitRollbackTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientCommitRollbackTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientCommitRollbackTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -28,7 +28,7 @@
 import org.jboss.messaging.core.client.ClientSessionFactory;
 import org.jboss.messaging.core.client.MessageHandler;
 import org.jboss.messaging.core.exception.MessagingException;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.Queue;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
@@ -54,10 +54,10 @@
 
    public void testReceiveWithCommit() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession sendSession = cf.createSession(false, true, true);
          ClientSession session = cf.createSession(false, false, false);
@@ -76,7 +76,7 @@
             assertNotNull(cm);
             cm.acknowledge();
          }
-         Queue q = (Queue) messagingService.getServer().getPostOffice().getBinding(queueA).getBindable();
+         Queue q = (Queue) server.getPostOffice().getBinding(queueA).getBindable();
          assertEquals(numMessages, q.getDeliveringCount());
          session.commit();
          assertEquals(0, q.getDeliveringCount());
@@ -84,19 +84,19 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
 
    public void testReceiveWithRollback() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession sendSession = cf.createSession(false, true, true);
          ClientSession session = cf.createSession(false, false, false);
@@ -115,7 +115,7 @@
             assertNotNull(cm);
             cm.acknowledge();
          }
-         Queue q = (Queue) messagingService.getServer().getPostOffice().getBinding(queueA).getBindable();
+         Queue q = (Queue) server.getPostOffice().getBinding(queueA).getBindable();
          assertEquals(numMessages, q.getDeliveringCount());
          session.rollback();
          for (int i = 0; i < numMessages; i++)
@@ -130,19 +130,19 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
 
    public void testReceiveWithRollbackMultipleConsumersDifferentQueues() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession sendSession = cf.createSession(false, true, true);
          ClientSession session = cf.createSession(false, false, false);
@@ -168,8 +168,8 @@
             assertNotNull(cm);
             cm.acknowledge();
          }
-         Queue q = (Queue) messagingService.getServer().getPostOffice().getBinding(queueA).getBindable();
-         Queue q2 = (Queue) messagingService.getServer().getPostOffice().getBinding(queueB).getBindable();
+         Queue q = (Queue) server.getPostOffice().getBinding(queueA).getBindable();
+         Queue q2 = (Queue) server.getPostOffice().getBinding(queueB).getBindable();
          assertEquals(numMessages, q.getDeliveringCount());
          cc.close();
          cc2.close();
@@ -182,19 +182,19 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
 
    public void testAsyncConsumerCommit() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          cf.setBlockOnAcknowledge(true);
          cf.setAckBatchSize(0);
@@ -233,7 +233,7 @@
             }
          });
          assertTrue(latch.await(5, TimeUnit.SECONDS));
-         Queue q = (Queue)messagingService.getServer().getPostOffice().getBinding(queueA).getBindable();
+         Queue q = (Queue)server.getPostOffice().getBinding(queueA).getBindable();
          assertEquals(numMessages, q.getDeliveringCount());
          assertEquals(numMessages, q.getMessageCount());
          session.commit();
@@ -244,19 +244,19 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
 
    public void testAsyncConsumerRollback() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          cf.setBlockOnAcknowledge(true);
          cf.setAckBatchSize(0);
@@ -274,7 +274,7 @@
          session.start();
          cc.setMessageHandler(new ackHandler(session, latch));
          assertTrue(latch.await(5, TimeUnit.SECONDS));
-         Queue q = (Queue) messagingService.getServer().getPostOffice().getBinding(queueA).getBindable();
+         Queue q = (Queue) server.getPostOffice().getBinding(queueA).getBindable();
          assertEquals(numMessages, q.getDeliveringCount());
          assertEquals(numMessages, q.getMessageCount());
          session.stop();
@@ -290,9 +290,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientConsumerCloseTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientConsumerCloseTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientConsumerCloseTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -35,7 +35,7 @@
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -50,7 +50,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingServiceImpl service;
+   private MessagingServer server;
    private ClientSession session;
    private SimpleString queue;
 
@@ -109,8 +109,8 @@
 
       Configuration config = new ConfigurationImpl();
       config.setSecurityEnabled(false);
-      service = Messaging.newNullStorageMessagingService(config);
-      service.start();
+      server = Messaging.newNullStorageMessagingServer(config);
+      server.start();
       
       SimpleString address = randomSimpleString();
       queue = randomSimpleString();
@@ -128,7 +128,7 @@
       
       session.close();
       
-      service.stop();
+      server.stop();
 
       super.tearDown();
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientConsumerRoundRobinTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientConsumerRoundRobinTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientConsumerRoundRobinTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -26,7 +26,7 @@
 import org.jboss.messaging.core.client.ClientProducer;
 import org.jboss.messaging.core.client.ClientSession;
 import org.jboss.messaging.core.client.ClientSessionFactory;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -41,10 +41,10 @@
 
    public void testConsumersRoundRobinCorrectly() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession session = cf.createSession(false, true, true);
          session.createQueue(addressA, queueA, false);
@@ -84,9 +84,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientConsumerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientConsumerTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientConsumerTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -27,7 +27,7 @@
 import org.jboss.messaging.core.client.ClientSession;
 import org.jboss.messaging.core.client.ClientSessionFactory;
 import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.Queue;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
@@ -40,7 +40,7 @@
 {
    private static final Logger log = Logger.getLogger(ClientConsumerTest.class);
 
-   private MessagingService messagingService;
+   private MessagingServer server;
 
    private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue");
 
@@ -49,17 +49,17 @@
    {
       super.setUp();
 
-      messagingService = createService(false);
+      server = createServer(false);
 
-      messagingService.start();
+      server.start();
    }
 
    @Override
    protected void tearDown() throws Exception
    {
-      messagingService.stop();
+      server.stop();
 
-      messagingService = null;
+      server = null;
 
       super.tearDown();
    }
@@ -94,9 +94,9 @@
       }
       // assert that all the messages are there and none have been acked
       assertEquals(0,
-                   ((Queue)messagingService.getServer().getPostOffice().getBinding(QUEUE).getBindable()).getDeliveringCount());
+                   ((Queue)server.getPostOffice().getBinding(QUEUE).getBindable()).getDeliveringCount());
       assertEquals(0,
-                   ((Queue)messagingService.getServer().getPostOffice().getBinding(QUEUE).getBindable()).getMessageCount());
+                   ((Queue)server.getPostOffice().getBinding(QUEUE).getBindable()).getMessageCount());
 
       session.close();
    }
@@ -130,9 +130,9 @@
       }
       // assert that all the messages are there and none have been acked
       assertEquals(0,
-                   ((Queue)messagingService.getServer().getPostOffice().getBinding(QUEUE).getBindable()).getDeliveringCount());
+                   ((Queue)server.getPostOffice().getBinding(QUEUE).getBindable()).getDeliveringCount());
       assertEquals(0,
-                   ((Queue)messagingService.getServer().getPostOffice().getBinding(QUEUE).getBindable()).getMessageCount());
+                   ((Queue)server.getPostOffice().getBinding(QUEUE).getBindable()).getMessageCount());
 
       session.close();
    }
@@ -170,9 +170,9 @@
       }
       // assert that all the messages are there and none have been acked
       assertEquals(0,
-                   ((Queue)messagingService.getServer().getPostOffice().getBinding(QUEUE).getBindable()).getDeliveringCount());
+                   ((Queue)server.getPostOffice().getBinding(QUEUE).getBindable()).getDeliveringCount());
       assertEquals(0,
-                   ((Queue)messagingService.getServer().getPostOffice().getBinding(QUEUE).getBindable()).getMessageCount());
+                   ((Queue)server.getPostOffice().getBinding(QUEUE).getBindable()).getMessageCount());
 
       session.close();
    }
@@ -210,16 +210,16 @@
       }
       // assert that all the messages are there and none have been acked
       assertEquals(0,
-                   ((Queue)messagingService.getServer().getPostOffice().getBinding(QUEUE).getBindable()).getDeliveringCount());
+                   ((Queue)server.getPostOffice().getBinding(QUEUE).getBindable()).getDeliveringCount());
       assertEquals(0,
-                   ((Queue)messagingService.getServer().getPostOffice().getBinding(QUEUE).getBindable()).getMessageCount());
+                   ((Queue)server.getPostOffice().getBinding(QUEUE).getBindable()).getMessageCount());
 
       session.close();
 
       assertEquals(0,
-                   ((Queue)messagingService.getServer().getPostOffice().getBinding(QUEUE).getBindable()).getDeliveringCount());
+                   ((Queue)server.getPostOffice().getBinding(QUEUE).getBindable()).getDeliveringCount());
       assertEquals(0,
-                   ((Queue)messagingService.getServer().getPostOffice().getBinding(QUEUE).getBindable()).getMessageCount());
+                   ((Queue)server.getPostOffice().getBinding(QUEUE).getBindable()).getMessageCount());
    }
 
 }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientDeliveryOrderTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientDeliveryOrderTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientDeliveryOrderTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -28,7 +28,7 @@
 import org.jboss.messaging.core.client.ClientSessionFactory;
 import org.jboss.messaging.core.client.MessageHandler;
 import org.jboss.messaging.core.exception.MessagingException;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -53,10 +53,10 @@
 
       public void testSendDeliveryOrderOnCommit() throws Exception
       {
-         MessagingService messagingService = createService(false);
+         MessagingServer server = createServer(false);
          try
          {
-            messagingService.start();
+            server.start();
             ClientSessionFactory cf = createInVMFactory();
             ClientSession sendSession = cf.createSession(false, false, true);
             ClientProducer cp = sendSession.createProducer(addressA);
@@ -84,19 +84,19 @@
          }
          finally
          {
-            if (messagingService.isStarted())
+            if (server.isStarted())
             {
-               messagingService.stop();
+               server.stop();
             }
          }
       }
 
       public void testReceiveDeliveryOrderOnRollback() throws Exception
       {
-         MessagingService messagingService = createService(false);
+         MessagingServer server = createServer(false);
          try
          {
-            messagingService.start();
+            server.start();
             ClientSessionFactory cf = createInVMFactory();
             ClientSession sendSession = cf.createSession(false, true, false);
             ClientProducer cp = sendSession.createProducer(addressA);
@@ -129,19 +129,19 @@
          }
          finally
          {
-            if (messagingService.isStarted())
+            if (server.isStarted())
             {
-               messagingService.stop();
+               server.stop();
             }
          }
       }
 
       public void testMultipleConsumersMessageOrder() throws Exception
       {
-         MessagingService messagingService = createService(false);
+         MessagingServer server = createServer(false);
          try
          {
-            messagingService.start();
+            server.start();
             ClientSessionFactory cf = createInVMFactory();
             ClientSession sendSession = cf.createSession(false, true, true);
             ClientSession recSession = cf.createSession(false, true, true);
@@ -176,9 +176,9 @@
          }
          finally
          {
-            if (messagingService.isStarted())
+            if (server.isStarted())
             {
-               messagingService.stop();
+               server.stop();
             }
          }
       }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientFileMessageTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientFileMessageTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientFileMessageTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -28,7 +28,7 @@
 import org.jboss.messaging.core.client.ClientSession;
 import org.jboss.messaging.core.client.ClientSessionFactory;
 import org.jboss.messaging.core.client.impl.ClientFileMessageImpl;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -50,10 +50,10 @@
    {
       String testDir = System.getProperty("java.io.tmpdir", "/tmp") + "/jbm-unit-test";
 
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          cf.setMinLargeMessageSize(1000);
          ClientSession sendSession = cf.createSession(false, true, true);
@@ -79,9 +79,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
@@ -90,10 +90,10 @@
    {
       String testDir = System.getProperty("java.io.tmpdir", "/tmp") + "/jbm-unit-test";
 
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          cf.setMinLargeMessageSize(1000);
          ClientSession sendSession = cf.createSession(false, true, true);
@@ -124,9 +124,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientLargeMessageTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientLargeMessageTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientLargeMessageTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -26,7 +26,7 @@
 import org.jboss.messaging.core.client.ClientProducer;
 import org.jboss.messaging.core.client.ClientSession;
 import org.jboss.messaging.core.client.ClientSessionFactory;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -41,10 +41,10 @@
 
    public void testSendConsumeLargeMessage() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          cf.setMinLargeMessageSize(1000);
          ClientSession sendSession = cf.createSession(false, true, true);
@@ -65,9 +65,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientMessageCounterTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientMessageCounterTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientMessageCounterTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -27,7 +27,7 @@
 import org.jboss.messaging.core.client.ClientSession;
 import org.jboss.messaging.core.client.ClientSessionFactory;
 import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -39,7 +39,7 @@
 {
    private static final Logger log = Logger.getLogger(ClientConsumerTest.class);
 
-   private MessagingService messagingService;
+   private MessagingServer server;
 
    private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue");
 
@@ -48,65 +48,65 @@
    {
       super.setUp();
 
-      messagingService = createService(false);
+      server = createServer(false);
 
-      messagingService.start();
+      server.start();
    }
 
    @Override
    protected void tearDown() throws Exception
    {
-      messagingService.stop();
+      server.stop();
 
-      messagingService = null;
+      server = null;
 
       super.tearDown();
    }
 
    public void testMessageCounter() throws Exception
-         {
-            ClientSessionFactory sf = createInVMFactory();
+   {
+      ClientSessionFactory sf = createInVMFactory();
 
-            sf.setBlockOnNonPersistentSend(true);
-            sf.setBlockOnPersistentSend(true);
+      sf.setBlockOnNonPersistentSend(true);
+      sf.setBlockOnPersistentSend(true);
 
-            ClientSession session = sf.createSession(null, null, false, false, false, false, 0);
+      ClientSession session = sf.createSession(null, null, false, false, false, false, 0);
 
-            session.createQueue(QUEUE, QUEUE, null, false);
+      session.createQueue(QUEUE, QUEUE, null, false);
 
-            ClientProducer producer = session.createProducer(QUEUE);
+      ClientProducer producer = session.createProducer(QUEUE);
 
-            final int numMessages = 100;
+      final int numMessages = 100;
 
-            for (int i = 0; i < numMessages; i++)
-            {
-               ClientMessage message = createTextMessage("m" + i, session);
-               producer.send(message);
-            }
+      for (int i = 0; i < numMessages; i++)
+      {
+         ClientMessage message = createTextMessage("m" + i, session);
+         producer.send(message);
+      }
 
-            session.commit();
-            session.start();
+      session.commit();
+      session.start();
 
-            assertEquals(100, getMessageCount(messagingService.getServer().getPostOffice(), QUEUE.toString()));
+      assertEquals(100, getMessageCount(server.getPostOffice(), QUEUE.toString()));
 
-            ClientConsumer consumer = session.createConsumer(QUEUE, null, false);
+      ClientConsumer consumer = session.createConsumer(QUEUE, null, false);
 
-            for (int i = 0; i < numMessages; i++)
-            {
-               ClientMessage message = consumer.receive(1000);
+      for (int i = 0; i < numMessages; i++)
+      {
+         ClientMessage message = consumer.receive(1000);
 
-               assertNotNull(message);
-               message.acknowledge();
+         assertNotNull(message);
+         message.acknowledge();
 
-               session.commit();
+         session.commit();
 
-               assertEquals("m" + i, message.getBody().readString());
-            }
+         assertEquals("m" + i, message.getBody().readString());
+      }
 
-            session.close();
+      session.close();
 
-            assertEquals(0, getMessageCount(messagingService.getServer().getPostOffice(), QUEUE.toString()));
+      assertEquals(0, getMessageCount(server.getPostOffice(), QUEUE.toString()));
 
-         }
+   }
 
 }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientMessageHandlerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientMessageHandlerTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientMessageHandlerTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -28,7 +28,7 @@
 import org.jboss.messaging.core.client.ClientSessionFactory;
 import org.jboss.messaging.core.client.MessageHandler;
 import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -42,7 +42,7 @@
 {
    private static final Logger log = Logger.getLogger(ClientConsumerTest.class);
 
-   private MessagingService messagingService;
+   private MessagingServer server;
 
    private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue");
 
@@ -51,17 +51,17 @@
    {
       super.setUp();
 
-      messagingService = createService(false);
+      server = createServer(false);
 
-      messagingService.start();
+      server.start();
    }
 
    @Override
    protected void tearDown() throws Exception
    {
-      messagingService.stop();
+      server.stop();
 
-      messagingService = null;
+      server = null;
 
       super.tearDown();
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientProducerCloseTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientProducerCloseTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientProducerCloseTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -23,11 +23,9 @@
 
 import static org.jboss.messaging.tests.util.RandomUtil.randomSimpleString;
 
-import org.jboss.messaging.core.client.ClientMessage;
 import org.jboss.messaging.core.client.ClientProducer;
 import org.jboss.messaging.core.client.ClientSession;
 import org.jboss.messaging.core.client.ClientSessionFactory;
-import org.jboss.messaging.core.client.MessageHandler;
 import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
 import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.config.TransportConfiguration;
@@ -35,10 +33,8 @@
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
-import org.jboss.messaging.tests.util.RandomUtil;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.ServiceTestBase;
-import org.jboss.messaging.utils.SimpleString;
 
 /**
  * 
@@ -51,7 +47,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingServiceImpl service;
+   private MessagingServer server;
 
    private ClientSession session;
 
@@ -91,8 +87,8 @@
 
       Configuration config = new ConfigurationImpl();
       config.setSecurityEnabled(false);
-      service = Messaging.newNullStorageMessagingService(config);
-      service.start();
+      server = Messaging.newNullStorageMessagingServer(config);
+      server.start();
 
       ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));
       session = sf.createSession(false, true, true);
@@ -103,7 +99,7 @@
    {
       session.close();
 
-      service.stop();
+      server.stop();
 
       super.tearDown();
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientQueueBrowserTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientQueueBrowserTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientQueueBrowserTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -29,7 +29,7 @@
 import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
 import org.jboss.messaging.core.config.TransportConfiguration;
 import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.Queue;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
@@ -42,7 +42,7 @@
 {
    private static final Logger log = Logger.getLogger(ClientConsumerTest.class);
 
-   private MessagingService messagingService;
+   private MessagingServer server;
 
    private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue");
 
@@ -51,17 +51,17 @@
    {
       super.setUp();
 
-      messagingService = createService(false);
+      server = createServer(false);
 
-      messagingService.start();
+      server.start();
    }
 
    @Override
    protected void tearDown() throws Exception
    {
-      messagingService.stop();
+      server.stop();
 
-      messagingService = null;
+      server = null;
 
       super.tearDown();
    }
@@ -314,9 +314,9 @@
          }
          // assert that all the messages are there and none have been acked
          assertEquals(0,
-                      ((Queue)messagingService.getServer().getPostOffice().getBinding(QUEUE).getBindable()).getDeliveringCount());
+                      ((Queue)server.getPostOffice().getBinding(QUEUE).getBindable()).getDeliveringCount());
          assertEquals(100,
-                      ((Queue)messagingService.getServer().getPostOffice().getBinding(QUEUE).getBindable()).getMessageCount());
+                      ((Queue)server.getPostOffice().getBinding(QUEUE).getBindable()).getMessageCount());
 
          session.close();
       }
@@ -351,9 +351,9 @@
          }
          // assert that all the messages are there and none have been acked
          assertEquals(0,
-                      ((Queue)messagingService.getServer().getPostOffice().getBinding(QUEUE).getBindable()).getDeliveringCount());
+                      ((Queue)server.getPostOffice().getBinding(QUEUE).getBindable()).getDeliveringCount());
          assertEquals(100,
-                      ((Queue)messagingService.getServer().getPostOffice().getBinding(QUEUE).getBindable()).getMessageCount());
+                      ((Queue)server.getPostOffice().getBinding(QUEUE).getBindable()).getMessageCount());
 
          session.close();
       }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientReceiveTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientReceiveTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientReceiveTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -28,7 +28,7 @@
 import org.jboss.messaging.core.client.ClientSessionFactory;
 import org.jboss.messaging.core.client.MessageHandler;
 import org.jboss.messaging.core.exception.MessagingException;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -43,10 +43,10 @@
 
    public void testBasicReceive() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession sendSession = cf.createSession(false, true, true);
          ClientProducer cp = sendSession.createProducer(addressA);
@@ -61,19 +61,19 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
 
    public void testReceiveTimesoutCorrectly() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession session = cf.createSession(false, true, true);
          session.createQueue(addressA, queueA, false);
@@ -88,19 +88,19 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
 
    public void testReceiveOnClosedException() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession session = cf.createSession(false, true, true);
          session.createQueue(addressA, queueA, false);
@@ -122,19 +122,19 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
 
    public void testReceiveThrowsExceptionWhenHandlerSet() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession session = cf.createSession(false, true, true);
          session.createQueue(addressA, queueA, false);
@@ -161,19 +161,19 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
 
    public void testReceiveImmediate() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          //forces perfect round robin
          cf.setConsumerWindowSize(1);
@@ -196,9 +196,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientRequestorTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientRequestorTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientRequestorTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -38,7 +38,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import static org.jboss.messaging.tests.util.RandomUtil.randomLong;
 import static org.jboss.messaging.tests.util.RandomUtil.randomSimpleString;
 import org.jboss.messaging.tests.util.UnitTestCase;
@@ -56,7 +56,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingService service;
+   private MessagingServer service;
 
    // Static --------------------------------------------------------
 
@@ -226,7 +226,7 @@
       Configuration conf = new ConfigurationImpl();
       conf.setSecurityEnabled(false);
       conf.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
-      service = Messaging.newNullStorageMessagingService(conf);
+      service = Messaging.newNullStorageMessagingServer(conf);
       service.start();
    }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientRoutingTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientRoutingTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientRoutingTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -26,7 +26,7 @@
 import org.jboss.messaging.core.client.ClientProducer;
 import org.jboss.messaging.core.client.ClientSession;
 import org.jboss.messaging.core.client.ClientSessionFactory;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -46,11 +46,11 @@
 
    public void testRouteToMultipleQueues() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
 
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession sendSession = cf.createSession(false, true, true);
          sendSession.createQueue(addressA, queueA, false);
@@ -87,20 +87,20 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
 
    public void testRouteToSingleNonDurableQueue() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
 
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession sendSession = cf.createSession(false, true, true);
          sendSession.createQueue(addressA, queueA, false);
@@ -125,20 +125,20 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
 
    public void testRouteToSingleDurableQueue() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
 
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession sendSession = cf.createSession(false, true, true);
          sendSession.createQueue(addressA, queueA, true);
@@ -163,20 +163,20 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
 
    public void testRouteToSingleQueueWithFilter() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
 
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession sendSession = cf.createSession(false, true, true);
          sendSession.createQueue(addressA, queueA, new SimpleString("foo = 'bar'"), false);
@@ -203,20 +203,20 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
 
    public void testRouteToMultipleQueueWithFilters() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
 
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession sendSession = cf.createSession(false, true, true);
          sendSession.createQueue(addressA, queueA, new SimpleString("foo = 'bar'"), false);
@@ -266,20 +266,20 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
 
    public void testRouteToSingleTemporaryQueue() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
 
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession sendSession = cf.createSession(false, true, true);
          sendSession.createTemporaryQueue(addressA, queueA);
@@ -304,9 +304,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSendTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSendTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSendTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -24,7 +24,7 @@
 import org.jboss.messaging.core.client.ClientProducer;
 import org.jboss.messaging.core.client.ClientSession;
 import org.jboss.messaging.core.client.ClientSessionFactory;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.Queue;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
@@ -45,10 +45,10 @@
 
    public void testSendWithCommit() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession session = cf.createSession(false, false, false);
          session.createQueue(addressA, queueA, false);
@@ -58,7 +58,7 @@
          {
             cp.send(session.createClientMessage(false));
          }
-         Queue q = (Queue) messagingService.getServer().getPostOffice().getBinding(queueA).getBindable();
+         Queue q = (Queue) server.getPostOffice().getBinding(queueA).getBindable();
          assertEquals(q.getMessageCount(), 0);
          session.commit();
          assertEquals(q.getMessageCount(), numMessages);
@@ -74,19 +74,19 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
 
    public void testSendWithRollback() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession session = cf.createSession(false, false, false);
          session.createQueue(addressA, queueA, false);
@@ -96,7 +96,7 @@
          {
             cp.send(session.createClientMessage(false));
          }
-         Queue q = (Queue) messagingService.getServer().getPostOffice().getBinding(queueA).getBindable();
+         Queue q = (Queue) server.getPostOffice().getBinding(queueA).getBindable();
          assertEquals(q.getMessageCount(), 0);
          session.rollback();
          assertEquals(q.getMessageCount(), 0);
@@ -112,9 +112,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCloseTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCloseTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCloseTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -42,7 +42,7 @@
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -60,7 +60,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingServiceImpl service;
+   private MessagingServer server;
 
    // Static --------------------------------------------------------
 
@@ -269,14 +269,14 @@
 
       Configuration config = new ConfigurationImpl();
       config.setSecurityEnabled(false);
-      service = Messaging.newNullStorageMessagingService(config);
-      service.start();
+      server = Messaging.newNullStorageMessagingServer(config);
+      server.start();
    }
 
    @Override
    protected void tearDown() throws Exception
    {
-      service.stop();
+      server.stop();
 
       super.tearDown();
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCreateAndDeleteQueueTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCreateAndDeleteQueueTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCreateAndDeleteQueueTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -24,7 +24,7 @@
 import org.jboss.messaging.core.client.ClientSession;
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.postoffice.Binding;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.Queue;
 import org.jboss.messaging.core.server.impl.SoloQueueImpl;
 import org.jboss.messaging.core.settings.impl.AddressSettings;
@@ -36,7 +36,7 @@
  */
 public class ClientSessionCreateAndDeleteQueueTest extends ServiceTestBase
 {
-   private MessagingService messagingService;
+   private MessagingServer server;
 
    private SimpleString address = new SimpleString("address");
 
@@ -47,7 +47,7 @@
    {
       ClientSession session = createInVMFactory().createSession(false, true, true);
       session.createQueue(address, queueName, false);
-      Binding binding = messagingService.getServer().getPostOffice().getBinding(queueName);
+      Binding binding = server.getPostOffice().getBinding(queueName);
       Queue q = (Queue) binding.getBindable();
       assertFalse(q.isDurable());
       
@@ -58,7 +58,7 @@
    {
       ClientSession session = createInVMFactory().createSession(false, true, true);
       session.createQueue(address, queueName, true);
-      Binding binding = messagingService.getServer().getPostOffice().getBinding(queueName);
+      Binding binding = server.getPostOffice().getBinding(queueName);
       Queue q = (Queue) binding.getBindable();
       assertTrue(q.isDurable());
 
@@ -69,7 +69,7 @@
    {
       ClientSession session = createInVMFactory().createSession(false, true, true);
       session.createQueue(address, queueName, false);
-      Binding binding = messagingService.getServer().getPostOffice().getBinding(queueName);
+      Binding binding = server.getPostOffice().getBinding(queueName);
       Queue q = (Queue) binding.getBindable();
       assertFalse(q.isTemporary());
       
@@ -80,7 +80,7 @@
    {
       ClientSession session = createInVMFactory().createSession(false, true, true);
       session.createTemporaryQueue(address, queueName);
-      Binding binding = messagingService.getServer().getPostOffice().getBinding(queueName);
+      Binding binding = server.getPostOffice().getBinding(queueName);
       Queue q = (Queue) binding.getBindable();
       assertTrue(q.isTemporary());
       
@@ -92,7 +92,7 @@
       ClientSession session = createInVMFactory().createSession(false, true, true);
       SimpleString filterString = new SimpleString("x=y");
       session.createQueue(address, queueName, filterString, false);
-      Binding binding = messagingService.getServer().getPostOffice().getBinding(queueName);
+      Binding binding = server.getPostOffice().getBinding(queueName);
       Queue q = (Queue) binding.getBindable();
       assertEquals(q.getFilter().getFilterString(), filterString);
       
@@ -103,11 +103,11 @@
    {
       AddressSettings addressSettings = new AddressSettings();
       addressSettings.setSoloQueue(true);
-      messagingService.getServer().getAddressSettingsRepository().addMatch(address.toString(), addressSettings);
+      server.getAddressSettingsRepository().addMatch(address.toString(), addressSettings);
       ClientSession session = createInVMFactory().createSession(false, true, true);
       SimpleString filterString = new SimpleString("x=y");
       session.createQueue(address, queueName, filterString, false);
-      Binding binding = messagingService.getServer().getPostOffice().getBinding(queueName);
+      Binding binding = server.getPostOffice().getBinding(queueName);
       assertTrue(binding.getBindable() instanceof SoloQueueImpl);
 
       session.close();
@@ -117,10 +117,10 @@
    {
       ClientSession session = createInVMFactory().createSession(false, true, true);
       session.createQueue(address, queueName, false);
-      Binding binding = messagingService.getServer().getPostOffice().getBinding(queueName);
+      Binding binding = server.getPostOffice().getBinding(queueName);
       assertNotNull(binding);
       session.deleteQueue(queueName);
-      binding = messagingService.getServer().getPostOffice().getBinding(queueName);
+      binding = server.getPostOffice().getBinding(queueName);
       assertNull(binding);
       session.close();
    }
@@ -145,16 +145,16 @@
    protected void setUp() throws Exception
    {
       super.setUp();
-      messagingService = createService(false);
-      messagingService.start();
+      server = createServer(false);
+      server.start();
    }
 
    @Override
    protected void tearDown() throws Exception
    {
-      if(messagingService != null && messagingService.isStarted())
+      if(server != null && server.isStarted())
       {
-         messagingService.stop();
+         server.stop();
       }
       
       super.tearDown();

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCreateConsumerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCreateConsumerTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCreateConsumerTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -25,7 +25,7 @@
 import org.jboss.messaging.core.client.ClientSessionFactory;
 import org.jboss.messaging.core.client.impl.ClientSessionInternal;
 import org.jboss.messaging.core.exception.MessagingException;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 
 import java.io.File;
@@ -39,7 +39,7 @@
 
    public void testCreateConsumer() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer service = createServer(false);
       try
       {
          service.start();
@@ -61,7 +61,7 @@
 
    public void testCreateConsumerNoQ() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer service = createServer(false);
       try
       {
          service.start();
@@ -89,7 +89,7 @@
 
    public void testCreateConsumerWithFilter() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer service = createServer(false);
       try
       {
          service.start();
@@ -111,7 +111,7 @@
 
    public void testCreateConsumerWithInvalidFilter() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer service = createServer(false);
       try
       {
          service.start();
@@ -140,7 +140,7 @@
 
    public void testCreateConsumerWithBrowseOnly() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer service = createServer(false);
       try
       {
          service.start();
@@ -162,7 +162,7 @@
 
    public void testCreateConsumerWithOverrides() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer service = createServer(false);
       try
       {
          service.start();
@@ -184,7 +184,7 @@
 
    public void testCreateFileConsumerTest() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer service = createServer(false);
       try
       {
          service.start();
@@ -206,7 +206,7 @@
 
    public void testCreateFileConsumerNoQ() throws Exception
       {
-         MessagingService service = createService(false);
+         MessagingServer service = createServer(false);
          try
          {
             service.start();
@@ -234,7 +234,7 @@
 
       public void testCreateFileConsumerWithFilter() throws Exception
       {
-         MessagingService service = createService(false);
+         MessagingServer service = createServer(false);
          try
          {
             service.start();
@@ -256,7 +256,7 @@
 
       public void testCreateFileConsumerWithInvalidFilter() throws Exception
       {
-         MessagingService service = createService(false);
+         MessagingServer service = createServer(false);
          try
          {
             service.start();
@@ -285,7 +285,7 @@
 
       public void testCreateFileConsumerWithBrowseOnly() throws Exception
       {
-         MessagingService service = createService(false);
+         MessagingServer service = createServer(false);
          try
          {
             service.start();
@@ -307,7 +307,7 @@
 
       public void testCreateFileConsumerWithOverrides() throws Exception
       {
-         MessagingService service = createService(false);
+         MessagingServer service = createServer(false);
          try
          {
             service.start();

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCreateProducerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCreateProducerTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionCreateProducerTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -25,7 +25,7 @@
 import org.jboss.messaging.core.client.ClientSessionFactory;
 import org.jboss.messaging.core.client.impl.ClientSessionInternal;
 import org.jboss.messaging.core.exception.MessagingException;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 
 /**
@@ -35,7 +35,7 @@
 {
    public void testCreateAnonProducer() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer service = createServer(false);
       try
       {
          service.start();
@@ -60,7 +60,7 @@
 
    public void testCreateProducer1() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer service = createServer(false);
       try
       {
          service.start();
@@ -85,7 +85,7 @@
 
    public void testCreateProducer2() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer service = createServer(false);
       try
       {
          service.start();
@@ -111,7 +111,7 @@
 
    public void testCreateProducer3() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer service = createServer(false);
       try
       {
          service.start();
@@ -139,7 +139,7 @@
 
    public void testProducerOnClosedSession() throws Exception
       {
-         MessagingService service = createService(false);
+         MessagingServer service = createServer(false);
          try
          {
             service.start();

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionFactoryTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionFactoryTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionFactoryTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -31,7 +31,7 @@
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.remoting.impl.invm.TransportConstants;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.integration.transports.netty.NettyConnectorFactory;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.Pair;
@@ -50,9 +50,9 @@
 
    private final int groupPort = 8765;
 
-   private MessagingService liveService;
+   private MessagingServer liveService;
 
-   private MessagingService backupService;
+   private MessagingServer backupService;
 
    private TransportConfiguration liveTC;
 
@@ -129,8 +129,8 @@
          int batchSize = 33;
          long interval = 44l;
          double intervalMultiplier = 6.0;
-         int retriesBeforeFailover = 8;
-         int retriesAfterFailover = 7;
+         int reconnectAttempts = 8;
+         boolean failoverOnServerShutdown = true;
          int maxConnections = 2;
          int minLargeMessageSize = 101;
          int producerMaxRate = 99;
@@ -149,7 +149,7 @@
                                                                 period, ttl, callTimeout, windowSize1,
                                                                 consumerMaxRate, windowSize, producerMaxRate, minLargeMessageSize,
                                                                 onAcknowledge, blockOnNonPersistentSend, blockOnPersistentSend, autoGroup, maxConnections, preAcknowledge, batchSize, interval,
-                                                                intervalMultiplier, retriesBeforeFailover, retriesAfterFailover);
+                                                                intervalMultiplier, reconnectAttempts, failoverOnServerShutdown);
          assertFactoryParams(cf,
                              batchSize,
                              callTimeout,
@@ -180,8 +180,8 @@
       int batchSize = 33;
       long interval = 44l;
       double intervalMultiplier = 6.0;
-      int retriesBeforeFailover = 8;
-      int retriesAfterFailover = 7;
+      int reconnectAttempts = 8;
+      boolean failoverOnServerShutdown = true;
       int maxConnections = 2;
       int minLargeMessageSize = 101;
       int producerMaxRate = 99;
@@ -205,7 +205,7 @@
                                                                 period, ttl, callTimeout, windowSize1,
                                                                 consumerMaxRate, windowSize, producerMaxRate, minLargeMessageSize,
                                                                 onAcknowledge, blockOnNonPersistentSend, blockOnPersistentSend, autoGroup, maxConnections, preAcknowledge, batchSize, interval,
-                                                                intervalMultiplier, retriesBeforeFailover, retriesAfterFailover);
+                                                                intervalMultiplier, reconnectAttempts, failoverOnServerShutdown);
          assertFactoryParams(cf,
                              batchSize,
                              callTimeout,
@@ -238,9 +238,9 @@
          startLiveAndBackup();
          long interval = 66l;
          double intervalMultiplier = 7.0;
-         int retriesBeforeFailover = 44;
-         int retriesAfterFailover = 33;
-         ClientSessionFactory cf = new ClientSessionFactoryImpl(liveTC, backupTC, interval, intervalMultiplier, retriesBeforeFailover, retriesAfterFailover);
+         int reconnectAttempts = 44;
+         boolean failoverOnServerShutdown = true;
+         ClientSessionFactory cf = new ClientSessionFactoryImpl(liveTC, backupTC, failoverOnServerShutdown, interval, intervalMultiplier, reconnectAttempts);
          assertFactoryParams(cf,
                              ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE,
                              ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT,
@@ -273,9 +273,8 @@
          startLiveAndBackup();
          long interval = 66l;
          double intervalMultiplier = 7.0;
-         int retriesBeforeFailover = 44;
-         int retriesAfterFailover = 33;
-         ClientSessionFactory cf = new ClientSessionFactoryImpl(liveTC, interval, intervalMultiplier, retriesBeforeFailover, retriesAfterFailover);
+         int reconnectAttempts = 44;
+         ClientSessionFactory cf = new ClientSessionFactoryImpl(liveTC, interval, intervalMultiplier, reconnectAttempts);
          assertFactoryParams(cf,
                              ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE,
                              ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT,
@@ -339,8 +338,7 @@
          int batchSize = 33;
          long interval = 44l;
          double intervalMultiplier = 6.0;
-         int retriesBeforeFailover = 8;
-         int retriesAfterFailover = 7;
+         int reconnectAttempts = 8;
          int maxConnections = 2;
          int minLargeMessageSize = 101;
          int producerMaxRate = 99;
@@ -355,13 +353,16 @@
          boolean blockOnPersistentSend = true;
          boolean autoGroup = true;
          boolean preAcknowledge = true;
+         boolean failoverOnServerShutdown = true;
+         
          startLiveAndBackup();
          ClientSessionFactory cf = new ClientSessionFactoryImpl(liveTC, backupTC,
+                                                                failoverOnServerShutdown,
                                                                 org.jboss.messaging.core.client.impl.RandomConnectionLoadBalancingPolicy.class.getName(),
                                                                 period, ttl, callTimeout, windowSize1,
                                                                 consumerMaxRate, windowSize, producerMaxRate, minLargeMessageSize,
                                                                 onAcknowledge, blockOnNonPersistentSend, blockOnPersistentSend, autoGroup, maxConnections, preAcknowledge, batchSize, interval,
-                                                                intervalMultiplier, retriesBeforeFailover, retriesAfterFailover);
+                                                                intervalMultiplier, reconnectAttempts);
 
          assertFactoryParams(cf,
                              batchSize,
@@ -569,9 +570,9 @@
 
       ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration(NettyConnectorFactory.class.getName()),
                                                              null,
+                                                             ClientSessionFactoryImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN,
                                                              ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL,
                                                              ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER,
-                                                             ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS,
                                                              ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS);
 
       try
@@ -639,7 +640,7 @@
             .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory",
                                             backupParams));
       backupConf.setBackup(true);
-      backupService = Messaging.newNullStorageMessagingService(backupConf);
+      backupService = Messaging.newNullStorageMessagingServer(backupConf);
       backupService.start();
 
       Configuration liveConf = new ConfigurationImpl();
@@ -676,7 +677,7 @@
       bcConfigs1.add(bcConfig1);
       liveConf.setBroadcastGroupConfigurations(bcConfigs1);
 
-      liveService = Messaging.newNullStorageMessagingService(liveConf);
+      liveService = Messaging.newNullStorageMessagingServer(liveConf);
       liveService.start();
    }
 }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionSendAcknowledgementHandlerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionSendAcknowledgementHandlerTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionSendAcknowledgementHandlerTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -29,7 +29,7 @@
 import org.jboss.messaging.core.client.SendAcknowledgementHandler;
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.message.Message;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -49,7 +49,7 @@
 {
    private static final Logger log = Logger.getLogger(ClientSessionSendAcknowledgementHandlerTest.class);
 
-   private MessagingService messagingService;
+   private MessagingServer server;
 
    private SimpleString address = new SimpleString("address");
 
@@ -60,16 +60,16 @@
    {
       super.setUp();
 
-      messagingService = createService(false);
-      messagingService.start();
+      server = createServer(false);
+      server.start();
    }
 
    @Override
    protected void tearDown() throws Exception
    {
-      if (messagingService != null && messagingService.isStarted())
+      if (server != null && server.isStarted())
       {
-         messagingService.stop();
+         server.stop();
       }
       
       super.tearDown();

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionStopStartTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionStopStartTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionStopStartTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -28,7 +28,7 @@
 import org.jboss.messaging.core.client.ClientSessionFactory;
 import org.jboss.messaging.core.client.MessageHandler;
 import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -42,7 +42,7 @@
 {
    private static final Logger log = Logger.getLogger(ClientConsumerTest.class);
 
-   private MessagingService messagingService;
+   private MessagingServer server;
 
    private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue");
 
@@ -51,17 +51,17 @@
    {
       super.setUp();
 
-      messagingService = createService(false);
+      server = createServer(false);
 
-      messagingService.start();
+      server.start();
    }
 
    @Override
    protected void tearDown() throws Exception
    {
-      messagingService.stop();
+      server.stop();
 
-      messagingService = null;
+      server = null;
 
       super.tearDown();
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ClientSessionTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -32,7 +32,7 @@
 import org.jboss.messaging.core.remoting.FailureListener;
 import org.jboss.messaging.core.remoting.impl.wireformat.SessionBindingQueryResponseMessage;
 import org.jboss.messaging.core.remoting.impl.wireformat.SessionQueueQueryResponseMessage;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.Queue;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
@@ -52,10 +52,10 @@
 
    public void testFailureListener() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         service.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession clientSession = cf.createSession(false, true, true);
          final CountDownLatch latch = new CountDownLatch(1);
@@ -68,24 +68,24 @@
             }
          });
 
-         service.stop();
+         server.stop();
          assertTrue(latch.await(5, TimeUnit.SECONDS));
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }
 
    public void testFailureListenerRemoved() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         service.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession clientSession = cf.createSession(false, true, true);
          class MyFailureListener implements FailureListener
@@ -103,24 +103,24 @@
          clientSession.addFailureListener(listener);
 
          assertTrue(clientSession.removeFailureListener(listener));
-         service.stop();
+         server.stop();
          assertFalse(listener.called);
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }
 
    public void testBindingQuery() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         service.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession clientSession = cf.createSession(false, true, true);
          clientSession.createQueue("a1", "q1", false);
@@ -146,19 +146,19 @@
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }
 
    public void testQueueQuery() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         service.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession clientSession = cf.createSession(false, true, true);
          clientSession.createQueue("a1", queueName, false);
@@ -176,19 +176,19 @@
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }
 
    public void testQueueQueryWithFilter() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         service.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession clientSession = cf.createSession(false, true, true);
          clientSession.createQueue("a1", queueName, "foo=bar", false);
@@ -203,19 +203,19 @@
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }
 
     public void testQueueQueryNoQ() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         service.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession clientSession = cf.createSession(false, true, true);
          SessionQueueQueryResponseMessage resp = clientSession.queueQuery(new SimpleString(queueName));
@@ -225,19 +225,19 @@
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }
 
    public void testClose() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         service.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession clientSession = cf.createSession(false, true, true);
          clientSession.createQueue(queueName, queueName, false);
@@ -254,19 +254,19 @@
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }
 
    public void testCreateClientMessageNonDurable() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         service.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession clientSession = cf.createSession(false, true, true);
          ClientMessage clientMessage = clientSession.createClientMessage(false);
@@ -275,19 +275,19 @@
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }
 
    public void testCreateClientMessageDurable() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         service.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession clientSession = cf.createSession(false, true, true);
          ClientMessage clientMessage = clientSession.createClientMessage(true);
@@ -296,19 +296,19 @@
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }
 
    public void testCreateClientMessageType() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         service.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession clientSession = cf.createSession(false, true, true);
          ClientMessage clientMessage = clientSession.createClientMessage((byte) 99, false);
@@ -317,19 +317,19 @@
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }
 
    public void testCreateClientMessageOverrides() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         service.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession clientSession = cf.createSession(false, true, true);
          ClientMessage clientMessage = clientSession.createClientMessage((byte) 88, false, 100l, 300l, (byte) 33);
@@ -341,19 +341,19 @@
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }
 
    public void testCreateClientFileMessageNonDurable() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         service.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession clientSession = cf.createSession(false, true, true);
          ClientFileMessageInternal clientMessage = (ClientFileMessageInternal) clientSession.createFileMessage(false);
@@ -362,19 +362,19 @@
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }
 
    public void testCreateClientFileMessageDurable() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         service.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession clientSession = cf.createSession(false, true, true);
          ClientFileMessageInternal clientMessage = (ClientFileMessageInternal) clientSession.createFileMessage(true);
@@ -383,39 +383,39 @@
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }
 
    public void testGetVersion() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         service.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSession clientSession = cf.createSession(false, true, true);
-         assertEquals(service.getServer().getVersion().getIncrementingVersion(), clientSession.getVersion());
+         assertEquals(server.getVersion().getIncrementingVersion(), clientSession.getVersion());
          clientSession.close();
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }
 
    public void testStart() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         service.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSessionImpl clientSession = (ClientSessionImpl) cf.createSession(false, true, true);
          clientSession.createQueue(queueName, queueName, false);
@@ -424,19 +424,19 @@
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }
 
    public void testStop() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         service.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSessionImpl clientSession = (ClientSessionImpl) cf.createSession(false, true, true);
          clientSession.createQueue(queueName, queueName, false);
@@ -446,19 +446,19 @@
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }
 
    public void testCommitWithSend() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         service.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSessionImpl clientSession = (ClientSessionImpl) cf.createSession(false, false, true);
          clientSession.createQueue(queueName, queueName, false);
@@ -473,7 +473,7 @@
          cp.send(clientSession.createClientMessage(false));
          cp.send(clientSession.createClientMessage(false));
          cp.send(clientSession.createClientMessage(false));
-         Queue q = (Queue) service.getServer().getPostOffice().getBinding(new SimpleString(queueName)).getBindable();
+         Queue q = (Queue) server.getPostOffice().getBinding(new SimpleString(queueName)).getBindable();
          assertEquals(0, q.getMessageCount());
          clientSession.commit();
          assertEquals(10, q.getMessageCount());
@@ -481,19 +481,19 @@
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }
 
    public void testRollbackWithSend() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         service.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          ClientSessionImpl clientSession = (ClientSessionImpl) cf.createSession(false, false, true);
          clientSession.createQueue(queueName, queueName, false);
@@ -508,7 +508,7 @@
          cp.send(clientSession.createClientMessage(false));
          cp.send(clientSession.createClientMessage(false));
          cp.send(clientSession.createClientMessage(false));
-         Queue q = (Queue) service.getServer().getPostOffice().getBinding(new SimpleString(queueName)).getBindable();
+         Queue q = (Queue) server.getPostOffice().getBinding(new SimpleString(queueName)).getBindable();
          assertEquals(0, q.getMessageCount());
          clientSession.rollback();
          cp.send(clientSession.createClientMessage(false));
@@ -519,19 +519,19 @@
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }
 
    public void testCommitWithReceive() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         service.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          cf.setBlockOnNonPersistentSend(true);
          cf.setBlockOnPersistentSend(true);
@@ -549,7 +549,7 @@
          cp.send(clientSession.createClientMessage(false));
          cp.send(clientSession.createClientMessage(false));
          cp.send(clientSession.createClientMessage(false));
-         Queue q = (Queue) service.getServer().getPostOffice().getBinding(new SimpleString(queueName)).getBindable();
+         Queue q = (Queue) server.getPostOffice().getBinding(new SimpleString(queueName)).getBindable();
          assertEquals(10, q.getMessageCount());
          ClientConsumer cc = clientSession.createConsumer(queueName);
          clientSession.start();
@@ -590,19 +590,19 @@
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }
 
    public void testRollbackWithReceive() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
       try
       {
-         service.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          cf.setBlockOnNonPersistentSend(true);
          cf.setBlockOnPersistentSend(true);
@@ -620,7 +620,7 @@
          cp.send(clientSession.createClientMessage(false));
          cp.send(clientSession.createClientMessage(false));
          cp.send(clientSession.createClientMessage(false));
-         Queue q = (Queue) service.getServer().getPostOffice().getBinding(new SimpleString(queueName)).getBindable();
+         Queue q = (Queue) server.getPostOffice().getBinding(new SimpleString(queueName)).getBindable();
          assertEquals(10, q.getMessageCount());
          ClientConsumer cc = clientSession.createConsumer(queueName);
          clientSession.start();
@@ -661,9 +661,9 @@
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ConsumerWindowSizeTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ConsumerWindowSizeTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ConsumerWindowSizeTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -31,7 +31,7 @@
 import org.jboss.messaging.core.client.ClientSessionFactory;
 import org.jboss.messaging.core.client.MessageHandler;
 import org.jboss.messaging.core.client.impl.ClientConsumerInternal;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -54,7 +54,7 @@
    * */
    public void testSendWindowSize() throws Exception
    {
-      MessagingService messagingService = createService(false);
+      MessagingServer messagingService = createServer(false);
       ClientSessionFactory cf = createInVMFactory();
       try
       {
@@ -111,7 +111,7 @@
 
    public void testSlowConsumerBufferingOne() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
 
       ClientSession sessionB = null;
       ClientSession session = null;
@@ -120,7 +120,7 @@
       {
          final int numberOfMessages = 100;
 
-         service.start();
+         server.start();
 
          ClientSessionFactory sf = createInVMFactory();
          sf.setConsumerWindowSize(1);
@@ -164,7 +164,7 @@
          sessionB.close();
          sessionB = null;
 
-         assertEquals(0, getMessageCount(service, ADDRESS.toString()));
+         assertEquals(0, getMessageCount(server, ADDRESS.toString()));
 
       }
       finally
@@ -184,9 +184,9 @@
          {
          }
 
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }
@@ -203,7 +203,7 @@
 
    private void internalTestSlowConsumerNoBuffer(final boolean largeMessages) throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
 
       ClientSession sessionB = null;
       ClientSession session = null;
@@ -212,7 +212,7 @@
       {
          final int numberOfMessages = 100;
 
-         service.start();
+         server.start();
 
          ClientSessionFactory sf = createInVMFactory();
          sf.setConsumerWindowSize(0);
@@ -267,7 +267,7 @@
          sessionB.close();
          sessionB = null;
 
-         assertEquals(0, getMessageCount(service, ADDRESS.toString()));
+         assertEquals(0, getMessageCount(server, ADDRESS.toString()));
 
       }
       finally
@@ -287,9 +287,9 @@
          {
          }
 
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }
@@ -306,7 +306,7 @@
 
    private void internalTestSlowConsumerNoBuffer2(final boolean largeMessages) throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
 
       ClientSession session1 = null;
       ClientSession session2 = null;
@@ -315,7 +315,7 @@
       {
          final int numberOfMessages = 100;
 
-         service.start();
+         server.start();
 
          ClientSessionFactory sf = createInVMFactory();
 
@@ -394,7 +394,7 @@
          prod = session1.createProducer(ADDRESS);
 
 
-         assertEquals(0, getMessageCount(service, ADDRESS.toString()));
+         assertEquals(0, getMessageCount(server, ADDRESS.toString()));
 
          // This should also work the other way around
 
@@ -450,7 +450,7 @@
          session1 = null;
          session2.close();
          session2 = null;
-         assertEquals(0, getMessageCount(service, ADDRESS.toString()));
+         assertEquals(0, getMessageCount(server, ADDRESS.toString()));
 
       }
       finally
@@ -470,16 +470,16 @@
          {
          }
 
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }
 
    public void testSlowConsumerOnMessageHandlerNoBuffers() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
 
       ClientSession sessionB = null;
       ClientSession session = null;
@@ -488,7 +488,7 @@
       {
          final int numberOfMessages = 100;
 
-         service.start();
+         server.start();
 
          ClientSessionFactory sf = createInVMFactory();
          sf.setConsumerWindowSize(0);
@@ -588,7 +588,7 @@
          sessionB.close();
          sessionB = null;
 
-         assertEquals(0, getMessageCount(service, ADDRESS.toString()));
+         assertEquals(0, getMessageCount(server, ADDRESS.toString()));
 
          assertFalse("MessageHandler received a failure", handler.failed);
 
@@ -610,9 +610,9 @@
          {
          }
 
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }
@@ -629,7 +629,7 @@
 
    private void internalTestSlowConsumerOnMessageHandlerBufferOne(final boolean largeMessage) throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
 
       ClientSession sessionB = null;
       ClientSession session = null;
@@ -638,7 +638,7 @@
       {
          final int numberOfMessages = 100;
 
-         service.start();
+         server.start();
 
          ClientSessionFactory sf = createInVMFactory();
          sf.setConsumerWindowSize(1);
@@ -749,7 +749,7 @@
          sessionB.close();
          sessionB = null;
 
-         assertEquals(0, getMessageCount(service, ADDRESS.toString()));
+         assertEquals(0, getMessageCount(server, ADDRESS.toString()));
 
          assertFalse("MessageHandler received a failure", handler.failed);
 
@@ -771,9 +771,9 @@
          {
          }
 
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }
@@ -791,7 +791,7 @@
    private void testNoWindowRoundRobin(final boolean largeMessages) throws Exception
    {
 
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
 
       ClientSession sessionA = null;
       ClientSession sessionB = null;
@@ -800,7 +800,7 @@
       {
          final int numberOfMessages = 100;
 
-         service.start();
+         server.start();
 
          ClientSessionFactory sf = createInVMFactory();
          sf.setConsumerWindowSize(-1);
@@ -886,9 +886,9 @@
          {
          }
 
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/CoreClientTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/CoreClientTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/CoreClientTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -34,7 +34,7 @@
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.jms.client.JBossTextMessage;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
@@ -75,9 +75,9 @@
       
       conf.getAcceptorConfigurations().add(new TransportConfiguration(acceptorFactoryClassName));
             
-      MessagingService messagingService = Messaging.newNullStorageMessagingService(conf);   
+      MessagingServer server = Messaging.newNullStorageMessagingServer(conf);   
            
-      messagingService.start();
+      server.start();
       
       ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration(connectorFactoryClassName));
 
@@ -114,7 +114,7 @@
       
       session.close();
       
-      messagingService.stop();
+      server.stop();
    }
 
    // Package protected ---------------------------------------------

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/DeadLetterAddressTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/DeadLetterAddressTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/DeadLetterAddressTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -40,7 +40,7 @@
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.message.impl.MessageImpl;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.Queue;
 import org.jboss.messaging.core.settings.impl.AddressSettings;
 import org.jboss.messaging.core.transaction.impl.XidImpl;
@@ -52,7 +52,7 @@
  */
 public class DeadLetterAddressTest extends UnitTestCase
 {
-   private MessagingService messagingService;
+   private MessagingServer server;
 
    private ClientSession clientSession;
 
@@ -64,7 +64,7 @@
       AddressSettings addressSettings = new AddressSettings();
       addressSettings.setMaxDeliveryAttempts(1);
       addressSettings.setDeadLetterAddress(dla);
-      messagingService.getServer().getAddressSettingsRepository().addMatch(qName.toString(), addressSettings);
+      server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings);
       SimpleString dlq = new SimpleString("DLQ1");
       clientSession.createQueue(dla, dlq, null, false);
       clientSession.createQueue(qName, qName, null, false);
@@ -97,7 +97,7 @@
       AddressSettings addressSettings = new AddressSettings();
       addressSettings.setMaxDeliveryAttempts(1);
       addressSettings.setDeadLetterAddress(dla);
-      messagingService.getServer().getAddressSettingsRepository().addMatch(qName.toString(), addressSettings);
+      server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings);
       SimpleString dlq = new SimpleString("DLQ1");
       SimpleString dlq2 = new SimpleString("DLQ2");
       clientSession.createQueue(dla, dlq, null, false);
@@ -139,7 +139,7 @@
       SimpleString qName = new SimpleString("q1");
       AddressSettings addressSettings = new AddressSettings();
       addressSettings.setMaxDeliveryAttempts(1);
-      messagingService.getServer().getAddressSettingsRepository().addMatch(qName.toString(), addressSettings);
+      server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings);
       clientSession.createQueue(qName, qName, null, false);
       ClientProducer producer = clientSession.createProducer(qName);
       producer.send(createTextMessage("heyho!", clientSession));
@@ -168,7 +168,7 @@
       AddressSettings addressSettings = new AddressSettings();
       addressSettings.setMaxDeliveryAttempts(MAX_DELIVERIES);
       addressSettings.setDeadLetterAddress(dla);
-      messagingService.getServer().getAddressSettingsRepository().addMatch(qName.toString(), addressSettings);
+      server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings);
       SimpleString dlq = new SimpleString("DLQ1");
       clientSession.createQueue(dla, dlq, null, false);
       clientSession.createQueue(qName, qName, null, false);
@@ -205,7 +205,7 @@
          clientSession.rollback(xid);
       }
       
-      assertEquals(0, ((Queue)messagingService.getServer().getPostOffice().getBinding(qName).getBindable()).getMessageCount());
+      assertEquals(0, ((Queue)server.getPostOffice().getBinding(qName).getBindable()).getMessageCount());
       ClientMessage m = clientConsumer.receive(1000);
       assertNull(m);
       //All the messages should now be in the DLQ
@@ -249,7 +249,7 @@
       AddressSettings addressSettings = new AddressSettings();
       addressSettings.setMaxDeliveryAttempts(deliveryAttempt);
       addressSettings.setDeadLetterAddress(deadLetterAdress);
-      messagingService.getServer().getAddressSettingsRepository().setDefault(addressSettings);
+      server.getAddressSettingsRepository().setDefault(addressSettings);
       
       clientSession.createQueue(address, queue, false);
       clientSession.createQueue(deadLetterAdress, deadLetterQueue, false);
@@ -292,7 +292,7 @@
       AddressSettings addressSettings = new AddressSettings();
       addressSettings.setMaxDeliveryAttempts(deliveryAttempt);
       addressSettings.setDeadLetterAddress(deadLetterAdress);
-      messagingService.getServer().getAddressSettingsRepository().addMatch("*", addressSettings);
+      server.getAddressSettingsRepository().addMatch("*", addressSettings);
       
       clientSession.createQueue(address, queue, false);
       clientSession.createQueue(deadLetterAdress, deadLetterQueue, false);
@@ -339,11 +339,11 @@
       AddressSettings defaultAddressSettings = new AddressSettings();
       defaultAddressSettings.setMaxDeliveryAttempts(defaultDeliveryAttempt);
       defaultAddressSettings.setDeadLetterAddress(defaultDeadLetterAddress);
-      messagingService.getServer().getAddressSettingsRepository().addMatch("*", defaultAddressSettings);
+      server.getAddressSettingsRepository().addMatch("*", defaultAddressSettings);
       AddressSettings specificAddressSettings = new AddressSettings();
       specificAddressSettings.setMaxDeliveryAttempts(specificeDeliveryAttempt);
       specificAddressSettings.setDeadLetterAddress(specificDeadLetterAddress);
-      messagingService.getServer().getAddressSettingsRepository().addMatch(address.toString(), specificAddressSettings);
+      server.getAddressSettingsRepository().addMatch(address.toString(), specificAddressSettings);
       
       clientSession.createQueue(address, queue, false);
       clientSession.createQueue(defaultDeadLetterAddress, defaultDeadLetterQueue, false);
@@ -394,9 +394,9 @@
       configuration.setSecurityEnabled(false);
       TransportConfiguration transportConfig = new TransportConfiguration(INVM_ACCEPTOR_FACTORY);
       configuration.getAcceptorConfigurations().add(transportConfig);
-      messagingService = Messaging.newNullStorageMessagingService(configuration);
+      server = Messaging.newNullStorageMessagingServer(configuration);
       //start the server
-      messagingService.start();
+      server.start();
       //then we create a client as normal
       ClientSessionFactory sessionFactory = new ClientSessionFactoryImpl(new TransportConfiguration(INVM_CONNECTOR_FACTORY));
       clientSession = sessionFactory.createSession(true, true, false);
@@ -416,18 +416,18 @@
             //
          }
       }
-      if (messagingService != null && messagingService.isStarted())
+      if (server != null && server.isStarted())
       {
          try
          {
-            messagingService.stop();
+            server.stop();
          }
          catch (Exception e1)
          {
             //
          }
       }
-      messagingService = null;
+      server = null;
       clientSession = null;
       super.tearDown();
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/DurableQueueTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/DurableQueueTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/DurableQueueTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -32,11 +32,9 @@
 import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.config.TransportConfiguration;
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
-import org.jboss.messaging.core.exception.MessagingException;
-import org.jboss.messaging.core.remoting.RemotingConnection;
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -52,7 +50,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingServiceImpl service;
+   private MessagingServer server;
 
    private ClientSession session;
 
@@ -98,8 +96,8 @@
 
       session.close();
       
-      service.stop();
-      service.start();
+      server.stop();
+      server.start();
       
       sf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));
       session = sf.createSession(false, true, true);
@@ -125,8 +123,8 @@
       
       session.close();
       
-      service.stop();
-      service.start();
+      server.stop();
+      server.start();
       
       sf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));
       session = sf.createSession(false, true, true);
@@ -157,8 +155,8 @@
 
       Configuration config = new ConfigurationImpl();
       config.setSecurityEnabled(false);
-      service = Messaging.newMessagingService(config);
-      service.start();
+      server = Messaging.newMessagingServer(config);
+      server.start();
 
       sf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));
       session = sf.createSession(false, true, true);
@@ -169,7 +167,7 @@
    {
       session.close();
 
-      service.stop();
+      server.stop();
 
       super.tearDown();
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ExpiryAddressTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ExpiryAddressTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ExpiryAddressTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -21,6 +21,9 @@
  */
 package org.jboss.messaging.tests.integration.client;
 
+import static org.jboss.messaging.core.message.impl.MessageImpl.HDR_ACTUAL_EXPIRY_TIME;
+import static org.jboss.messaging.tests.util.RandomUtil.randomSimpleString;
+
 import org.jboss.messaging.core.client.ClientConsumer;
 import org.jboss.messaging.core.client.ClientMessage;
 import org.jboss.messaging.core.client.ClientProducer;
@@ -31,13 +34,9 @@
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.logging.Logger;
-import static org.jboss.messaging.core.message.impl.MessageImpl.HDR_ACTUAL_EXPIRY_TIME;
-import static org.jboss.messaging.tests.util.RandomUtil.randomSimpleString;
-
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.settings.impl.AddressSettings;
-import org.jboss.messaging.tests.util.RandomUtil;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -48,7 +47,7 @@
 {
    private static final Logger log = Logger.getLogger(ExpiryAddressTest.class);
 
-   private MessagingService messagingService;
+   private MessagingServer server;
 
    private ClientSession clientSession;
 
@@ -59,7 +58,7 @@
       SimpleString eq = new SimpleString("EA1");
       AddressSettings addressSettings = new AddressSettings();
       addressSettings.setExpiryAddress(ea);
-      messagingService.getServer().getAddressSettingsRepository().addMatch(qName.toString(), addressSettings);
+      server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings);
       clientSession.createQueue(ea, eq, null, false);
       clientSession.createQueue(qName, qName, null, false);
       
@@ -72,7 +71,7 @@
       ClientConsumer clientConsumer = clientSession.createConsumer(qName);
       ClientMessage m = clientConsumer.receive(500);
       assertNull(m);
-      System.out.println("size3 = " + messagingService.getServer().getPostOffice().getPagingManager().getGlobalSize());
+      System.out.println("size3 = " + server.getPostOffice().getPagingManager().getGlobalSize());
       m = clientConsumer.receive(500);
       assertNull(m);
       clientConsumer.close();
@@ -83,7 +82,7 @@
       m.acknowledge();
       
       // PageSize should be the same as when it started
-      assertEquals(0, messagingService.getServer().getPostOffice().getPagingManager().getGlobalSize());
+      assertEquals(0, server.getPostOffice().getPagingManager().getGlobalSize());
    }
 
    public void testBasicSendToMultipleQueues() throws Exception
@@ -94,7 +93,7 @@
       SimpleString eq2 = new SimpleString("EQ2");
       AddressSettings addressSettings = new AddressSettings();
       addressSettings.setExpiryAddress(ea);
-      messagingService.getServer().getAddressSettingsRepository().addMatch(qName.toString(), addressSettings);
+      server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings);
       clientSession.createQueue(ea, eq, null, false);
       clientSession.createQueue(ea, eq2, null, false);
       clientSession.createQueue(qName, qName, null, false);
@@ -102,17 +101,17 @@
       ClientMessage clientMessage = createTextMessage("heyho!", clientSession);
       clientMessage.setExpiration(System.currentTimeMillis());
       
-      System.out.println("initialPageSize = " + messagingService.getServer().getPostOffice().getPagingManager().getGlobalSize());
+      System.out.println("initialPageSize = " + server.getPostOffice().getPagingManager().getGlobalSize());
       
       producer.send(clientMessage);
       
-      System.out.println("pageSize after message sent = " + messagingService.getServer().getPostOffice().getPagingManager().getGlobalSize());
+      System.out.println("pageSize after message sent = " + server.getPostOffice().getPagingManager().getGlobalSize());
       
       clientSession.start();
       ClientConsumer clientConsumer = clientSession.createConsumer(qName);
       ClientMessage m = clientConsumer.receive(500);
       
-      System.out.println("pageSize after message received = " + messagingService.getServer().getPostOffice().getPagingManager().getGlobalSize());
+      System.out.println("pageSize after message received = " + server.getPostOffice().getPagingManager().getGlobalSize());
       
       assertNull(m);
       
@@ -147,7 +146,7 @@
       clientSession.commit();
 
       // PageGlobalSize should be untouched as the message expired
-      assertEquals(0, messagingService.getServer().getPostOffice().getPagingManager().getGlobalSize());
+      assertEquals(0, server.getPostOffice().getPagingManager().getGlobalSize());
    }
 
    public void testBasicSendToNoQueue() throws Exception
@@ -177,7 +176,7 @@
       SimpleString qName = new SimpleString("q1");
       AddressSettings addressSettings = new AddressSettings();
       addressSettings.setExpiryAddress(ea);
-      messagingService.getServer().getAddressSettingsRepository().addMatch(qName.toString(), addressSettings);
+      server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings);
       SimpleString eq = new SimpleString("EA1");
       clientSession.createQueue(ea, eq, null, false);
       clientSession.createQueue(qName, qName, null, false);
@@ -224,7 +223,7 @@
       SimpleString eq = new SimpleString("EA1");
       AddressSettings addressSettings = new AddressSettings();
       addressSettings.setExpiryAddress(ea);
-      messagingService.getServer().getAddressSettingsRepository().setDefault(addressSettings);
+      server.getAddressSettingsRepository().setDefault(addressSettings);
       clientSession.createQueue(ea, eq, null, false);
       clientSession.createQueue(qName, qName, null, false);
       
@@ -254,7 +253,7 @@
       SimpleString eq = new SimpleString("EA1");
       AddressSettings addressSettings = new AddressSettings();
       addressSettings.setExpiryAddress(ea);
-      messagingService.getServer().getAddressSettingsRepository().addMatch("*", addressSettings);
+      server.getAddressSettingsRepository().addMatch("*", addressSettings);
       clientSession.createQueue(ea, eq, null, false);
       clientSession.createQueue(qName, qName, null, false);
       
@@ -287,10 +286,10 @@
 
       AddressSettings defaultAddressSettings = new AddressSettings();
       defaultAddressSettings.setExpiryAddress(defaultExpiryAddress);
-      messagingService.getServer().getAddressSettingsRepository().addMatch("prefix.*", defaultAddressSettings);
+      server.getAddressSettingsRepository().addMatch("prefix.*", defaultAddressSettings);
       AddressSettings specificAddressSettings = new AddressSettings();
       specificAddressSettings.setExpiryAddress(specificExpiryAddress);
-      messagingService.getServer().getAddressSettingsRepository().addMatch("prefix.address", specificAddressSettings);
+      server.getAddressSettingsRepository().addMatch("prefix.address", specificAddressSettings);
 
       clientSession.createQueue(address, queue, false);
       clientSession.createQueue(defaultExpiryAddress, defaultExpiryQueue, false);
@@ -328,9 +327,9 @@
       configuration.setSecurityEnabled(false);
       TransportConfiguration transportConfig = new TransportConfiguration(INVM_ACCEPTOR_FACTORY);
       configuration.getAcceptorConfigurations().add(transportConfig);
-      messagingService = Messaging.newNullStorageMessagingService(configuration);
+      server = Messaging.newNullStorageMessagingServer(configuration);
       // start the server
-      messagingService.start();
+      server.start();
       // then we create a client as normal
       ClientSessionFactory sessionFactory = new ClientSessionFactoryImpl(new TransportConfiguration(INVM_CONNECTOR_FACTORY));
       sessionFactory.setBlockOnAcknowledge(true); // There are assertions over sizes that needs to be done after the ACK was received on server
@@ -351,18 +350,18 @@
             //
          }
       }
-      if (messagingService != null && messagingService.isStarted())
+      if (server != null && server.isStarted())
       {
          try
          {
-            messagingService.stop();
+            server.stop();
          }
          catch (Exception e1)
          {
             //
          }
       }
-      messagingService = null;
+      server = null;
       clientSession = null;
       
       super.tearDown();

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/HeuristicXATest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/HeuristicXATest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/HeuristicXATest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -36,7 +36,7 @@
 import org.jboss.messaging.core.client.ClientSessionFactory;
 import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.management.MessagingServerControlMBean;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.Queue;
 import org.jboss.messaging.core.settings.impl.AddressSettings;
 import org.jboss.messaging.core.transaction.impl.XidImpl;
@@ -73,14 +73,14 @@
       Configuration configuration = createDefaultConfig();
       configuration.setJMXManagementEnabled(true);
 
-      MessagingService service = createService(false,
+      MessagingServer server = createService(false,
                                                configuration,
                                                mbeanServer,
                                                new HashMap<String, AddressSettings>());
 
       try
       {
-         service.start();
+         server.start();
 
          MessagingServerControlMBean jmxServer = ManagementControlHelper.createMessagingServerControl(mbeanServer);
 
@@ -88,9 +88,9 @@
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
 
@@ -111,13 +111,13 @@
       Configuration configuration = createDefaultConfig();
       configuration.setJMXManagementEnabled(true);
 
-      MessagingService service = createService(false,
+      MessagingServer server = createService(false,
                                                configuration,
                                                mbeanServer,
                                                new HashMap<String, AddressSettings>());
       try
       {
-         service.start();
+         server.start();
          Xid xid = newXID();
 
          ClientSessionFactory sf = createInVMFactory();
@@ -165,7 +165,7 @@
          if (isCommit)
          {
             assertEquals(1,
-                         ((Queue)service.getServer().getPostOffice().getBinding(ADDRESS).getBindable()).getMessageCount());
+                         ((Queue)server.getPostOffice().getBinding(ADDRESS).getBindable()).getMessageCount());
 
             session = sf.createSession(false, false, false);
 
@@ -181,14 +181,14 @@
          }
 
          assertEquals(0,
-                      ((Queue)service.getServer().getPostOffice().getBinding(ADDRESS).getBindable()).getMessageCount());
+                      ((Queue)server.getPostOffice().getBinding(ADDRESS).getBindable()).getMessageCount());
 
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/MessageChunkTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/MessageChunkTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/MessageChunkTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -235,9 +235,9 @@
       try
       {
 
-         messagingService = createService(true);
+         server = createServer(true);
 
-         messagingService.start();
+         server.start();
 
          SimpleString queue[] = new SimpleString[] { new SimpleString("queue1"), new SimpleString("queue2") };
 
@@ -292,7 +292,7 @@
       {
          try
          {
-            messagingService.stop();
+            server.stop();
          }
          catch (Throwable ignored)
          {
@@ -321,9 +321,9 @@
       try
       {
 
-         messagingService = createService(true);
+         server = createServer(true);
 
-         messagingService.start();
+         server.start();
 
          SimpleString queue[] = new SimpleString[] { new SimpleString("queue1"), new SimpleString("queue2") };
 
@@ -350,13 +350,13 @@
          {
             session.close();
 
-            messagingService.stop();
+            server.stop();
 
             log.info("Restartning");
 
-            messagingService = createService(true);
+            server = createServer(true);
 
-            messagingService.start();
+            server.start();
 
             sf = createInVMFactory();
 
@@ -373,7 +373,7 @@
       {
          try
          {
-            messagingService.stop();
+            server.stop();
          }
          catch (Throwable ignored)
          {
@@ -396,9 +396,9 @@
    {
       clearData();
 
-      messagingService = createService(true);
+      server = createServer(true);
 
-      messagingService.start();
+      server.start();
 
       ClientSessionFactory sf = createInVMFactory();
 
@@ -438,7 +438,7 @@
 
       validateNoFilesOnLargeDir();
 
-      messagingService.stop();
+      server.stop();
 
    }
 
@@ -462,9 +462,9 @@
       try
       {
 
-         messagingService = createService(true);
+         server = createServer(true);
 
-         messagingService.start();
+         server.start();
 
          ClientSessionFactory sf = createInVMFactory();
 
@@ -577,7 +577,7 @@
       {
          try
          {
-            messagingService.stop();
+            server.stop();
          }
          catch (Throwable ignored)
          {
@@ -615,9 +615,9 @@
       config.setPagingMaxGlobalSizeBytes(20 * 1024);
       config.setPagingGlobalWatermarkSize(10 * 1024);
 
-      messagingService = createService(realFiles, config, new HashMap<String, AddressSettings>());
+      server = createServer(realFiles, config, new HashMap<String, AddressSettings>());
 
-      messagingService.start();
+      server.start();
 
       final int numberOfIntegers = 256;
 
@@ -674,10 +674,10 @@
 
          if (realFiles)
          {
-            messagingService.stop();
+            server.stop();
 
-            messagingService = createService(true, config, new HashMap<String, AddressSettings>());
-            messagingService.start();
+            server = createServer(true, config, new HashMap<String, AddressSettings>());
+            server.start();
 
             sf = createInVMFactory();
          }
@@ -728,7 +728,7 @@
       {
          try
          {
-            messagingService.stop();
+            server.stop();
          }
          catch (Throwable ignored)
          {

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/MessageDurabilityTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/MessageDurabilityTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/MessageDurabilityTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -34,7 +34,7 @@
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -52,7 +52,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingServiceImpl service;
+   private MessagingServer server;
 
    private ClientSession session;
 
@@ -199,9 +199,10 @@
 
       Configuration config = new ConfigurationImpl();
       config.setSecurityEnabled(false);
+
       config.setJournalMinFiles(2);
-      service = Messaging.newMessagingService(config);
-      service.start();
+      server = Messaging.newMessagingServer(config);
+      server.start();
 
       sf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));
       session = sf.createSession(false, true, true);
@@ -212,7 +213,7 @@
    {
       session.close();
 
-      service.stop();
+      server.stop();
 
       super.tearDown();
    }
@@ -223,8 +224,8 @@
    {
       session.close();
 
-      service.stop();
-      service.start();
+      server.stop();
+      server.start();
 
       sf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));
       session = sf.createSession(false, true, true);

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/MessageExpirationTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/MessageExpirationTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/MessageExpirationTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -36,7 +36,7 @@
 import org.jboss.messaging.core.message.impl.MessageImpl;
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.settings.impl.AddressSettings;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
@@ -57,7 +57,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingServiceImpl service;
+   private MessagingServer server;
 
    private ClientSession session;
 
@@ -100,7 +100,7 @@
 
       session.createQueue(address, queue, false);
       session.createQueue(expiryAddress, expiryQueue, false);
-      service.getServer().getAddressSettingsRepository().addMatch(address.toString(), new AddressSettings()
+      server.getAddressSettingsRepository().addMatch(address.toString(), new AddressSettings()
       {
          @Override
          public SimpleString getExpiryAddress()
@@ -143,8 +143,8 @@
 
       Configuration config = new ConfigurationImpl();
       config.setSecurityEnabled(false);
-      service = Messaging.newMessagingService(config);
-      service.start();
+      server = Messaging.newMessagingServer(config);
+      server.start();
 
       ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));
       session = sf.createSession(false, true, true);
@@ -155,7 +155,7 @@
    {
       session.close();
 
-      service.stop();
+      server.stop();
 
       super.tearDown();
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/MessageGroupingTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/MessageGroupingTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/MessageGroupingTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -33,7 +33,7 @@
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.message.impl.MessageImpl;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.impl.GroupingRoundRobinDistributor;
 import org.jboss.messaging.core.settings.impl.AddressSettings;
 import org.jboss.messaging.core.transaction.impl.XidImpl;
@@ -51,7 +51,7 @@
  */
 public class MessageGroupingTest extends UnitTestCase
 {
-   private MessagingService messagingService;
+   private MessagingServer server;
 
    private ClientSession clientSession;
 
@@ -529,18 +529,18 @@
             //
          }
       }
-      if (messagingService != null && messagingService.isStarted())
+      if (server != null && server.isStarted())
       {
          try
          {
-            messagingService.stop();
+            server.stop();
          }
          catch (Exception e1)
          {
             //
          }
       }
-      messagingService = null;
+      server = null;
       clientSession = null;
       
       super.tearDown();
@@ -554,13 +554,13 @@
       configuration.setSecurityEnabled(false);
       TransportConfiguration transportConfig = new TransportConfiguration(INVM_ACCEPTOR_FACTORY);
       configuration.getAcceptorConfigurations().add(transportConfig);
-      messagingService = Messaging.newNullStorageMessagingService(configuration);
+      server = Messaging.newNullStorageMessagingServer(configuration);
       // start the server
-      messagingService.start();
+      server.start();
 
       AddressSettings qs = new AddressSettings();
       qs.setDistributionPolicyClass(GroupingRoundRobinDistributor.class.getName());
-      messagingService.getServer().getAddressSettingsRepository().addMatch(qName.toString(), qs);
+      server.getAddressSettingsRepository().addMatch(qName.toString(), qs);
       // then we create a client as normal
       ClientSessionFactory sessionFactory = new ClientSessionFactoryImpl(new TransportConfiguration(INVM_CONNECTOR_FACTORY));
       clientSession = sessionFactory.createSession(false, true, true);

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/MessagePriorityTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/MessagePriorityTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/MessagePriorityTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -35,7 +35,7 @@
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -51,7 +51,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingServiceImpl service;
+   private MessagingServer server;
 
    private ClientSession session;
 
@@ -223,8 +223,8 @@
 
       Configuration config = new ConfigurationImpl();
       config.setSecurityEnabled(false);
-      service = Messaging.newNullStorageMessagingService(config);
-      service.start();
+      server = Messaging.newNullStorageMessagingServer(config);
+      server.start();
 
       ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));
       sf.setBlockOnNonPersistentSend(true);
@@ -237,7 +237,7 @@
    {
       session.close();
 
-      service.stop();
+      server.stop();
 
       super.tearDown();
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/MessageRateTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/MessageRateTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/MessageRateTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -26,8 +26,13 @@
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import org.jboss.messaging.core.client.*;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.client.ClientConsumer;
+import org.jboss.messaging.core.client.ClientMessage;
+import org.jboss.messaging.core.client.ClientProducer;
+import org.jboss.messaging.core.client.ClientSession;
+import org.jboss.messaging.core.client.ClientSessionFactory;
+import org.jboss.messaging.core.client.MessageHandler;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -55,11 +60,11 @@
 
    public void testProduceRate() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
 
       try
       {
-         service.start();
+         server.start();
 
          ClientSessionFactory sf = createInVMFactory();
          sf.setProducerMaxRate(10);
@@ -81,9 +86,9 @@
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
 
@@ -92,11 +97,11 @@
 
    public void testConsumeRate() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
 
       try
       {
-         service.start();
+         server.start();
 
          ClientSessionFactory sf = createInVMFactory();
          sf.setConsumerMaxRate(10);
@@ -132,9 +137,9 @@
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
 
@@ -143,11 +148,11 @@
 
    public void testConsumeRateListener() throws Exception
    {
-      MessagingService service = createService(false);
+      MessagingServer server = createServer(false);
 
       try
       {
-         service.start();
+         server.start();
 
          ClientSessionFactory sf = createInVMFactory();
          sf.setConsumerMaxRate(10);
@@ -201,9 +206,9 @@
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/PagingTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/PagingTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/PagingTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -37,7 +37,7 @@
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.message.impl.MessageImpl;
 import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.Queue;
 import org.jboss.messaging.core.settings.impl.AddressSettings;
 import org.jboss.messaging.tests.util.ServiceTestBase;
@@ -80,9 +80,9 @@
       config.setPagingMaxGlobalSizeBytes(100 * 1024);
       config.setPagingGlobalWatermarkSize(10 * 1024);
 
-      MessagingService messagingService = createService(true, config, new HashMap<String, AddressSettings>());
+      MessagingServer server = createServer(true, config, new HashMap<String, AddressSettings>());
 
-      messagingService.start();
+      server.start();
 
       final int numberOfIntegers = 256;
 
@@ -129,14 +129,14 @@
 
          session.close();
 
-         messagingService.stop();
+         server.stop();
 
-         messagingService = createService(true, config, new HashMap<String, AddressSettings>());
-         messagingService.start();
+         server = createServer(true, config, new HashMap<String, AddressSettings>());
+         server.start();
 
          sf = createInVMFactory();
 
-         assertTrue(messagingService.getServer().getPostOffice().getPagingManager().getGlobalSize() > 0);
+         assertTrue(server.getPostOffice().getPagingManager().getGlobalSize() > 0);
 
          session = sf.createSession(null, null, false, true, true, false, 0);
 
@@ -172,14 +172,14 @@
 
          session.close();
 
-         assertEquals(0, messagingService.getServer().getPostOffice().getPagingManager().getGlobalSize());
+         assertEquals(0, server.getPostOffice().getPagingManager().getGlobalSize());
 
       }
       finally
       {
          try
          {
-            messagingService.stop();
+            server.stop();
          }
          catch (Throwable ignored)
          {
@@ -205,9 +205,9 @@
       config.setPagingMaxGlobalSizeBytes(100 * 1024);
       config.setPagingGlobalWatermarkSize(10 * 1024);
 
-      MessagingService messagingService = createService(true, config, new HashMap<String, AddressSettings>());
+      MessagingServer server = createServer(true, config, new HashMap<String, AddressSettings>());
 
-      messagingService.start();
+      server.start();
 
       final int numberOfIntegers = 256;
 
@@ -236,7 +236,7 @@
             message.setBody(bodyLocal);
 
             // Stop sending message as soon as we start paging
-            if (messagingService.getServer().getPostOffice().getPagingManager().isPaging(ADDRESS))
+            if (server.getPostOffice().getPagingManager().isPaging(ADDRESS))
             {
                break;
             }
@@ -245,7 +245,7 @@
             producer.send(message);
          }
 
-         assertTrue(messagingService.getServer().getPostOffice().getPagingManager().isPaging(ADDRESS));
+         assertTrue(server.getPostOffice().getPagingManager().isPaging(ADDRESS));
 
          session.start();
 
@@ -309,14 +309,14 @@
 
          session.close();
 
-         assertEquals(0, messagingService.getServer().getPostOffice().getPagingManager().getGlobalSize());
+         assertEquals(0, server.getPostOffice().getPagingManager().getGlobalSize());
 
       }
       finally
       {
          try
          {
-            messagingService.stop();
+            server.stop();
          }
          catch (Throwable ignored)
          {
@@ -344,9 +344,9 @@
       config.setPagingMaxGlobalSizeBytes(100 * 1024);
       config.setPagingGlobalWatermarkSize(10 * 1024);
 
-      MessagingService messagingService = createService(true, config, new HashMap<String, AddressSettings>());
+      MessagingServer server = createServer(true, config, new HashMap<String, AddressSettings>());
 
-      messagingService.start();
+      server.start();
 
       final int numberOfIntegers = 256;
 
@@ -392,7 +392,7 @@
             message.putIntProperty(new SimpleString("id"), i);
 
             // Worse scenario possible... only schedule what's on pages
-            if (messagingService.getServer().getPostOffice().getPagingManager().isPaging(ADDRESS))
+            if (server.getPostOffice().getPagingManager().isPaging(ADDRESS))
             {
                message.putLongProperty(MessageImpl.HDR_SCHEDULED_DELIVERY_TIME, scheduledTime);
             }
@@ -404,10 +404,10 @@
          {
             session.close();
 
-            messagingService.stop();
+            server.stop();
 
-            messagingService = createService(true, config, new HashMap<String, AddressSettings>());
-            messagingService.start();
+            server = createServer(true, config, new HashMap<String, AddressSettings>());
+            server.start();
 
             sf = createInVMFactory();
 
@@ -450,14 +450,14 @@
 
          session.close();
 
-         assertEquals(0, messagingService.getServer().getPostOffice().getPagingManager().getGlobalSize());
+         assertEquals(0, server.getPostOffice().getPagingManager().getGlobalSize());
 
       }
       finally
       {
          try
          {
-            messagingService.stop();
+            server.stop();
          }
          catch (Throwable ignored)
          {
@@ -475,9 +475,9 @@
       config.setPagingMaxGlobalSizeBytes(100 * 1024);
       config.setPagingGlobalWatermarkSize(10 * 1024);
 
-      MessagingService messagingService = createService(true, config, new HashMap<String, AddressSettings>());
+      MessagingServer server = createServer(true, config, new HashMap<String, AddressSettings>());
 
-      messagingService.start();
+      server.start();
 
       final int numberOfIntegers = 256;
 
@@ -497,7 +497,7 @@
 
          ClientProducer producer = session.createProducer(ADDRESS);
 
-         long initialSize = messagingService.getServer().getPostOffice().getPagingManager().getGlobalSize();
+         long initialSize = server.getPostOffice().getPagingManager().getGlobalSize();
 
          ClientMessage message = null;
 
@@ -527,13 +527,13 @@
 
          session.close();
 
-         assertEquals(initialSize, messagingService.getServer().getPostOffice().getPagingManager().getGlobalSize());
+         assertEquals(initialSize, server.getPostOffice().getPagingManager().getGlobalSize());
       }
       finally
       {
          try
          {
-            messagingService.stop();
+            server.stop();
          }
          catch (Throwable ignored)
          {
@@ -551,9 +551,9 @@
       config.setPagingMaxGlobalSizeBytes(100 * 1024);
       config.setPagingGlobalWatermarkSize(10 * 1024);
 
-      MessagingService messagingService = createService(true, config, new HashMap<String, AddressSettings>());
+      MessagingServer server = createServer(true, config, new HashMap<String, AddressSettings>());
 
-      messagingService.start();
+      server.start();
 
       final int numberOfIntegers = 10;
 
@@ -573,7 +573,7 @@
 
          ClientProducer producer = session.createProducer(ADDRESS);
 
-         long initialSize = messagingService.getServer().getPostOffice().getPagingManager().getGlobalSize();
+         long initialSize = server.getPostOffice().getPagingManager().getGlobalSize();
 
          ClientMessage message = null;
 
@@ -609,13 +609,13 @@
 
          session.close();
 
-         assertEquals(initialSize, messagingService.getServer().getPostOffice().getPagingManager().getGlobalSize());
+         assertEquals(initialSize, server.getPostOffice().getPagingManager().getGlobalSize());
       }
       finally
       {
          try
          {
-            messagingService.stop();
+            server.stop();
          }
          catch (Throwable ignored)
          {
@@ -670,9 +670,9 @@
 
       config.setPagingGlobalWatermarkSize(10 * 1024);
 
-      MessagingService messagingService = createService(true, config, settings);
+      MessagingServer server = createServer(true, config, settings);
 
-      messagingService.start();
+      server.start();
 
       final int numberOfMessages = 1000;
 
@@ -719,8 +719,8 @@
 
          assertNull(consumer.receive(100));
 
-         assertEquals(0, messagingService.getServer().getPostOffice().getPagingManager().getGlobalSize());
-         assertEquals(0, messagingService.getServer()
+         assertEquals(0, server.getPostOffice().getPagingManager().getGlobalSize());
+         assertEquals(0, server
                                          .getPostOffice()
                                          .getPagingManager()
                                          .getPageStore(ADDRESS)
@@ -784,8 +784,8 @@
 
          session.close();
 
-         assertEquals(0, messagingService.getServer().getPostOffice().getPagingManager().getGlobalSize());
-         assertEquals(0, messagingService.getServer()
+         assertEquals(0, server.getPostOffice().getPagingManager().getGlobalSize());
+         assertEquals(0, server
                                          .getPostOffice()
                                          .getPagingManager()
                                          .getPageStore(ADDRESS)
@@ -796,7 +796,7 @@
       {
          try
          {
-            messagingService.stop();
+            server.stop();
          }
          catch (Throwable ignored)
          {
@@ -816,9 +816,9 @@
       config.setPagingMaxGlobalSizeBytes(100 * 1024);
       config.setPagingGlobalWatermarkSize(10 * 1024);
 
-      MessagingService messagingService = createService(true, config, new HashMap<String, AddressSettings>());
+      MessagingServer server = createServer(true, config, new HashMap<String, AddressSettings>());
 
-      messagingService.start();
+      server.start();
 
       try
       {
@@ -856,14 +856,14 @@
 
          session.close();
 
-         messagingService.stop();
+         server.stop();
 
-         messagingService = createService(true, config, new HashMap<String, AddressSettings>());
-         messagingService.start();
+         server = createServer(true, config, new HashMap<String, AddressSettings>());
+         server.start();
 
          sf = createInVMFactory();
 
-         assertTrue(messagingService.getServer().getPostOffice().getPagingManager().getGlobalSize() > 0);
+         assertTrue(server.getPostOffice().getPagingManager().getGlobalSize() > 0);
 
          session = sf.createSession(null, null, false, true, true, false, 0);
 
@@ -893,7 +893,7 @@
 
          for (int i = 0; i < NUMBER_OF_BINDINGS; i++)
          {
-            Queue queue = (Queue)messagingService.getServer()
+            Queue queue = (Queue)server
                                                  .getPostOffice()
                                                  .getBinding(new SimpleString("someQueue" + i))
                                                  .getBindable();
@@ -902,7 +902,7 @@
             assertEquals("Queue someQueue" + i + " was supposed to be empty", 0, queue.getDeliveringCount());
          }
 
-         assertEquals("There are pending messages on the server", 0, messagingService.getServer()
+         assertEquals("There are pending messages on the server", 0, server
                                                                                      .getPostOffice()
                                                                                      .getPagingManager()
                                                                                      .getGlobalSize());
@@ -912,7 +912,7 @@
       {
          try
          {
-            messagingService.stop();
+            server.stop();
          }
          catch (Throwable ignored)
          {
@@ -941,11 +941,11 @@
 
       addresses.put(PAGED_ADDRESS.toString(), pagedDestination);
 
-      MessagingService service = createService(true, configuration, addresses);
+      MessagingServer server = createServer(true, configuration, addresses);
 
       try
       {
-         service.start();
+         server.start();
 
          ClientSessionFactory sf = createInVMFactory();
 
@@ -971,8 +971,8 @@
 
          session.close();
 
-         assertTrue(service.getServer().getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS).isPaging());
-         assertFalse(service.getServer().getPostOffice().getPagingManager().getPageStore(NON_PAGED_ADDRESS).isPaging());
+         assertTrue(server.getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS).isPaging());
+         assertFalse(server.getPostOffice().getPagingManager().getPageStore(NON_PAGED_ADDRESS).isPaging());
 
          session = sf.createSession(false, true, false);
 
@@ -1013,17 +1013,17 @@
 
          assertNull(consumerPaged.receiveImmediate());
 
-         assertFalse(service.getServer().getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS).isPaging());
-         assertFalse(service.getServer().getPostOffice().getPagingManager().getPageStore(NON_PAGED_ADDRESS).isPaging());
+         assertFalse(server.getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS).isPaging());
+         assertFalse(server.getPostOffice().getPagingManager().getPageStore(NON_PAGED_ADDRESS).isPaging());
 
          session.close();
 
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }
@@ -1056,11 +1056,11 @@
 
       addresses.put(PAGED_ADDRESS_B.toString(), pagedDestinationB);
 
-      MessagingService service = createService(true, configuration, addresses);
+      MessagingServer server = createServer(true, configuration, addresses);
 
       try
       {
-         service.start();
+         server.start();
 
          ClientSessionFactory sf = createInVMFactory();
 
@@ -1086,8 +1086,8 @@
 
          session.commit(); // commit was called to clean the buffer only (making sure everything is on the server side)
 
-         assertTrue(service.getServer().getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_A).isPaging());
-         assertFalse(service.getServer().getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_B).isPaging());
+         assertTrue(server.getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_A).isPaging());
+         assertFalse(server.getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_B).isPaging());
 
          for (int i = 0; i < NUMBER_MESSAGES_BEFORE_PAGING; i++)
          {
@@ -1100,8 +1100,8 @@
 
          session.commit(); // commit was called to clean the buffer only (making sure everything is on the server side)
 
-         assertTrue(service.getServer().getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_A).isPaging());
-         assertTrue(service.getServer().getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_B).isPaging());
+         assertTrue(server.getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_A).isPaging());
+         assertTrue(server.getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_B).isPaging());
 
          for (int i = NUMBER_MESSAGES_BEFORE_PAGING * 2; i < NUMBER_OF_MESSAGES; i++)
          {
@@ -1114,8 +1114,8 @@
 
          session.close();
 
-         assertTrue(service.getServer().getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_A).isPaging());
-         assertTrue(service.getServer().getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_B).isPaging());
+         assertTrue(server.getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_A).isPaging());
+         assertTrue(server.getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_B).isPaging());
 
          session = sf.createSession(null, null, false, true, true, false, 0);
 
@@ -1136,7 +1136,7 @@
 
          consumerA.close();
 
-         assertTrue(service.getServer().getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_B).isPaging());
+         assertTrue(server.getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_B).isPaging());
 
          for (int i = 0; i < NUMBER_OF_MESSAGES; i++)
          {
@@ -1155,9 +1155,9 @@
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }
@@ -1191,11 +1191,11 @@
 
       addresses.put(PAGED_ADDRESS_B.toString(), pagedDestinationB);
 
-      MessagingService service = createService(true, configuration, addresses);
+      MessagingServer server = createServer(true, configuration, addresses);
 
       try
       {
-         service.start();
+         server.start();
 
          ClientSessionFactory sf = createInVMFactory();
 
@@ -1223,8 +1223,8 @@
 
          session.commit(); // commit was called to clean the buffer only (making sure everything is on the server side)
 
-         assertTrue(service.getServer().getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_A).isPaging());
-         assertFalse(service.getServer().getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_B).isPaging());
+         assertTrue(server.getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_A).isPaging());
+         assertFalse(server.getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_B).isPaging());
 
          for (int i = 0; i < NUMBER_MESSAGES_BEFORE_PAGING; i++)
          {
@@ -1237,8 +1237,8 @@
 
          session.commit(); // commit was called to clean the buffer only (making sure everything is on the server side)
 
-         assertTrue(service.getServer().getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_A).isPaging());
-         assertTrue(service.getServer().getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_B).isPaging());
+         assertTrue(server.getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_A).isPaging());
+         assertTrue(server.getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_B).isPaging());
 
          for (int i = NUMBER_MESSAGES_BEFORE_PAGING * 2; i < NUMBER_OF_MESSAGES; i++)
          {
@@ -1251,8 +1251,8 @@
 
          session.close();
 
-         assertTrue(service.getServer().getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_A).isPaging());
-         assertTrue(service.getServer().getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_B).isPaging());
+         assertTrue(server.getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_A).isPaging());
+         assertTrue(server.getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_B).isPaging());
 
          session = sf.createSession(null, null, false, true, true, false, 0);
 
@@ -1275,8 +1275,8 @@
 
          session.commit();
 
-         assertFalse(service.getServer().getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_A).isPaging());
-         assertTrue(service.getServer().getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_B).isPaging());
+         assertFalse(server.getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_A).isPaging());
+         assertTrue(server.getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_B).isPaging());
 
          for (int i = 0; i < NUMBER_OF_MESSAGES; i++)
          {
@@ -1291,13 +1291,12 @@
          consumerB.close();
 
          session.close();
-
       }
       finally
       {
-         if (service.isStarted())
+         if (server.isStarted())
          {
-            service.stop();
+            server.stop();
          }
       }
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/RedeliveryConsumerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/RedeliveryConsumerTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/RedeliveryConsumerTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -27,9 +27,15 @@
 import org.jboss.messaging.core.client.ClientProducer;
 import org.jboss.messaging.core.client.ClientSession;
 import org.jboss.messaging.core.client.ClientSessionFactory;
+import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
 import org.jboss.messaging.core.config.Configuration;
+import org.jboss.messaging.core.config.TransportConfiguration;
+import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.exception.MessagingException;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
+import org.jboss.messaging.core.server.Messaging;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -47,9 +53,12 @@
 
    // Constants -----------------------------------------------------
 
+   private static final Logger log = Logger.getLogger(RedeliveryConsumerTest.class);
+
+   
    // Attributes ----------------------------------------------------
 
-   MessagingService messagingService;
+   MessagingServer server;
 
    final SimpleString ADDRESS = new SimpleString("address");
 
@@ -143,8 +152,8 @@
       if (persistent)
       {
          session.close();
-         messagingService.stop();
-         messagingService.start();
+         server.stop();
+         server.start();
          session = factory.createSession(false, false, false);
          session.start();
          consumer = session.createConsumer(ADDRESS);
@@ -165,8 +174,8 @@
             if (persistent)
             {
                session.close();
-               messagingService.stop();
-               messagingService.start();
+               server.stop();
+               server.start();
                session = factory.createSession(false, false, false);
                session.start();
                consumer = session.createConsumer(ADDRESS);
@@ -185,6 +194,9 @@
    {
       setUp(strictUpdate);
       ClientSession session = factory.createSession(false, false, false);
+      
+      log.info("created");
+      
       ClientProducer prod = session.createProducer(ADDRESS);
       prod.send(createTextMessage(session, "Hello"));
       session.commit();
@@ -207,9 +219,9 @@
          session.close();
       }
 
-      messagingService.stop();
+      server.stop();
 
-      messagingService.start();
+      server.start();
 
       session = factory.createSession(false, true, false);
       session.start();
@@ -231,14 +243,15 @@
     */
    private void setUp(final boolean persistDeliveryCountBeforeDelivery) throws Exception, MessagingException
    {
-      Configuration config = createFileConfig();
+      Configuration config = createConfigForJournal();
       config.setJournalFileSize(10 * 1024);
       config.setJournalMinFiles(2);
       config.setSecurityEnabled(false);
       config.setPersistDeliveryCountBeforeDelivery(persistDeliveryCountBeforeDelivery);
 
-      messagingService = createService(true, config);
-      messagingService.start();
+      server = createServer(true, config);
+      
+      server.start();
 
       factory = createInVMFactory();
 
@@ -251,9 +264,9 @@
    @Override
    protected void tearDown() throws Exception
    {
-      if (messagingService != null && messagingService.isStarted())
+      if (server != null && server.isStarted())
       {
-         messagingService.stop();
+         server.stop();
       }
       
       super.tearDown();

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/SelfExpandingBufferTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/SelfExpandingBufferTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/SelfExpandingBufferTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -28,7 +28,7 @@
 import org.jboss.messaging.core.client.ClientSession;
 import org.jboss.messaging.core.client.ClientSessionFactory;
 import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -48,7 +48,7 @@
 
    // Attributes ----------------------------------------------------
 
-   MessagingService service;
+   MessagingServer service;
 
    SimpleString ADDRESS = new SimpleString("Address");
 
@@ -128,7 +128,7 @@
 
    protected void setUpService(boolean netty) throws Exception
    {
-      service = createService(false, createDefaultConfig(netty));
+      service = createServer(false, createDefaultConfig(netty));
       service.start();
    }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/TemporaryQueueTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/TemporaryQueueTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/TemporaryQueueTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -36,7 +36,7 @@
 import org.jboss.messaging.core.remoting.RemotingConnection;
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.impl.ServerSessionImpl;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
@@ -60,7 +60,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingServiceImpl service;
+   private MessagingServer server;
 
    private ClientSession session;
 
@@ -149,7 +149,7 @@
       SimpleString address = randomSimpleString();
 
       session.createTemporaryQueue(address, queue);
-      assertEquals(1, service.getServer().getConnectionCount());
+      assertEquals(1, server.getConnectionCount());
       
       // we create a second session. the temp queue must be present
       // even after we closed the session which created it
@@ -176,9 +176,9 @@
 
       session.createTemporaryQueue(address, queue);
 
-      assertEquals(1, service.getServer().getConnectionCount());
+      assertEquals(1, server.getConnectionCount());
 
-      RemotingConnection remotingConnection = service.getServer()
+      RemotingConnection remotingConnection = server
                                                      .getRemotingService()
                                                      .getConnections()
                                                      .iterator()
@@ -188,7 +188,7 @@
       // let some time for the server to clean the connections
       Thread.sleep(1000);
 
-      assertEquals(0, service.getServer().getConnectionCount());
+      assertEquals(0, server.getConnectionCount());
 
       sf.close();
       sf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));
@@ -217,8 +217,8 @@
 
       Configuration config = new ConfigurationImpl();
       config.setSecurityEnabled(false);
-      service = Messaging.newMessagingService(config);
-      service.start();
+      server = Messaging.newMessagingServer(config);
+      server.start();
 
       sf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));
       session = sf.createSession(false, true, true);
@@ -229,7 +229,7 @@
    {
       session.close();
 
-      service.stop();
+      server.stop();
 
       super.tearDown();
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/TransactionDurabilityTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/TransactionDurabilityTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/TransactionDurabilityTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -30,7 +30,7 @@
 import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.config.TransportConfiguration;
 import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
 /**
@@ -72,9 +72,9 @@
       
       final SimpleString queue2 = new SimpleString("queue2");
                    
-      MessagingService messagingService = createService(true, conf); 
+      MessagingServer server = createServer(true, conf); 
       
-      messagingService.start();
+      server.start();
 
       ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"));
 
@@ -120,9 +120,9 @@
       
       session2.close();
       
-      messagingService.stop();
+      server.stop();
       
-      messagingService.start();
+      server.start();
       
       sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"));
       
@@ -152,9 +152,9 @@
       
       session2.close();
       
-      messagingService.stop();
+      server.stop();
       
-      messagingService.start();
+      server.start();
       
       sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"));
       
@@ -182,7 +182,7 @@
       
       session2.close();
       
-      messagingService.stop();
+      server.stop();
       
    }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/WildCardRoutingTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/WildCardRoutingTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/WildCardRoutingTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -31,7 +31,7 @@
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -40,7 +40,7 @@
  */
 public class WildCardRoutingTest extends UnitTestCase
 {
-   private MessagingService messagingService;
+   private MessagingServer server;
 
    private ClientSession clientSession;
 
@@ -99,9 +99,9 @@
       clientConsumer.close();
       clientSession.deleteQueue(queueName);
 
-      assertEquals(0, messagingService.getServer().getPostOffice().getBindingsForAddress(addressAB).getBindings().size());
-      assertEquals(0, messagingService.getServer().getPostOffice().getBindingsForAddress(addressAC).getBindings().size());
-      assertEquals(0, messagingService.getServer().getPostOffice().getBindingsForAddress(address).getBindings().size());
+      assertEquals(0, server.getPostOffice().getBindingsForAddress(addressAB).getBindings().size());
+      assertEquals(0, server.getPostOffice().getBindingsForAddress(addressAC).getBindings().size());
+      assertEquals(0, server.getPostOffice().getBindingsForAddress(address).getBindings().size());
    }
 
    public void testBasicWildcardRoutingQueuesDontExist2() throws Exception
@@ -132,15 +132,15 @@
       clientConsumer.close();
       clientSession.deleteQueue(queueName);
 
-      assertEquals(1, messagingService.getServer().getPostOffice().getBindingsForAddress(addressAB).getBindings().size());
-      assertEquals(1, messagingService.getServer().getPostOffice().getBindingsForAddress(addressAC).getBindings().size());
-      assertEquals(1, messagingService.getServer().getPostOffice().getBindingsForAddress(address).getBindings().size());
+      assertEquals(1, server.getPostOffice().getBindingsForAddress(addressAB).getBindings().size());
+      assertEquals(1, server.getPostOffice().getBindingsForAddress(addressAC).getBindings().size());
+      assertEquals(1, server.getPostOffice().getBindingsForAddress(address).getBindings().size());
 
       clientSession.deleteQueue(queueName2);
 
-      assertEquals(0, messagingService.getServer().getPostOffice().getBindingsForAddress(addressAB).getBindings().size());
-      assertEquals(0, messagingService.getServer().getPostOffice().getBindingsForAddress(addressAC).getBindings().size());
-      assertEquals(0, messagingService.getServer().getPostOffice().getBindingsForAddress(address).getBindings().size());
+      assertEquals(0, server.getPostOffice().getBindingsForAddress(addressAB).getBindings().size());
+      assertEquals(0, server.getPostOffice().getBindingsForAddress(addressAC).getBindings().size());
+      assertEquals(0, server.getPostOffice().getBindingsForAddress(address).getBindings().size());
    }
 
    public void testBasicWildcardRoutingWithHash() throws Exception
@@ -218,7 +218,7 @@
       clientSession.start();
       clientSession.deleteQueue(queueName1);
       //the wildcard binding should still exist
-      assertEquals(messagingService.getServer().getPostOffice().getBindingsForAddress(addressAB).getBindings().size(), 1);
+      assertEquals(server.getPostOffice().getBindingsForAddress(addressAB).getBindings().size(), 1);
       producer.send(createTextMessage("m1", clientSession));
       producer2.send(createTextMessage("m2", clientSession));
       ClientMessage m = clientConsumer.receive(500);
@@ -231,7 +231,7 @@
       m.acknowledge();
       clientConsumer.close();
       clientSession.deleteQueue(queueName);
-      assertEquals(messagingService.getServer().getPostOffice().getBindingsForAddress(addressAB).getBindings().size(), 0);
+      assertEquals(server.getPostOffice().getBindingsForAddress(addressAB).getBindings().size(), 0);
    }
 
    public void testWildcardRoutingLotsOfQueuesAddedThenDeleted() throws Exception
@@ -734,9 +734,9 @@
       clientSession.createQueue(addressAB, queueName1, null, false);
       clientSession.createQueue(addressAC, queueName2, null, false);
       clientSession.createQueue(address, queueName, null, false);
-      assertEquals(2, messagingService.getServer().getPostOffice().getBindingsForAddress(addressAB).getBindings().size());
-      assertEquals(2, messagingService.getServer().getPostOffice().getBindingsForAddress(addressAC).getBindings().size());
-      assertEquals(1, messagingService.getServer().getPostOffice().getBindingsForAddress(address).getBindings().size());
+      assertEquals(2, server.getPostOffice().getBindingsForAddress(addressAB).getBindings().size());
+      assertEquals(2, server.getPostOffice().getBindingsForAddress(addressAC).getBindings().size());
+      assertEquals(1, server.getPostOffice().getBindingsForAddress(address).getBindings().size());
       ClientProducer producer = clientSession.createProducer(addressAB);
       ClientProducer producer2 = clientSession.createProducer(addressAC);
       ClientConsumer clientConsumer = clientSession.createConsumer(queueName);
@@ -755,9 +755,9 @@
       assertNull(m);
       clientConsumer.close();
       clientSession.deleteQueue(queueName);
-      assertEquals(1, messagingService.getServer().getPostOffice().getBindingsForAddress(addressAB).getBindings().size());
-      assertEquals(1, messagingService.getServer().getPostOffice().getBindingsForAddress(addressAC).getBindings().size());
-      assertEquals(0, messagingService.getServer().getPostOffice().getBindingsForAddress(address).getBindings().size());
+      assertEquals(1, server.getPostOffice().getBindingsForAddress(addressAB).getBindings().size());
+      assertEquals(1, server.getPostOffice().getBindingsForAddress(addressAC).getBindings().size());
+      assertEquals(0, server.getPostOffice().getBindingsForAddress(address).getBindings().size());
    }
 
    @Override
@@ -771,10 +771,10 @@
       configuration.setTransactionTimeoutScanPeriod(500);
       TransportConfiguration transportConfig = new TransportConfiguration(INVM_ACCEPTOR_FACTORY);
       configuration.getAcceptorConfigurations().add(transportConfig);
-      messagingService = Messaging.newNullStorageMessagingService(configuration);
+      server = Messaging.newNullStorageMessagingServer(configuration);
       //start the server
-      messagingService.start();
-      messagingService.getServer().getManagementService().enableNotifications(false);
+      server.start();
+      server.getManagementService().enableNotifications(false);
       //then we create a client as normal
       ClientSessionFactory sessionFactory = new ClientSessionFactoryImpl(new TransportConfiguration(INVM_CONNECTOR_FACTORY));
       clientSession = sessionFactory.createSession(false, true, true);
@@ -794,18 +794,18 @@
             //
          }
       }
-      if (messagingService != null && messagingService.isStarted())
+      if (server != null && server.isStarted())
       {
          try
          {
-            messagingService.stop();
+            server.stop();
          }
          catch (Exception e1)
          {
             //
          }
       }
-      messagingService = null;
+      server = null;
       clientSession = null;
       
       super.tearDown();

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientCrashTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientCrashTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientCrashTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -29,14 +29,14 @@
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_PERSISTENT_SEND;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE;
@@ -151,6 +151,7 @@
 
       sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory"),
                                         null,
+                                        DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN,
                                         DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
                                         PING_PERIOD,
                                         CONNECTION_TTL,
@@ -169,7 +170,6 @@
                                         DEFAULT_ACK_BATCH_SIZE,
                                         DEFAULT_RETRY_INTERVAL,
                                         DEFAULT_RETRY_INTERVAL_MULTIPLIER,
-                                        DEFAULT_INITIAL_CONNECT_ATTEMPTS,
                                         DEFAULT_RECONNECT_ATTEMPTS);
 
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientTestBase.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientTestBase.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -20,11 +20,10 @@
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 
-
 package org.jboss.messaging.tests.integration.clientcrash;
 
 import org.jboss.messaging.core.config.Configuration;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 
 /**
@@ -41,7 +40,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingService messagingService;
+   private MessagingServer server;
 
    // Static --------------------------------------------------------
 
@@ -60,26 +59,26 @@
 
       Configuration config = createDefaultConfig(true);
       config.setSecurityEnabled(false);
-      messagingService = createService(false, config);
-      messagingService.start();
+      server = createServer(false, config);
+      server.start();
    }
 
    @Override
    protected void tearDown() throws Exception
    {
-      messagingService.stop();
+      server.stop();
 
       super.tearDown();
    }
-   
+
    protected void assertActiveConnections(int expectedActiveConnections) throws Exception
    {
-      assertEquals(expectedActiveConnections, messagingService.getServer().getServerManagement().getConnectionCount());
+      assertEquals(expectedActiveConnections, server.getServerManagement().getConnectionCount());
    }
 
    protected void assertActiveSession(int expectedActiveSession) throws Exception
    {
-      assertEquals(expectedActiveSession, messagingService.getServer().getSessions().size());
+      assertEquals(expectedActiveSession, server.getSessions().size());
    }
 
    // Private -------------------------------------------------------

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/CrashClient.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/CrashClient.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/clientcrash/CrashClient.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -29,14 +29,14 @@
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_PERSISTENT_SEND;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE;
@@ -80,6 +80,7 @@
          
          ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory"),
                                            null,
+                                           DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN,
                                            DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
                                            ClientCrashTest.PING_PERIOD,
                                            ClientCrashTest.CONNECTION_TTL,
@@ -97,8 +98,7 @@
                                            DEFAULT_PRE_ACKNOWLEDGE,
                                            DEFAULT_ACK_BATCH_SIZE,                                 
                                            DEFAULT_RETRY_INTERVAL,
-                                           DEFAULT_RETRY_INTERVAL_MULTIPLIER,                                        
-                                           DEFAULT_INITIAL_CONNECT_ATTEMPTS,
+                                           DEFAULT_RETRY_INTERVAL_MULTIPLIER,                                                                            
                                            DEFAULT_RECONNECT_ATTEMPTS);
          ClientSession session = sf.createSession(false, true, true);
          ClientProducer producer = session.createProducer(QUEUE);

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeReconnectTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeReconnectTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeReconnectTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -40,7 +40,7 @@
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.remoting.RemotingConnection;
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnector;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.cluster.Bridge;
 import org.jboss.messaging.core.server.cluster.impl.BridgeImpl;
 import org.jboss.messaging.utils.Pair;
@@ -59,41 +59,42 @@
 {
    private static final Logger log = Logger.getLogger(BridgeReconnectTest.class);
 
-   public void testAutomaticReconnectBeforeFailover() throws Exception
+
+   //Fail bridge and reconnecting immediately
+   public void testFailoverAndReconnectImmediately() throws Exception
    {
-      Map<String, Object> service0Params = new HashMap<String, Object>();
-      MessagingService service0 = createMessagingService(0, service0Params);
+      Map<String, Object> server0Params = new HashMap<String, Object>();
+      MessagingServer server0 = createMessagingServer(0, server0Params);
 
-      Map<String, Object> service1Params = new HashMap<String, Object>();
-      MessagingService service1 = createMessagingService(1, service1Params);
+      Map<String, Object> server1Params = new HashMap<String, Object>();
+      MessagingServer server1 = createMessagingServer(1, server1Params);
 
-      Map<String, Object> service2Params = new HashMap<String, Object>();
-      MessagingService service2 = createMessagingService(2, service2Params, true);
+      Map<String, Object> server2Params = new HashMap<String, Object>();
+      MessagingServer service2 = createMessagingServer(2, server2Params, true);
 
       TransportConfiguration server0tc = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                    service0Params,
+                                                                    server0Params,
                                                                     "server0tc");
 
       Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
 
       TransportConfiguration server1tc = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                    service1Params,
+                                                                    server1Params,
                                                                     "server1tc");
 
       TransportConfiguration server2tc = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                    service2Params,
+                                                                    server2Params,
                                                                     "server2tc");
 
       connectors.put(server1tc.getName(), server1tc);
 
       connectors.put(server2tc.getName(), server2tc);
 
-      service0.getServer().getConfiguration().setConnectorConfigurations(connectors);
+      server0.getConfiguration().setConnectorConfigurations(connectors);
+      server1.getConfiguration().setConnectorConfigurations(connectors);
 
-      service1.getServer().getConfiguration().setConnectorConfigurations(connectors);
+      server1.getConfiguration().setBackupConnectorName(server2tc.getName());
 
-      service1.getServer().getConfiguration().setBackupConnectorName(server2tc.getName());
-
       final String bridgeName = "bridge1";
       final String testAddress = "testAddress";
       final String queueName0 = "queue0";
@@ -101,62 +102,56 @@
 
       final long retryInterval = 50;
       final double retryIntervalMultiplier = 1d;
-      final int initalConnectAttempts = 3;
-      final int reconnectAttempts = -1;
-
+      final int reconnectAttempts = 1;
+   
       Pair<String, String> connectorPair = new Pair<String, String>(server1tc.getName(), server2tc.getName());
 
       BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
                                                                         queueName0,
                                                                         forwardAddress,
-                                                                        null,                                                      
+                                                                        null,                                                            
                                                                         null,
                                                                         retryInterval,
-                                                                        retryIntervalMultiplier,
-                                                                        initalConnectAttempts,
+                                                                        retryIntervalMultiplier,                                                               
                                                                         reconnectAttempts,
+                                                                        true,
                                                                         false,
                                                                         connectorPair);
 
       List<BridgeConfiguration> bridgeConfigs = new ArrayList<BridgeConfiguration>();
       bridgeConfigs.add(bridgeConfiguration);
-      service0.getServer().getConfiguration().setBridgeConfigurations(bridgeConfigs);
+      server0.getConfiguration().setBridgeConfigurations(bridgeConfigs);
 
       QueueConfiguration queueConfig0 = new QueueConfiguration(testAddress, queueName0, null, true);
       List<QueueConfiguration> queueConfigs0 = new ArrayList<QueueConfiguration>();
       queueConfigs0.add(queueConfig0);
-      service0.getServer().getConfiguration().setQueueConfigurations(queueConfigs0);
+      server0.getConfiguration().setQueueConfigurations(queueConfigs0);
 
       QueueConfiguration queueConfig1 = new QueueConfiguration(forwardAddress, queueName0, null, true);
       List<QueueConfiguration> queueConfigs1 = new ArrayList<QueueConfiguration>();
       queueConfigs1.add(queueConfig1);
-      service1.getServer().getConfiguration().setQueueConfigurations(queueConfigs1);
-      service2.getServer().getConfiguration().setQueueConfigurations(queueConfigs1);
+      server1.getConfiguration().setQueueConfigurations(queueConfigs1);
+      service2.getConfiguration().setQueueConfigurations(queueConfigs1);
 
       service2.start();
-      service1.start();
-      service0.start();
+      server1.start();
+      server0.start();
 
       ClientSessionFactory csf0 = new ClientSessionFactoryImpl(server0tc);
       ClientSession session0 = csf0.createSession(false, true, true);
 
-      ClientSessionFactory csf1 = new ClientSessionFactoryImpl(server1tc);
-      ClientSession session1 = csf1.createSession(false, true, true);
+      ClientSessionFactory csf2 = new ClientSessionFactoryImpl(server2tc);
+      ClientSession session2 = csf2.createSession(false, true, true);
 
       ClientProducer prod0 = session0.createProducer(testAddress);
 
-      ClientConsumer cons1 = session1.createConsumer(queueName0);
+      ClientConsumer cons2 = session2.createConsumer(queueName0);
 
-      session1.start();
+      session2.start();
 
-      log.info("Simulating failure");
-
-      // Now we will simulate a failure of the bridge connection between server1 and server2
-      // And prevent reconnection for a few tries, then it will reconnect without failing over
-      Bridge bridge = service0.getServer().getClusterManager().getBridges().get(bridgeName);
+      // Now we will simulate a failure of the bridge connection between server0 and server1
+      Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
       RemotingConnection forwardingConnection = getForwardingConnection(bridge);
-      InVMConnector.failOnCreateConnection = true;
-      InVMConnector.numberOfFailures = initalConnectAttempts - 1;
       forwardingConnection.fail(new MessagingException(MessagingException.NOT_CONNECTED));
 
       final int numMessages = 10;
@@ -173,56 +168,57 @@
 
       for (int i = 0; i < numMessages; i++)
       {
-         ClientMessage r1 = cons1.receive(500);
+         ClientMessage r1 = cons2.receive(1500);
          assertNotNull(r1);
          assertEquals(i, r1.getProperty(propKey));
       }
 
       session0.close();
-      session1.close();
+      session2.close();
 
-      service0.stop();
-      service1.stop();
+      server0.stop();
+      server1.stop();
       service2.stop();
 
-      assertEquals(0, service0.getServer().getRemotingService().getConnections().size());
-      assertEquals(0, service1.getServer().getRemotingService().getConnections().size());
-      assertEquals(0, service2.getServer().getRemotingService().getConnections().size());
+      assertEquals(0, server0.getRemotingService().getConnections().size());
+      assertEquals(0, server1.getRemotingService().getConnections().size());
+      assertEquals(0, service2.getRemotingService().getConnections().size());
    }
-
-   public void testAutomaticReconnectTryThenFailover() throws Exception
+   
+   // Fail bridge and attempt failover a few times before succeeding
+   public void testFailoverAndReconnectAfterAFewTries() throws Exception
    {
-      Map<String, Object> service0Params = new HashMap<String, Object>();
-      MessagingService service0 = createMessagingService(0, service0Params);
+      Map<String, Object> server0Params = new HashMap<String, Object>();
+      MessagingServer server0 = createMessagingServer(0, server0Params);
 
-      Map<String, Object> service1Params = new HashMap<String, Object>();
-      MessagingService service1 = createMessagingService(1, service1Params);
+      Map<String, Object> server1Params = new HashMap<String, Object>();
+      MessagingServer server1 = createMessagingServer(1, server1Params);
 
-      Map<String, Object> service2Params = new HashMap<String, Object>();
-      MessagingService service2 = createMessagingService(2, service2Params, true);
+      Map<String, Object> server2Params = new HashMap<String, Object>();
+      MessagingServer service2 = createMessagingServer(2, server2Params, true);
 
       TransportConfiguration server0tc = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                    service0Params,
+                                                                    server0Params,
                                                                     "server0tc");
 
       Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
 
       TransportConfiguration server1tc = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                    service1Params,
+                                                                    server1Params,
                                                                     "server1tc");
 
       TransportConfiguration server2tc = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                    service2Params,
+                                                                    server2Params,
                                                                     "server2tc");
 
       connectors.put(server1tc.getName(), server1tc);
 
       connectors.put(server2tc.getName(), server2tc);
 
-      service0.getServer().getConfiguration().setConnectorConfigurations(connectors);
-      service1.getServer().getConfiguration().setConnectorConfigurations(connectors);
+      server0.getConfiguration().setConnectorConfigurations(connectors);
+      server1.getConfiguration().setConnectorConfigurations(connectors);
 
-      service1.getServer().getConfiguration().setBackupConnectorName(server2tc.getName());
+      server1.getConfiguration().setBackupConnectorName(server2tc.getName());
 
       final String bridgeName = "bridge1";
       final String testAddress = "testAddress";
@@ -231,41 +227,40 @@
 
       final long retryInterval = 50;
       final double retryIntervalMultiplier = 1d;
-      final int initalConnectAttempts = 3;
-      final int reconnectAttempts = -1;
+      final int reconnectAttempts = 3;
 
       Pair<String, String> connectorPair = new Pair<String, String>(server1tc.getName(), server2tc.getName());
 
       BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
                                                                         queueName0,
                                                                         forwardAddress,
-                                                                        null,                                                            
+                                                                        null,                                                               
                                                                         null,
                                                                         retryInterval,
                                                                         retryIntervalMultiplier,
-                                                                        initalConnectAttempts,
                                                                         reconnectAttempts,
+                                                                        true,
                                                                         false,
                                                                         connectorPair);
 
       List<BridgeConfiguration> bridgeConfigs = new ArrayList<BridgeConfiguration>();
       bridgeConfigs.add(bridgeConfiguration);
-      service0.getServer().getConfiguration().setBridgeConfigurations(bridgeConfigs);
+      server0.getConfiguration().setBridgeConfigurations(bridgeConfigs);
 
       QueueConfiguration queueConfig0 = new QueueConfiguration(testAddress, queueName0, null, true);
       List<QueueConfiguration> queueConfigs0 = new ArrayList<QueueConfiguration>();
       queueConfigs0.add(queueConfig0);
-      service0.getServer().getConfiguration().setQueueConfigurations(queueConfigs0);
+      server0.getConfiguration().setQueueConfigurations(queueConfigs0);
 
       QueueConfiguration queueConfig1 = new QueueConfiguration(forwardAddress, queueName0, null, true);
       List<QueueConfiguration> queueConfigs1 = new ArrayList<QueueConfiguration>();
       queueConfigs1.add(queueConfig1);
-      service1.getServer().getConfiguration().setQueueConfigurations(queueConfigs1);
-      service2.getServer().getConfiguration().setQueueConfigurations(queueConfigs1);
+      server1.getConfiguration().setQueueConfigurations(queueConfigs1);
+      service2.getConfiguration().setQueueConfigurations(queueConfigs1);
 
       service2.start();
-      service1.start();
-      service0.start();
+      server1.start();
+      server0.start();
 
       ClientSessionFactory csf0 = new ClientSessionFactoryImpl(server0tc);
       ClientSession session0 = csf0.createSession(false, true, true);
@@ -279,13 +274,16 @@
 
       session2.start();
 
-      log.info("Simulating failure");
-
       // Now we will simulate a failure of the bridge connection between server0 and server1
-      Bridge bridge = service0.getServer().getClusterManager().getBridges().get(bridgeName);
+      Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
       RemotingConnection forwardingConnection = getForwardingConnection(bridge);
+      InVMConnector.failOnCreateConnection = true;
+      InVMConnector.numberOfFailures = reconnectAttempts - 1;
       forwardingConnection.fail(new MessagingException(MessagingException.NOT_CONNECTED));
 
+      forwardingConnection = getForwardingConnection(bridge);      
+      forwardingConnection.fail(new MessagingException(MessagingException.NOT_CONNECTED));
+
       final int numMessages = 10;
 
       SimpleString propKey = new SimpleString("propkey");
@@ -308,69 +306,39 @@
       session0.close();
       session2.close();
 
-      service0.stop();
-      service1.stop();
+      server0.stop();
+      server1.stop();
       service2.stop();
 
-      assertEquals(0, service0.getServer().getRemotingService().getConnections().size());
-      assertEquals(0, service1.getServer().getRemotingService().getConnections().size());
-      assertEquals(0, service2.getServer().getRemotingService().getConnections().size());
+      assertEquals(0, server0.getRemotingService().getConnections().size());
+      assertEquals(0, server1.getRemotingService().getConnections().size());
+      assertEquals(0, service2.getRemotingService().getConnections().size());
    }
    
-   private RemotingConnection getForwardingConnection(final Bridge bridge) throws Exception
+   // Fail bridge and reconnect same node, no backup specified
+   public void testReconnectSameNode() throws Exception
    {
-      long start = System.currentTimeMillis();
-      
-      do
-      {
-         RemotingConnection forwardingConnection = ((BridgeImpl)bridge).getForwardingConnection();
-         
-         if (forwardingConnection != null)
-         {
-            return forwardingConnection;
-         }
-                  
-         Thread.sleep(10);
-      }
-      while (System.currentTimeMillis() - start < 50000);
-      
-      throw new IllegalStateException("Failed to get forwarding connection");
-   }
+      Map<String, Object> server0Params = new HashMap<String, Object>();
+      MessagingServer server0 = createMessagingServer(0, server0Params);
 
-   public void testFailoverThenReconnectAfterFailover() throws Exception
-   {
-      Map<String, Object> service0Params = new HashMap<String, Object>();
-      MessagingService service0 = createMessagingService(0, service0Params);
+      Map<String, Object> server1Params = new HashMap<String, Object>();
+      MessagingServer server1 = createMessagingServer(1, server1Params);
 
-      Map<String, Object> service1Params = new HashMap<String, Object>();
-      MessagingService service1 = createMessagingService(1, service1Params);
-
-      Map<String, Object> service2Params = new HashMap<String, Object>();
-      MessagingService service2 = createMessagingService(2, service2Params, true);
-
       TransportConfiguration server0tc = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                    service0Params,
+                                                                    server0Params,
                                                                     "server0tc");
 
       Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
 
       TransportConfiguration server1tc = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                    service1Params,
+                                                                    server1Params,
                                                                     "server1tc");
 
-      TransportConfiguration server2tc = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                    service2Params,
-                                                                    "server2tc");
-
       connectors.put(server1tc.getName(), server1tc);
 
-      connectors.put(server2tc.getName(), server2tc);
+      server0.getConfiguration().setConnectorConfigurations(connectors);
+      server1.getConfiguration().setConnectorConfigurations(connectors);
 
-      service0.getServer().getConfiguration().setConnectorConfigurations(connectors);
-      service1.getServer().getConfiguration().setConnectorConfigurations(connectors);
-
-      service1.getServer().getConfiguration().setBackupConnectorName(server2tc.getName());
-
       final String bridgeName = "bridge1";
       final String testAddress = "testAddress";
       final String queueName0 = "queue0";
@@ -378,10 +346,9 @@
 
       final long retryInterval = 50;
       final double retryIntervalMultiplier = 1d;
-      final int initalConnectAttempts = 3;
       final int reconnectAttempts = 3;
 
-      Pair<String, String> connectorPair = new Pair<String, String>(server1tc.getName(), server2tc.getName());
+      Pair<String, String> connectorPair = new Pair<String, String>(server1tc.getName(), null);
 
       BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
                                                                         queueName0,
@@ -390,50 +357,47 @@
                                                                         null,
                                                                         retryInterval,
                                                                         retryIntervalMultiplier,
-                                                                        initalConnectAttempts,
                                                                         reconnectAttempts,
+                                                                        true,
                                                                         false,
                                                                         connectorPair);
 
       List<BridgeConfiguration> bridgeConfigs = new ArrayList<BridgeConfiguration>();
       bridgeConfigs.add(bridgeConfiguration);
-      service0.getServer().getConfiguration().setBridgeConfigurations(bridgeConfigs);
+      server0.getConfiguration().setBridgeConfigurations(bridgeConfigs);
 
       QueueConfiguration queueConfig0 = new QueueConfiguration(testAddress, queueName0, null, true);
       List<QueueConfiguration> queueConfigs0 = new ArrayList<QueueConfiguration>();
       queueConfigs0.add(queueConfig0);
-      service0.getServer().getConfiguration().setQueueConfigurations(queueConfigs0);
+      server0.getConfiguration().setQueueConfigurations(queueConfigs0);
 
       QueueConfiguration queueConfig1 = new QueueConfiguration(forwardAddress, queueName0, null, true);
       List<QueueConfiguration> queueConfigs1 = new ArrayList<QueueConfiguration>();
       queueConfigs1.add(queueConfig1);
-      service1.getServer().getConfiguration().setQueueConfigurations(queueConfigs1);
-      service2.getServer().getConfiguration().setQueueConfigurations(queueConfigs1);
+      server1.getConfiguration().setQueueConfigurations(queueConfigs1);
 
-      service2.start();
-      service1.start();
-      service0.start();
+      server1.start();
+      server0.start();
 
       ClientSessionFactory csf0 = new ClientSessionFactoryImpl(server0tc);
       ClientSession session0 = csf0.createSession(false, true, true);
 
-      ClientSessionFactory csf2 = new ClientSessionFactoryImpl(server2tc);
-      ClientSession session2 = csf2.createSession(false, true, true);
+      ClientSessionFactory csf1 = new ClientSessionFactoryImpl(server1tc);
+      ClientSession session1 = csf1.createSession(false, true, true);
 
       ClientProducer prod0 = session0.createProducer(testAddress);
 
-      ClientConsumer cons2 = session2.createConsumer(queueName0);
+      ClientConsumer cons1 = session1.createConsumer(queueName0);
 
-      session2.start();
+      session1.start();
 
-      log.info("Simulating failure");
-
       // Now we will simulate a failure of the bridge connection between server0 and server1
-      Bridge bridge = service0.getServer().getClusterManager().getBridges().get(bridgeName);
+      Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
       RemotingConnection forwardingConnection = getForwardingConnection(bridge);
+      InVMConnector.failOnCreateConnection = true;
+      InVMConnector.numberOfFailures = reconnectAttempts - 1;
       forwardingConnection.fail(new MessagingException(MessagingException.NOT_CONNECTED));
 
-      // Now we should be failed over so fail again and should reconnect
       forwardingConnection = getForwardingConnection(bridge);      
       forwardingConnection.fail(new MessagingException(MessagingException.NOT_CONNECTED));
 
@@ -451,44 +415,43 @@
 
       for (int i = 0; i < numMessages; i++)
       {
-         ClientMessage r1 = cons2.receive(1500);
+         ClientMessage r1 = cons1.receive(1500);
          assertNotNull(r1);
          assertEquals(i, r1.getProperty(propKey));
       }
 
       session0.close();
-      session2.close();
+      session1.close();
 
-      service0.stop();
-      service1.stop();
-      service2.stop();
+      server0.stop();
+      server1.stop();
 
-      assertEquals(0, service0.getServer().getRemotingService().getConnections().size());
-      assertEquals(0, service1.getServer().getRemotingService().getConnections().size());
-      assertEquals(0, service2.getServer().getRemotingService().getConnections().size());
+      assertEquals(0, server0.getRemotingService().getConnections().size());
+      assertEquals(0, server1.getRemotingService().getConnections().size());
    }
-
-   public void testAutomaticReconnectSingleServer() throws Exception
+      
+   public void testShutdownServerCleanlyAndReconnectSameNode() throws Exception
    {
-      Map<String, Object> service0Params = new HashMap<String, Object>();
-      MessagingService service0 = createMessagingService(0, service0Params);
+      Map<String, Object> server0Params = new HashMap<String, Object>();
+      MessagingServer server0 = createMessagingServer(0, server0Params);
 
-      Map<String, Object> service1Params = new HashMap<String, Object>();
-      MessagingService service1 = createMessagingService(1, service1Params);
+      Map<String, Object> server1Params = new HashMap<String, Object>();
+      MessagingServer server1 = createMessagingServer(1, server1Params);
 
       TransportConfiguration server0tc = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                    service0Params,
+                                                                    server0Params,
                                                                     "server0tc");
 
       Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
 
       TransportConfiguration server1tc = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                    service1Params,
+                                                                    server1Params,
                                                                     "server1tc");
 
       connectors.put(server1tc.getName(), server1tc);
 
-      service0.getServer().getConfiguration().setConnectorConfigurations(connectors);
+      server0.getConfiguration().setConnectorConfigurations(connectors);
+      server1.getConfiguration().setConnectorConfigurations(connectors);
 
       final String bridgeName = "bridge1";
       final String testAddress = "testAddress";
@@ -497,7 +460,6 @@
 
       final long retryInterval = 50;
       final double retryIntervalMultiplier = 1d;
-      final int initalConnectAttempts = 3;
       final int reconnectAttempts = -1;
 
       Pair<String, String> connectorPair = new Pair<String, String>(server1tc.getName(), null);
@@ -509,50 +471,43 @@
                                                                         null,
                                                                         retryInterval,
                                                                         retryIntervalMultiplier,
-                                                                        initalConnectAttempts,
                                                                         reconnectAttempts,
+                                                                        true,
                                                                         false,
                                                                         connectorPair);
 
       List<BridgeConfiguration> bridgeConfigs = new ArrayList<BridgeConfiguration>();
       bridgeConfigs.add(bridgeConfiguration);
-      service0.getServer().getConfiguration().setBridgeConfigurations(bridgeConfigs);
+      server0.getConfiguration().setBridgeConfigurations(bridgeConfigs);
 
       QueueConfiguration queueConfig0 = new QueueConfiguration(testAddress, queueName0, null, true);
       List<QueueConfiguration> queueConfigs0 = new ArrayList<QueueConfiguration>();
       queueConfigs0.add(queueConfig0);
-      service0.getServer().getConfiguration().setQueueConfigurations(queueConfigs0);
+      server0.getConfiguration().setQueueConfigurations(queueConfigs0);
 
       QueueConfiguration queueConfig1 = new QueueConfiguration(forwardAddress, queueName0, null, true);
       List<QueueConfiguration> queueConfigs1 = new ArrayList<QueueConfiguration>();
       queueConfigs1.add(queueConfig1);
-      service1.getServer().getConfiguration().setQueueConfigurations(queueConfigs1);
+      server1.getConfiguration().setQueueConfigurations(queueConfigs1);
 
-      service1.start();
-      service0.start();
+      server1.start();
+      server0.start();
 
       ClientSessionFactory csf0 = new ClientSessionFactoryImpl(server0tc);
       ClientSession session0 = csf0.createSession(false, true, true);
 
+      ClientProducer prod0 = session0.createProducer(testAddress);
+
+      server1.stop();
+      server1.start();
+      
       ClientSessionFactory csf1 = new ClientSessionFactoryImpl(server1tc);
       ClientSession session1 = csf1.createSession(false, true, true);
 
-      ClientProducer prod0 = session0.createProducer(testAddress);
-
       ClientConsumer cons1 = session1.createConsumer(queueName0);
 
       session1.start();
 
-      log.info("Simulating failure");
-
-      // Now we will simulate a failure of the bridge connection between server1 and server2
-      // And prevent reconnection for a few tries, then it will reconnect without failing over
-      Bridge bridge = service0.getServer().getClusterManager().getBridges().get(bridgeName);
-      RemotingConnection forwardingConnection = getForwardingConnection(bridge);
-      InVMConnector.failOnCreateConnection = true;
-      InVMConnector.numberOfFailures = initalConnectAttempts - 1;
-      forwardingConnection.fail(new MessagingException(MessagingException.NOT_CONNECTED));
-
       final int numMessages = 10;
 
       SimpleString propKey = new SimpleString("propkey");
@@ -573,35 +528,36 @@
       }
 
       session0.close();
+      session1.close();
 
-      service0.stop();
-      service1.stop();
+      server0.stop();
+      server1.stop();
 
-      assertEquals(0, service0.getServer().getRemotingService().getConnections().size());
-      assertEquals(0, service1.getServer().getRemotingService().getConnections().size());
+      assertEquals(0, server0.getRemotingService().getConnections().size());
+      assertEquals(0, server1.getRemotingService().getConnections().size());
    }
    
-   public void testNonAutomaticReconnectSingleServer() throws Exception
+   public void testFailoverThenFailAgainAndReconnect() throws Exception
    {
-      Map<String, Object> service0Params = new HashMap<String, Object>();
-      MessagingService service0 = createMessagingService(0, service0Params);
+      Map<String, Object> server0Params = new HashMap<String, Object>();
+      MessagingServer server0 = createMessagingServer(0, server0Params);
 
-      Map<String, Object> service1Params = new HashMap<String, Object>();
-      MessagingService service1 = createMessagingService(1, service1Params);
+      Map<String, Object> server1Params = new HashMap<String, Object>();
+      MessagingServer server1 = createMessagingServer(1, server1Params);
 
       TransportConfiguration server0tc = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                    service0Params,
+                                                                    server0Params,
                                                                     "server0tc");
 
       Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
 
       TransportConfiguration server1tc = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                    service1Params,
+                                                                    server1Params,
                                                                     "server1tc");
 
       connectors.put(server1tc.getName(), server1tc);
 
-      service0.getServer().getConfiguration().setConnectorConfigurations(connectors);
+      server0.getConfiguration().setConnectorConfigurations(connectors);
 
       final String bridgeName = "bridge1";
       final String testAddress = "testAddress";
@@ -610,8 +566,7 @@
 
       final long retryInterval = 50;
       final double retryIntervalMultiplier = 1d;
-      final int initalConnectAttempts = 3;
-      final int reconnectAttempts = -1;
+      final int reconnectAttempts = 3;
 
       Pair<String, String> connectorPair = new Pair<String, String>(server1tc.getName(), null);
 
@@ -622,27 +577,27 @@
                                                                         null,
                                                                         retryInterval,
                                                                         retryIntervalMultiplier,
-                                                                        initalConnectAttempts,
                                                                         reconnectAttempts,
+                                                                        true,
                                                                         false,
                                                                         connectorPair);
 
       List<BridgeConfiguration> bridgeConfigs = new ArrayList<BridgeConfiguration>();
       bridgeConfigs.add(bridgeConfiguration);
-      service0.getServer().getConfiguration().setBridgeConfigurations(bridgeConfigs);
+      server0.getConfiguration().setBridgeConfigurations(bridgeConfigs);
 
       QueueConfiguration queueConfig0 = new QueueConfiguration(testAddress, queueName0, null, true);
       List<QueueConfiguration> queueConfigs0 = new ArrayList<QueueConfiguration>();
       queueConfigs0.add(queueConfig0);
-      service0.getServer().getConfiguration().setQueueConfigurations(queueConfigs0);
+      server0.getConfiguration().setQueueConfigurations(queueConfigs0);
 
       QueueConfiguration queueConfig1 = new QueueConfiguration(forwardAddress, queueName0, null, true);
       List<QueueConfiguration> queueConfigs1 = new ArrayList<QueueConfiguration>();
       queueConfigs1.add(queueConfig1);
-      service1.getServer().getConfiguration().setQueueConfigurations(queueConfigs1);
+      server1.getConfiguration().setQueueConfigurations(queueConfigs1);
 
-      service1.start();
-      service0.start();
+      server1.start();
+      server0.start();
 
       ClientSessionFactory csf0 = new ClientSessionFactoryImpl(server0tc);
       ClientSession session0 = csf0.createSession(false, true, true);
@@ -656,14 +611,10 @@
 
       session1.start();
 
-      log.info("Simulating failure");
-
-      // Now we will simulate a failure of the bridge connection between server1 and server2
-      // And prevent reconnection for a few tries, then it will reconnect without failing over
-      Bridge bridge = service0.getServer().getClusterManager().getBridges().get(bridgeName);
+      Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
       RemotingConnection forwardingConnection = getForwardingConnection(bridge);
       InVMConnector.failOnCreateConnection = true;
-      InVMConnector.numberOfFailures = initalConnectAttempts * 2;
+      InVMConnector.numberOfFailures = reconnectAttempts - 1;
       forwardingConnection.fail(new MessagingException(MessagingException.NOT_CONNECTED));
 
       final int numMessages = 10;
@@ -685,9 +636,10 @@
          assertEquals(i, r1.getProperty(propKey));
       }
       
+      //Fail again - should reconnect
       forwardingConnection = ((BridgeImpl)bridge).getForwardingConnection();
       InVMConnector.failOnCreateConnection = true;
-      InVMConnector.numberOfFailures = initalConnectAttempts * 2;
+      InVMConnector.numberOfFailures = reconnectAttempts - 1;
       forwardingConnection.fail(new MessagingException(MessagingException.NOT_CONNECTED));
       
       for (int i = 0; i < numMessages; i++)
@@ -707,10 +659,31 @@
 
       session0.close();
 
-      service0.stop();
-      service1.stop();
+      server0.stop();
+      server1.stop();
 
-      assertEquals(0, service0.getServer().getRemotingService().getConnections().size());
-      assertEquals(0, service1.getServer().getRemotingService().getConnections().size());
+      assertEquals(0, server0.getRemotingService().getConnections().size());
+      assertEquals(0, server1.getRemotingService().getConnections().size());
    }
+   
+   private RemotingConnection getForwardingConnection(final Bridge bridge) throws Exception
+   {
+      long start = System.currentTimeMillis();
+      
+      do
+      {
+         RemotingConnection forwardingConnection = ((BridgeImpl)bridge).getForwardingConnection();
+         
+         if (forwardingConnection != null)
+         {
+            return forwardingConnection;
+         }
+                  
+         Thread.sleep(10);
+      }
+      while (System.currentTimeMillis() - start < 50000);
+      
+      throw new IllegalStateException("Failed to get forwarding connection");
+   }
+
 }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeStartTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeStartTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeStartTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -39,7 +39,7 @@
 import org.jboss.messaging.core.config.cluster.BridgeConfiguration;
 import org.jboss.messaging.core.config.cluster.QueueConfiguration;
 import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.cluster.Bridge;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.Pair;
@@ -60,12 +60,12 @@
 
    public void testStartStop() throws Exception
    {
-      Map<String, Object> service0Params = new HashMap<String, Object>();
-      MessagingService service0 = createClusteredServiceWithParams(0, true, service0Params);
+      Map<String, Object> server0Params = new HashMap<String, Object>();
+      MessagingServer server0 = createClusteredServerWithParams(0, true, server0Params);
 
-      Map<String, Object> service1Params = new HashMap<String, Object>();
-      service1Params.put(SERVER_ID_PROP_NAME, 1);
-      MessagingService service1 = createClusteredServiceWithParams(1, true, service1Params);
+      Map<String, Object> server1Params = new HashMap<String, Object>();
+      server1Params.put(SERVER_ID_PROP_NAME, 1);
+      MessagingServer server1 = createClusteredServerWithParams(1, true, server1Params);
 
       final String testAddress = "testAddress";
       final String queueName0 = "queue0";
@@ -74,12 +74,12 @@
 
       Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
       TransportConfiguration server0tc = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                    service0Params);
+                                                                    server0Params);
       TransportConfiguration server1tc = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                    service1Params);
+                                                                    server1Params);
       connectors.put(server1tc.getName(), server1tc);
 
-      service0.getServer().getConfiguration().setConnectorConfigurations(connectors);
+      server0.getConfiguration().setConnectorConfigurations(connectors);
 
       Pair<String, String> connectorPair = new Pair<String, String>(server1tc.getName(), null);
 
@@ -88,31 +88,31 @@
       BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
                                                                         queueName0,
                                                                         forwardAddress,
-                                                                        null,                                                                
                                                                         null,
+                                                                        null,
                                                                         1000,
                                                                         1d,
-                                                                        1,
                                                                         0,
                                                                         true,
+                                                                        true,
                                                                         connectorPair);
 
       List<BridgeConfiguration> bridgeConfigs = new ArrayList<BridgeConfiguration>();
       bridgeConfigs.add(bridgeConfiguration);
-      service0.getServer().getConfiguration().setBridgeConfigurations(bridgeConfigs);
+      server0.getConfiguration().setBridgeConfigurations(bridgeConfigs);
 
       QueueConfiguration queueConfig0 = new QueueConfiguration(testAddress, queueName0, null, true);
       List<QueueConfiguration> queueConfigs0 = new ArrayList<QueueConfiguration>();
       queueConfigs0.add(queueConfig0);
-      service0.getServer().getConfiguration().setQueueConfigurations(queueConfigs0);
+      server0.getConfiguration().setQueueConfigurations(queueConfigs0);
 
       QueueConfiguration queueConfig1 = new QueueConfiguration(forwardAddress, queueName1, null, true);
       List<QueueConfiguration> queueConfigs1 = new ArrayList<QueueConfiguration>();
       queueConfigs1.add(queueConfig1);
-      service1.getServer().getConfiguration().setQueueConfigurations(queueConfigs1);
+      server1.getConfiguration().setQueueConfigurations(queueConfigs1);
 
-      service1.start();
-      service0.start();
+      server1.start();
+      server0.start();
 
       ClientSessionFactory sf0 = new ClientSessionFactoryImpl(server0tc);
 
@@ -154,7 +154,7 @@
 
       assertNull(consumer1.receive(200));
 
-      Bridge bridge = service0.getServer().getClusterManager().getBridges().get(bridgeName);
+      Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
 
       bridge.stop();
 
@@ -192,24 +192,24 @@
 
       sf1.close();
 
-      service0.stop();
+      server0.stop();
 
-      service1.stop();
+      server1.stop();
    }
-   
-   
+
    public void testTargetServerUpAndDown() throws Exception
    {
-      //This test needs to use real files, since it requires duplicate detection, since when the target server is shutdown, messages will get resent when it is started, so the dup id cache needs
-      //to be persisted
-      
-      Map<String, Object> service0Params = new HashMap<String, Object>();
-      MessagingService service0 = createClusteredServiceWithParams(0, true, service0Params);
+      // This test needs to use real files, since it requires duplicate detection, since when the target server is
+      // shutdown, messages will get resent when it is started, so the dup id cache needs
+      // to be persisted
 
-      Map<String, Object> service1Params = new HashMap<String, Object>();
-      service1Params.put(SERVER_ID_PROP_NAME, 1);
-      MessagingService service1 = createClusteredServiceWithParams(1, true, service1Params);
+      Map<String, Object> server0Params = new HashMap<String, Object>();
+      MessagingServer server0 = createClusteredServerWithParams(0, true, server0Params);
 
+      Map<String, Object> server1Params = new HashMap<String, Object>();
+      server1Params.put(SERVER_ID_PROP_NAME, 1);
+      MessagingServer server1 = createClusteredServerWithParams(1, true, server1Params);
+
       final String testAddress = "testAddress";
       final String queueName0 = "queue0";
       final String forwardAddress = "forwardAddress";
@@ -217,12 +217,12 @@
 
       Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
       TransportConfiguration server0tc = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                    service0Params);
+                                                                    server0Params);
       TransportConfiguration server1tc = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                    service1Params);
+                                                                    server1Params);
       connectors.put(server1tc.getName(), server1tc);
 
-      service0.getServer().getConfiguration().setConnectorConfigurations(connectors);
+      server0.getConfiguration().setConnectorConfigurations(connectors);
 
       Pair<String, String> connectorPair = new Pair<String, String>(server1tc.getName(), null);
 
@@ -231,34 +231,34 @@
       BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
                                                                         queueName0,
                                                                         forwardAddress,
-                                                                        null,                                                                   
                                                                         null,
+                                                                        null,
                                                                         1000,
                                                                         1d,
                                                                         -1,
-                                                                        -1,
+                                                                        false,
                                                                         true,
                                                                         connectorPair);
 
       List<BridgeConfiguration> bridgeConfigs = new ArrayList<BridgeConfiguration>();
       bridgeConfigs.add(bridgeConfiguration);
-      service0.getServer().getConfiguration().setBridgeConfigurations(bridgeConfigs);
+      server0.getConfiguration().setBridgeConfigurations(bridgeConfigs);
 
       QueueConfiguration queueConfig0 = new QueueConfiguration(testAddress, queueName0, null, true);
       List<QueueConfiguration> queueConfigs0 = new ArrayList<QueueConfiguration>();
       queueConfigs0.add(queueConfig0);
-      service0.getServer().getConfiguration().setQueueConfigurations(queueConfigs0);
+      server0.getConfiguration().setQueueConfigurations(queueConfigs0);
 
       QueueConfiguration queueConfig1 = new QueueConfiguration(forwardAddress, queueName1, null, true);
       List<QueueConfiguration> queueConfigs1 = new ArrayList<QueueConfiguration>();
       queueConfigs1.add(queueConfig1);
-      service1.getServer().getConfiguration().setQueueConfigurations(queueConfigs1);
+      server1.getConfiguration().setQueueConfigurations(queueConfigs1);
 
       try
       {
-         // Don't start service 1 yet
+         // Don't start server 1 yet
 
-         service0.start();
+         server0.start();
 
          ClientSessionFactory sf0 = new ClientSessionFactoryImpl(server0tc);
 
@@ -278,11 +278,11 @@
 
             producer0.send(message);
          }
-         
+
          // Wait a bit
          Thread.sleep(1000);
 
-         service1.start();
+         server1.start();
 
          ClientSessionFactory sf1 = new ClientSessionFactoryImpl(server1tc);
 
@@ -302,9 +302,9 @@
 
             message.acknowledge();
          }
-                  
+
          assertNull(consumer1.receive(200));
-         
+
          for (int i = 0; i < numMessages; i++)
          {
             ClientMessage message = session0.createClientMessage(false);
@@ -313,7 +313,7 @@
 
             producer0.send(message);
          }
-         
+
          for (int i = 0; i < numMessages; i++)
          {
             ClientMessage message = consumer1.receive(1000);
@@ -326,12 +326,12 @@
          }
 
          assertNull(consumer1.receive(200));
-         
+
          session1.close();
 
          sf1.close();
 
-         service1.stop();
+         server1.stop();
 
          for (int i = 0; i < numMessages; i++)
          {
@@ -342,7 +342,7 @@
             producer0.send(message);
          }
 
-         service1.start();
+         server1.start();
 
          sf1 = new ClientSessionFactoryImpl(server1tc);
 
@@ -357,14 +357,14 @@
             ClientMessage message = consumer1.receive(1000);
 
             assertNotNull(message);
-            
+
             assertEquals((Integer)i, (Integer)message.getProperty(propKey));
 
             message.acknowledge();
          }
 
          assertNull(consumer1.receive(200));
-         
+
          session1.close();
 
          sf1.close();
@@ -375,20 +375,20 @@
       }
       finally
       {
-         service0.stop();
+         server0.stop();
 
-         service1.stop();
+         server1.stop();
       }
    }
-   
+
    public void testTargetServerNotAvailableNoReconnectTries() throws Exception
    {
-      Map<String, Object> service0Params = new HashMap<String, Object>();
-      MessagingService service0 = createClusteredServiceWithParams(0, false, service0Params);
+      Map<String, Object> server0Params = new HashMap<String, Object>();
+      MessagingServer server0 = createClusteredServerWithParams(0, false, server0Params);
 
-      Map<String, Object> service1Params = new HashMap<String, Object>();
-      service1Params.put(SERVER_ID_PROP_NAME, 1);
-      MessagingService service1 = createClusteredServiceWithParams(1, false, service1Params);
+      Map<String, Object> server1Params = new HashMap<String, Object>();
+      server1Params.put(SERVER_ID_PROP_NAME, 1);
+      MessagingServer server1 = createClusteredServerWithParams(1, false, server1Params);
 
       final String testAddress = "testAddress";
       final String queueName0 = "queue0";
@@ -397,12 +397,12 @@
 
       Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
       TransportConfiguration server0tc = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                    service0Params);
+                                                                    server0Params);
       TransportConfiguration server1tc = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                    service1Params);
+                                                                    server1Params);
       connectors.put(server1tc.getName(), server1tc);
 
-      service0.getServer().getConfiguration().setConnectorConfigurations(connectors);
+      server0.getConfiguration().setConnectorConfigurations(connectors);
 
       Pair<String, String> connectorPair = new Pair<String, String>(server1tc.getName(), null);
 
@@ -411,32 +411,32 @@
       BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
                                                                         queueName0,
                                                                         forwardAddress,
-                                                                        null,                                                                
                                                                         null,
+                                                                        null,
                                                                         1000,
                                                                         1d,
-                                                                        1,
                                                                         0,
                                                                         false,
+                                                                        false,
                                                                         connectorPair);
 
       List<BridgeConfiguration> bridgeConfigs = new ArrayList<BridgeConfiguration>();
       bridgeConfigs.add(bridgeConfiguration);
-      service0.getServer().getConfiguration().setBridgeConfigurations(bridgeConfigs);
+      server0.getConfiguration().setBridgeConfigurations(bridgeConfigs);
 
       QueueConfiguration queueConfig0 = new QueueConfiguration(testAddress, queueName0, null, true);
       List<QueueConfiguration> queueConfigs0 = new ArrayList<QueueConfiguration>();
       queueConfigs0.add(queueConfig0);
-      service0.getServer().getConfiguration().setQueueConfigurations(queueConfigs0);
+      server0.getConfiguration().setQueueConfigurations(queueConfigs0);
 
       QueueConfiguration queueConfig1 = new QueueConfiguration(forwardAddress, queueName1, null, true);
       List<QueueConfiguration> queueConfigs1 = new ArrayList<QueueConfiguration>();
       queueConfigs1.add(queueConfig1);
-      service1.getServer().getConfiguration().setQueueConfigurations(queueConfigs1);
+      server1.getConfiguration().setQueueConfigurations(queueConfigs1);
 
-      // Don't start service 1 yet
+      // Don't start server 1 yet
 
-      service0.start();
+      server0.start();
 
       ClientSessionFactory sf0 = new ClientSessionFactoryImpl(server0tc);
 
@@ -462,7 +462,7 @@
 
       // Bridge should be stopped since retries = 0
 
-      service1.start();
+      server1.start();
 
       ClientSessionFactory sf1 = new ClientSessionFactoryImpl(server1tc);
 
@@ -477,7 +477,7 @@
 
       // Now start the bridge manually
 
-      Bridge bridge = service0.getServer().getClusterManager().getBridges().get(bridgeName);
+      Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
 
       bridge.start();
 
@@ -486,7 +486,7 @@
       for (int i = 0; i < numMessages; i++)
       {
          ClientMessage message = consumer1.receive(1000);
-         
+
          assertNotNull(message);
 
          assertEquals((Integer)i, (Integer)message.getProperty(propKey));
@@ -504,19 +504,19 @@
 
       sf0.close();
 
-      service0.stop();
+      server0.stop();
 
-      service1.stop();
+      server1.stop();
    }
 
    public void testManualStopStart() throws Exception
    {
-      Map<String, Object> service0Params = new HashMap<String, Object>();
-      MessagingService service0 = createClusteredServiceWithParams(0, false, service0Params);
+      Map<String, Object> server0Params = new HashMap<String, Object>();
+      MessagingServer server0 = createClusteredServerWithParams(0, false, server0Params);
 
-      Map<String, Object> service1Params = new HashMap<String, Object>();
-      service1Params.put(SERVER_ID_PROP_NAME, 1);
-      MessagingService service1 = createClusteredServiceWithParams(1, false, service1Params);
+      Map<String, Object> server1Params = new HashMap<String, Object>();
+      server1Params.put(SERVER_ID_PROP_NAME, 1);
+      MessagingServer server1 = createClusteredServerWithParams(1, false, server1Params);
 
       final String testAddress = "testAddress";
       final String queueName0 = "queue0";
@@ -525,12 +525,12 @@
 
       Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
       TransportConfiguration server0tc = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                    service0Params);
+                                                                    server0Params);
       TransportConfiguration server1tc = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                    service1Params);
+                                                                    server1Params);
       connectors.put(server1tc.getName(), server1tc);
 
-      service0.getServer().getConfiguration().setConnectorConfigurations(connectors);
+      server0.getConfiguration().setConnectorConfigurations(connectors);
 
       Pair<String, String> connectorPair = new Pair<String, String>(server1tc.getName(), null);
 
@@ -539,32 +539,32 @@
       BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
                                                                         queueName0,
                                                                         forwardAddress,
-                                                                        null,                                                               
                                                                         null,
+                                                                        null,
                                                                         1000,
                                                                         1d,
                                                                         1,
-                                                                        0,
                                                                         false,
+                                                                        false,
                                                                         connectorPair);
 
       List<BridgeConfiguration> bridgeConfigs = new ArrayList<BridgeConfiguration>();
       bridgeConfigs.add(bridgeConfiguration);
-      service0.getServer().getConfiguration().setBridgeConfigurations(bridgeConfigs);
+      server0.getConfiguration().setBridgeConfigurations(bridgeConfigs);
 
       QueueConfiguration queueConfig0 = new QueueConfiguration(testAddress, queueName0, null, true);
       List<QueueConfiguration> queueConfigs0 = new ArrayList<QueueConfiguration>();
       queueConfigs0.add(queueConfig0);
-      service0.getServer().getConfiguration().setQueueConfigurations(queueConfigs0);
+      server0.getConfiguration().setQueueConfigurations(queueConfigs0);
 
       QueueConfiguration queueConfig1 = new QueueConfiguration(forwardAddress, queueName1, null, true);
       List<QueueConfiguration> queueConfigs1 = new ArrayList<QueueConfiguration>();
       queueConfigs1.add(queueConfig1);
-      service1.getServer().getConfiguration().setQueueConfigurations(queueConfigs1);
+      server1.getConfiguration().setQueueConfigurations(queueConfigs1);
 
-      service1.start();
+      server1.start();
 
-      service0.start();
+      server0.start();
 
       ClientSessionFactory sf0 = new ClientSessionFactoryImpl(server0tc);
 
@@ -608,7 +608,7 @@
 
       // Now stop the bridge manually
 
-      Bridge bridge = service0.getServer().getClusterManager().getBridges().get(bridgeName);
+      Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
 
       bridge.stop();
 
@@ -630,7 +630,7 @@
          ClientMessage message = consumer1.receive(1000);
 
          assertNotNull(message);
-         
+
          assertEquals((Integer)i, (Integer)message.getProperty(propKey));
 
          message.acknowledge();
@@ -674,9 +674,9 @@
 
       sf0.close();
 
-      service0.stop();
+      server0.stop();
 
-      service1.stop();
+      server1.stop();
    }
 
 }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -39,7 +39,7 @@
 import org.jboss.messaging.core.config.cluster.BridgeConfiguration;
 import org.jboss.messaging.core.config.cluster.QueueConfiguration;
 import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.Pair;
 import org.jboss.messaging.utils.SimpleString;
@@ -59,12 +59,12 @@
 
    public void testSimpleBridge() throws Exception
    {
-      Map<String, Object> service0Params = new HashMap<String, Object>();
-      MessagingService service0 = createClusteredServiceWithParams(0, false, service0Params);
+      Map<String, Object> server0Params = new HashMap<String, Object>();
+      MessagingServer server0 = createClusteredServerWithParams(0, false, server0Params);
 
-      Map<String, Object> service1Params = new HashMap<String, Object>();
-      service1Params.put(SERVER_ID_PROP_NAME, 1);
-      MessagingService service1 = createClusteredServiceWithParams(1, false, service1Params);
+      Map<String, Object> server1Params = new HashMap<String, Object>();
+      server1Params.put(SERVER_ID_PROP_NAME, 1);
+      MessagingServer server1 = createClusteredServerWithParams(1, false, server1Params);
 
       final String testAddress = "testAddress";
       final String queueName0 = "queue0";
@@ -73,12 +73,12 @@
 
       Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
       TransportConfiguration server0tc = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                    service0Params);
+                                                                    server0Params);
       TransportConfiguration server1tc = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                    service1Params);
+                                                                    server1Params);
       connectors.put(server1tc.getName(), server1tc);
 
-      service0.getServer().getConfiguration().setConnectorConfigurations(connectors);
+      server0.getConfiguration().setConnectorConfigurations(connectors);
 
       Pair<String, String> connectorPair = new Pair<String, String>(server1tc.getName(), null);
 
@@ -90,26 +90,26 @@
                                                                         1000,
                                                                         1d,
                                                                         -1,
-                                                                        -1,
+                                                                        true,
                                                                         false,                                                                        
                                                                         connectorPair);
 
       List<BridgeConfiguration> bridgeConfigs = new ArrayList<BridgeConfiguration>();
       bridgeConfigs.add(bridgeConfiguration);
-      service0.getServer().getConfiguration().setBridgeConfigurations(bridgeConfigs);
+      server0.getConfiguration().setBridgeConfigurations(bridgeConfigs);
 
       QueueConfiguration queueConfig0 = new QueueConfiguration(testAddress, queueName0, null, true);
       List<QueueConfiguration> queueConfigs0 = new ArrayList<QueueConfiguration>();
       queueConfigs0.add(queueConfig0);
-      service0.getServer().getConfiguration().setQueueConfigurations(queueConfigs0);
+      server0.getConfiguration().setQueueConfigurations(queueConfigs0);
 
       QueueConfiguration queueConfig1 = new QueueConfiguration(forwardAddress, queueName1, null, true);
       List<QueueConfiguration> queueConfigs1 = new ArrayList<QueueConfiguration>();
       queueConfigs1.add(queueConfig1);
-      service1.getServer().getConfiguration().setQueueConfigurations(queueConfigs1);
+      server1.getConfiguration().setQueueConfigurations(queueConfigs1);
 
-      service1.start();
-      service0.start();
+      server1.start();
+      server0.start();
 
       ClientSessionFactory sf0 = new ClientSessionFactoryImpl(server0tc);
 
@@ -159,20 +159,20 @@
 
       sf1.close();
 
-      service0.stop();
+      server0.stop();
 
-      service1.stop();
+      server1.stop();
    }
 
    
    public void testWithFilter() throws Exception
    {
-      Map<String, Object> service0Params = new HashMap<String, Object>();
-      MessagingService service0 = createClusteredServiceWithParams(0, false, service0Params);
+      Map<String, Object> server0Params = new HashMap<String, Object>();
+      MessagingServer server0 = createClusteredServerWithParams(0, false, server0Params);
 
-      Map<String, Object> service1Params = new HashMap<String, Object>();
-      service1Params.put(SERVER_ID_PROP_NAME, 1);
-      MessagingService service1 = createClusteredServiceWithParams(1, false, service1Params);
+      Map<String, Object> server1Params = new HashMap<String, Object>();
+      server1Params.put(SERVER_ID_PROP_NAME, 1);
+      MessagingServer server1 = createClusteredServerWithParams(1, false, server1Params);
 
       final String testAddress = "testAddress";
       final String queueName0 = "queue0";
@@ -181,12 +181,12 @@
 
       Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
       TransportConfiguration server0tc = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                    service0Params);
+                                                                    server0Params);
       TransportConfiguration server1tc = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                    service1Params);
+                                                                    server1Params);
       connectors.put(server1tc.getName(), server1tc);
 
-      service0.getServer().getConfiguration().setConnectorConfigurations(connectors);
+      server0.getConfiguration().setConnectorConfigurations(connectors);
 
       Pair<String, String> connectorPair = new Pair<String, String>(server1tc.getName(), null);
 
@@ -200,26 +200,26 @@
                                                                         1000,
                                                                         1d,
                                                                         -1,
-                                                                        -1,
+                                                                        true,
                                                                         false,                                                                        
                                                                         connectorPair);
 
       List<BridgeConfiguration> bridgeConfigs = new ArrayList<BridgeConfiguration>();
       bridgeConfigs.add(bridgeConfiguration);
-      service0.getServer().getConfiguration().setBridgeConfigurations(bridgeConfigs);
+      server0.getConfiguration().setBridgeConfigurations(bridgeConfigs);
 
       QueueConfiguration queueConfig0 = new QueueConfiguration(testAddress, queueName0, null, true);
       List<QueueConfiguration> queueConfigs0 = new ArrayList<QueueConfiguration>();
       queueConfigs0.add(queueConfig0);
-      service0.getServer().getConfiguration().setQueueConfigurations(queueConfigs0);
+      server0.getConfiguration().setQueueConfigurations(queueConfigs0);
 
       QueueConfiguration queueConfig1 = new QueueConfiguration(forwardAddress, queueName1, null, true);
       List<QueueConfiguration> queueConfigs1 = new ArrayList<QueueConfiguration>();
       queueConfigs1.add(queueConfig1);
-      service1.getServer().getConfiguration().setQueueConfigurations(queueConfigs1);
+      server1.getConfiguration().setQueueConfigurations(queueConfigs1);
 
-      service1.start();
-      service0.start();
+      server1.start();
+      server0.start();
 
       ClientSessionFactory sf0 = new ClientSessionFactoryImpl(server0tc);
 
@@ -286,19 +286,19 @@
 
       sf1.close();
 
-      service0.stop();
+      server0.stop();
 
-      service1.stop();
+      server1.stop();
    }
 
    public void testWithTransformer() throws Exception
    {
-      Map<String, Object> service0Params = new HashMap<String, Object>();
-      MessagingService service0 = createClusteredServiceWithParams(0, false, service0Params);
+      Map<String, Object> server0Params = new HashMap<String, Object>();
+      MessagingServer server0 = createClusteredServerWithParams(0, false, server0Params);
 
-      Map<String, Object> service1Params = new HashMap<String, Object>();
-      service1Params.put(SERVER_ID_PROP_NAME, 1);
-      MessagingService service1 = createClusteredServiceWithParams(1, false, service1Params);
+      Map<String, Object> server1Params = new HashMap<String, Object>();
+      server1Params.put(SERVER_ID_PROP_NAME, 1);
+      MessagingServer server1 = createClusteredServerWithParams(1, false, server1Params);
 
       final String testAddress = "testAddress";
       final String queueName0 = "queue0";
@@ -307,12 +307,12 @@
 
       Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
       TransportConfiguration server0tc = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                    service0Params);
+                                                                    server0Params);
       TransportConfiguration server1tc = new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                    service1Params);
+                                                                    server1Params);
       connectors.put(server1tc.getName(), server1tc);
 
-      service0.getServer().getConfiguration().setConnectorConfigurations(connectors);
+      server0.getConfiguration().setConnectorConfigurations(connectors);
 
       Pair<String, String> connectorPair = new Pair<String, String>(server1tc.getName(), null);
 
@@ -324,26 +324,26 @@
                                                                         1000,
                                                                         1d,
                                                                         -1,
-                                                                        -1,
+                                                                        true,
                                                                         false,                                                                        
                                                                         connectorPair);
 
       List<BridgeConfiguration> bridgeConfigs = new ArrayList<BridgeConfiguration>();
       bridgeConfigs.add(bridgeConfiguration);
-      service0.getServer().getConfiguration().setBridgeConfigurations(bridgeConfigs);
+      server0.getConfiguration().setBridgeConfigurations(bridgeConfigs);
 
       QueueConfiguration queueConfig0 = new QueueConfiguration(testAddress, queueName0, null, true);
       List<QueueConfiguration> queueConfigs0 = new ArrayList<QueueConfiguration>();
       queueConfigs0.add(queueConfig0);
-      service0.getServer().getConfiguration().setQueueConfigurations(queueConfigs0);
+      server0.getConfiguration().setQueueConfigurations(queueConfigs0);
 
       QueueConfiguration queueConfig1 = new QueueConfiguration(forwardAddress, queueName1, null, true);
       List<QueueConfiguration> queueConfigs1 = new ArrayList<QueueConfiguration>();
       queueConfigs1.add(queueConfig1);
-      service1.getServer().getConfiguration().setQueueConfigurations(queueConfigs1);
+      server1.getConfiguration().setQueueConfigurations(queueConfigs1);
 
-      service1.start();
-      service0.start();
+      server1.start();
+      server0.start();
 
       ClientSessionFactory sf0 = new ClientSessionFactoryImpl(server0tc);
 
@@ -401,9 +401,9 @@
 
       sf1.close();
 
-      service0.stop();
+      server0.stop();
 
-      service1.stop();
+      server1.stop();
    }
 
 }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeTestBase.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeTestBase.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -30,7 +30,7 @@
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.remoting.impl.invm.TransportConstants;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.UnitTestCase;
 
 /**
@@ -44,50 +44,50 @@
  */
 public abstract class BridgeTestBase extends UnitTestCase
 {
-   protected MessagingService createMessagingServiceNIO(final int id, final Map<String, Object> params)
+   protected MessagingServer createMessagingServerNIO(final int id, final Map<String, Object> params)
    {
+      return createMessagingServerNIO(id, params, false);
+   }
+
+   protected MessagingServer createMessagingServerNIO(final int id,
+                                                      final Map<String, Object> params,
+                                                      final boolean backup)
+   {
       Configuration serviceConf = new ConfigurationImpl();
       serviceConf.setClustered(true);
-      serviceConf.setSecurityEnabled(false); 
+      serviceConf.setSecurityEnabled(false);
+      serviceConf.setBackup(backup);
       serviceConf.setJournalMinFiles(2);
       serviceConf.setJournalFileSize(100 * 1024);
       params.put(TransportConstants.SERVER_ID_PROP_NAME, id);
       serviceConf.getAcceptorConfigurations()
-                  .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory",
-                                                  params));
-      MessagingService service = Messaging.newMessagingService(serviceConf);
+                 .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory",
+                                                 params));
+      MessagingServer service = Messaging.newMessagingServer(serviceConf);
       return service;
    }
-   
-   protected MessagingService createMessagingService(final int id, final Map<String, Object> params)
+
+   protected MessagingServer createMessagingServer(final int id, final Map<String, Object> params)
    {
-      Configuration serviceConf = new ConfigurationImpl();
-      serviceConf.setClustered(true);
-      serviceConf.setSecurityEnabled(false);     
-      params.put(TransportConstants.SERVER_ID_PROP_NAME, id);
-      serviceConf.getAcceptorConfigurations()
-                  .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory",
-                                                  params));
-      MessagingService service = Messaging.newNullStorageMessagingService(serviceConf);
-      return service;
+      return createMessagingServer(id, params, false);
    }
-   
-   protected MessagingService createMessagingService(final int id, final Map<String, Object> params, final boolean backup)
+
+   protected MessagingServer createMessagingServer(final int id, final Map<String, Object> params, final boolean backup)
    {
       Configuration serviceConf = new ConfigurationImpl();
       serviceConf.setClustered(true);
-      serviceConf.setSecurityEnabled(false);     
+      serviceConf.setSecurityEnabled(false);
       serviceConf.setBackup(backup);
       params.put(TransportConstants.SERVER_ID_PROP_NAME, id);
       serviceConf.getAcceptorConfigurations()
-                  .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory",
-                                                  params));
-      MessagingService service = Messaging.newNullStorageMessagingService(serviceConf);
+                 .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory",
+                                                 params));
+      MessagingServer service = Messaging.newNullStorageMessagingServer(serviceConf);
       return service;
    }
-   
-   protected MessagingService createMessagingService(final int id)
+
+   protected MessagingServer createMessagingServer(final int id)
    {
-      return this.createMessagingService(id, new HashMap<String, Object>());
+      return this.createMessagingServer(id, new HashMap<String, Object>());
    }
 }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusterTestBase.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusterTestBase.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -51,8 +51,9 @@
 import org.jboss.messaging.core.postoffice.PostOffice;
 import org.jboss.messaging.core.postoffice.QueueBinding;
 import org.jboss.messaging.core.postoffice.impl.LocalQueueBinding;
+import org.jboss.messaging.core.server.JournalType;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.cluster.ClusterConnection;
 import org.jboss.messaging.core.server.cluster.RemoteQueueBinding;
 import org.jboss.messaging.tests.util.ServiceTestBase;
@@ -108,17 +109,17 @@
 
    private static final int MAX_SERVERS = 10;
 
-   private MessagingService[] services = new MessagingService[MAX_SERVERS];
+   private MessagingServer[] servers = new MessagingServer[MAX_SERVERS];
 
    private ClientSessionFactory[] sfs = new ClientSessionFactory[MAX_SERVERS];
 
    protected void failNode(TransportConfiguration conf)
    {
-      // MessagingService service = this.services[node];
+      // MessagingServer server = this.services[node];
       //
-      // if (service == null)
+      // if (server == null)
       // {
-      // throw new IllegalArgumentException("No service at " + node);
+      // throw new IllegalArgumentException("No server at " + node);
       // }
       //
       // RemotingConnection conn = ((ClientSessionInternal)this.consumers[node].session).getConnection();
@@ -132,14 +133,14 @@
 
    protected void waitForMessages(int node, final String address, final int count) throws Exception
    {
-      MessagingService service = this.services[node];
+      MessagingServer server = this.servers[node];
 
-      if (service == null)
+      if (server == null)
       {
-         throw new IllegalArgumentException("No service at " + node);
+         throw new IllegalArgumentException("No server at " + node);
       }
 
-      PostOffice po = service.getServer().getPostOffice();
+      PostOffice po = server.getPostOffice();
 
       long start = System.currentTimeMillis();
 
@@ -149,11 +150,11 @@
       {
          messageCount = getMessageCount(po, address);
 
-        // log.info(node + " messageCount " + messageCount);
+         // log.info(node + " messageCount " + messageCount);
 
          if (messageCount == count)
          {
-            //log.info("Waited " + (System.currentTimeMillis() - start));
+            // log.info("Waited " + (System.currentTimeMillis() - start));
             return;
          }
 
@@ -183,14 +184,14 @@
 //               consumerCount +
 //               " local " +
 //               local);
-      MessagingService service = this.services[node];
+      MessagingServer server = this.servers[node];
 
-      if (service == null)
+      if (server == null)
       {
-         throw new IllegalArgumentException("No service at " + node);
+         throw new IllegalArgumentException("No server at " + node);
       }
 
-      PostOffice po = service.getServer().getPostOffice();
+      PostOffice po = server.getPostOffice();
 
       long start = System.currentTimeMillis();
 
@@ -218,7 +219,7 @@
             }
          }
 
-       //  log.info(node + " binding count " + bindingCount + " consumer Count " + totConsumers);
+        // log.info(node + " binding count " + bindingCount + " consumer Count " + totConsumers);
 
          if (bindingCount == count && totConsumers == consumerCount)
          {
@@ -479,7 +480,9 @@
 
             if (message != null)
             {
-               log.info("check receive Consumer " + consumerIDs[i] + " received message " + message.getProperty(COUNT_PROP));
+               log.info("check receive Consumer " + consumerIDs[i] +
+                        " received message " +
+                        message.getProperty(COUNT_PROP));
             }
             else
             {
@@ -696,8 +699,6 @@
          {
             int count = (Integer)message.getProperty(COUNT_PROP);
 
-            // log.info("consumer " + consumerID + " received message " + count);
-
             ints.add(count);
          }
       }
@@ -734,7 +735,7 @@
    {
       if (sfs[node] != null)
       {
-         throw new IllegalArgumentException("Already a service at " + node);
+         throw new IllegalArgumentException("Already a server at " + node);
       }
 
       Map<String, Object> params = generateParams(node, netty);
@@ -762,7 +763,7 @@
    {
       if (sfs[node] != null)
       {
-         throw new IllegalArgumentException("Already a service at " + node);
+         throw new IllegalArgumentException("Already a server at " + node);
       }
 
       Map<String, Object> params = generateParams(node, netty);
@@ -804,14 +805,14 @@
       this.setupSessionFactory(node, backupNode, netty, true);
    }
 
-   protected MessagingService getService(int node)
+   protected MessagingServer getServer(int node)
    {
-      if (services[node] == null)
+      if (servers[node] == null)
       {
-         throw new IllegalArgumentException("No service at node " + node);
+         throw new IllegalArgumentException("No server at node " + node);
       }
 
-      return services[node];
+      return servers[node];
    }
 
    protected void setupServer(int node, boolean fileStorage, boolean netty)
@@ -831,9 +832,9 @@
 
    protected void setupServer(int node, boolean fileStorage, boolean netty, boolean backup, int backupNode)
    {
-      if (services[node] != null)
+      if (servers[node] != null)
       {
-         throw new IllegalArgumentException("Already a service at node " + node);
+         throw new IllegalArgumentException("Already a server at node " + node);
       }
 
       Configuration configuration = new ConfigurationImpl();
@@ -841,8 +842,9 @@
       configuration.setSecurityEnabled(false);
       configuration.setBindingsDirectory(getBindingsDir(node));
       configuration.setJournalMinFiles(2);
-      configuration.setJournalDirectory(getJournalDir(node));
+      configuration.setJournalDirectory(getJournalDir(node, backup));
       configuration.setJournalFileSize(100 * 1024);
+      configuration.setJournalType(JournalType.NIO);
       configuration.setPagingDirectory(getPageDir(node));
       configuration.setLargeMessagesDirectory(getLargeMessagesDir(node));
       configuration.setClustered(true);
@@ -883,24 +885,24 @@
          configuration.getAcceptorConfigurations().add(nettytc);
       }
 
-      MessagingService service;
+      MessagingServer server;
 
       if (fileStorage)
       {
-         service = Messaging.newMessagingService(configuration);
+         server = Messaging.newMessagingServer(configuration);
       }
       else
       {
-         service = Messaging.newNullStorageMessagingService(configuration);
+         server = Messaging.newNullStorageMessagingServer(configuration);
       }
-      services[node] = service;
+      servers[node] = server;
    }
 
    protected void setupServerWithDiscovery(int node, String groupAddress, int port, boolean fileStorage, boolean netty)
    {
-      if (services[node] != null)
+      if (servers[node] != null)
       {
-         throw new IllegalArgumentException("Already a service at node " + node);
+         throw new IllegalArgumentException("Already a server at node " + node);
       }
 
       Configuration configuration = new ConfigurationImpl();
@@ -908,7 +910,7 @@
       configuration.setSecurityEnabled(false);
       configuration.setBindingsDirectory(getBindingsDir(node));
       configuration.setJournalMinFiles(2);
-      configuration.setJournalDirectory(getJournalDir(node));
+      configuration.setJournalDirectory(getJournalDir(node, false));
       configuration.setJournalFileSize(100 * 1024);
       configuration.setPagingDirectory(getPageDir(node));
       configuration.setLargeMessagesDirectory(getLargeMessagesDir(node));
@@ -957,17 +959,17 @@
 
       configuration.getDiscoveryGroupConfigurations().put(dcConfig.getName(), dcConfig);
 
-      MessagingService service;
+      MessagingServer server;
 
       if (fileStorage)
       {
-         service = Messaging.newMessagingService(configuration);
+         server = Messaging.newMessagingServer(configuration);
       }
       else
       {
-         service = Messaging.newNullStorageMessagingService(configuration);
+         server = Messaging.newNullStorageMessagingServer(configuration);
       }
-      services[node] = service;
+      servers[node] = server;
    }
 
    protected Map<String, Object> generateParams(int node, boolean netty)
@@ -988,12 +990,12 @@
    {
       for (int i = 0; i < nodes.length; i++)
       {
-         if (services[nodes[i]] == null)
+         if (servers[nodes[i]] == null)
          {
-            throw new IllegalArgumentException("No service at node " + nodes[i]);
+            throw new IllegalArgumentException("No server at node " + nodes[i]);
          }
 
-         services[nodes[i]] = null;
+         servers[nodes[i]] = null;
       }
    }
 
@@ -1005,14 +1007,14 @@
                                          int maxHops,
                                          boolean netty)
    {
-      MessagingService serviceFrom = services[nodeFrom];
+      MessagingServer serverFrom = servers[nodeFrom];
 
-      if (serviceFrom == null)
+      if (serverFrom == null)
       {
-         throw new IllegalStateException("No service at node " + nodeFrom);
+         throw new IllegalStateException("No server at node " + nodeFrom);
       }
 
-      // Map<String, TransportConfiguration> connectors = serviceFrom.getServer()
+      // Map<String, TransportConfiguration> connectors = serviceFrom
       // .getConfiguration()
       // .getConnectorConfigurations();
 
@@ -1029,7 +1031,7 @@
          serverTotc = new TransportConfiguration(INVM_CONNECTOR_FACTORY, params);
       }
 
-      serviceFrom.getServer().getConfiguration().getConnectorConfigurations().put(serverTotc.getName(), serverTotc);
+      serverFrom.getConfiguration().getConnectorConfigurations().put(serverTotc.getName(), serverTotc);
 
       Pair<String, String> connectorPair = new Pair<String, String>(serverTotc.getName(), null);
 
@@ -1039,18 +1041,15 @@
       ClusterConnectionConfiguration clusterConf = new ClusterConnectionConfiguration(name,
                                                                                       address,
                                                                                       100,
-                                                                                      1d,
-                                                                                      -1,
-                                                                                      -1,
                                                                                       true,
                                                                                       forwardWhenNoConsumers,
                                                                                       maxHops,
                                                                                       pairs);
-      serviceFrom.getServer().getConfiguration().getClusterConfigurations().add(clusterConf);
+      serverFrom.getConfiguration().getClusterConfigurations().add(clusterConf);
 
       // clusterConfs.add(clusterConf);
 
-      // serviceFrom.getServer().getConfiguration().setClusterConfigurations(clusterConfs);
+      // serviceFrom.getConfiguration().setClusterConfigurations(clusterConfs);
    }
 
    // protected void setupClusterConnection(String name,
@@ -1061,14 +1060,14 @@
    // int maxHops,
    // boolean netty)
    // {
-   // MessagingService serviceFrom = services[nodeFrom];
+   // MessagingServer serviceFrom = servers[nodeFrom];
    //
    // if (serviceFrom == null)
    // {
-   // throw new IllegalStateException("No service at node " + nodeFrom);
+   // throw new IllegalStateException("No server at node " + nodeFrom);
    // }
    //
-   // Map<String, TransportConfiguration> connectors = serviceFrom.getServer()
+   // Map<String, TransportConfiguration> connectors = serviceFrom
    // .getConfiguration()
    // .getConnectorConfigurations();
    //
@@ -1087,7 +1086,7 @@
    //
    // connectors.put(serverTotc.getName(), serverTotc);
    //
-   // serviceFrom.getServer().getConfiguration().setConnectorConfigurations(connectors);
+   // serviceFrom.getConfiguration().setConnectorConfigurations(connectors);
    //
    // Pair<String, String> connectorPair = new Pair<String, String>(serverTotc.getName(), null);
    //
@@ -1104,13 +1103,13 @@
    // forwardWhenNoConsumers,
    // maxHops,
    // pairs);
-   // List<ClusterConnectionConfiguration> clusterConfs = serviceFrom.getServer()
+   // List<ClusterConnectionConfiguration> clusterConfs = serviceFrom
    // .getConfiguration()
    // .getClusterConfigurations();
    //
    // clusterConfs.add(clusterConf);
    //
-   // serviceFrom.getServer().getConfiguration().setClusterConfigurations(clusterConfs);
+   // serviceFrom.getConfiguration().setClusterConfigurations(clusterConfs);
    // }
 
    protected void setupClusterConnection(String name,
@@ -1121,16 +1120,14 @@
                                          int nodeFrom,
                                          int... nodesTo)
    {
-      MessagingService serviceFrom = services[nodeFrom];
+      MessagingServer serverFrom = servers[nodeFrom];
 
-      if (serviceFrom == null)
+      if (serverFrom == null)
       {
-         throw new IllegalStateException("No service at node " + nodeFrom);
+         throw new IllegalStateException("No server at node " + nodeFrom);
       }
 
-      Map<String, TransportConfiguration> connectors = serviceFrom.getServer()
-                                                                  .getConfiguration()
-                                                                  .getConnectorConfigurations();
+      Map<String, TransportConfiguration> connectors = serverFrom.getConfiguration().getConnectorConfigurations();
 
       List<Pair<String, String>> pairs = new ArrayList<Pair<String, String>>();
 
@@ -1159,15 +1156,12 @@
       ClusterConnectionConfiguration clusterConf = new ClusterConnectionConfiguration(name,
                                                                                       address,
                                                                                       250,
-                                                                                      1d,
-                                                                                      -1,
-                                                                                      -1,
                                                                                       true,
                                                                                       forwardWhenNoConsumers,
                                                                                       maxHops,
                                                                                       pairs);
 
-      serviceFrom.getServer().getConfiguration().getClusterConfigurations().add(clusterConf);
+      serverFrom.getConfiguration().getClusterConfigurations().add(clusterConf);
    }
 
    protected void setupClusterConnectionWithBackups(String name,
@@ -1179,16 +1173,14 @@
                                                     int[] nodesTo,
                                                     int[] backupsTo)
    {
-      MessagingService serviceFrom = services[nodeFrom];
+      MessagingServer serverFrom = servers[nodeFrom];
 
-      if (serviceFrom == null)
+      if (serverFrom == null)
       {
-         throw new IllegalStateException("No service at node " + nodeFrom);
+         throw new IllegalStateException("No server at node " + nodeFrom);
       }
 
-      Map<String, TransportConfiguration> connectors = serviceFrom.getServer()
-                                                                  .getConfiguration()
-                                                                  .getConnectorConfigurations();
+      Map<String, TransportConfiguration> connectors = serverFrom.getConfiguration().getConnectorConfigurations();
 
       List<Pair<String, String>> pairs = new ArrayList<Pair<String, String>>();
 
@@ -1234,15 +1226,12 @@
       ClusterConnectionConfiguration clusterConf = new ClusterConnectionConfiguration(name,
                                                                                       address,
                                                                                       250,
-                                                                                      1d,
-                                                                                      -1,
-                                                                                      -1,
                                                                                       true,
                                                                                       forwardWhenNoConsumers,
                                                                                       maxHops,
                                                                                       pairs);
 
-      serviceFrom.getServer().getConfiguration().getClusterConfigurations().add(clusterConf);
+      serverFrom.getConfiguration().getClusterConfigurations().add(clusterConf);
    }
 
    protected void setupDiscoveryClusterConnection(String name,
@@ -1253,26 +1242,21 @@
                                                   int maxHops,
                                                   boolean netty)
    {
-      MessagingService service = services[node];
+      MessagingServer server = servers[node];
 
-      if (service == null)
+      if (server == null)
       {
-         throw new IllegalStateException("No service at node " + node);
+         throw new IllegalStateException("No server at node " + node);
       }
 
       ClusterConnectionConfiguration clusterConf = new ClusterConnectionConfiguration(name,
                                                                                       address,
                                                                                       100,
-                                                                                      1d,
-                                                                                      -1,
-                                                                                      -1,
                                                                                       true,
                                                                                       forwardWhenNoConsumers,
                                                                                       maxHops,
                                                                                       discoveryGroupName);
-      List<ClusterConnectionConfiguration> clusterConfs = service.getServer()
-                                                                 .getConfiguration()
-                                                                 .getClusterConfigurations();
+      List<ClusterConnectionConfiguration> clusterConfs = server.getConfiguration().getClusterConfigurations();
 
       clusterConfs.add(clusterConf);
    }
@@ -1283,7 +1267,7 @@
       {
          log.info("starting server " + nodes[i]);
 
-         services[nodes[i]].start();
+         servers[nodes[i]].start();
 
          log.info("started server " + nodes[i]);
       }
@@ -1293,9 +1277,9 @@
    {
       for (int i = 0; i < nodes.length; i++)
       {
-         if (services[nodes[i]].isStarted())
-         {            
-            for (ClusterConnection cc : services[nodes[i]].getServer().getClusterManager().getClusterConnections())
+         if (servers[nodes[i]].isStarted())
+         {
+            for (ClusterConnection cc : servers[nodes[i]].getClusterManager().getClusterConnections())
             {
                cc.stop();
             }
@@ -1307,10 +1291,10 @@
    {
       for (int i = 0; i < nodes.length; i++)
       {
-         if (services[nodes[i]].isStarted())
+         if (servers[nodes[i]].isStarted())
          {
             log.info("stopping server " + nodes[i]);
-            services[nodes[i]].stop();
+            servers[nodes[i]].stop();
             log.info("server stopped");
          }
       }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusterWithBackupTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusterWithBackupTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusterWithBackupTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -138,9 +138,6 @@
 
       closeAllSessionFactories();
 
-      // We stop the cluster connections first since this makes server shutdown quicker
-      stopClusterConnections(0, 1, 2, 3, 4, 5);
-
       stopServers(0, 1, 2, 3, 4, 5);
    }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -175,9 +175,6 @@
 
       closeAllSessionFactories();
 
-      // We stop the cluster connections first since this makes server shutdown quicker
-      stopClusterConnections(0, 1, 2, 3, 4);
-
       stopServers(0, 1, 2, 3, 4);
    }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/MessageRedistributionTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/MessageRedistributionTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/MessageRedistributionTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -606,9 +606,9 @@
       AddressSettings as = new AddressSettings();
       as.setRedistributionDelay(delay);
 
-      getService(0).getServer().getAddressSettingsRepository().addMatch("queues.*", as);
-      getService(1).getServer().getAddressSettingsRepository().addMatch("queues.*", as);
-      getService(2).getServer().getAddressSettingsRepository().addMatch("queues.*", as);
+      getServer(0).getAddressSettingsRepository().addMatch("queues.*", as);
+      getServer(1).getAddressSettingsRepository().addMatch("queues.*", as);
+      getServer(2).getAddressSettingsRepository().addMatch("queues.*", as);
    }
 
    protected void setupServers() throws Exception
@@ -623,8 +623,6 @@
       closeAllConsumers();
 
       closeAllSessionFactories();
-      
-      stopClusterConnections(0, 1, 2);
 
       stopServers(0, 1, 2);
       

Added: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/NettyFileStorageSymmetricClusterTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/NettyFileStorageSymmetricClusterTest.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/NettyFileStorageSymmetricClusterTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.tests.integration.cluster.distribution;
+
+/**
+ * A NettyFileStorageSymmetricClusterTest
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ *
+ */
+public class NettyFileStorageSymmetricClusterTest extends SymmetricClusterTest
+{
+   protected boolean isNetty()
+   {
+      return true;
+   }
+
+   protected boolean isFileStorage()
+   {
+      return true;
+   }
+
+}

Added: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/NettyFileStorageSymmetricClusterWithDiscoveryTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/NettyFileStorageSymmetricClusterWithDiscoveryTest.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/NettyFileStorageSymmetricClusterWithDiscoveryTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+
+package org.jboss.messaging.tests.integration.cluster.distribution;
+
+/**
+ * A NettyFileStorageSymmetricClusterWithDiscoveryTest
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ *
+ */
+public class NettyFileStorageSymmetricClusterWithDiscoveryTest extends SymmetricClusterWithDiscoveryTest
+{
+   protected boolean isNetty()
+   {
+      return true;
+   }
+   
+   protected boolean isFileStorage()
+   {
+      return true;
+   }
+}

Added: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/NettySymmetricClusterWithBackupTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/NettySymmetricClusterWithBackupTest.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/NettySymmetricClusterWithBackupTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+
+package org.jboss.messaging.tests.integration.cluster.distribution;
+
+/**
+ * A NettySymmetricClusterWithBackupTest
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ *
+ */
+public class NettySymmetricClusterWithBackupTest extends SymmetricClusterWithBackupTest
+{
+   protected boolean isNetty()
+   {
+      return true;
+   }
+   
+   protected boolean isFileStorage()
+   {
+      return false;
+   }
+}

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/OneWayChainClusterTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/OneWayChainClusterTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/OneWayChainClusterTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -57,8 +57,6 @@
       
       closeAllSessionFactories();
       
-      stopClusterConnections(0, 1, 2, 3, 4);
-      
       stopServers(0, 1, 2, 3, 4);
       
       super.tearDown();

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -54,8 +54,6 @@
       
       closeAllSessionFactories();
       
-      stopClusterConnections(0, 1);
-      
       stopServers(0, 1);
       
       super.tearDown();
@@ -82,7 +80,6 @@
       //Give it a little time for the bridge to try to start
       Thread.sleep(2000);
       
-      log.info("Stopping server 0");
       stopServers(0);            
    }
    
@@ -161,14 +158,8 @@
       
       stopServers(1);
       
-      log.info("*** stopped service 1");
-      
-      log.info("** starting server 1");
-      
       startServers(1);
       
-      log.info("*** started service 1");
-      
       long end = System.currentTimeMillis();
       
       //We time how long it takes to restart, since it has been known to hang in the past and wait for a timeout
@@ -182,12 +173,8 @@
       
       createQueue(1, "queues.testaddress", "queue0", myFilter, false);
       
-      log.info("** adding consumer");
-      
       addConsumer(0, 1, "queue0", null);
       
-      log.info("** added consumer");
-          
       waitForBindings(1, "queues.testaddress", 1, 1, true);
       waitForBindings(0, "queues.testaddress", 1, 1, false);
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/SymmetricClusterTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/SymmetricClusterTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/SymmetricClusterTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -154,8 +154,6 @@
       verifyReceiveRoundRobinInSomeOrder(10, 0, 1, 2, 3, 4);
 
       this.verifyNotReceive(0, 1, 2, 3, 4);
-
-      log.info("got here");
    }
    
    public void testBasicRoundRobin() throws Exception
@@ -199,8 +197,6 @@
       verifyReceiveRoundRobinInSomeOrder(10, 0, 1, 2, 3, 4);
 
       this.verifyNotReceive(0, 1, 2, 3, 4);
-
-      log.info("got here");
    }
 
    public void testRoundRobinMultipleQueues() throws Exception
@@ -1523,9 +1519,6 @@
 
       closeAllSessionFactories();
 
-      // We stop the cluster connections first since this makes server shutdown quicker
-      stopClusterConnections(0, 1, 2, 3, 4);
-
       stopServers(0, 1, 2, 3, 4);
    }
 

Deleted: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/SymmetricClusterTestWithBackup.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/SymmetricClusterTestWithBackup.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/SymmetricClusterTestWithBackup.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -1,311 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-
-package org.jboss.messaging.tests.integration.cluster.distribution;
-
-
-/**
- * A SymmetricClusterTestWithBackup
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * 
- * Created 13 Mar 2009 11:00:31
- *
- *
- */
-public class SymmetricClusterTestWithBackup extends SymmetricClusterTest
-{
-   @Override   
-   public void testStopAllStartAll() throws Exception
-   {
-      setupCluster();
-
-      startServers();
-
-      setupSessionFactory(0, isNetty());
-      setupSessionFactory(1, isNetty());
-      setupSessionFactory(2, isNetty());
-      setupSessionFactory(3, isNetty());
-      setupSessionFactory(4, isNetty());
-
-      createQueue(0, "queues.testaddress", "queue0", null, false);
-      createQueue(1, "queues.testaddress", "queue0", null, false);
-      createQueue(2, "queues.testaddress", "queue0", null, false);
-      createQueue(3, "queues.testaddress", "queue0", null, false);
-      createQueue(4, "queues.testaddress", "queue0", null, false);
-
-      addConsumer(0, 0, "queue0", null);
-      addConsumer(1, 1, "queue0", null);
-      addConsumer(2, 2, "queue0", null);
-      addConsumer(3, 3, "queue0", null);
-      addConsumer(4, 4, "queue0", null);
-
-      waitForBindings(0, "queues.testaddress", 1, 1, true);
-      waitForBindings(1, "queues.testaddress", 1, 1, true);
-      waitForBindings(2, "queues.testaddress", 1, 1, true);
-      waitForBindings(3, "queues.testaddress", 1, 1, true);
-      waitForBindings(4, "queues.testaddress", 1, 1, true);
-
-      waitForBindings(0, "queues.testaddress", 4, 4, false);
-      waitForBindings(1, "queues.testaddress", 4, 4, false);
-      waitForBindings(2, "queues.testaddress", 4, 4, false);
-      waitForBindings(3, "queues.testaddress", 4, 4, false);
-      waitForBindings(4, "queues.testaddress", 4, 4, false);
-
-      send(0, "queues.testaddress", 10, false, null);
-
-      verifyReceiveRoundRobinInSomeOrder(10, 0, 1, 2, 3, 4);
-
-      this.verifyNotReceive(0, 1, 2, 3, 4);
-
-      this.removeConsumer(0);
-      this.removeConsumer(1);
-      this.removeConsumer(2);
-      this.removeConsumer(3);
-      this.removeConsumer(4);
-
-      this.closeAllSessionFactories();
-
-      stopServers(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
-
-      startServers();
-
-      setupSessionFactory(0, isNetty());
-      setupSessionFactory(1, isNetty());
-      setupSessionFactory(2, isNetty());
-      setupSessionFactory(3, isNetty());
-      setupSessionFactory(4, isNetty());
-
-      createQueue(0, "queues.testaddress", "queue0", null, false);
-      createQueue(1, "queues.testaddress", "queue0", null, false);
-      createQueue(2, "queues.testaddress", "queue0", null, false);
-      createQueue(3, "queues.testaddress", "queue0", null, false);
-      createQueue(4, "queues.testaddress", "queue0", null, false);
-
-      addConsumer(0, 0, "queue0", null);
-      addConsumer(1, 1, "queue0", null);
-      addConsumer(2, 2, "queue0", null);
-      addConsumer(3, 3, "queue0", null);
-      addConsumer(4, 4, "queue0", null);
-
-      waitForBindings(0, "queues.testaddress", 1, 1, true);
-      waitForBindings(1, "queues.testaddress", 1, 1, true);
-      waitForBindings(2, "queues.testaddress", 1, 1, true);
-      waitForBindings(3, "queues.testaddress", 1, 1, true);
-      waitForBindings(4, "queues.testaddress", 1, 1, true);
-
-      waitForBindings(0, "queues.testaddress", 4, 4, false);
-      waitForBindings(1, "queues.testaddress", 4, 4, false);
-      waitForBindings(2, "queues.testaddress", 4, 4, false);
-      waitForBindings(3, "queues.testaddress", 4, 4, false);
-      waitForBindings(4, "queues.testaddress", 4, 4, false);
-
-      send(0, "queues.testaddress", 10, false, null);
-
-      verifyReceiveRoundRobinInSomeOrder(10, 0, 1, 2, 3, 4);
-
-      this.verifyNotReceive(0, 1, 2, 3, 4);
-   }
-   
-   @Override
-   public void testMixtureLoadBalancedAndNonLoadBalancedQueuesAddQueuesAndConsumersBeforeAllServersAreStarted() throws Exception
-   {
-      setupCluster();
-      
-      startServers(5, 0);
-
-      setupSessionFactory(0, isNetty());
-
-      createQueue(0, "queues.testaddress", "queue0", null, false);
-      createQueue(0, "queues.testaddress", "queue5", null, false);
-      createQueue(0, "queues.testaddress", "queue10", null, false);
-      createQueue(0, "queues.testaddress", "queue15", null, false);
-      createQueue(0, "queues.testaddress", "queue17", null, false);
-
-      addConsumer(0, 0, "queue0", null);
-      addConsumer(5, 0, "queue5", null);
-
-      startServers(6, 1);
-      setupSessionFactory(1, isNetty());
-
-      createQueue(1, "queues.testaddress", "queue1", null, false);
-      createQueue(1, "queues.testaddress", "queue6", null, false);
-      createQueue(1, "queues.testaddress", "queue11", null, false);
-      createQueue(1, "queues.testaddress", "queue15", null, false);
-      createQueue(1, "queues.testaddress", "queue17", null, false);
-
-      addConsumer(1, 1, "queue1", null);
-      addConsumer(6, 1, "queue6", null);
-      addConsumer(11, 1, "queue11", null);
-      addConsumer(16, 1, "queue15", null);
-
-      startServers(7, 2);
-      setupSessionFactory(2, isNetty());
-
-      createQueue(2, "queues.testaddress", "queue2", null, false);
-      createQueue(2, "queues.testaddress", "queue7", null, false);
-      createQueue(2, "queues.testaddress", "queue12", null, false);
-      createQueue(2, "queues.testaddress", "queue15", null, false);
-      createQueue(2, "queues.testaddress", "queue16", null, false);
-
-      addConsumer(2, 2, "queue2", null);
-      addConsumer(7, 2, "queue7", null);
-      addConsumer(12, 2, "queue12", null);
-      addConsumer(17, 2, "queue15", null);
-
-      startServers(8, 3);
-      setupSessionFactory(3, isNetty());
-
-      createQueue(3, "queues.testaddress", "queue3", null, false);
-      createQueue(3, "queues.testaddress", "queue8", null, false);
-      createQueue(3, "queues.testaddress", "queue13", null, false);
-      createQueue(3, "queues.testaddress", "queue15", null, false);
-      createQueue(3, "queues.testaddress", "queue16", null, false);
-      createQueue(3, "queues.testaddress", "queue18", null, false);
-
-      addConsumer(3, 3, "queue3", null);
-      addConsumer(8, 3, "queue8", null);
-      addConsumer(13, 3, "queue13", null);
-      addConsumer(18, 3, "queue15", null);
-
-      startServers(9, 4);
-      setupSessionFactory(4, isNetty());
-
-      createQueue(4, "queues.testaddress", "queue4", null, false);
-      createQueue(4, "queues.testaddress", "queue9", null, false);
-      createQueue(4, "queues.testaddress", "queue14", null, false);
-      createQueue(4, "queues.testaddress", "queue15", null, false);
-      createQueue(4, "queues.testaddress", "queue16", null, false);
-      createQueue(4, "queues.testaddress", "queue17", null, false);
-      createQueue(4, "queues.testaddress", "queue18", null, false);
-
-      addConsumer(4, 4, "queue4", null);
-      addConsumer(9, 4, "queue9", null);
-      addConsumer(10, 0, "queue10", null);
-      addConsumer(14, 4, "queue14", null);
-
-      addConsumer(15, 0, "queue15", null);
-      addConsumer(19, 4, "queue15", null);
-
-      addConsumer(20, 2, "queue16", null);
-      addConsumer(21, 3, "queue16", null);
-      addConsumer(22, 4, "queue16", null);
-
-      addConsumer(23, 0, "queue17", null);
-      addConsumer(24, 1, "queue17", null);
-      addConsumer(25, 4, "queue17", null);
-
-      addConsumer(26, 3, "queue18", null);
-      addConsumer(27, 4, "queue18", null);
-
-      waitForBindings(0, "queues.testaddress", 5, 5, true);
-      waitForBindings(1, "queues.testaddress", 5, 5, true);
-      waitForBindings(2, "queues.testaddress", 5, 5, true);
-      waitForBindings(3, "queues.testaddress", 6, 6, true);
-      waitForBindings(4, "queues.testaddress", 7, 7, true);
-
-      waitForBindings(0, "queues.testaddress", 23, 23, false);
-      waitForBindings(1, "queues.testaddress", 23, 23, false);
-      waitForBindings(2, "queues.testaddress", 23, 23, false);
-      waitForBindings(3, "queues.testaddress", 22, 22, false);
-      waitForBindings(4, "queues.testaddress", 21, 21, false);
-
-      send(0, "queues.testaddress", 10, false, null);
-
-      verifyReceiveAll(10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14);
-
-      verifyReceiveRoundRobinInSomeOrder(10, 15, 16, 17, 18, 19);
-
-      verifyReceiveRoundRobinInSomeOrder(10, 20, 21, 22);
-
-      verifyReceiveRoundRobinInSomeOrder(10, 23, 24, 25);
-
-      verifyReceiveRoundRobinInSomeOrder(10, 26, 27);
-   }
-   
-   @Override
-   protected void setupCluster(final boolean forwardWhenNoConsumers) throws Exception
-   {
-      //The lives
-      setupClusterConnection("cluster0", "queues", forwardWhenNoConsumers, 1, isNetty(), 0, 1, 2, 3, 4);
-
-      setupClusterConnection("cluster1", "queues", forwardWhenNoConsumers, 1, isNetty(), 1, 0, 2, 3, 4);
-
-      setupClusterConnection("cluster2", "queues", forwardWhenNoConsumers, 1, isNetty(), 2, 0, 1, 3, 4);
-
-      setupClusterConnection("cluster3", "queues", forwardWhenNoConsumers, 1, isNetty(), 3, 0, 1, 2, 4);
-
-      setupClusterConnection("cluster4", "queues", forwardWhenNoConsumers, 1, isNetty(), 4, 0, 1, 2, 3);
-      
-      
-      //The backups
-      
-      setupClusterConnection("cluster0", "queues", forwardWhenNoConsumers, 1, isNetty(), 5, 1, 2, 3, 4);
-
-      setupClusterConnection("cluster1", "queues", forwardWhenNoConsumers, 1, isNetty(), 6, 0, 2, 3, 4);
-
-      setupClusterConnection("cluster2", "queues", forwardWhenNoConsumers, 1, isNetty(), 7, 0, 1, 3, 4);
-
-      setupClusterConnection("cluster3", "queues", forwardWhenNoConsumers, 1, isNetty(), 8, 0, 1, 2, 4);
-
-      setupClusterConnection("cluster4", "queues", forwardWhenNoConsumers, 1, isNetty(), 9, 0, 1, 2, 3);
-   }
-
-   @Override
-   protected void setupServers() throws Exception
-   {
-      //The backups
-      setupServer(5, isFileStorage(), isNetty(), true);
-      setupServer(6, isFileStorage(), isNetty(), true);
-      setupServer(7, isFileStorage(), isNetty(), true);
-      setupServer(8, isFileStorage(), isNetty(), true);
-      setupServer(9, isFileStorage(), isNetty(), true);   
-      
-      //The lives
-      setupServer(0, isFileStorage(), isNetty(), 5);
-      setupServer(1, isFileStorage(), isNetty(), 6);
-      setupServer(2, isFileStorage(), isNetty(), 7);
-      setupServer(3, isFileStorage(), isNetty(), 8);
-      setupServer(4, isFileStorage(), isNetty(), 9); 
-   }
-   
-   @Override
-   protected void startServers() throws Exception
-   {
-      startServers(5, 6, 7, 8, 9, 0, 1, 2, 3, 4);
-   }
-
-   @Override
-   protected void stopServers() throws Exception
-   {
-      closeAllConsumers();
-
-      closeAllSessionFactories();
-
-      // We stop the cluster connections first since this makes server shutdown quicker
-      stopClusterConnections(5, 6, 7, 8, 9, 0, 1, 2, 3, 4);
-
-      stopServers(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
-   }
-
-}

Copied: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/SymmetricClusterWithBackupTest.java (from rev 6150, trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/SymmetricClusterTestWithBackup.java)
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/SymmetricClusterWithBackupTest.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/SymmetricClusterWithBackupTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -0,0 +1,579 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.tests.integration.cluster.distribution;
+
+import org.jboss.messaging.core.logging.Logger;
+
+/**
+ * A SymmetricClusterWithBackupTest
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * 
+ * Created 13 Mar 2009 11:00:31
+ *
+ *
+ */
+public class SymmetricClusterWithBackupTest extends SymmetricClusterTest
+{
+   private static final Logger log = Logger.getLogger(SymmetricClusterWithBackupTest.class);
+
+   @Override
+   public void testStopAllStartAll() throws Exception
+   {
+      setupCluster();
+
+      startServers();
+
+      setupSessionFactory(0, isNetty());
+      setupSessionFactory(1, isNetty());
+      setupSessionFactory(2, isNetty());
+      setupSessionFactory(3, isNetty());
+      setupSessionFactory(4, isNetty());
+
+      createQueue(0, "queues.testaddress", "queue0", null, false);
+      createQueue(1, "queues.testaddress", "queue0", null, false);
+      createQueue(2, "queues.testaddress", "queue0", null, false);
+      createQueue(3, "queues.testaddress", "queue0", null, false);
+      createQueue(4, "queues.testaddress", "queue0", null, false);
+
+      addConsumer(0, 0, "queue0", null);
+      addConsumer(1, 1, "queue0", null);
+      addConsumer(2, 2, "queue0", null);
+      addConsumer(3, 3, "queue0", null);
+      addConsumer(4, 4, "queue0", null);
+
+      waitForBindings(0, "queues.testaddress", 1, 1, true);
+      waitForBindings(1, "queues.testaddress", 1, 1, true);
+      waitForBindings(2, "queues.testaddress", 1, 1, true);
+      waitForBindings(3, "queues.testaddress", 1, 1, true);
+      waitForBindings(4, "queues.testaddress", 1, 1, true);
+
+      waitForBindings(0, "queues.testaddress", 4, 4, false);
+      waitForBindings(1, "queues.testaddress", 4, 4, false);
+      waitForBindings(2, "queues.testaddress", 4, 4, false);
+      waitForBindings(3, "queues.testaddress", 4, 4, false);
+      waitForBindings(4, "queues.testaddress", 4, 4, false);
+
+      send(0, "queues.testaddress", 10, false, null);
+
+      verifyReceiveRoundRobinInSomeOrder(10, 0, 1, 2, 3, 4);
+
+      this.verifyNotReceive(0, 1, 2, 3, 4);
+
+      this.removeConsumer(0);
+      this.removeConsumer(1);
+      this.removeConsumer(2);
+      this.removeConsumer(3);
+      this.removeConsumer(4);
+
+      this.closeAllSessionFactories();
+
+      stopServers(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
+
+      startServers();
+
+      setupSessionFactory(0, isNetty());
+      setupSessionFactory(1, isNetty());
+      setupSessionFactory(2, isNetty());
+      setupSessionFactory(3, isNetty());
+      setupSessionFactory(4, isNetty());
+
+      createQueue(0, "queues.testaddress", "queue0", null, false);
+      createQueue(1, "queues.testaddress", "queue0", null, false);
+      createQueue(2, "queues.testaddress", "queue0", null, false);
+      createQueue(3, "queues.testaddress", "queue0", null, false);
+      createQueue(4, "queues.testaddress", "queue0", null, false);
+
+      addConsumer(0, 0, "queue0", null);
+      addConsumer(1, 1, "queue0", null);
+      addConsumer(2, 2, "queue0", null);
+      addConsumer(3, 3, "queue0", null);
+      addConsumer(4, 4, "queue0", null);
+
+      waitForBindings(0, "queues.testaddress", 1, 1, true);
+      waitForBindings(1, "queues.testaddress", 1, 1, true);
+      waitForBindings(2, "queues.testaddress", 1, 1, true);
+      waitForBindings(3, "queues.testaddress", 1, 1, true);
+      waitForBindings(4, "queues.testaddress", 1, 1, true);
+
+      waitForBindings(0, "queues.testaddress", 4, 4, false);
+      waitForBindings(1, "queues.testaddress", 4, 4, false);
+      waitForBindings(2, "queues.testaddress", 4, 4, false);
+      waitForBindings(3, "queues.testaddress", 4, 4, false);
+      waitForBindings(4, "queues.testaddress", 4, 4, false);
+
+      send(0, "queues.testaddress", 10, false, null);
+
+      verifyReceiveRoundRobinInSomeOrder(10, 0, 1, 2, 3, 4);
+
+      this.verifyNotReceive(0, 1, 2, 3, 4);
+   }
+
+   @Override
+   public void testMixtureLoadBalancedAndNonLoadBalancedQueuesAddQueuesAndConsumersBeforeAllServersAreStarted() throws Exception
+   {
+      setupCluster();
+
+      startServers(5, 0);
+
+      setupSessionFactory(0, isNetty());
+
+      createQueue(0, "queues.testaddress", "queue0", null, false);
+      createQueue(0, "queues.testaddress", "queue5", null, false);
+      createQueue(0, "queues.testaddress", "queue10", null, false);
+      createQueue(0, "queues.testaddress", "queue15", null, false);
+      createQueue(0, "queues.testaddress", "queue17", null, false);
+
+      addConsumer(0, 0, "queue0", null);
+      addConsumer(5, 0, "queue5", null);
+
+      startServers(6, 1);
+      setupSessionFactory(1, isNetty());
+
+      createQueue(1, "queues.testaddress", "queue1", null, false);
+      createQueue(1, "queues.testaddress", "queue6", null, false);
+      createQueue(1, "queues.testaddress", "queue11", null, false);
+      createQueue(1, "queues.testaddress", "queue15", null, false);
+      createQueue(1, "queues.testaddress", "queue17", null, false);
+
+      addConsumer(1, 1, "queue1", null);
+      addConsumer(6, 1, "queue6", null);
+      addConsumer(11, 1, "queue11", null);
+      addConsumer(16, 1, "queue15", null);
+
+      startServers(7, 2);
+      setupSessionFactory(2, isNetty());
+
+      createQueue(2, "queues.testaddress", "queue2", null, false);
+      createQueue(2, "queues.testaddress", "queue7", null, false);
+      createQueue(2, "queues.testaddress", "queue12", null, false);
+      createQueue(2, "queues.testaddress", "queue15", null, false);
+      createQueue(2, "queues.testaddress", "queue16", null, false);
+
+      addConsumer(2, 2, "queue2", null);
+      addConsumer(7, 2, "queue7", null);
+      addConsumer(12, 2, "queue12", null);
+      addConsumer(17, 2, "queue15", null);
+
+      startServers(8, 3);
+      setupSessionFactory(3, isNetty());
+
+      createQueue(3, "queues.testaddress", "queue3", null, false);
+      createQueue(3, "queues.testaddress", "queue8", null, false);
+      createQueue(3, "queues.testaddress", "queue13", null, false);
+      createQueue(3, "queues.testaddress", "queue15", null, false);
+      createQueue(3, "queues.testaddress", "queue16", null, false);
+      createQueue(3, "queues.testaddress", "queue18", null, false);
+
+      addConsumer(3, 3, "queue3", null);
+      addConsumer(8, 3, "queue8", null);
+      addConsumer(13, 3, "queue13", null);
+      addConsumer(18, 3, "queue15", null);
+
+      startServers(9, 4);
+      setupSessionFactory(4, isNetty());
+
+      createQueue(4, "queues.testaddress", "queue4", null, false);
+      createQueue(4, "queues.testaddress", "queue9", null, false);
+      createQueue(4, "queues.testaddress", "queue14", null, false);
+      createQueue(4, "queues.testaddress", "queue15", null, false);
+      createQueue(4, "queues.testaddress", "queue16", null, false);
+      createQueue(4, "queues.testaddress", "queue17", null, false);
+      createQueue(4, "queues.testaddress", "queue18", null, false);
+
+      addConsumer(4, 4, "queue4", null);
+      addConsumer(9, 4, "queue9", null);
+      addConsumer(10, 0, "queue10", null);
+      addConsumer(14, 4, "queue14", null);
+
+      addConsumer(15, 0, "queue15", null);
+      addConsumer(19, 4, "queue15", null);
+
+      addConsumer(20, 2, "queue16", null);
+      addConsumer(21, 3, "queue16", null);
+      addConsumer(22, 4, "queue16", null);
+
+      addConsumer(23, 0, "queue17", null);
+      addConsumer(24, 1, "queue17", null);
+      addConsumer(25, 4, "queue17", null);
+
+      addConsumer(26, 3, "queue18", null);
+      addConsumer(27, 4, "queue18", null);
+
+      waitForBindings(0, "queues.testaddress", 5, 5, true);
+      waitForBindings(1, "queues.testaddress", 5, 5, true);
+      waitForBindings(2, "queues.testaddress", 5, 5, true);
+      waitForBindings(3, "queues.testaddress", 6, 6, true);
+      waitForBindings(4, "queues.testaddress", 7, 7, true);
+
+      waitForBindings(0, "queues.testaddress", 23, 23, false);
+      waitForBindings(1, "queues.testaddress", 23, 23, false);
+      waitForBindings(2, "queues.testaddress", 23, 23, false);
+      waitForBindings(3, "queues.testaddress", 22, 22, false);
+      waitForBindings(4, "queues.testaddress", 21, 21, false);
+
+      send(0, "queues.testaddress", 10, false, null);
+
+      verifyReceiveAll(10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14);
+
+      verifyReceiveRoundRobinInSomeOrder(10, 15, 16, 17, 18, 19);
+
+      verifyReceiveRoundRobinInSomeOrder(10, 20, 21, 22);
+
+      verifyReceiveRoundRobinInSomeOrder(10, 23, 24, 25);
+
+      verifyReceiveRoundRobinInSomeOrder(10, 26, 27);
+   }
+
+   @Override
+   public void testStartStopServers() throws Exception
+   {
+      setupCluster();
+
+      startServers();
+
+      setupSessionFactory(0, isNetty());
+      setupSessionFactory(1, isNetty());
+      setupSessionFactory(2, isNetty());
+      setupSessionFactory(3, isNetty());
+      setupSessionFactory(4, isNetty());
+
+      createQueue(0, "queues.testaddress", "queue0", null, false);
+      createQueue(1, "queues.testaddress", "queue1", null, false);
+      createQueue(2, "queues.testaddress", "queue2", null, false);
+      createQueue(3, "queues.testaddress", "queue3", null, false);
+      createQueue(4, "queues.testaddress", "queue4", null, false);
+
+      createQueue(0, "queues.testaddress", "queue5", null, false);
+      createQueue(1, "queues.testaddress", "queue6", null, false);
+      createQueue(2, "queues.testaddress", "queue7", null, false);
+      createQueue(3, "queues.testaddress", "queue8", null, false);
+      createQueue(4, "queues.testaddress", "queue9", null, false);
+
+      createQueue(0, "queues.testaddress", "queue10", null, false);
+      createQueue(1, "queues.testaddress", "queue11", null, false);
+      createQueue(2, "queues.testaddress", "queue12", null, false);
+      createQueue(3, "queues.testaddress", "queue13", null, false);
+      createQueue(4, "queues.testaddress", "queue14", null, false);
+
+      createQueue(0, "queues.testaddress", "queue15", null, false);
+      createQueue(1, "queues.testaddress", "queue15", null, false);
+      createQueue(2, "queues.testaddress", "queue15", null, false);
+      createQueue(3, "queues.testaddress", "queue15", null, false);
+      createQueue(4, "queues.testaddress", "queue15", null, false);
+
+      createQueue(2, "queues.testaddress", "queue16", null, false);
+      createQueue(3, "queues.testaddress", "queue16", null, false);
+      createQueue(4, "queues.testaddress", "queue16", null, false);
+
+      createQueue(0, "queues.testaddress", "queue17", null, false);
+      createQueue(1, "queues.testaddress", "queue17", null, false);
+      createQueue(4, "queues.testaddress", "queue17", null, false);
+
+      createQueue(3, "queues.testaddress", "queue18", null, false);
+      createQueue(4, "queues.testaddress", "queue18", null, false);
+
+      addConsumer(0, 0, "queue0", null);
+      addConsumer(1, 1, "queue1", null);
+      addConsumer(2, 2, "queue2", null);
+      addConsumer(3, 3, "queue3", null);
+      addConsumer(4, 4, "queue4", null);
+
+      addConsumer(5, 0, "queue5", null);
+      addConsumer(6, 1, "queue6", null);
+      addConsumer(7, 2, "queue7", null);
+      addConsumer(8, 3, "queue8", null);
+      addConsumer(9, 4, "queue9", null);
+
+      addConsumer(10, 0, "queue10", null);
+      addConsumer(11, 1, "queue11", null);
+      addConsumer(12, 2, "queue12", null);
+      addConsumer(13, 3, "queue13", null);
+      addConsumer(14, 4, "queue14", null);
+
+      addConsumer(15, 0, "queue15", null);
+      addConsumer(16, 1, "queue15", null);
+      addConsumer(17, 2, "queue15", null);
+      addConsumer(18, 3, "queue15", null);
+      addConsumer(19, 4, "queue15", null);
+
+      addConsumer(20, 2, "queue16", null);
+      addConsumer(21, 3, "queue16", null);
+      addConsumer(22, 4, "queue16", null);
+
+      addConsumer(23, 0, "queue17", null);
+      addConsumer(24, 1, "queue17", null);
+      addConsumer(25, 4, "queue17", null);
+
+      addConsumer(26, 3, "queue18", null);
+      addConsumer(27, 4, "queue18", null);
+
+      waitForBindings(0, "queues.testaddress", 5, 5, true);
+      waitForBindings(1, "queues.testaddress", 5, 5, true);
+      waitForBindings(2, "queues.testaddress", 5, 5, true);
+      waitForBindings(3, "queues.testaddress", 6, 6, true);
+      waitForBindings(4, "queues.testaddress", 7, 7, true);
+
+      waitForBindings(0, "queues.testaddress", 23, 23, false);
+      waitForBindings(1, "queues.testaddress", 23, 23, false);
+      waitForBindings(2, "queues.testaddress", 23, 23, false);
+      waitForBindings(3, "queues.testaddress", 22, 22, false);
+      waitForBindings(4, "queues.testaddress", 21, 21, false);
+
+      send(0, "queues.testaddress", 10, false, null);
+
+      verifyReceiveAll(10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14);
+
+      verifyReceiveRoundRobinInSomeOrder(10, 15, 16, 17, 18, 19);
+
+      verifyReceiveRoundRobinInSomeOrder(10, 20, 21, 22);
+
+      verifyReceiveRoundRobinInSomeOrder(10, 23, 24, 25);
+
+      verifyReceiveRoundRobinInSomeOrder(10, 26, 27);
+
+      removeConsumer(0);
+      removeConsumer(5);
+      removeConsumer(10);
+      removeConsumer(15);
+      removeConsumer(23);
+      removeConsumer(3);
+      removeConsumer(8);
+      removeConsumer(13);
+      removeConsumer(18);
+      removeConsumer(21);
+      removeConsumer(26);
+
+      closeSessionFactory(0);
+      closeSessionFactory(3);
+
+      stopServers(0, 3, 5, 8);
+      
+      startServers(5, 8, 0, 3);
+      
+      setupSessionFactory(0, isNetty());
+      setupSessionFactory(3, isNetty());
+
+      createQueue(0, "queues.testaddress", "queue0", null, false);
+      createQueue(3, "queues.testaddress", "queue3", null, false);
+
+      createQueue(0, "queues.testaddress", "queue5", null, false);
+      createQueue(3, "queues.testaddress", "queue8", null, false);
+
+      createQueue(0, "queues.testaddress", "queue10", null, false);
+      createQueue(3, "queues.testaddress", "queue13", null, false);
+
+      createQueue(0, "queues.testaddress", "queue15", null, false);
+      createQueue(3, "queues.testaddress", "queue15", null, false);
+
+      createQueue(3, "queues.testaddress", "queue16", null, false);
+
+      createQueue(0, "queues.testaddress", "queue17", null, false);
+
+      createQueue(3, "queues.testaddress", "queue18", null, false);
+
+      addConsumer(0, 0, "queue0", null);
+      addConsumer(3, 3, "queue3", null);
+
+      addConsumer(5, 0, "queue5", null);
+      addConsumer(8, 3, "queue8", null);
+
+      addConsumer(10, 0, "queue10", null);
+      addConsumer(13, 3, "queue13", null);
+
+      addConsumer(15, 0, "queue15", null);
+      addConsumer(18, 3, "queue15", null);
+
+      addConsumer(21, 3, "queue16", null);
+
+      addConsumer(23, 0, "queue17", null);
+
+      addConsumer(26, 3, "queue18", null);
+
+      waitForBindings(0, "queues.testaddress", 5, 5, true);
+      waitForBindings(1, "queues.testaddress", 5, 5, true);
+      waitForBindings(2, "queues.testaddress", 5, 5, true);
+      waitForBindings(3, "queues.testaddress", 6, 6, true);
+      waitForBindings(4, "queues.testaddress", 7, 7, true);
+
+      waitForBindings(0, "queues.testaddress", 23, 23, false);
+      waitForBindings(1, "queues.testaddress", 23, 23, false);
+      waitForBindings(2, "queues.testaddress", 23, 23, false);
+      waitForBindings(3, "queues.testaddress", 22, 22, false);
+      waitForBindings(4, "queues.testaddress", 21, 21, false);
+
+      send(0, "queues.testaddress", 10, false, null);
+
+      verifyReceiveAll(10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14);
+
+      verifyReceiveRoundRobinInSomeOrder(10, 15, 16, 17, 18, 19);
+
+      verifyReceiveRoundRobinInSomeOrder(10, 20, 21, 22);
+
+      verifyReceiveRoundRobinInSomeOrder(10, 23, 24, 25);
+
+      verifyReceiveRoundRobinInSomeOrder(10, 26, 27);
+
+      tearDown();
+   }
+
+   @Override
+   protected void setupCluster(final boolean forwardWhenNoConsumers) throws Exception
+   {
+      // The lives
+      setupClusterConnectionWithBackups("cluster0",
+                                        "queues",
+                                        forwardWhenNoConsumers,
+                                        1,
+                                        isNetty(),
+                                        0,
+                                        new int[] { 1, 2, 3, 4 },
+                                        new int[] { 6, 7, 8, 9 });
+
+      setupClusterConnectionWithBackups("cluster1",
+                                        "queues",
+                                        forwardWhenNoConsumers,
+                                        1,
+                                        isNetty(),
+                                        1,
+                                        new int[] { 0, 2, 3, 4 },
+                                        new int[] { 5, 7, 8, 9 });
+
+      setupClusterConnectionWithBackups("cluster2",
+                                        "queues",
+                                        forwardWhenNoConsumers,
+                                        1,
+                                        isNetty(),
+                                        2,
+                                        new int[] { 0, 1, 3, 4 },
+                                        new int[] { 5, 6, 8, 9 });
+
+      setupClusterConnectionWithBackups("cluster3",
+                                        "queues",
+                                        forwardWhenNoConsumers,
+                                        1,
+                                        isNetty(),
+                                        3,
+                                        new int[] { 0, 1, 2, 4 },
+                                        new int[] { 5, 6, 7, 9 });
+
+      setupClusterConnectionWithBackups("cluster4",
+                                        "queues",
+                                        forwardWhenNoConsumers,
+                                        1,
+                                        isNetty(),
+                                        4,
+                                        new int[] { 0, 1, 2, 3 },
+                                        new int[] { 5, 6, 7, 8 });
+
+      // The backups
+
+      setupClusterConnectionWithBackups("cluster0",
+                                        "queues",
+                                        forwardWhenNoConsumers,
+                                        1,
+                                        isNetty(),
+                                        5,
+                                        new int[] { 1, 2, 3, 4 },
+                                        new int[] { 6, 7, 8, 9 });
+
+      setupClusterConnectionWithBackups("cluster1",
+                                        "queues",
+                                        forwardWhenNoConsumers,
+                                        1,
+                                        isNetty(),
+                                        6,
+                                        new int[] { 0, 2, 3, 4 },
+                                        new int[] { 5, 7, 8, 9 });
+
+      setupClusterConnectionWithBackups("cluster2",
+                                        "queues",
+                                        forwardWhenNoConsumers,
+                                        1,
+                                        isNetty(),
+                                        7,
+                                        new int[] { 0, 1, 3, 4 },
+                                        new int[] { 5, 6, 8, 9 });
+
+      setupClusterConnectionWithBackups("cluster3",
+                                        "queues",
+                                        forwardWhenNoConsumers,
+                                        1,
+                                        isNetty(),
+                                        8,
+                                        new int[] { 0, 1, 2, 4 },
+                                        new int[] { 5, 6, 7, 9 });
+
+      setupClusterConnectionWithBackups("cluster4",
+                                        "queues",
+                                        forwardWhenNoConsumers,
+                                        1,
+                                        isNetty(),
+                                        9,
+                                        new int[] { 0, 1, 2, 3 },
+                                        new int[] { 5, 6, 7, 8 });
+   }
+
+   @Override
+   protected void setupServers() throws Exception
+   {
+      // The backups
+      setupServer(5, isFileStorage(), isNetty(), true);
+      setupServer(6, isFileStorage(), isNetty(), true);
+      setupServer(7, isFileStorage(), isNetty(), true);
+      setupServer(8, isFileStorage(), isNetty(), true);
+      setupServer(9, isFileStorage(), isNetty(), true);
+
+      // The lives
+      setupServer(0, isFileStorage(), isNetty(), 5);
+      setupServer(1, isFileStorage(), isNetty(), 6);
+      setupServer(2, isFileStorage(), isNetty(), 7);
+      setupServer(3, isFileStorage(), isNetty(), 8);
+      setupServer(4, isFileStorage(), isNetty(), 9);
+   }
+
+   @Override
+   protected void startServers() throws Exception
+   {
+      // Need to set backup, since when restarting backup after it has failed over, backup will have been set to false
+
+      getServer(5).getConfiguration().setBackup(true);
+      getServer(6).getConfiguration().setBackup(true);
+      getServer(7).getConfiguration().setBackup(true);
+      getServer(8).getConfiguration().setBackup(true);
+      getServer(9).getConfiguration().setBackup(true);
+
+      startServers(5, 6, 7, 8, 9, 0, 1, 2, 3, 4);
+   }
+
+   @Override
+   protected void stopServers() throws Exception
+   {
+      closeAllConsumers();
+
+      closeAllSessionFactories();
+
+      stopServers(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
+   }
+
+}

Added: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.tests.integration.cluster.distribution;
+
+import org.jboss.messaging.core.logging.Logger;
+
+/**
+ * A OnewayTwoNodeClusterTest
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * 
+ * Created 30 Jan 2009 18:03:28
+ *
+ *
+ */
+public class TwoWayTwoNodeClusterTest extends ClusterTestBase
+{
+   private static final Logger log = Logger.getLogger(OnewayTwoNodeClusterTest.class);
+
+   @Override
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+
+      setupServer(0, isFileStorage(), isNetty());
+      
+      setupServer(1, isFileStorage(), isNetty());
+   }
+
+   @Override
+   protected void tearDown() throws Exception
+   {
+      closeAllConsumers();
+
+      closeAllSessionFactories();
+
+      stopServers(0, 1);
+
+      super.tearDown();
+   }
+
+   protected boolean isNetty()
+   {
+      return false;
+   }
+
+   protected boolean isFileStorage()
+   {
+      return false;
+   }
+
+   public void testStartStop() throws Exception
+   {
+      setupClusterConnection("cluster0", 0, 1, "queues", false, 1, isNetty());
+
+      setupClusterConnection("cluster1", 1, 0, "queues", false, 1, isNetty());
+
+      startServers(0, 1);
+
+      // Give it a little time for the bridge to try to start
+      Thread.sleep(2000);
+
+      stopServers(0, 1);
+   }
+
+}

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ActivationTimeoutTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ActivationTimeoutTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ActivationTimeoutTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -41,7 +41,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMRegistry;
 import org.jboss.messaging.core.remoting.impl.invm.TransportConstants;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.jms.client.JBossTextMessage;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
@@ -68,9 +68,9 @@
    
    private static final SimpleString ADDRESS = new SimpleString("FailoverTestAddress");
 
-   private MessagingService liveService;
+   private MessagingServer liveService;
 
-   private MessagingService backupService;
+   private MessagingServer backupService;
 
    private final Map<String, Object> backupParams = new HashMap<String, Object>();
 
@@ -112,7 +112,6 @@
          message.getBody().writeString("aardvarks");
          producer.send(message);
       }
-      log.info("Sent messages");
       
       ClientConsumer consumer1 = session1.createConsumer(ADDRESS);
       
@@ -198,8 +197,6 @@
          message.getBody().writeString("aardvarks");
          producer.send(message);
       }
-      log.info("Sent messages");
-            
       
       ClientSession session2 = sf2.createSession(false, true, true);
       
@@ -273,7 +270,7 @@
                 .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory",
                                                 backupParams));
       backupConf.setBackup(true);
-      backupService = Messaging.newNullStorageMessagingService(backupConf);
+      backupService = Messaging.newNullStorageMessagingServer(backupConf);
       backupService.start();
 
       Configuration liveConf = new ConfigurationImpl();
@@ -286,7 +283,7 @@
       connectors.put(backupTC.getName(), backupTC);
       liveConf.setConnectorConfigurations(connectors);
       liveConf.setBackupConnectorName(backupTC.getName());
-      liveService = Messaging.newNullStorageMessagingService(liveConf);
+      liveService = Messaging.newNullStorageMessagingServer(liveConf);
       liveService.start();
    }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/AutomaticFailoverWithDiscoveryTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/AutomaticFailoverWithDiscoveryTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/AutomaticFailoverWithDiscoveryTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -71,8 +71,6 @@
 
       ClientSession session = sf.createSession(false, true, true);
 
-      log.info("Created session");
-
       session.createQueue(ADDRESS, ADDRESS, null, false);
 
       ClientProducer producer = session.createProducer(ADDRESS);

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ClusterWithBackupFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ClusterWithBackupFailoverTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ClusterWithBackupFailoverTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -68,7 +68,7 @@
 
    protected boolean isFileStorage()
    {
-      return true;
+      return false;
    }
    
    private void failNode(int node)
@@ -89,61 +89,77 @@
       super.failNode(serverTC);
    }
 
-   public void testBasicRoundRobin() throws Exception
-   {
-      setupCluster();
-
-      startServers(3, 4, 5, 0, 1, 2);
+   public void testFailAllNodes() throws Exception
+   {           
+      //We do this in a loop a few times
       
-      setupSessionFactory(0, 3, isNetty(), false);
-      setupSessionFactory(1, 4, isNetty(), false);
-      setupSessionFactory(2, 5, isNetty(), false);
-
-      createQueue(0, "queues.testaddress", "queue0", null, false);
-      createQueue(1, "queues.testaddress", "queue0", null, false);
-      createQueue(2, "queues.testaddress", "queue0", null, false);
-
-      addConsumer(0, 0, "queue0", null);
-      addConsumer(1, 1, "queue0", null);
-      addConsumer(2, 2, "queue0", null);
-
-      waitForBindings(0, "queues.testaddress", 1, 1, true);
-      waitForBindings(1, "queues.testaddress", 1, 1, true);
-      waitForBindings(2, "queues.testaddress", 1, 1, true);
-
-      waitForBindings(0, "queues.testaddress", 2, 2, false);
-      waitForBindings(1, "queues.testaddress", 2, 2, false);
-      waitForBindings(2, "queues.testaddress", 2, 2, false);
-
-      send(0, "queues.testaddress", 10, false, null);
-
-      verifyReceiveRoundRobinInSomeOrder(10, 0, 1, 2);
-
-      verifyNotReceive(0, 1, 2);
+      final int numIterations = 5;
       
-      failNode(0);
-                  
-      send(0, "queues.testaddress", 10, false, null);
+      this.setupCluster();
       
-      verifyReceiveRoundRobinInSomeOrder(10, 0, 1, 2);
-
-      verifyNotReceive(0, 1, 2);
-      
-      failNode(1);
-      
-      send(0, "queues.testaddress", 10, false, null);
-      
-      verifyReceiveRoundRobinInSomeOrder(10, 0, 1, 2);
-
-      verifyNotReceive(0, 1, 2);
-      
-      failNode(2);
-      
-      send(0, "queues.testaddress", 10, false, null);
-      
-      verifyReceiveRoundRobinInSomeOrder(10, 0, 1, 2);
-
-      verifyNotReceive(0, 1, 2);
+      for (int i = 0; i < numIterations; i++)
+      {
+         log.info("Iteration " + i);
+         
+         startServers(3, 4, 5, 0, 1, 2);
+         
+         setupSessionFactory(0, 3, isNetty(), false);
+         setupSessionFactory(1, 4, isNetty(), false);
+         setupSessionFactory(2, 5, isNetty(), false);
+         
+         createQueue(0, "queues.testaddress", "queue0", null, false);
+         createQueue(1, "queues.testaddress", "queue0", null, false);
+         createQueue(2, "queues.testaddress", "queue0", null, false);
+   
+         addConsumer(0, 0, "queue0", null);
+         addConsumer(1, 1, "queue0", null);
+         addConsumer(2, 2, "queue0", null);
+   
+         waitForBindings(0, "queues.testaddress", 1, 1, true);
+         waitForBindings(1, "queues.testaddress", 1, 1, true);
+         waitForBindings(2, "queues.testaddress", 1, 1, true);
+   
+         waitForBindings(0, "queues.testaddress", 2, 2, false);
+         waitForBindings(1, "queues.testaddress", 2, 2, false);
+         waitForBindings(2, "queues.testaddress", 2, 2, false);
+   
+         send(0, "queues.testaddress", 10, false, null);
+   
+         verifyReceiveRoundRobinInSomeOrder(10, 0, 1, 2);
+   
+         verifyNotReceive(0, 1, 2);
+         
+         failNode(0);
+                     
+         send(0, "queues.testaddress", 10, false, null);
+         
+         verifyReceiveRoundRobinInSomeOrder(10, 0, 1, 2);
+   
+         verifyNotReceive(0, 1, 2);
+         
+         failNode(1);
+         
+         send(0, "queues.testaddress", 10, false, null);
+         
+         verifyReceiveRoundRobinInSomeOrder(10, 0, 1, 2);
+   
+         verifyNotReceive(0, 1, 2);
+         
+         failNode(2);
+         
+         send(0, "queues.testaddress", 10, false, null);
+         
+         verifyReceiveRoundRobinInSomeOrder(10, 0, 1, 2);
+   
+         verifyNotReceive(0, 1, 2);
+          
+         stopServers();
+         
+         //Need to reset backup status since they will have gone live
+         getServer(3).getConfiguration().setBackup(true);
+         getServer(4).getConfiguration().setBackup(true);
+         getServer(5).getConfiguration().setBackup(true);
+      }            
    }
 
    protected void setupCluster() throws Exception
@@ -227,14 +243,6 @@
 
       closeAllSessionFactories();
       
-      log.info("**** stopping cluster connections");
-
-      // We stop the cluster connections first since this makes server shutdown quicker
-      stopClusterConnections(0, 1, 2, 3, 4, 5);
-      
-      
-      log.info("**** stopped cluster connections");
-
       stopServers(0, 1, 2, 3, 4, 5);
    }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailBackupServerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailBackupServerTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailBackupServerTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -41,7 +41,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMRegistry;
 import org.jboss.messaging.core.remoting.impl.invm.TransportConstants;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.jms.client.JBossTextMessage;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
@@ -68,9 +68,9 @@
 
    private static final SimpleString ADDRESS = new SimpleString("FailoverTestAddress");
 
-   private MessagingService liveService;
+   private MessagingServer liveServer;
 
-   private MessagingService backupService;
+   private MessagingServer backupServer;
 
    private final Map<String, Object> backupParams = new HashMap<String, Object>();
 
@@ -126,9 +126,7 @@
          {
             // Fail the replicating connection - this simulates the backup server crashing
             
-            log.info("Failing backup connection");
-            
-            liveService.getServer().getReplicatingChannel().getConnection().fail(new MessagingException(MessagingException.NOT_CONNECTED, "blah"));
+            liveServer.getReplicatingChannel().getConnection().fail(new MessagingException(MessagingException.NOT_CONNECTED, "blah"));
          }
 
          message.acknowledge();
@@ -231,8 +229,8 @@
                 .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory",
                                                 backupParams));
       backupConf.setBackup(true);
-      backupService = Messaging.newNullStorageMessagingService(backupConf);
-      backupService.start();
+      backupServer = Messaging.newNullStorageMessagingServer(backupConf);
+      backupServer.start();
 
       Configuration liveConf = new ConfigurationImpl();
       liveConf.setSecurityEnabled(false);
@@ -244,16 +242,16 @@
       connectors.put(backupTC.getName(), backupTC);
       liveConf.setConnectorConfigurations(connectors);
       liveConf.setBackupConnectorName(backupTC.getName());
-      liveService = Messaging.newNullStorageMessagingService(liveConf);
-      liveService.start();
+      liveServer = Messaging.newNullStorageMessagingServer(liveConf);
+      liveServer.start();
    }
 
    @Override
    protected void tearDown() throws Exception
    {
-      backupService.stop();
+      backupServer.stop();
 
-      liveService.stop();
+      liveServer.stop();
 
       assertEquals(0, InVMRegistry.instance.size());
       

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverExpiredMessageTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverExpiredMessageTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverExpiredMessageTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -41,7 +41,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMRegistry;
 import org.jboss.messaging.core.remoting.impl.invm.TransportConstants;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.jms.client.JBossTextMessage;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
@@ -66,9 +66,9 @@
 
    private static final SimpleString ADDRESS = new SimpleString("FailoverTestAddress");
 
-   private MessagingService liveService;
+   private MessagingServer liveService;
 
-   private MessagingService backupService;
+   private MessagingServer backupService;
 
    private final Map<String, Object> backupParams = new HashMap<String, Object>();
 
@@ -191,12 +191,8 @@
   
       ClientSession session1 = sf1.createSession(false, true, true);
       
-      log.info("created session");
-
       session1.createQueue(ADDRESS, ADDRESS, null, false);
-      
-      log.info("created queue");
-      
+          
       ClientProducer producer = session1.createProducer(ADDRESS);
 
       final int numMessages = 10000;
@@ -268,7 +264,7 @@
                 .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory",
                                                 backupParams));
       backupConf.setBackup(true);
-      backupService = Messaging.newNullStorageMessagingService(backupConf);
+      backupService = Messaging.newNullStorageMessagingServer(backupConf);
       backupService.start();
 
       Configuration liveConf = new ConfigurationImpl();
@@ -282,7 +278,7 @@
       connectors.put(backupTC.getName(), backupTC);
       liveConf.setConnectorConfigurations(connectors);
       liveConf.setBackupConnectorName(backupTC.getName());
-      liveService = Messaging.newNullStorageMessagingService(liveConf);
+      liveService = Messaging.newNullStorageMessagingServer(liveConf);
       liveService.start();
    }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverManagementTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverManagementTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverManagementTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -46,7 +46,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMRegistry;
 import org.jboss.messaging.core.remoting.impl.invm.TransportConstants;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -70,9 +70,9 @@
 
    private static final SimpleString ADDRESS = new SimpleString("FailoverTestAddress");
 
-   private MessagingService liveService;
+   private MessagingServer liveService;
 
-   private MessagingService backupService;
+   private MessagingServer backupService;
 
    private final Map<String, Object> backupParams = new HashMap<String, Object>();
 
@@ -268,7 +268,7 @@
                 .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory",
                                                 backupParams));
       backupConf.setBackup(true);
-      backupService = Messaging.newNullStorageMessagingService(backupConf);
+      backupService = Messaging.newNullStorageMessagingServer(backupConf);
       backupService.start();
 
       Configuration liveConf = new ConfigurationImpl();
@@ -281,7 +281,7 @@
       connectors.put(backupTC.getName(), backupTC);
       liveConf.setConnectorConfigurations(connectors);
       liveConf.setBackupConnectorName(backupTC.getName());
-      liveService = Messaging.newNullStorageMessagingService(liveConf);
+      liveService = Messaging.newNullStorageMessagingServer(liveConf);
       liveService.start();
    }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverNoSessionsFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverNoSessionsFailoverTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverNoSessionsFailoverTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -38,7 +38,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMRegistry;
 import org.jboss.messaging.core.remoting.impl.invm.TransportConstants;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.jms.client.JBossTextMessage;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
@@ -64,9 +64,9 @@
 
    private static final SimpleString ADDRESS = new SimpleString("FailoverTestAddress");
 
-   private MessagingService liveService;
+   private MessagingServer liveService;
 
-   private MessagingService backupService;
+   private MessagingServer backupService;
 
    private final Map<String, Object> backupParams = new HashMap<String, Object>();
 
@@ -190,7 +190,7 @@
                 .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory",
                                                 backupParams));
       backupConf.setBackup(true);
-      backupService = Messaging.newNullStorageMessagingService(backupConf);
+      backupService = Messaging.newNullStorageMessagingServer(backupConf);
       backupService.start();
 
       Configuration liveConf = new ConfigurationImpl();
@@ -203,7 +203,7 @@
       connectors.put(backupTC.getName(), backupTC);
       liveConf.setConnectorConfigurations(connectors);
       liveConf.setBackupConnectorName(backupTC.getName());
-      liveService = Messaging.newNullStorageMessagingService(liveConf);
+      liveService = Messaging.newNullStorageMessagingServer(liveConf);
       liveService.start();
    }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverPreAcknowledgeTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverPreAcknowledgeTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverPreAcknowledgeTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -40,7 +40,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMRegistry;
 import org.jboss.messaging.core.remoting.impl.invm.TransportConstants;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.jms.client.JBossTextMessage;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
@@ -58,9 +58,9 @@
 
    private static final SimpleString ADDRESS = new SimpleString("FailoverTestAddress");
 
-   private MessagingService liveService;
+   private MessagingServer liveService;
 
-   private MessagingService backupService;
+   private MessagingServer backupService;
 
    private final Map<String, Object> backupParams = new HashMap<String, Object>();
 
@@ -133,13 +133,10 @@
          }
          else
          {
-            log.info("message was null");
             break;
          }
       }
 
-      log.info("Got " + count + " messages");
-
       t.join();
 
       session1.close();
@@ -174,7 +171,7 @@
                 .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory",
                                                 backupParams));
       backupConf.setBackup(true);
-      backupService = Messaging.newNullStorageMessagingService(backupConf);
+      backupService = Messaging.newNullStorageMessagingServer(backupConf);
       backupService.start();
 
       Configuration liveConf = new ConfigurationImpl();
@@ -187,7 +184,7 @@
       connectors.put(backupTC.getName(), backupTC);
       liveConf.setConnectorConfigurations(connectors);
       liveConf.setBackupConnectorName(backupTC.getName());
-      liveService = Messaging.newNullStorageMessagingService(liveConf);
+      liveService = Messaging.newNullStorageMessagingServer(liveConf);
       liveService.start();
    }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverScheduledMessageTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverScheduledMessageTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverScheduledMessageTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -42,7 +42,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMRegistry;
 import org.jboss.messaging.core.remoting.impl.invm.TransportConstants;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.jms.client.JBossTextMessage;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
@@ -66,9 +66,9 @@
 
    private static final SimpleString ADDRESS = new SimpleString("FailoverTestAddress");
 
-   private MessagingService liveService;
+   private MessagingServer liveService;
 
-   private MessagingService backupService;
+   private MessagingServer backupService;
 
    private final Map<String, Object> backupParams = new HashMap<String, Object>();
 
@@ -149,9 +149,7 @@
          ClientMessage message = consumer1.receive(delay * 2);
                            
          assertNotNull(message);
-         
-         log.info("got message " + i);
-         
+            
          message.acknowledge();
       }      
       
@@ -193,7 +191,7 @@
                 .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory",
                                                 backupParams));
       backupConf.setBackup(true);
-      backupService = Messaging.newNullStorageMessagingService(backupConf);
+      backupService = Messaging.newNullStorageMessagingServer(backupConf);
       backupService.start();
 
       Configuration liveConf = new ConfigurationImpl();
@@ -206,7 +204,7 @@
       connectors.put(backupTC.getName(), backupTC);
       liveConf.setConnectorConfigurations(connectors);
       liveConf.setBackupConnectorName(backupTC.getName());
-      liveService = Messaging.newNullStorageMessagingService(liveConf);
+      liveService = Messaging.newNullStorageMessagingServer(liveConf);
       liveService.start();
    }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverTestBase.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverTestBase.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -39,7 +39,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.TransportConstants;
 import org.jboss.messaging.core.server.JournalType;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.settings.impl.AddressSettings;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.Pair;
@@ -62,9 +62,9 @@
 
    protected final Map<String, Object> backupParams = new HashMap<String, Object>();
 
-   protected MessagingService liveService;
+   protected MessagingServer liveServer;
 
-   protected MessagingService backupService;
+   protected MessagingServer backupServer;
 
    // Static --------------------------------------------------------
 
@@ -128,14 +128,14 @@
 
          backupConf.setPagingMaxGlobalSizeBytes(maxGlobalSize);
          backupConf.setPagingGlobalWatermarkSize(pageSize);
-         backupService = Messaging.newMessagingService(backupConf);
+         backupServer = Messaging.newMessagingServer(backupConf);
       }
       else
       {
-         backupService = Messaging.newNullStorageMessagingService(backupConf);
+         backupServer = Messaging.newNullStorageMessagingServer(backupConf);
       }
 
-      backupService.start();
+      backupServer.start();
       
       Configuration liveConf = new ConfigurationImpl();
       liveConf.setSecurityEnabled(false);
@@ -169,22 +169,22 @@
 
       if (fileBased)
       {
-         liveService = Messaging.newMessagingService(liveConf);
+         liveServer = Messaging.newMessagingServer(liveConf);
       }
       else
       {
-         liveService = Messaging.newNullStorageMessagingService(liveConf);
+         liveServer = Messaging.newNullStorageMessagingServer(liveConf);
       }
 
       AddressSettings settings = new AddressSettings();
       settings.setPageSizeBytes(pageSize);
 
-      liveService.getServer().getAddressSettingsRepository().addMatch("#", settings);
-      backupService.getServer().getAddressSettingsRepository().addMatch("#", settings);
+      liveServer.getAddressSettingsRepository().addMatch("#", settings);
+      backupServer.getAddressSettingsRepository().addMatch("#", settings);
 
       clearData(getTestDir() + "/live");
 
-      liveService.start();
+      liveServer.start();
    }
    
    protected void setupGroupServers(boolean fileBased, String bcGroupName, int localBindPort, String groupAddress, int groupPort) throws Exception
@@ -212,14 +212,14 @@
 
          backupConf.setPagingMaxGlobalSizeBytes(-1);
          backupConf.setPagingGlobalWatermarkSize(-1);
-         backupService = Messaging.newMessagingService(backupConf);
+         backupServer = Messaging.newMessagingServer(backupConf);
       }
       else
       {
-         backupService = Messaging.newNullStorageMessagingService(backupConf);
+         backupServer = Messaging.newNullStorageMessagingServer(backupConf);
       }
       
-      backupService.start();
+      backupServer.start();
 
       Configuration liveConf = new ConfigurationImpl();
       liveConf.setSecurityEnabled(false);
@@ -263,15 +263,15 @@
          liveConf.setJournalFileSize(100 * 1024);
 
          liveConf.setJournalType(JournalType.NIO);
-         liveService = Messaging.newMessagingService(liveConf);
+         liveServer = Messaging.newMessagingServer(liveConf);
       }
       else
       {
-         liveService = Messaging.newNullStorageMessagingService(liveConf);
+         liveServer = Messaging.newNullStorageMessagingServer(liveConf);
       }
 
-      liveService = Messaging.newNullStorageMessagingService(liveConf);
-      liveService.start();
+      liveServer = Messaging.newNullStorageMessagingServer(liveConf);
+      liveServer.start();
 
    }
    
@@ -289,18 +289,18 @@
 
    protected void stopServers() throws Exception
    {
-      if (backupService != null && backupService.isStarted())
+      if (backupServer != null && backupServer.isStarted())
       {
-         backupService.stop();
+         backupServer.stop();
 
-         backupService = null;
+         backupServer = null;
       }
 
-      if (liveService != null && liveService.isStarted())
+      if (liveServer != null && liveServer.isStarted())
       {
-         liveService.stop();
+         liveServer.stop();
 
-         liveService = null;
+         liveServer = null;
 
       }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailureListenerOnFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailureListenerOnFailoverTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailureListenerOnFailoverTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -44,7 +44,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMRegistry;
 import org.jboss.messaging.core.remoting.impl.invm.TransportConstants;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.UnitTestCase;
 
 /**
@@ -67,9 +67,9 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingService liveService;
+   private MessagingServer liveService;
 
-   private MessagingService backupService;
+   private MessagingServer backupService;
 
    private final Map<String, Object> backupParams = new HashMap<String, Object>();
 
@@ -82,28 +82,27 @@
    class MyListener implements FailureListener
    {
       private int i;
-      
+
       MyListener(int i)
       {
          this.i = i;
       }
-      
+
       int failCount;
 
       public synchronized boolean connectionFailed(final MessagingException me)
       {
          failCount++;
-         
+
          return true;
       }
-      
+
       synchronized int getFailCount()
       {
          return failCount;
       }
    }
 
-   
    /*
     * Listeners shouldn't be called if failed over successfully
     */
@@ -120,7 +119,7 @@
       RemotingConnection conn = null;
 
       Set<ClientSession> sessions = new HashSet<ClientSession>();
-      
+
       for (int i = 0; i < numSessions; i++)
       {
          ClientSession session = sf.createSession(false, true, true);
@@ -135,7 +134,7 @@
          session.addFailureListener(listener);
 
          listeners.add(listener);
-         
+
          sessions.add(session);
       }
 
@@ -145,20 +144,20 @@
       {
          assertEquals(0, listener.getFailCount());
       }
-      
-      //Do some stuff to make sure sessions failed over/reconnected ok
+
+      // Do some stuff to make sure sessions failed over/reconnected ok
       int i = 0;
-      for (ClientSession session: sessions)
+      for (ClientSession session : sessions)
       {
          session.createQueue("testaddress" + i, "testaddress" + i, false);
          session.deleteQueue("testaddress" + i);
-         i++;         
+         i++;
          session.close();
       }
 
       sf.close();
    }
-   
+
    /*
     * Listeners shouldn't be called if reconnected successfully
     */
@@ -168,14 +167,11 @@
 
       final double retryMultiplier = 1d;
 
-      final int initialConnectAttempts = 10;
+      final int reconnectAttempts = 10;
 
-      final int reconnectAttempts = 1;
-
       ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
                                                                      retryInterval,
                                                                      retryMultiplier,
-                                                                     initialConnectAttempts,
                                                                      reconnectAttempts);
 
       final int numSessions = (int)(ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS * 1.5);
@@ -183,7 +179,7 @@
       List<MyListener> listeners = new ArrayList<MyListener>();
 
       RemotingConnection conn = null;
-      
+
       Set<ClientSession> sessions = new HashSet<ClientSession>();
 
       for (int i = 0; i < numSessions; i++)
@@ -200,7 +196,7 @@
          session.addFailureListener(listener);
 
          listeners.add(listener);
-         
+
          sessions.add(session);
       }
 
@@ -210,14 +206,14 @@
       {
          assertEquals(0, listener.getFailCount());
       }
-      
-      //Do some stuff to make sure sessions failed over/reconnected ok
+
+      // Do some stuff to make sure sessions failed over/reconnected ok
       int i = 0;
-      for (ClientSession session: sessions)
+      for (ClientSession session : sessions)
       {
          session.createQueue("testaddress" + i, "testaddress" + i, false);
          session.deleteQueue("testaddress" + i);
-         i++;         
+         i++;
          session.close();
       }
 
@@ -231,7 +227,6 @@
    {
       ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"));
 
-     
       final int numSessions = (int)(ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS * 1.5);
 
       List<MyListener> listeners = new ArrayList<MyListener>();
@@ -255,12 +250,12 @@
       }
 
       conn.fail(new MessagingException(MessagingException.NOT_CONNECTED));
-      
+
       for (MyListener listener : listeners)
       {
          assertEquals(1, listener.getFailCount());
       }
-      
+
       sf.close();
    }
 
@@ -273,14 +268,11 @@
 
       final double retryMultiplier = 1d;
 
-      final int initialConnectAttempts = 1;
-
       final int reconnectAttempts = 10;
 
       ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
                                                                      retryInterval,
                                                                      retryMultiplier,
-                                                                     initialConnectAttempts,
                                                                      reconnectAttempts);
 
       final int numSessions = (int)(ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS * 1.5);
@@ -306,7 +298,7 @@
       }
 
       InVMConnector.failOnCreateConnection = true;
-      
+
       conn.fail(new MessagingException(MessagingException.NOT_CONNECTED));
 
       int i = 0;
@@ -317,9 +309,9 @@
 
       sf.close();
    }
-   
+
    /*
-    * Listener should be called if failed to reconnect, backup present
+    * Listener should be called if failed to reconnect after failover, backup present
     */
    public void testFailureListenerCalledOnFailureToReconnectBackupPresent() throws Exception
    {
@@ -327,16 +319,14 @@
 
       final double retryMultiplier = 1d;
 
-      final int initialConnectAttempts = 1;
-
       final int reconnectAttempts = 10;
 
       ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
                                                                      new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
                                                                                                 backupParams),
+                                                                     true,
                                                                      retryInterval,
                                                                      retryMultiplier,
-                                                                     initialConnectAttempts,
                                                                      reconnectAttempts);
 
       final int numSessions = (int)(ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS * 1.5);
@@ -344,7 +334,7 @@
       List<MyListener> listeners = new ArrayList<MyListener>();
 
       RemotingConnection conn = null;
-      
+
       Set<ClientSession> sessions = new HashSet<ClientSession>();
 
       for (int i = 0; i < numSessions; i++)
@@ -361,69 +351,69 @@
          session.addFailureListener(listener);
 
          listeners.add(listener);
-         
+
          sessions.add(session);
       }
-      
-      //Fail once to failover ok
 
+      // Fail once to failover ok
+
       conn.fail(new MessagingException(MessagingException.NOT_CONNECTED));
-      
+
       for (MyListener listener : listeners)
       {
          assertEquals(0, listener.getFailCount());
       }
-      
-      //Do some stuff to make sure sessions failed over/reconnected ok
+
+      // Do some stuff to make sure sessions failed over/reconnected ok
       int i = 0;
-      for (ClientSession session: sessions)
+      for (ClientSession session : sessions)
       {
          session.createQueue("testaddress" + i, "testaddress" + i, false);
          session.deleteQueue("testaddress" + i);
-         i++;         
+         i++;
       }
-      
-      //Now fail again and reconnect ok
-       
+
+      // Now fail again and reconnect ok
+
       ClientSession csession = sf.createSession(false, true, true);
 
       conn = ((ClientSessionImpl)csession).getConnection();
-      
+
       InVMConnector.failOnCreateConnection = true;
       InVMConnector.numberOfFailures = reconnectAttempts - 1;
-                  
+
       conn.fail(new MessagingException(MessagingException.NOT_CONNECTED));
-      
+
       i = 0;
-      for (ClientSession session: sessions)
+      for (ClientSession session : sessions)
       {
          session.createQueue("testaddress" + i, "testaddress" + i, false);
          session.deleteQueue("testaddress" + i);
-         i++;         
+         i++;
       }
-      
-      //Now fail again and fail to reconnect
-      
+
+      // Now fail again and fail to reconnect
+
       csession = sf.createSession(false, true, true);
 
       conn = ((ClientSessionImpl)csession).getConnection();
-      
+
       InVMConnector.failOnCreateConnection = true;
       InVMConnector.numberOfFailures = -1;
-                  
+
       conn.fail(new MessagingException(MessagingException.NOT_CONNECTED));
-      
+
       i = 0;
       for (MyListener listener : listeners)
       {
          assertEquals(1, listener.getFailCount());
       }
-      
+
       csession.close();
-            
+
       sf.close();
    }
-   
+
    /*
     * Listener should be called if failed to failover
     */
@@ -433,16 +423,14 @@
 
       final double retryMultiplier = 1d;
 
-      final int initialConnectAttempts = 1;
-
       final int reconnectAttempts = 1;
 
       ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
                                                                      new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
                                                                                                 backupParams),
+                                                                     true,
                                                                      retryInterval,
                                                                      retryMultiplier,
-                                                                     initialConnectAttempts,
                                                                      reconnectAttempts);
 
       final int numSessions = (int)(ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS * 1.5);
@@ -466,7 +454,7 @@
 
          listeners.add(listener);
       }
-      
+
       InVMConnector.failOnCreateConnection = true;
 
       conn.fail(new MessagingException(MessagingException.NOT_CONNECTED));
@@ -476,7 +464,7 @@
          assertEquals(1, listener.getFailCount());
       }
 
-      sf.close();      
+      sf.close();
    }
 
    // Package protected ---------------------------------------------
@@ -495,7 +483,7 @@
                 .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory",
                                                 backupParams));
       backupConf.setBackup(true);
-      backupService = Messaging.newNullStorageMessagingService(backupConf);
+      backupService = Messaging.newNullStorageMessagingServer(backupConf);
       backupService.start();
 
       Configuration liveConf = new ConfigurationImpl();
@@ -509,7 +497,7 @@
       connectors.put(backupTC.getName(), backupTC);
       liveConf.setConnectorConfigurations(connectors);
       liveConf.setBackupConnectorName(backupTC.getName());
-      liveService = Messaging.newNullStorageMessagingService(liveConf);
+      liveService = Messaging.newNullStorageMessagingServer(liveConf);
       liveService.start();
    }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailureOnCreateConnectionTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailureOnCreateConnectionTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailureOnCreateConnectionTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -38,7 +38,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnector;
 import org.jboss.messaging.core.remoting.impl.invm.InVMRegistry;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.jms.client.JBossTextMessage;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
@@ -63,7 +63,7 @@
 
    private static final SimpleString ADDRESS = new SimpleString("FailoverTestAddress");
 
-   private MessagingService service;
+   private MessagingServer service;
 
    // Static --------------------------------------------------------
 
@@ -96,7 +96,7 @@
       liveConf.setSecurityEnabled(false);
       liveConf.getAcceptorConfigurations()
               .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory"));
-      service = Messaging.newNullStorageMessagingService(liveConf);
+      service = Messaging.newNullStorageMessagingServer(liveConf);
       service.start();
    }
 
@@ -120,14 +120,11 @@
 
       final double retryMultiplier = 1d;
 
-      final int initialConnectAttempts = -1;
-      
       final int reconnectAttempts = -1;      
 
       ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
                                                                      retryInterval,
                                                                      retryMultiplier,
-                                                                     initialConnectAttempts,
                                                                      reconnectAttempts);
 
       InVMConnector.failOnCreateConnection = true;

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/LargeMessageMultiThreadFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/LargeMessageMultiThreadFailoverTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/LargeMessageMultiThreadFailoverTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -103,8 +103,8 @@
                 .add(new TransportConfiguration(InVMAcceptorFactory.class.getCanonicalName(), backupParams));
       backupConf.setBackup(true);
 
-      backupService = Messaging.newMessagingService(backupConf);
-      backupService.start();
+      backupServer = Messaging.newMessagingServer(backupConf);
+      backupServer.start();
 
       Configuration liveConf = new ConfigurationImpl();
 
@@ -130,9 +130,9 @@
       connectors.put(backupTC.getName(), backupTC);
       liveConf.setConnectorConfigurations(connectors);
       liveConf.setBackupConnectorName(backupTC.getName());
-      liveService = Messaging.newMessagingService(liveConf);
+      liveServer = Messaging.newMessagingServer(liveConf);
 
-      liveService.start();
+      liveServer.start();
 
    }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadFailoverSupport.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadFailoverSupport.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadFailoverSupport.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -102,8 +102,6 @@
    {
       for (int its = 0; its < numIts; its++)
       {
-         log.info("************ ITERATION: " + its);
-
          start();
 
          final ClientSessionFactoryInternal sf = createSessionFactory();

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -40,8 +40,8 @@
                 .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory",
                                                 backupParams));
       backupConf.setBackup(true);
-      backupService = Messaging.newNullStorageMessagingService(backupConf);
-      backupService.start();
+      backupServer = Messaging.newNullStorageMessagingServer(backupConf);
+      backupServer.start();
 
       Configuration liveConf = new ConfigurationImpl();
       liveConf.setSecurityEnabled(false);
@@ -54,8 +54,8 @@
       connectors.put(backupTC.getName(), backupTC);
       liveConf.setConnectorConfigurations(connectors);
       liveConf.setBackupConnectorName(backupTC.getName());
-      liveService = Messaging.newNullStorageMessagingService(liveConf);
-      liveService.start();
+      liveServer = Messaging.newNullStorageMessagingServer(liveConf);
+      liveServer.start();
    }
 
    /* (non-Javadoc)

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTestBase.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTestBase.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -41,7 +41,7 @@
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.remoting.impl.invm.InVMRegistry;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.jms.client.JBossBytesMessage;
 import org.jboss.messaging.jms.client.JBossTextMessage;
 import org.jboss.messaging.utils.SimpleString;
@@ -62,7 +62,7 @@
    // Constants -----------------------------------------------------
 
    private static final int RECEIVE_TIMEOUT = 30000;
-   
+
    private final int LATCH_WAIT = getLatchWait();
 
    private int NUM_THREADS = getNumThreads();
@@ -70,9 +70,9 @@
    // Attributes ----------------------------------------------------
    protected static final SimpleString ADDRESS = new SimpleString("FailoverTestAddress");
 
-   protected MessagingService liveService;
+   protected MessagingServer liveServer;
 
-   protected MessagingService backupService;
+   protected MessagingServer backupServer;
 
    protected final Map<String, Object> backupParams = new HashMap<String, Object>();
 
@@ -258,7 +258,7 @@
    protected abstract void setBody(ClientMessage message) throws Exception;
 
    protected abstract boolean checkSize(ClientMessage message);
-   
+
    protected int getNumThreads()
    {
       return 10;
@@ -562,7 +562,7 @@
          {
             throw new Exception("Handler failed: " + handler.failure);
          }
-         
+
          handler.reset();
       }
 
@@ -570,7 +570,7 @@
       {
          session.rollback();
       }
-      
+
       for (MyHandler handler : handlers)
       {
          boolean ok = handler.latch.await(LATCH_WAIT, TimeUnit.MILLISECONDS);
@@ -1279,7 +1279,7 @@
 
       sessCreate.close();
    }
-   
+
    protected int getLatchWait()
    {
       return 20000;
@@ -1303,13 +1303,13 @@
    {
       log.info("************* Ending test " + getName());
 
-      if (liveService != null && liveService.isStarted())
+      if (liveServer != null && liveServer.isStarted())
       {
-         liveService.stop();
+         liveServer.stop();
       }
-      if (backupService != null && backupService.isStarted())
+      if (backupServer != null && backupServer.isStarted())
       {
-         backupService.stop();
+         backupServer.stop();
       }
 
       super.tearDown();
@@ -1329,7 +1329,7 @@
                                        final boolean failOnCreateConnection,
                                        final long failDelay) throws Exception
    {
-      
+
       runMultipleThreadsFailoverTest(runnable, numThreads, getNumIterations(), failOnCreateConnection, failDelay);
    }
 
@@ -1341,10 +1341,10 @@
       final ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
                                                                            new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
                                                                                                       backupParams),
-                                                                           0,
-                                                                           1,
-                                                                           ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS,
-                                                                           ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS);
+                                                                           ClientSessionFactoryImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN,
+                                                                           ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL,
+                                                                           ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER,
+                                                                           -1);
 
       sf.setSendWindowSize(32 * 1024);
       return sf;
@@ -1352,9 +1352,9 @@
 
    protected void stop() throws Exception
    {
-      backupService.stop();
+      backupServer.stop();
 
-      liveService.stop();
+      liveServer.stop();
 
       assertEquals(0, InVMRegistry.instance.size());
    }
@@ -1443,15 +1443,15 @@
       final int numMessages;
 
       volatile boolean done;
-      
+
       synchronized void reset()
       {
          counts.clear();
-         
+
          done = false;
-         
+
          failure = null;
-         
+
          latch = new CountDownLatch(1);
       }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PageOrderingOnBackupTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PageOrderingOnBackupTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PageOrderingOnBackupTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -187,8 +187,8 @@
          }
       }
 
-      PagingManager livePagingManager = liveService.getServer().getPostOffice().getPagingManager();
-      PagingManager backupPagingManager = backupService.getServer().getPostOffice().getPagingManager();
+      PagingManager livePagingManager = liveServer.getPostOffice().getPagingManager();
+      PagingManager backupPagingManager = backupServer.getPostOffice().getPagingManager();
 
       TestSupportPageStore livePagingStore = (TestSupportPageStore)livePagingManager.getPageStore(ADDRESS);
       TestSupportPageStore backupPagingStore = (TestSupportPageStore)backupPagingManager.getPageStore(ADDRESS);

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PagingFailoverMultiThreadTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PagingFailoverMultiThreadTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PagingFailoverMultiThreadTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -50,7 +50,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.TransportConstants;
 import org.jboss.messaging.core.server.JournalType;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.settings.impl.AddressSettings;
 import org.jboss.messaging.jms.client.JBossBytesMessage;
 import org.jboss.messaging.utils.SimpleString;
@@ -87,9 +87,9 @@
 
    protected static final SimpleString ADDRESS_GLOBAL = new SimpleString("FailoverTestAddress");
 
-   protected MessagingService liveService;
+   protected MessagingServer liveService;
 
-   protected MessagingService backupService;
+   protected MessagingServer backupService;
 
    protected final Map<String, Object> backupParams = new HashMap<String, Object>();
 
@@ -327,12 +327,7 @@
    {
       final ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
                                                                            new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                                                      backupParams),
-                                                                           0,
-                                                                           1,
-                                                                           ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS,
-                                                                           ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS);
-
+                                                                                                      backupParams));
       sf.setSendWindowSize(32 * 1024);
       return sf;
    }
@@ -391,17 +386,15 @@
 
          backupConf.setPagingMaxGlobalSizeBytes(maxGlobalSize);
          backupConf.setPagingGlobalWatermarkSize(pageSize);
-         backupService = Messaging.newMessagingService(backupConf);
+         backupService = Messaging.newMessagingServer(backupConf);
       }
       else
       {
-         backupService = Messaging.newNullStorageMessagingService(backupConf);
+         backupService = Messaging.newNullStorageMessagingServer(backupConf);
       }
 
       backupService.start();
 
-      Thread.sleep(20);
-
       Configuration liveConf = new ConfigurationImpl();
       liveConf.setSecurityEnabled(false);
       liveConf.setClustered(true);
@@ -434,18 +427,18 @@
 
       if (fileBased)
       {
-         liveService = Messaging.newMessagingService(liveConf);
+         liveService = Messaging.newMessagingServer(liveConf);
       }
       else
       {
-         liveService = Messaging.newNullStorageMessagingService(liveConf);
+         liveService = Messaging.newNullStorageMessagingServer(liveConf);
       }
 
       AddressSettings settings = new AddressSettings();
       settings.setPageSizeBytes(pageSize);
 
-      liveService.getServer().getAddressSettingsRepository().addMatch("#", settings);
-      backupService.getServer().getAddressSettingsRepository().addMatch("#", settings);
+      liveService.getAddressSettingsRepository().addMatch("#", settings);
+      backupService.getAddressSettingsRepository().addMatch("#", settings);
 
       clearData(getTestDir() + "/live");
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PagingFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PagingFailoverTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PagingFailoverTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -136,10 +136,10 @@
 
          final int numMessages = getNumberOfMessages();
 
-         PagingManager pmLive = liveService.getServer().getPostOffice().getPagingManager();
+         PagingManager pmLive = liveServer.getPostOffice().getPagingManager();
          PagingStore storeLive = pmLive.getPageStore(ADDRESS);
 
-         PagingManager pmBackup = backupService.getServer().getPostOffice().getPagingManager();
+         PagingManager pmBackup = backupServer.getPostOffice().getPagingManager();
          PagingStore storeBackup = pmBackup.getPageStore(ADDRESS);
 
          for (int i = 0; i < numMessages; i++)
@@ -275,12 +275,12 @@
          if (connectedOnBackup)
          {
             factory = createBackupFactory();
-            store = backupService.getServer().getPostOffice().getPagingManager().getPageStore(ADDRESS);
+            store = backupServer.getPostOffice().getPagingManager().getPageStore(ADDRESS);
          }
          else
          {
             factory = createFailoverFactory();
-            store = liveService.getServer().getPostOffice().getPagingManager().getPageStore(ADDRESS);
+            store = liveServer.getPostOffice().getPagingManager().getPageStore(ADDRESS);
          }
 
          session = factory.createSession(false, true, true, false);
@@ -432,7 +432,7 @@
    {
 
       final AtomicInteger numberOfMessages = new AtomicInteger(0);
-      final PagingStore store = liveService.getServer().getPostOffice().getPagingManager().getPageStore(ADDRESS);
+      final PagingStore store = liveServer.getPostOffice().getPagingManager().getPageStore(ADDRESS);
 
       final ClientSessionFactory factory = createFailoverFactory();
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PreserveOrderDuringFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PreserveOrderDuringFailoverTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PreserveOrderDuringFailoverTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -77,10 +77,10 @@
    {
 
       // This test would fail if both servers have the same time component
-//      NullStorageManager storageManagerLive = (NullStorageManager)liveService.getServer().getStorageManager();
+//      NullStorageManager storageManagerLive = (NullStorageManager)liveServer.getStorageManager();
 //      TimeAndCounterIDGenerator idgeneratorlive = (TimeAndCounterIDGenerator)storageManagerLive.getIDGenerator();
 //
-//      NullStorageManager storageManagerBackup = (NullStorageManager)backupService.getServer().getStorageManager();
+//      NullStorageManager storageManagerBackup = (NullStorageManager)backupServer.getStorageManager();
 //      TimeAndCounterIDGenerator idgeneratorBackup = (TimeAndCounterIDGenerator)storageManagerBackup.getIDGenerator();
 //
 //      idgeneratorBackup.setInternalDate(0);
@@ -118,10 +118,8 @@
          }
       };
 
-      liveService.getServer().getRemotingService().addInterceptor(failInterceptor);
+      liveServer.getRemotingService().addInterceptor(failInterceptor);
 
-      log.info("Created session");
-
       ClientProducer producer = session.createProducer(ADDRESS);
 
       final int numMessages = 1000;

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/RandomFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/RandomFailoverTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/RandomFailoverTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -37,7 +37,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMRegistry;
 import org.jboss.messaging.core.remoting.impl.invm.TransportConstants;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.jms.client.JBossTextMessage;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
@@ -59,9 +59,9 @@
 
    private static final SimpleString ADDRESS = new SimpleString("FailoverTestAddress");
 
-   private MessagingService liveService;
+   private MessagingServer liveService;
 
-   private MessagingService backupService;
+   private MessagingServer backupService;
 
    private final Map<String, Object> backupParams = new HashMap<String, Object>();
 
@@ -226,19 +226,14 @@
 
          ClientSessionFactoryImpl sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
                                                                     new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                                               backupParams),
-                                                                    0,
-                                                                    1,
-                                                                    ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS,
-                                                                    ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS);
+                                                                                               backupParams));
 
          sf.setSendWindowSize(32 * 1024);
 
          ClientSession session = sf.createSession(false, false, false);
 
          Failer failer = startFailer(1000, session);
-
-         log.info("***************Iteration: " + its);
+         
          do
          {
             runnable.run(sf);
@@ -263,8 +258,6 @@
    {
       long start = System.currentTimeMillis();
 
-      log.info("starting================");
-
       ClientSession s = sf.createSession(false, false, false);
 
       final int numMessages = 100;
@@ -1044,8 +1037,6 @@
 
       sessSend.commit();
 
-      log.info("sent and committed");
-
       for (int i = 0; i < numMessages; i++)
       {
          for (ClientConsumer consumer : consumers)
@@ -1415,18 +1406,13 @@
    {
       super.setUp();
 
-      log.info("*********** created timer");
-      timer = new Timer(true);
-
-      log.info("************ Starting test " + this.getName());
+      timer = new Timer(true);     
    }
 
    protected void tearDown() throws Exception
    {
       timer.cancel();
 
-      log.info("************ Ended test " + this.getName());
-
       InVMRegistry.instance.clear();
 
       super.tearDown();
@@ -1452,7 +1438,7 @@
                 .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory",
                                                 backupParams));
       backupConf.setBackup(true);
-      backupService = Messaging.newNullStorageMessagingService(backupConf);
+      backupService = Messaging.newNullStorageMessagingServer(backupConf);
       backupService.start();
 
       Configuration liveConf = new ConfigurationImpl();
@@ -1466,7 +1452,7 @@
       connectors.put(backupTC.getName(), backupTC);
       liveConf.setConnectorConfigurations(connectors);
       liveConf.setBackupConnectorName(backupTC.getName());
-      liveService = Messaging.newNullStorageMessagingService(liveConf);
+      liveService = Messaging.newNullStorageMessagingServer(liveConf);
       liveService.start();
    }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -38,7 +38,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnector;
 import org.jboss.messaging.core.remoting.impl.invm.InVMRegistry;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.jms.client.JBossTextMessage;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
@@ -63,7 +63,7 @@
 
    private static final SimpleString ADDRESS = new SimpleString("FailoverTestAddress");
 
-   private MessagingService service;
+   private MessagingServer service;
 
    // Static --------------------------------------------------------
 
@@ -80,14 +80,11 @@
 
       final double retryMultiplier = 1d;
 
-      final int initialConnectAttempts = -1;
-      
       final int reconnectAttempts = 1;      
 
       ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
                                                                      retryInterval,
                                                                      retryMultiplier,
-                                                                     initialConnectAttempts,
                                                                      reconnectAttempts);
 
       ClientSession session = sf.createSession(false, true, true);
@@ -98,8 +95,6 @@
       
       for (int j = 0; j < numIterations; j++)
       {  
-         log.info("Iteration " + j);
-         
          ClientProducer producer = session.createProducer(ADDRESS);
    
          final int numMessages = 1000;
@@ -161,14 +156,11 @@
 
       final double retryMultiplier = 1d;
 
-      final int initialConnectAttempts = -1;
+      final int reconnectAttempts = -1;
       
-      final int reconnectAttempts = -1;      
-
       ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
                                                                      retryInterval,
-                                                                     retryMultiplier,
-                                                                     initialConnectAttempts,
+                                                                     retryMultiplier,                                                                     
                                                                      reconnectAttempts);
 
       ClientSession session = sf.createSession(false, true, true);
@@ -190,7 +182,6 @@
          message.getBody().writeString("aardvarks");
          producer.send(message);
       }
-      log.info("Sent messages");
 
       ClientConsumer consumer = session.createConsumer(ADDRESS);
 
@@ -244,20 +235,17 @@
       t.join();
    }
    
-   public void testMaxRetriesFailsToReconnect() throws Exception
+   public void testReconnectAttemptsFailsToReconnect() throws Exception
    {
       final long retryInterval = 500;
 
       final double retryMultiplier = 1d;
 
-      final int initialConnectAttempts = 3;
-      
-      final int reconnectAttempts = 0;      
+      final int reconnectAttempts = 3;      
 
       ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
                                                                      retryInterval,
                                                                      retryMultiplier,
-                                                                     initialConnectAttempts,
                                                                      reconnectAttempts);
 
       ClientSession session = sf.createSession(false, true, true);
@@ -279,7 +267,6 @@
          message.getBody().writeString("aardvarks");
          producer.send(message);
       }
-      log.info("Sent messages");
 
       ClientConsumer consumer = session.createConsumer(ADDRESS);
 
@@ -295,7 +282,7 @@
          {
             try
             {
-               Thread.sleep(retryInterval * (initialConnectAttempts + 1));
+               Thread.sleep(retryInterval * (reconnectAttempts + 1));
             }
             catch (InterruptedException ignore)
             {               
@@ -323,20 +310,17 @@
       t.join();
    }
    
-   public void testMaxRetriesSucceedsInReconnecting() throws Exception
+   public void testReconnectAttemptsSucceedsInReconnecting() throws Exception
    {
       final long retryInterval = 500;
 
       final double retryMultiplier = 1d;
 
-      final int initialConnectAttempts = -1;
-      
       final int reconnectAttempts = 10;      
 
       ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
                                                                      retryInterval,
-                                                                     retryMultiplier,
-                                                                     initialConnectAttempts,
+                                                                     retryMultiplier,                                                      
                                                                      reconnectAttempts);
 
       ClientSession session = sf.createSession(false, true, true);
@@ -358,7 +342,6 @@
          message.getBody().writeString("aardvarks");
          producer.send(message);
       }
-      log.info("Sent messages");
 
       ClientConsumer consumer = session.createConsumer(ADDRESS);
 
@@ -399,14 +382,11 @@
 
       final double retryMultiplier = 1d;
 
-      final int initialConnectAttempts = -1;
-      
       final int reconnectAttempts = -1;      
 
       ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
                                                                      retryInterval,
-                                                                     retryMultiplier,
-                                                                     initialConnectAttempts,
+                                                                     retryMultiplier,                                                                    
                                                                      reconnectAttempts);
 
       ClientSession session = sf.createSession(false, true, true);
@@ -428,7 +408,6 @@
          message.getBody().writeString("aardvarks");
          producer.send(message);
       }
-      log.info("Sent messages");
 
       ClientConsumer consumer = session.createConsumer(ADDRESS);
 
@@ -493,14 +472,11 @@
 
       final double retryMultiplier = 4d;
 
-      final int initialConnectAttempts = -1;
-      
       final int reconnectAttempts = -1;      
 
       ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
                                                                      retryInterval,
-                                                                     retryMultiplier,
-                                                                     initialConnectAttempts,
+                                                                     retryMultiplier,                                                  
                                                                      reconnectAttempts);
 
       ClientSession session = sf.createSession(false, true, true);
@@ -522,7 +498,6 @@
          message.getBody().writeString("aardvarks");
          producer.send(message);
       }
-      log.info("Sent messages");
 
       ClientConsumer consumer = session.createConsumer(ADDRESS);
 
@@ -595,7 +570,7 @@
       liveConf.setSecurityEnabled(false);
       liveConf.getAcceptorConfigurations()
               .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory"));
-      service = Messaging.newNullStorageMessagingService(liveConf);
+      service = Messaging.newNullStorageMessagingServer(liveConf);
       service.start();
    }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectWithBackupTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectWithBackupTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectWithBackupTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -41,7 +41,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMRegistry;
 import org.jboss.messaging.core.remoting.impl.invm.TransportConstants;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.jms.client.JBossTextMessage;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
@@ -66,9 +66,9 @@
 
    private static final SimpleString ADDRESS = new SimpleString("FailoverTestAddress");
 
-   private MessagingService liveService;
+   private MessagingServer liveService;
 
-   private MessagingService backupService;
+   private MessagingServer backupService;
 
    private final Map<String, Object> backupParams = new HashMap<String, Object>();
 
@@ -87,16 +87,14 @@
 
       final double retryMultiplier = 1d;
 
-      final int initialConnectAttempts = -1;
-
       final int reconnectAttempts = -1;
 
       ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
                                                                      new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
                                                                                                 backupParams),
+                                                                     true,
                                                                      retryInterval,
                                                                      retryMultiplier,
-                                                                     initialConnectAttempts,
                                                                      reconnectAttempts);
 
       ClientSession session = sf.createSession(false, true, true);
@@ -104,7 +102,7 @@
       session.createQueue(ADDRESS, ADDRESS, null, false);
 
       final int numIterations = 10;
-      
+
       // We reconnect in a loop a few times
       for (int j = 0; j < numIterations; j++)
       {
@@ -151,7 +149,7 @@
          producer.close();
 
          consumer.close();
-     }
+      }
 
       session.close();
 
@@ -164,16 +162,14 @@
 
       final double retryMultiplier = 1d;
 
-      final int initialConnectAttempts = -1;
-
       final int reconnectAttempts = -1;
 
       ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
                                                                      new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
                                                                                                 backupParams),
+                                                                     true,
                                                                      retryInterval,
                                                                      retryMultiplier,
-                                                                     initialConnectAttempts,
                                                                      reconnectAttempts);
 
       ClientSession session = sf.createSession(false, true, true);
@@ -223,7 +219,7 @@
       session.stop();
 
       final int numIterations = 10;
-      
+
       for (int j = 0; j < numIterations; j++)
       {
          // Send some more messages
@@ -275,7 +271,7 @@
    protected void setUp() throws Exception
    {
       super.setUp();
-      
+
       Configuration backupConf = new ConfigurationImpl();
       backupConf.setSecurityEnabled(false);
       backupParams.put(TransportConstants.SERVER_ID_PROP_NAME, 1);
@@ -283,7 +279,7 @@
                 .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory",
                                                 backupParams));
       backupConf.setBackup(true);
-      backupService = Messaging.newNullStorageMessagingService(backupConf);
+      backupService = Messaging.newNullStorageMessagingServer(backupConf);
       backupService.start();
 
       Configuration liveConf = new ConfigurationImpl();
@@ -297,7 +293,7 @@
       connectors.put(backupTC.getName(), backupTC);
       liveConf.setConnectorConfigurations(connectors);
       liveConf.setBackupConnectorName(backupTC.getName());
-      liveService = Messaging.newNullStorageMessagingService(liveConf);
+      liveService = Messaging.newNullStorageMessagingServer(liveConf);
       liveService.start();
    }
 
@@ -309,7 +305,7 @@
       liveService.stop();
 
       assertEquals(0, InVMRegistry.instance.size());
-      
+
       super.tearDown();
    }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReplicateConnectionFailureTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReplicateConnectionFailureTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReplicateConnectionFailureTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -29,14 +29,14 @@
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_PERSISTENT_SEND;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE;
@@ -56,7 +56,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMRegistry;
 import org.jboss.messaging.core.remoting.impl.invm.TransportConstants;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.UnitTestCase;
 
 /**
@@ -79,9 +79,9 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingService liveService;
+   private MessagingServer liveServer;
 
-   private MessagingService backupService;
+   private MessagingServer backupServer;
 
    private final Map<String, Object> backupParams = new HashMap<String, Object>();
 
@@ -97,6 +97,7 @@
 
       ClientSessionFactoryInternal sf1 = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
                                                                       null,
+                                                                      DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN,
                                                                       DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
                                                                       pingPeriod,
                                                                       (long)(pingPeriod * 1.5),
@@ -115,52 +116,47 @@
                                                                       DEFAULT_ACK_BATCH_SIZE,
                                                                       DEFAULT_RETRY_INTERVAL,
                                                                       DEFAULT_RETRY_INTERVAL_MULTIPLIER,
-                                                                      DEFAULT_INITIAL_CONNECT_ATTEMPTS,
                                                                       DEFAULT_RECONNECT_ATTEMPTS);
 
       sf1.setSendWindowSize(32 * 1024);
 
-      assertEquals(0, liveService.getServer().getRemotingService().getConnections().size());
+      assertEquals(0, liveServer.getRemotingService().getConnections().size());
 
-      assertEquals(1, backupService.getServer().getRemotingService().getConnections().size());
+      assertEquals(1, backupServer.getRemotingService().getConnections().size());
 
       ClientSession session1 = sf1.createSession(false, true, true);
 
       // One connection
-      assertEquals(1, liveService.getServer().getRemotingService().getConnections().size());
+      assertEquals(1, liveServer.getRemotingService().getConnections().size());
 
       // One replicating connection
-      assertEquals(1, backupService.getServer().getRemotingService().getConnections().size());
+      assertEquals(1, backupServer.getRemotingService().getConnections().size());
 
       session1.close();
       
       Thread.sleep(2000);
       
-      assertEquals(0, liveService.getServer().getRemotingService().getConnections().size());
+      assertEquals(0, liveServer.getRemotingService().getConnections().size());
 
-      assertEquals(1, backupService.getServer().getRemotingService().getConnections().size());
+      assertEquals(1, backupServer.getRemotingService().getConnections().size());
 
-      log.info("recreating");
-
       session1 = sf1.createSession(false, true, true);
 
       final RemotingConnectionImpl conn1 = (RemotingConnectionImpl)((ClientSessionImpl)session1).getConnection();
 
       conn1.stopPingingAfterOne();
 
-      log.info("waiting");
-      
       Thread.sleep(3 * pingPeriod);
 
-      assertEquals(0, liveService.getServer().getRemotingService().getConnections().size());
+      assertEquals(0, liveServer.getRemotingService().getConnections().size());
 
-      assertEquals(1, backupService.getServer().getRemotingService().getConnections().size());
+      assertEquals(1, backupServer.getRemotingService().getConnections().size());
 
       session1.close();
 
-      assertEquals(0, liveService.getServer().getRemotingService().getConnections().size());
+      assertEquals(0, liveServer.getRemotingService().getConnections().size());
 
-      assertEquals(1, backupService.getServer().getRemotingService().getConnections().size());
+      assertEquals(1, backupServer.getRemotingService().getConnections().size());
    }
    
    // Package protected ---------------------------------------------
@@ -180,8 +176,8 @@
                 .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory",
                                                 backupParams));
       backupConf.setBackup(true);
-      backupService = Messaging.newNullStorageMessagingService(backupConf);
-      backupService.start();
+      backupServer = Messaging.newNullStorageMessagingServer(backupConf);
+      backupServer.start();
 
       Configuration liveConf = new ConfigurationImpl();
       liveConf.setConnectionScanPeriod(100);
@@ -195,16 +191,16 @@
       connectors.put(backupTC.getName(), backupTC);
       liveConf.setConnectorConfigurations(connectors);
       liveConf.setBackupConnectorName(backupTC.getName());
-      liveService = Messaging.newNullStorageMessagingService(liveConf);
-      liveService.start();
+      liveServer = Messaging.newNullStorageMessagingServer(liveConf);
+      liveServer.start();
    }
 
    @Override
    protected void tearDown() throws Exception
    {
-      backupService.stop();
+      backupServer.stop();
 
-      liveService.stop();
+      liveServer.stop();
 
       assertEquals(0, InVMRegistry.instance.size());
       

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleAutomaticFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleAutomaticFailoverTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleAutomaticFailoverTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -48,7 +48,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMRegistry;
 import org.jboss.messaging.core.remoting.impl.invm.TransportConstants;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.jms.client.JBossTextMessage;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
@@ -70,9 +70,9 @@
 
    private static final SimpleString ADDRESS = new SimpleString("FailoverTestAddress");
 
-   private MessagingService liveService;
+   private MessagingServer liveService;
 
-   private MessagingService backupService;
+   private MessagingServer backupService;
 
    private final Map<String, Object> backupParams = new HashMap<String, Object>();
 
@@ -96,8 +96,6 @@
 
       final int numMessages = 100;
 
-      log.info("Sending messages");
-
       for (int i = 0; i < numMessages; i++)
       {
          ClientMessage message = session.createClientMessage(JBossTextMessage.TYPE,
@@ -110,8 +108,6 @@
          producer.send(message);
       }
 
-      log.info("sent messages");
-
       ClientConsumer consumer = session.createConsumer(ADDRESS);
 
       session.start();
@@ -120,17 +116,15 @@
       {
          ClientMessage message2 = consumer.receive();
 
-         // log.info("Got message " + message2);
-
          assertEquals("aardvarks", message2.getBody().readString());
          assertEquals(i, message2.getProperty(new SimpleString("count")));
 
          message2.acknowledge();
       }
 
-      // ClientMessage message3 = consumer.receive(250);
+      ClientMessage message3 = consumer.receive(250);
 
-      // assertNull(message3);
+      assertNull(message3);
 
       session.close();
    }
@@ -518,8 +512,6 @@
       assertEquals(0, sf.numSessions());
 
       assertEquals(0, sf.numConnections());
-
-      log.info("** got to end");
    }
 
    public void testAllConnectionsReturned() throws Exception
@@ -595,16 +587,14 @@
 
       final double retryMultiplier = 1d;
 
-      final int initialConnectAttempts = -1;
-
       final int reconnectAttempts = 0;
 
       ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
                                                                      new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
                                                                                                 backupParams),
+                                                                     true,
                                                                      retryInterval,
                                                                      retryMultiplier,
-                                                                     initialConnectAttempts,
                                                                      reconnectAttempts);
 
       sf.setSendWindowSize(32 * 1024);
@@ -669,6 +659,7 @@
 
       assertFalse(conn == conn2);
 
+      InVMConnector.failOnCreateConnection = true;
       conn2.fail(new MessagingException(MessagingException.NOT_CONNECTED));
 
       boolean ok = latch.await(1000, TimeUnit.MILLISECONDS);
@@ -704,21 +695,19 @@
          ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
                                                                         new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
                                                                                                    backupParams),
+                                                                        true,
                                                                         100,
                                                                         1,
-                                                                        -1,
                                                                         -1);
 
          sf.setSendWindowSize(32 * 1024);
 
          for (int i = 0; i < 10; i++)
          {
-            log.info("j:" + j + " i:" + i);
             // We test failing on the 0th connection created, then the first, then the second etc, to make sure they are
             // all failed over ok
             if (i == j)
             {
-               log.info("Failing on " + i);
                InVMConnector.numberOfFailures = 1;
                InVMConnector.failOnCreateConnection = true;
             }
@@ -839,7 +828,7 @@
                 .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory",
                                                 backupParams));
       backupConf.setBackup(true);
-      backupService = Messaging.newNullStorageMessagingService(backupConf);
+      backupService = Messaging.newNullStorageMessagingServer(backupConf);
       backupService.start();
 
       Configuration liveConf = new ConfigurationImpl();
@@ -853,7 +842,7 @@
       connectors.put(backupTC.getName(), backupTC);
       liveConf.setConnectorConfigurations(connectors);
       liveConf.setBackupConnectorName(backupTC.getName());
-      liveService = Messaging.newNullStorageMessagingService(liveConf);
+      liveService = Messaging.newNullStorageMessagingServer(liveConf);
       liveService.start();
    }
 
@@ -885,6 +874,8 @@
    {
       stopServers();
 
+      InVMConnector.resetFailures();
+
       super.tearDown();
    }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleManualFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleManualFailoverTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleManualFailoverTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -45,7 +45,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMRegistry;
 import org.jboss.messaging.core.remoting.impl.invm.TransportConstants;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.jms.client.JBossTextMessage;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
@@ -67,9 +67,9 @@
 
    private static final SimpleString ADDRESS = new SimpleString("FailoverTestAddress");
 
-   private MessagingService server0Service;
+   private MessagingServer server0Service;
 
-   private MessagingService server1Service;
+   private MessagingServer server1Service;
 
    private Map<String, Object> server1Params = new HashMap<String, Object>();
 
@@ -134,8 +134,7 @@
       class MyListener implements FailureListener
       {
          public boolean connectionFailed(MessagingException me)
-         {
-            log.info("*** connection failed");
+         {            
             latch.countDown();
             
             return true;
@@ -155,10 +154,8 @@
 
       assertTrue(ok);
 
-      log.info("closing session");
       session.close();
-      log.info("closed session");
-
+ 
       sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
                                                                    server1Params));
 
@@ -185,14 +182,14 @@
       server1Conf.getAcceptorConfigurations()
                  .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory",
                                                  server1Params));
-      server1Service = Messaging.newNullStorageMessagingService(server1Conf);
+      server1Service = Messaging.newNullStorageMessagingServer(server1Conf);
       server1Service.start();
 
       Configuration server0Conf = new ConfigurationImpl();
       server0Conf.setSecurityEnabled(false);
       server0Conf.getAcceptorConfigurations()
                  .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory"));
-      server0Service = Messaging.newNullStorageMessagingService(server0Conf);
+      server0Service = Messaging.newNullStorageMessagingServer(server0Conf);
       server0Service.start();
    }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SplitBrainTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SplitBrainTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SplitBrainTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -45,7 +45,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.TransportConstants;
 import org.jboss.messaging.core.remoting.spi.Connection;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.jms.client.JBossTextMessage;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
@@ -72,9 +72,9 @@
 
    private static final SimpleString ADDRESS = new SimpleString("FailoverTestAddress");
 
-   private MessagingService liveService;
+   private MessagingServer liveServer;
 
-   private MessagingService backupService;
+   private MessagingServer backupServer;
 
    private final Map<String, Object> backupParams = new HashMap<String, Object>();
 
@@ -117,10 +117,10 @@
       }
       
       //Now fail the replicating connections
-      Set<RemotingConnection> conns = liveService.getServer().getRemotingService().getConnections();
+      Set<RemotingConnection> conns = liveServer.getRemotingService().getConnections();
       for (RemotingConnection conn : conns)
       {
-         RemotingConnection replicatingConnection = liveService.getServer().getReplicatingChannel().getConnection();
+         RemotingConnection replicatingConnection = liveServer.getReplicatingChannel().getConnection();
          Connection tcConn = replicatingConnection.getTransportConnection();
          tcConn.fail(new MessagingException(MessagingException.INTERNAL_ERROR, "blah"));
       }
@@ -146,8 +146,6 @@
          
          int count = (Integer)message.getProperty(new SimpleString("count"));
          
-         log.info("got message " + count);
-
          assertEquals(consumeCount++, count);
        
          deliveredMessageIDs.add(count);
@@ -193,8 +191,6 @@
          
          int count = (Integer)message.getProperty(new SimpleString("count"));
          
-         log.info("got message on live after failover " + count);
-         
          //Assert that this has been consumed before!!
          assertTrue(deliveredMessageIDs.contains(count));
  
@@ -223,8 +219,8 @@
                 .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory",
                                                 backupParams));
       backupConf.setBackup(true);
-      backupService = Messaging.newNullStorageMessagingService(backupConf);
-      backupService.start();
+      backupServer = Messaging.newNullStorageMessagingServer(backupConf);
+      backupServer.start();
 
       Configuration liveConf = new ConfigurationImpl();
       liveConf.setSecurityEnabled(false);
@@ -236,16 +232,16 @@
       connectors.put(backupTC.getName(), backupTC);
       liveConf.setConnectorConfigurations(connectors);
       liveConf.setBackupConnectorName(backupTC.getName());
-      liveService = Messaging.newNullStorageMessagingService(liveConf);
-      liveService.start();
+      liveServer = Messaging.newNullStorageMessagingServer(liveConf);
+      liveServer.start();
    }
 
    @Override
    protected void tearDown() throws Exception
    {
-      backupService.stop();
+      backupServer.stop();
 
-      liveService.stop();
+      liveServer.stop();
 
       assertEquals(0, InVMRegistry.instance.size());
       

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/XALargeMessageMultiThreadFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/XALargeMessageMultiThreadFailoverTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/XALargeMessageMultiThreadFailoverTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -94,7 +94,7 @@
                 .add(new TransportConfiguration(InVMAcceptorFactory.class.getCanonicalName(), backupParams));
       backupConf.setBackup(true);
 
-      backupService = Messaging.newMessagingService(backupConf);
+      backupService = Messaging.newMessagingServer(backupConf);
       backupService.start();
 
       Configuration liveConf = new ConfigurationImpl();
@@ -120,7 +120,7 @@
       connectors.put(backupTC.getName(), backupTC);
       liveConf.setConnectorConfigurations(connectors);
       liveConf.setBackupConnectorName(backupTC.getName());
-      liveService = Messaging.newMessagingService(liveConf);
+      liveService = Messaging.newMessagingServer(liveConf);
 
       liveService.start();
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/XAMultiThreadRandomFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/XAMultiThreadRandomFailoverTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/XAMultiThreadRandomFailoverTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -12,9 +12,6 @@
 
 package org.jboss.messaging.tests.integration.cluster.failover;
 
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
-
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
@@ -42,7 +39,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMRegistry;
 import org.jboss.messaging.core.remoting.impl.invm.TransportConstants;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.jms.client.JBossBytesMessage;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -60,9 +57,9 @@
 
    private final Logger log = Logger.getLogger(getClass());
 
-   protected MessagingService liveService;
+   protected MessagingServer liveService;
 
-   protected MessagingService backupService;
+   protected MessagingServer backupService;
 
    protected final Map<String, Object> backupParams = new HashMap<String, Object>();
 
@@ -607,7 +604,7 @@
                 .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory",
                                                 backupParams));
       backupConf.setBackup(true);
-      backupService = Messaging.newNullStorageMessagingService(backupConf);
+      backupService = Messaging.newNullStorageMessagingServer(backupConf);
       backupService.start();
 
       Configuration liveConf = new ConfigurationImpl();
@@ -621,7 +618,7 @@
       connectors.put(backupTC.getName(), backupTC);
       liveConf.setConnectorConfigurations(connectors);
       liveConf.setBackupConnectorName(backupTC.getName());
-      liveService = Messaging.newNullStorageMessagingService(liveConf);
+      liveService = Messaging.newNullStorageMessagingServer(liveConf);
       liveService.start();
    }
 
@@ -643,11 +640,7 @@
    {
       final ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
                                                                            new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                                                      backupParams),
-                                                                           0,
-                                                                           1,
-                                                                           DEFAULT_INITIAL_CONNECT_ATTEMPTS,
-                                                                           DEFAULT_RECONNECT_ATTEMPTS);
+                                                                                                      backupParams));
 
       sf.setSendWindowSize(32 * 1024);
       return sf;
@@ -828,8 +821,7 @@
             log.error(failure);
             return;
          }
-
-         // log.info("*** handler got message");
+      
          try
          {
             message.acknowledge();
@@ -853,8 +845,6 @@
             c = new Integer(cnt);
          }
 
-         // log.info(System.identityHashCode(this) + " consumed message " + threadNum + ":" + cnt);
-
          if (tn == threadNum && cnt != c.intValue())
          {
             failure = "Invalid count, expected " + threadNum + ":" + c + " got " + cnt;

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareQueueControlWrapperTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareQueueControlWrapperTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareQueueControlWrapperTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -28,15 +28,15 @@
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_TTL;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PING_PERIOD;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE;
@@ -474,6 +474,7 @@
       ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()),
                                                                      new TransportConfiguration(InVMConnectorFactory.class.getName(),
                                                                                                 backupParams),
+                                                                                                DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN,
                                                                                                 DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
                                                                                                 DEFAULT_PING_PERIOD,
                                                                                                 DEFAULT_CONNECTION_TTL,
@@ -492,7 +493,6 @@
                                                                                                 DEFAULT_ACK_BATCH_SIZE,                                 
                                                                                                 DEFAULT_RETRY_INTERVAL,
                                                                                                 DEFAULT_RETRY_INTERVAL_MULTIPLIER,                                        
-                                                                                                DEFAULT_INITIAL_CONNECT_ATTEMPTS,
                                                                                                 DEFAULT_RECONNECT_ATTEMPTS);
 
       session = sf.createSession(false, true, true);

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareTestBase.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareTestBase.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -37,7 +37,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMRegistry;
 import org.jboss.messaging.core.remoting.impl.invm.TransportConstants;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.UnitTestCase;
 
 /**
@@ -51,9 +51,9 @@
 
    // Attributes ----------------------------------------------------
 
-   protected MessagingService liveService;
+   protected MessagingServer liveServer;
 
-   protected MessagingService backupService;
+   protected MessagingServer backupServer;
 
    protected final Map<String, Object> backupParams = new HashMap<String, Object>();
 
@@ -106,8 +106,8 @@
                                                                             backupParams));
       backupConf.setBackup(true);
       backupConf.setJMXManagementEnabled(true);
-      backupService = Messaging.newNullStorageMessagingService(backupConf, backupMBeanServer);
-      backupService.start();
+      backupServer = Messaging.newNullStorageMessagingServer(backupConf, backupMBeanServer);
+      backupServer.start();
 
       Configuration liveConf = new ConfigurationImpl();
       liveConf.setSecurityEnabled(false);
@@ -120,16 +120,16 @@
       liveConf.setConnectorConfigurations(connectors);
       liveConf.setBackupConnectorName(backupTC.getName());
       liveConf.setJMXManagementEnabled(true);
-      liveService = Messaging.newNullStorageMessagingService(liveConf, liveMBeanServer);
-      liveService.start();
+      liveServer = Messaging.newNullStorageMessagingServer(liveConf, liveMBeanServer);
+      liveServer.start();
    }
 
    @Override
    protected void tearDown() throws Exception
    {
-      backupService.stop();
+      backupServer.stop();
 
-      liveService.stop();
+      liveServer.stop();
 
       super.tearDown();
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/divert/DivertTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/divert/DivertTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/divert/DivertTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -37,7 +37,7 @@
 import org.jboss.messaging.core.config.cluster.DivertConfiguration;
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -72,7 +72,7 @@
       
       conf.setDivertConfigurations(divertConfs);
       
-      MessagingService messagingService = Messaging.newNullStorageMessagingService(conf);
+      MessagingServer messagingService = Messaging.newNullStorageMessagingServer(conf);
            
       messagingService.start();
       
@@ -160,7 +160,7 @@
       
       conf.setDivertConfigurations(divertConfs);
       
-      MessagingService messagingService = Messaging.newNullStorageMessagingService(conf);
+      MessagingServer messagingService = Messaging.newNullStorageMessagingServer(conf);
            
       messagingService.start();
       
@@ -286,7 +286,7 @@
       
       conf.setDivertConfigurations(divertConfs);
       
-      MessagingService messagingService = Messaging.newNullStorageMessagingService(conf);
+      MessagingServer messagingService = Messaging.newNullStorageMessagingServer(conf);
            
       messagingService.start();
       
@@ -355,7 +355,7 @@
       
       conf.setDivertConfigurations(divertConfs);
       
-      MessagingService messagingService = Messaging.newNullStorageMessagingService(conf);
+      MessagingServer messagingService = Messaging.newNullStorageMessagingServer(conf);
            
       messagingService.start();
       
@@ -454,7 +454,7 @@
       
       conf.setDivertConfigurations(divertConfs);
       
-      MessagingService messagingService = Messaging.newNullStorageMessagingService(conf);
+      MessagingServer messagingService = Messaging.newNullStorageMessagingServer(conf);
            
       messagingService.start();
       
@@ -588,7 +588,7 @@
       
       conf.setDivertConfigurations(divertConfs);
       
-      MessagingService messagingService = Messaging.newNullStorageMessagingService(conf);
+      MessagingServer messagingService = Messaging.newNullStorageMessagingServer(conf);
            
       messagingService.start();
       
@@ -711,7 +711,7 @@
       
       conf.setDivertConfigurations(divertConfs);
       
-      MessagingService messagingService = Messaging.newNullStorageMessagingService(conf);
+      MessagingServer messagingService = Messaging.newNullStorageMessagingServer(conf);
            
       messagingService.start();
       
@@ -823,7 +823,7 @@
       
       conf.setDivertConfigurations(divertConfs);
       
-      MessagingService messagingService = Messaging.newNullStorageMessagingService(conf);
+      MessagingServer messagingService = Messaging.newNullStorageMessagingServer(conf);
            
       messagingService.start();
       
@@ -965,7 +965,7 @@
       
       conf.setDivertConfigurations(divertConfs);
       
-      MessagingService messagingService = Messaging.newNullStorageMessagingService(conf);
+      MessagingServer messagingService = Messaging.newNullStorageMessagingServer(conf);
            
       messagingService.start();
       

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/divert/PersistentDivertTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/divert/PersistentDivertTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/divert/PersistentDivertTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -37,7 +37,7 @@
 import org.jboss.messaging.core.config.cluster.DivertConfiguration;
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -82,7 +82,7 @@
       
       conf.setDivertConfigurations(divertConfs);
       
-      MessagingService messagingService = Messaging.newMessagingService(conf);
+      MessagingServer messagingService = Messaging.newMessagingServer(conf);
            
       messagingService.start();
       
@@ -218,7 +218,7 @@
       
       conf.setDivertConfigurations(divertConfs);
       
-      MessagingService messagingService = Messaging.newMessagingService(conf);
+      MessagingServer messagingService = Messaging.newMessagingServer(conf);
            
       messagingService.start();
       
@@ -369,7 +369,7 @@
       
       sf.close();
       
-      assertEquals(0, messagingService.getServer().getPostOffice().getPagingManager().getGlobalSize());
+      assertEquals(0, messagingService.getPostOffice().getPagingManager().getGlobalSize());
       
       messagingService.stop();
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/http/CoreClientOverHttpTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/http/CoreClientOverHttpTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/http/CoreClientOverHttpTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -33,7 +33,7 @@
 import org.jboss.messaging.core.config.TransportConfiguration;
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.jms.client.JBossTextMessage;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
@@ -55,9 +55,9 @@
 //      params.put("jbm.remoting.netty.httpenabled", true);
 //      conf.getAcceptorConfigurations().add(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, params));
 //
-//      MessagingService messagingService = Messaging.newNullStorageMessagingService(conf);
+//      MessagingServer server = Messaging.newNullStorageMessagingServer(conf);
 //
-//      messagingService.start();
+//      server.start();
 //
 //      ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration(NETTY_CONNECTOR_FACTORY, params));
 //
@@ -92,7 +92,7 @@
 //
 //      session.close();
 //
-//      messagingService.stop();
+//      server.stop();
 //   }
 //
 //   public void testCoreHttpClientIdle() throws Exception
@@ -107,9 +107,9 @@
 //      params.put("jbm.remoting.netty.httpenabled", true);
 //      conf.getAcceptorConfigurations().add(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, params));
 //
-//      MessagingService messagingService = Messaging.newNullStorageMessagingService(conf);
+//      MessagingServer server = Messaging.newNullStorageMessagingServer(conf);
 //
-//      messagingService.start();
+//      server.start();
 //
 //      ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration(NETTY_CONNECTOR_FACTORY, params));
 //
@@ -119,11 +119,11 @@
 //
 //      ClientProducer producer = session.createProducer(QUEUE);
 //
-//      Thread.sleep(messagingService.getServer().getConfiguration().getConnectionScanPeriod() * 5);
+//      Thread.sleep(server.getServer().getConfiguration().getConnectionScanPeriod() * 5);
 //
 //      session.close();
 //
-//      messagingService.stop();
+//      server.stop();
 //   }
    
    public void testFoo()

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/bridge/BridgeReconnectionTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/bridge/BridgeReconnectionTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/bridge/BridgeReconnectionTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -111,7 +111,7 @@
          server1.start();
          
          context1 = new InVMContext();
-         jmsServer1 = JMSServerManagerImpl.newJMSServerManagerImpl(server1.getServer());
+         jmsServer1 = JMSServerManagerImpl.newJMSServerManagerImpl(server1);
          jmsServer1.start();
          jmsServer1.setContext(context1);
 
@@ -185,7 +185,7 @@
          server1.start();
          
          context1 = new InVMContext();
-         jmsServer1 = JMSServerManagerImpl.newJMSServerManagerImpl(server1.getServer());
+         jmsServer1 = JMSServerManagerImpl.newJMSServerManagerImpl(server1);
          jmsServer1.start();
          jmsServer1.setContext(context1);
 
@@ -267,7 +267,7 @@
          server1.start();
          
          context1 = new InVMContext();
-         jmsServer1 = JMSServerManagerImpl.newJMSServerManagerImpl(server1.getServer());
+         jmsServer1 = JMSServerManagerImpl.newJMSServerManagerImpl(server1);
          jmsServer1.start();
          jmsServer1.setContext(context1);
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/bridge/BridgeTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/bridge/BridgeTestBase.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/bridge/BridgeTestBase.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -28,13 +28,11 @@
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_TTL;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PING_PERIOD;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE;
@@ -67,11 +65,12 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
 import org.jboss.messaging.core.remoting.impl.invm.TransportConstants;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.jms.bridge.ConnectionFactoryFactory;
 import org.jboss.messaging.jms.bridge.DestinationFactory;
 import org.jboss.messaging.jms.bridge.QualityOfServiceMode;
 import org.jboss.messaging.jms.client.JBossConnectionFactory;
+import org.jboss.messaging.jms.server.JMSServerManager;
 import org.jboss.messaging.jms.server.impl.JMSServerManagerImpl;
 import org.jboss.messaging.jms.server.management.JMSQueueControlMBean;
 import org.jboss.messaging.jms.server.management.TopicControlMBean;
@@ -105,13 +104,13 @@
 
    protected static boolean firstTime = true;
 
-   protected MessagingServiceImpl server0;
+   protected MessagingServer server0;
 
-   protected JMSServerManagerImpl jmsServer0;
+   protected JMSServerManager jmsServer0;
 
-   protected MessagingServiceImpl server1;
+   protected MessagingServer server1;
 
-   protected JMSServerManagerImpl jmsServer1;
+   protected JMSServerManager jmsServer1;
 
    private InVMContext context0;
 
@@ -128,11 +127,11 @@
       conf0.setSecurityEnabled(false);
       conf0.getAcceptorConfigurations()
            .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory"));
-      server0 = Messaging.newNullStorageMessagingService(conf0);
+      server0 = Messaging.newNullStorageMessagingServer(conf0);
       server0.start();
 
       context0 = new InVMContext();
-      jmsServer0 = JMSServerManagerImpl.newJMSServerManagerImpl(server0.getServer());
+      jmsServer0 = JMSServerManagerImpl.newJMSServerManagerImpl(server0);
       jmsServer0.start();
       jmsServer0.setContext(context0);
 
@@ -143,11 +142,11 @@
       conf1.getAcceptorConfigurations()
            .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory", params1));
 
-      server1 = Messaging.newNullStorageMessagingService(conf1);
+      server1 = Messaging.newNullStorageMessagingServer(conf1);
       server1.start();
 
       context1 = new InVMContext();
-      jmsServer1 = JMSServerManagerImpl.newJMSServerManagerImpl(server1.getServer());
+      jmsServer1 = JMSServerManagerImpl.newJMSServerManagerImpl(server1);
       jmsServer1.start();
       jmsServer1.setContext(context1);
 
@@ -171,7 +170,7 @@
 
    protected void createQueue(String queueName, int index) throws Exception
    {
-      JMSServerManagerImpl server = jmsServer0;
+      JMSServerManager server = jmsServer0;
       if (index == 1)
       {
          server = jmsServer1;
@@ -201,9 +200,10 @@
       {
          public ConnectionFactory createConnectionFactory() throws Exception
          {
+             
             //Note! We disable automatic reconnection on the session factory. The bridge needs to do the reconnection
             return new JBossConnectionFactory(new TransportConfiguration(InVMConnectorFactory.class.getName()),
-                                              null,
+                                              null,                                             
                                               DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
                                               DEFAULT_PING_PERIOD,
                                               DEFAULT_CONNECTION_TTL,
@@ -224,8 +224,8 @@
                                               DEFAULT_PRE_ACKNOWLEDGE,
                                               DEFAULT_RETRY_INTERVAL,
                                               DEFAULT_RETRY_INTERVAL_MULTIPLIER,
-                                              1,
-                                              0);
+                                              0,
+                                              false);
          }
 
       };
@@ -260,8 +260,8 @@
                                               DEFAULT_PRE_ACKNOWLEDGE,
                                               DEFAULT_RETRY_INTERVAL,
                                               DEFAULT_RETRY_INTERVAL_MULTIPLIER,
-                                              1,
-                                              0);
+                                              0,
+                                              false);
          }
       };
 
@@ -451,10 +451,10 @@
 
    public boolean checkEmpty(Queue queue, int index) throws Exception
    {
-      ManagementService managementService = server0.getServer().getManagementService();
+      ManagementService managementService = server0.getManagementService();
       if (index == 1)
       {
-         managementService = server1.getServer().getManagementService();
+         managementService = server1.getManagementService();
       }
       ObjectName objectName = ObjectNames.getJMSQueueObjectName(queue.getQueueName());
       JMSQueueControlMBean queueControl = (JMSQueueControlMBean)managementService.getResource(objectName);
@@ -470,10 +470,10 @@
 
    protected void checkNoSubscriptions(Topic topic, int index) throws Exception
    {
-      ManagementService managementService = server0.getServer().getManagementService();
+      ManagementService managementService = server0.getManagementService();
       if (index == 1)
       {
-         managementService = server1.getServer().getManagementService();
+         managementService = server1.getManagementService();
       }
       ObjectName objectName = ObjectNames.getJMSTopicObjectName(topic.getTopicName());
       TopicControlMBean topicControl = (TopicControlMBean)managementService.getResource(objectName);
@@ -483,10 +483,10 @@
 
    protected void removeAllMessages(String queueName, int index) throws Exception
    {
-      ManagementService managementService = server0.getServer().getManagementService();
+      ManagementService managementService = server0.getManagementService();
       if (index == 1)
       {
-         managementService = server1.getServer().getManagementService();
+         managementService = server1.getManagementService();
       }
       ObjectName objectName = ObjectNames.getJMSQueueObjectName(queueName);
       JMSQueueControlMBean queueControl = (JMSQueueControlMBean)managementService.getResource(objectName);

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/cluster/JMSFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/cluster/JMSFailoverTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/cluster/JMSFailoverTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -29,15 +29,15 @@
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_TTL;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PING_PERIOD;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE;
@@ -55,7 +55,6 @@
 import javax.jms.TextMessage;
 
 import org.jboss.messaging.core.client.ClientSession;
-import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
 import org.jboss.messaging.core.client.impl.ClientSessionImpl;
 import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.config.TransportConfiguration;
@@ -66,7 +65,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMRegistry;
 import org.jboss.messaging.core.remoting.impl.invm.TransportConstants;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.jms.JBossQueue;
 import org.jboss.messaging.jms.client.JBossConnectionFactory;
 import org.jboss.messaging.jms.client.JBossSession;
@@ -94,9 +93,9 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingService liveService;
+   private MessagingServer liveService;
 
-   private MessagingService backupService;
+   private MessagingServer backupService;
 
    private final Map<String, Object> backupParams = new HashMap<String, Object>();
 
@@ -110,7 +109,7 @@
    {
       JBossConnectionFactory jbcf = new JBossConnectionFactory(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
                                                                new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
-                                                                                          backupParams),
+                                                                                          backupParams),                                                               
                                                                DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
                                                                DEFAULT_PING_PERIOD,
                                                                DEFAULT_CONNECTION_TTL,
@@ -128,11 +127,11 @@
                                                                true,
                                                                DEFAULT_AUTO_GROUP,
                                                                DEFAULT_MAX_CONNECTIONS,
-                                                               DEFAULT_PRE_ACKNOWLEDGE,                                                              
+                                                               DEFAULT_PRE_ACKNOWLEDGE,
                                                                DEFAULT_RETRY_INTERVAL,
                                                                DEFAULT_RETRY_INTERVAL_MULTIPLIER,
-                                                               DEFAULT_INITIAL_CONNECT_ATTEMPTS,
-                                                               DEFAULT_RECONNECT_ATTEMPTS);
+                                                               DEFAULT_RECONNECT_ATTEMPTS,
+                                                               DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN);
 
       Connection conn = jbcf.createConnection();
 
@@ -186,7 +185,7 @@
 
       conn.close();
 
-      assertNull(listener.e);     
+      assertNull(listener.e);
    }
 
    public void testManualFailover() throws Exception
@@ -210,11 +209,11 @@
                                                                    true,
                                                                    DEFAULT_AUTO_GROUP,
                                                                    DEFAULT_MAX_CONNECTIONS,
-                                                                   DEFAULT_PRE_ACKNOWLEDGE,                                                                
+                                                                   DEFAULT_PRE_ACKNOWLEDGE,
                                                                    DEFAULT_RETRY_INTERVAL,
                                                                    DEFAULT_RETRY_INTERVAL_MULTIPLIER,
-                                                                   DEFAULT_INITIAL_CONNECT_ATTEMPTS,
-                                                                   DEFAULT_RECONNECT_ATTEMPTS);
+                                                                   DEFAULT_RECONNECT_ATTEMPTS,
+                                                                   DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN);
 
       JBossConnectionFactory jbcfBackup = new JBossConnectionFactory(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
                                                                                                 backupParams),
@@ -236,11 +235,11 @@
                                                                      true,
                                                                      DEFAULT_AUTO_GROUP,
                                                                      DEFAULT_MAX_CONNECTIONS,
-                                                                     DEFAULT_PRE_ACKNOWLEDGE,                                                                   
+                                                                     DEFAULT_PRE_ACKNOWLEDGE,
                                                                      DEFAULT_RETRY_INTERVAL,
                                                                      DEFAULT_RETRY_INTERVAL_MULTIPLIER,
-                                                                     DEFAULT_INITIAL_CONNECT_ATTEMPTS,
-                                                                     DEFAULT_RECONNECT_ATTEMPTS);
+                                                                     DEFAULT_RECONNECT_ATTEMPTS,
+                                                                     DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN);
 
       Connection connLive = jbcfLive.createConnection();
 
@@ -322,7 +321,7 @@
    protected void setUp() throws Exception
    {
       super.setUp();
-      
+
       Configuration backupConf = new ConfigurationImpl();
       backupConf.setSecurityEnabled(false);
       backupParams.put(TransportConstants.SERVER_ID_PROP_NAME, 1);
@@ -330,7 +329,7 @@
                 .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory",
                                                 backupParams));
       backupConf.setBackup(true);
-      backupService = Messaging.newNullStorageMessagingService(backupConf);
+      backupService = Messaging.newNullStorageMessagingServer(backupConf);
       backupService.start();
 
       Configuration liveConf = new ConfigurationImpl();
@@ -344,7 +343,7 @@
       connectors.put(backupTC.getName(), backupTC);
       liveConf.setConnectorConfigurations(connectors);
       liveConf.setBackupConnectorName(backupTC.getName());
-      liveService = Messaging.newNullStorageMessagingService(liveConf);
+      liveService = Messaging.newNullStorageMessagingServer(liveConf);
       liveService.start();
    }
 
@@ -356,7 +355,7 @@
       liveService.stop();
 
       assertEquals(0, InVMRegistry.instance.size());
-      
+
       super.tearDown();
    }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/cluster/management/ReplicationAwareJMSQueueControlWrapperTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/cluster/management/ReplicationAwareJMSQueueControlWrapperTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/cluster/management/ReplicationAwareJMSQueueControlWrapperTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -310,11 +310,11 @@
    {
       super.setUp();
 
-      liveServerManager = JMSServerManagerImpl.newJMSServerManagerImpl(liveService.getServer());
+      liveServerManager = JMSServerManagerImpl.newJMSServerManagerImpl(liveServer);
       liveServerManager.start();
       liveServerManager.setContext(new NullInitialContext());
 
-      backupServerManager = JMSServerManagerImpl.newJMSServerManagerImpl(backupService.getServer());
+      backupServerManager = JMSServerManagerImpl.newJMSServerManagerImpl(backupServer);
       backupServerManager.start();
       backupServerManager.setContext(new NullInitialContext());
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/consumer/ConsumerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/consumer/ConsumerTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/consumer/ConsumerTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -28,14 +28,14 @@
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_TTL;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PING_PERIOD;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE;
@@ -50,7 +50,7 @@
 import org.jboss.messaging.core.config.TransportConfiguration;
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.Queue;
 import org.jboss.messaging.jms.JBossQueue;
 import org.jboss.messaging.jms.client.JBossConnectionFactory;
@@ -65,7 +65,7 @@
  */
 public class ConsumerTest extends UnitTestCase
 {
-   private MessagingService service;
+   private MessagingServer service;
 
    private JMSServerManagerImpl serverManager;
 
@@ -85,9 +85,9 @@
       conf.setJMXManagementEnabled(true);
       conf.getAcceptorConfigurations()
           .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory"));
-      service = Messaging.newNullStorageMessagingService(conf);
+      service = Messaging.newNullStorageMessagingServer(conf);
       service.start();
-      serverManager = JMSServerManagerImpl.newJMSServerManagerImpl(service.getServer());
+      serverManager = JMSServerManagerImpl.newJMSServerManagerImpl(service);
       serverManager.start();
       serverManager.setContext(new NullInitialContext());
       serverManager.createQueue(Q_NAME, Q_NAME);
@@ -113,8 +113,8 @@
                                       true,                            
                                       DEFAULT_RETRY_INTERVAL,
                                       DEFAULT_RETRY_INTERVAL_MULTIPLIER,
-                                      DEFAULT_INITIAL_CONNECT_ATTEMPTS,
-                                      DEFAULT_RECONNECT_ATTEMPTS);
+                                      DEFAULT_RECONNECT_ATTEMPTS,
+                                      DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN);
    }
 
    @Override
@@ -159,8 +159,8 @@
       }
       // assert that all the messages are there and none have been acked
       SimpleString queueName = new SimpleString(JBossQueue.JMS_QUEUE_ADDRESS_PREFIX + Q_NAME);
-      assertEquals(0, ((Queue)service.getServer().getPostOffice().getBinding(queueName).getBindable()).getDeliveringCount());
-      assertEquals(0, ((Queue)service.getServer().getPostOffice().getBinding(queueName).getBindable()).getMessageCount());
+      assertEquals(0, ((Queue)service.getPostOffice().getBinding(queueName).getBindable()).getDeliveringCount());
+      assertEquals(0, ((Queue)service.getPostOffice().getBinding(queueName).getBindable()).getMessageCount());
       session.close();
    }
 }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSQueueControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSQueueControlTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSQueueControlTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -29,15 +29,15 @@
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_TTL;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PING_PERIOD;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE;
@@ -56,14 +56,13 @@
 import javax.management.openmbean.TabularData;
 import javax.naming.Context;
 
-import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
 import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.config.TransportConfiguration;
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.settings.impl.AddressSettings;
 import org.jboss.messaging.jms.JBossQueue;
 import org.jboss.messaging.jms.client.JBossConnectionFactory;
@@ -89,7 +88,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingService service;
+   private MessagingServer server;
 
    private JMSServerManagerImpl serverManager;
 
@@ -303,7 +302,7 @@
 
       assertNull(queueControl.getExpiryAddress());
 
-      service.getServer().getAddressSettingsRepository().addMatch(queue.getAddress(), new AddressSettings()
+      server.getAddressSettingsRepository().addMatch(queue.getAddress(), new AddressSettings()
       {
          @Override
          public SimpleString getExpiryAddress()
@@ -427,7 +426,7 @@
 
       assertNull(queueControl.getDeadLetterAddress());
 
-      service.getServer().getAddressSettingsRepository().addMatch(queue.getAddress(), new AddressSettings()
+      server.getAddressSettingsRepository().addMatch(queue.getAddress(), new AddressSettings()
       {
          @Override
          public SimpleString getDeadLetterAddress()
@@ -667,10 +666,10 @@
       conf.setSecurityEnabled(false);
       conf.setJMXManagementEnabled(true);
       conf.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
-      service = Messaging.newNullStorageMessagingService(conf, mbeanServer);
-      service.start();
+      server = Messaging.newNullStorageMessagingServer(conf, mbeanServer);
+      server.start();
 
-      serverManager = JMSServerManagerImpl.newJMSServerManagerImpl(service.getServer());
+      serverManager = JMSServerManagerImpl.newJMSServerManagerImpl(server);
       serverManager.start();
       context = new InVMContext();
       serverManager.setContext(context);
@@ -683,7 +682,7 @@
    @Override
    protected void tearDown() throws Exception
    {
-      service.stop();
+      server.stop();
 
       super.tearDown();
    }
@@ -719,8 +718,8 @@
                                                              DEFAULT_PRE_ACKNOWLEDGE,
                                                              DEFAULT_RETRY_INTERVAL,
                                                              DEFAULT_RETRY_INTERVAL_MULTIPLIER,
-                                                             DEFAULT_INITIAL_CONNECT_ATTEMPTS,
-                                                             DEFAULT_RECONNECT_ATTEMPTS);
+                                                             DEFAULT_RECONNECT_ATTEMPTS,
+                                                             DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN);
 
       return cf.createConnection();
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSServerControl2Test.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSServerControl2Test.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSServerControl2Test.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -31,7 +31,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory;
 import org.jboss.messaging.integration.transports.netty.NettyConnectorFactory;
 import org.jboss.messaging.jms.server.impl.JMSServerManagerImpl;
@@ -39,6 +39,9 @@
 import org.jboss.messaging.tests.integration.management.ManagementControlHelper;
 import org.jboss.messaging.tests.integration.management.ManagementTestBase;
 import org.jboss.messaging.tests.unit.util.InVMContext;
+
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN;
 import static org.jboss.messaging.tests.util.RandomUtil.randomString;
 
 import javax.jms.Connection;
@@ -69,24 +72,24 @@
 
    // Static --------------------------------------------------------
 
-   private MessagingService startMessagingService(String acceptorFactory) throws Exception
+   private MessagingServer startMessagingServer(String acceptorFactory) throws Exception
    {
       Configuration conf = new ConfigurationImpl();
       conf.setSecurityEnabled(false);
       conf.setJMXManagementEnabled(true);
       conf.getAcceptorConfigurations().add(new TransportConfiguration(acceptorFactory));
-      MessagingService service = Messaging.newNullStorageMessagingService(conf, mbeanServer);
-      service.start();
+      MessagingServer server = Messaging.newNullStorageMessagingServer(conf, mbeanServer);
+      server.start();
 
       context = new InVMContext();
-      JMSServerManagerImpl serverManager = JMSServerManagerImpl.newJMSServerManagerImpl(service.getServer());
+      JMSServerManagerImpl serverManager = JMSServerManagerImpl.newJMSServerManagerImpl(server);
       serverManager.start();
       serverManager.setContext(context);
 
-      return service;
+      return server;
    }
 
-   private MessagingService startMessagingService(int discoveryPort) throws Exception
+   private MessagingServer startMessagingServer(int discoveryPort) throws Exception
    {
       Configuration conf = new ConfigurationImpl();
       conf.setSecurityEnabled(false);
@@ -97,15 +100,15 @@
                                                "localhost",
                                                discoveryPort,
                                                ConfigurationImpl.DEFAULT_BROADCAST_REFRESH_TIMEOUT));
-      MessagingService service = Messaging.newNullStorageMessagingService(conf, mbeanServer);
-      service.start();
+      MessagingServer server = Messaging.newNullStorageMessagingServer(conf, mbeanServer);
+      server.start();
 
       context = new InVMContext();
-      JMSServerManagerImpl serverManager = JMSServerManagerImpl.newJMSServerManagerImpl(service.getServer());
+      JMSServerManagerImpl serverManager = JMSServerManagerImpl.newJMSServerManagerImpl(server);
       serverManager.start();
       serverManager.setContext(context);
 
-      return service;
+      return server;
    }
 
    // Constructors --------------------------------------------------
@@ -114,13 +117,13 @@
 
    public void _testCreateConnectionFactoryWithDiscoveryGroup() throws Exception
    {
-      MessagingService service = null;
+      MessagingServer server = null;
       try
       {
          String cfJNDIBinding = randomString();
          String cfName = randomString();
 
-         service = startMessagingService(8765);
+         server = startMessagingServer(8765);
 
          checkNoBinding(context, cfJNDIBinding);
 
@@ -151,8 +154,8 @@
                                          ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE,
                                          ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL,
                                          ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER,
-                                         ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS,
-                                         ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS,
+                                         DEFAULT_RECONNECT_ATTEMPTS,
+                                         DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN,
                                          cfJNDIBinding);
 
          Object o = checkBinding(context, cfJNDIBinding);
@@ -163,9 +166,9 @@
       }
       finally
       {
-         if (service != null)
+         if (server != null)
          {
-            service.stop();
+            server.stop();
          }
       }
    }
@@ -233,10 +236,10 @@
 
    private void doListConnectionIDs(String acceptorFactory, String connectorFactory) throws Exception
    {
-      MessagingService service = null;
+      MessagingServer server = null;
       try
       {
-         service = startMessagingService(acceptorFactory);
+         server = startMessagingServer(acceptorFactory);
 
          JMSServerControlMBean control = createManagementControl();
 
@@ -262,19 +265,19 @@
       }
       finally
       {
-         if (service != null)
+         if (server != null)
          {
-            service.stop();
+            server.stop();
          }
       }
    }
 
    private void doListSessions(String acceptorFactory, String connectorFactory) throws Exception
    {
-      MessagingService service = null;
+      MessagingServer server = null;
       try
       {
-         service = startMessagingService(acceptorFactory);
+         server = startMessagingServer(acceptorFactory);
 
          JMSServerControlMBean control = createManagementControl();
 
@@ -300,19 +303,19 @@
       }
       finally
       {
-         if (service != null)
+         if (server != null)
          {
-            service.stop();
+            server.stop();
          }
       }
    }
 
    private void doListClientConnections(String acceptorFactory, String connectorFactory) throws Exception
    {
-      MessagingService service = null;
+      MessagingServer server = null;
       try
       {
-         service = startMessagingService(acceptorFactory);
+         server = startMessagingServer(acceptorFactory);
 
          JMSServerControlMBean control = createManagementControl();
 
@@ -327,20 +330,21 @@
          {
             System.out.println(remoteAddress);
          }
+         
+         log.info("*** closing connection");
+         
          connection.close();
 
          // FIXME: with Netty, the server is not notified immediately that the connection is closed
-         Thread.sleep(500);
+         Thread.sleep(1000);
 
-         log.info("got here");
-
          assertEquals(0, control.listRemoteAddresses().length);
       }
       finally
       {
-         if (service != null)
+         if (server != null)
          {
-            service.stop();
+            server.stop();
          }
       }
 
@@ -348,19 +352,19 @@
 
    private void doCloseConnectionsForAddress(String acceptorFactory, String connectorFactory) throws Exception
    {
-      MessagingService service = null;
+      MessagingServer server = null;
       try
       {
-         service = startMessagingService(acceptorFactory);
+         server = startMessagingServer(acceptorFactory);
 
          JMSServerControlMBean control = createManagementControl();
 
-         assertEquals(0, service.getServer().getConnectionCount());
+         assertEquals(0, server.getConnectionCount());
          assertEquals(0, control.listRemoteAddresses().length);
 
          Connection connection = JMSUtil.createConnection(connectorFactory);
 
-         assertEquals(1, service.getServer().getConnectionCount());
+         assertEquals(1, server.getConnectionCount());
 
          String[] remoteAddresses = control.listRemoteAddresses();
          assertEquals(1, remoteAddresses.length);
@@ -380,13 +384,13 @@
          boolean gotException = exceptionLatch.await(5, TimeUnit.SECONDS);
          assertTrue("did not received the expected JMSException", gotException);
          assertEquals(0, control.listRemoteAddresses().length);
-         assertEquals(0, service.getServer().getConnectionCount());
+         assertEquals(0, server.getConnectionCount());
       }
       finally
       {
-         if (service != null)
+         if (server != null)
          {
-            service.stop();
+            server.stop();
          }
       }
    }
@@ -395,20 +399,20 @@
    {
       String unknownAddress = randomString();
 
-      MessagingService service = null;
+      MessagingServer server = null;
 
       try
       {
-         service = startMessagingService(acceptorFactory);
+         server = startMessagingServer(acceptorFactory);
 
          JMSServerControlMBean control = createManagementControl();
 
-         assertEquals(0, service.getServer().getConnectionCount());
+         assertEquals(0, server.getConnectionCount());
          assertEquals(0, control.listRemoteAddresses().length);
 
          Connection connection = JMSUtil.createConnection(connectorFactory);
 
-         assertEquals(1, service.getServer().getConnectionCount());
+         assertEquals(1, server.getConnectionCount());
          String[] remoteAddresses = control.listRemoteAddresses();
          assertEquals(1, remoteAddresses.length);
 
@@ -427,14 +431,14 @@
          assertFalse(gotException);
 
          assertEquals(1, control.listRemoteAddresses().length);
-         assertEquals(1, service.getServer().getConnectionCount());
+         assertEquals(1, server.getConnectionCount());
 
       }
       finally
       {
-         if (service != null)
+         if (server != null)
          {
-            service.stop();
+            server.stop();
          }
       }
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSServerControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSServerControlTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSServerControlTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -42,7 +42,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.jms.server.impl.JMSServerManagerImpl;
 import org.jboss.messaging.jms.server.management.ConnectionFactoryControlMBean;
 import org.jboss.messaging.jms.server.management.JMSServerControlMBean;
@@ -69,7 +69,7 @@
 
    protected InVMContext context;
 
-   protected MessagingServiceImpl service;
+   protected MessagingServer server;
 
    // Static --------------------------------------------------------
 
@@ -81,7 +81,7 @@
    {
       JMSServerControlMBean control = createManagementControl();
       String version = control.getVersion();
-      assertEquals(service.getServer().getVersion().getFullVersion(), version);
+      assertEquals(server.getVersion().getFullVersion(), version);
    }
 
    public void testCreateQueue() throws Exception
@@ -235,8 +235,8 @@
       int maxConnections = randomPositiveInt();
       long retryInterval = randomPositiveLong();
       double retryIntervalMultiplier = randomDouble();
-      int initialConnectAttempts = randomPositiveInt();
       int reconnectAttempts = randomPositiveInt();
+      boolean failoverOnServerShutdown = randomBoolean();
       boolean preAcknowledge = randomBoolean();
       boolean blockOnAcknowledge = randomBoolean();
       boolean blockOnNonPersistentSend = randomBoolean();
@@ -248,30 +248,30 @@
       JMSServerControlMBean control = createManagementControl();
 
       control.createSimpleConnectionFactory(cfName,
-                                      InVMConnectorFactory.class.getName(),
-                                      ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
-                                      pingPeriod,
-                                      connectionTTL,
-                                      callTimeout,
-                                      clientID,
-                                      dupsOKBatchSize,
-                                      transactionBatchSize,
-                                      consumerWindowSize,
-                                      consumerMaxRate,
-                                      producerWindowSize,
-                                      producerMaxRate,
-                                      minLargeMessageSize,
-                                      blockOnAcknowledge,
-                                      blockOnNonPersistentSend,
-                                      blockOnPersistentSend,
-                                      autoGroup,
-                                      maxConnections,
-                                      preAcknowledge,
-                                      retryInterval,
-                                      retryIntervalMultiplier,
-                                      initialConnectAttempts,
-                                      reconnectAttempts,
-                                      cfJNDIBinding);
+                                            InVMConnectorFactory.class.getName(),
+                                            ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
+                                            pingPeriod,
+                                            connectionTTL,
+                                            callTimeout,
+                                            clientID,
+                                            dupsOKBatchSize,
+                                            transactionBatchSize,
+                                            consumerWindowSize,
+                                            consumerMaxRate,
+                                            producerWindowSize,
+                                            producerMaxRate,
+                                            minLargeMessageSize,
+                                            blockOnAcknowledge,
+                                            blockOnNonPersistentSend,
+                                            blockOnPersistentSend,
+                                            autoGroup,
+                                            maxConnections,
+                                            preAcknowledge,
+                                            retryInterval,
+                                            retryIntervalMultiplier,
+                                            reconnectAttempts,
+                                            failoverOnServerShutdown,
+                                            cfJNDIBinding);
 
       Object o = checkBinding(context, cfJNDIBinding);
       assertTrue(o instanceof ConnectionFactory);
@@ -298,8 +298,8 @@
       assertEquals(maxConnections, cfControl.getMaxConnections());
       assertEquals(retryInterval, cfControl.getRetryInterval());
       assertEquals(retryIntervalMultiplier, cfControl.getRetryIntervalMultiplier());
-      assertEquals(initialConnectAttempts, cfControl.getInitialConnectAttempts());
       assertEquals(reconnectAttempts, cfControl.getReconnectAttempts());
+      assertEquals(failoverOnServerShutdown, cfControl.isFailoverOnNodeShutdown());
       assertEquals(preAcknowledge, cfControl.isPreAcknowledge());
       assertEquals(blockOnAcknowledge, cfControl.isBlockOnAcknowledge());
       assertEquals(blockOnNonPersistentSend, cfControl.isBlockOnNonPersistentSend());
@@ -343,11 +343,11 @@
       conf.setSecurityEnabled(false);
       conf.setJMXManagementEnabled(true);
       conf.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
-      service = Messaging.newNullStorageMessagingService(conf, mbeanServer);
-      service.start();
+      server = Messaging.newNullStorageMessagingServer(conf, mbeanServer);
+      server.start();
 
       context = new InVMContext();
-      JMSServerManagerImpl serverManager = JMSServerManagerImpl.newJMSServerManagerImpl(service.getServer());
+      JMSServerManagerImpl serverManager = JMSServerManagerImpl.newJMSServerManagerImpl(server);
       serverManager.start();
       serverManager.setContext(context);
    }
@@ -355,7 +355,7 @@
    @Override
    protected void tearDown() throws Exception
    {
-      service.stop();
+      server.stop();
 
       super.tearDown();
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSServerControlUsingJMSTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSServerControlUsingJMSTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSServerControlUsingJMSTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -66,7 +66,7 @@
    {
       super.setUp();
 
-      JMSServerManagerImpl serverManager = JMSServerManagerImpl.newJMSServerManagerImpl(service.getServer());
+      JMSServerManagerImpl serverManager = JMSServerManagerImpl.newJMSServerManagerImpl(server);
       serverManager.start();
       serverManager.setContext(context);
 
@@ -148,8 +148,8 @@
                                                    final boolean preAcknowledge,
                                                    final long retryInterval,
                                                    final double retryIntervalMultiplier,
-                                                   final int maxRetriesBeforeFailover,
-                                                   final int maxRetriesAfterFailover,
+                                                   final int reconnectAttempts,
+                                                   final boolean failoverOnServerShutdown,
                                                    final String jndiBinding) throws Exception
          {
             proxy.invokeOperation("createSimpleConnectionFactory",
@@ -175,8 +175,8 @@
                                  preAcknowledge,
                                  retryInterval,
                                  retryIntervalMultiplier,
-                                 maxRetriesBeforeFailover,
-                                 maxRetriesAfterFailover,
+                                 reconnectAttempts,
+                                 failoverOnServerShutdown,
                                  jndiBinding);
          }
 
@@ -202,8 +202,8 @@
                                              final boolean preAcknowledge,
                                              final long retryInterval,
                                              final double retryIntervalMultiplier,
-                                             final int maxRetriesBeforeFailover,
-                                             final int maxRetriesAfterFailover,
+                                             final int reconnectAttempts,
+                                             final boolean failoverOnServerShutdown,
                                              final String jndiBinding) throws Exception
          {
             proxy.invokeOperation("createConnectionFactory",
@@ -229,8 +229,8 @@
                                  preAcknowledge,
                                  retryInterval,
                                  retryIntervalMultiplier,
-                                 maxRetriesBeforeFailover,
-                                 maxRetriesAfterFailover,
+                                 reconnectAttempts,
+                                 failoverOnServerShutdown,
                                  jndiBinding);
          }
 
@@ -260,8 +260,8 @@
                                              final boolean preAcknowledge,
                                              final long retryInterval,
                                              final double retryIntervalMultiplier,
-                                             final int maxRetriesBeforeFailover,
-                                             final int maxRetriesAfterFailover,
+                                             final int reconnectAttempts,
+                                             final boolean failoverOnServerShutdown,
                                              final String jndiBinding) throws Exception
          {
             proxy.invokeOperation("createConnectionFactory",
@@ -291,8 +291,8 @@
                                  preAcknowledge,
                                  retryInterval,
                                  retryIntervalMultiplier,
-                                 maxRetriesBeforeFailover,
-                                 maxRetriesAfterFailover,
+                                 reconnectAttempts,
+                                 failoverOnServerShutdown,
                                  jndiBinding);
          }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSUtil.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSUtil.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSUtil.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -29,15 +29,15 @@
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_TTL;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PING_PERIOD;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE;
@@ -102,8 +102,8 @@
                                                              DEFAULT_PRE_ACKNOWLEDGE,                                                  
                                                              DEFAULT_RETRY_INTERVAL,
                                                              DEFAULT_RETRY_INTERVAL_MULTIPLIER,
-                                                             DEFAULT_INITIAL_CONNECT_ATTEMPTS,
-                                                             DEFAULT_RECONNECT_ATTEMPTS);
+                                                             DEFAULT_RECONNECT_ATTEMPTS,
+                                                             DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN);
 
       return cf.createConnection();
    }
@@ -132,8 +132,8 @@
                                                              DEFAULT_PRE_ACKNOWLEDGE,                                                
                                                              DEFAULT_RETRY_INTERVAL,
                                                              DEFAULT_RETRY_INTERVAL_MULTIPLIER,
-                                                             DEFAULT_INITIAL_CONNECT_ATTEMPTS,
-                                                             DEFAULT_RECONNECT_ATTEMPTS);
+                                                             DEFAULT_RECONNECT_ATTEMPTS,
+                                                             DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN);
 
       Connection conn = cf.createConnection();
 
@@ -178,8 +178,8 @@
                                                              DEFAULT_PRE_ACKNOWLEDGE,                                                       
                                                              DEFAULT_RETRY_INTERVAL,
                                                              DEFAULT_RETRY_INTERVAL_MULTIPLIER,
-                                                             DEFAULT_INITIAL_CONNECT_ATTEMPTS,
-                                                             DEFAULT_RECONNECT_ATTEMPTS);
+                                                             DEFAULT_RECONNECT_ATTEMPTS,
+                                                             DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN);
 
       Connection conn = cf.createConnection();
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/TopicControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/TopicControlTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/TopicControlTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -37,7 +37,7 @@
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.jms.JBossTopic;
 import org.jboss.messaging.jms.server.impl.JMSServerManagerImpl;
 import org.jboss.messaging.jms.server.management.TopicControlMBean;
@@ -60,7 +60,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingService service;
+   private MessagingServer server;
 
    private JMSServerManagerImpl serverManager;
 
@@ -306,10 +306,10 @@
       conf.setJMXManagementEnabled(true);
       conf.getAcceptorConfigurations()
           .add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory"));
-      service = Messaging.newNullStorageMessagingService(conf, mbeanServer);
-      service.start();
+      server = Messaging.newNullStorageMessagingServer(conf, mbeanServer);
+      server.start();
 
-      serverManager = JMSServerManagerImpl.newJMSServerManagerImpl(service.getServer());
+      serverManager = JMSServerManagerImpl.newJMSServerManagerImpl(server);
       serverManager.start();
       serverManager.setContext(new NullInitialContext());
 
@@ -324,7 +324,7 @@
    @Override
    protected void tearDown() throws Exception
    {
-      service.stop();
+      server.stop();
 
       super.tearDown();
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/AcceptorControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/AcceptorControlTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/AcceptorControlTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -33,10 +33,11 @@
 import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.config.TransportConfiguration;
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
+import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.management.AcceptorControlMBean;
 import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory;
 import org.jboss.messaging.integration.transports.netty.NettyConnectorFactory;
 
@@ -54,9 +55,12 @@
 
    // Constants -----------------------------------------------------
 
+   private static final Logger log = Logger.getLogger(AcceptorControlTest.class);
+
+   
    // Attributes ----------------------------------------------------
 
-   private MessagingService service;
+   private MessagingServer service;
 
    // Static --------------------------------------------------------
 
@@ -74,7 +78,7 @@
       conf.setSecurityEnabled(false);
       conf.setJMXManagementEnabled(true);
       conf.getAcceptorConfigurations().add(acceptorConfig);
-      service = Messaging.newNullStorageMessagingService(conf, mbeanServer);
+      service = Messaging.newNullStorageMessagingServer(conf, mbeanServer);
       service.start();
 
       AcceptorControlMBean acceptorControl = createAcceptorControl(acceptorConfig.getName(), mbeanServer);
@@ -92,37 +96,96 @@
       conf.setSecurityEnabled(false);
       conf.setJMXManagementEnabled(true);
       conf.getAcceptorConfigurations().add(acceptorConfig);
-      service = Messaging.newNullStorageMessagingService(conf, mbeanServer);
+      service = Messaging.newNullStorageMessagingServer(conf, mbeanServer);
       service.start();
 
       AcceptorControlMBean acceptorControl = createAcceptorControl(acceptorConfig.getName(), mbeanServer);
 
-      // started by the service
+      // started by the server
       assertTrue(acceptorControl.isStarted());
 
       ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration(NettyConnectorFactory.class.getName()));
       ClientSession session = sf.createSession(false, true, true);
       assertNotNull(session);
       session.close();
-
+      
+      acceptorControl.pause();
+      
+      try
+      {
+         ClientSession session2 = sf.createSession(false, true, true);
+         
+         fail("acceptor must not accept connections when paused");
+      }
+      catch (Exception e)
+      {
+      }
+      
+      //Pausing a second time should do nothing
+      
+      acceptorControl.pause();
+      assertTrue(acceptorControl.isStarted());
+         
+      try
+      {
+         ClientSession session2 = sf.createSession(false, true, true);
+         
+         fail("acceptor must not accept connections when paused");
+      }
+      catch (Exception e)
+      {
+      }
+      
+      acceptorControl.resume();
+      assertTrue(acceptorControl.isStarted());
+      
+      ClientSession session2 = sf.createSession(false, true, true);
+      assertNotNull(session2);
+      session2.close();
+      
+      //resuming again should do nothing
+      
+      acceptorControl.resume();
+      assertTrue(acceptorControl.isStarted());
+      
+      session2 = sf.createSession(false, true, true);
+      assertNotNull(session2);
+      session2.close();
+      
+      
       acceptorControl.stop();
-
+       
       assertFalse(acceptorControl.isStarted());
+      
       try
       {
          sf.createSession(false, true, true);
-         fail("acceptor must not accept connections when stopped");
+         fail("acceptor must not accept connections when stopped accepting");
       }
       catch (Exception e)
       {
       }
-
+      
       acceptorControl.start();
 
       assertTrue(acceptorControl.isStarted());
       session = sf.createSession(false, true, true);
       assertNotNull(session);
       session.close();
+      
+      acceptorControl.stop();
+      
+      assertFalse(acceptorControl.isStarted());
+      
+      try
+      {
+         sf.createSession(false, true, true);
+         fail("acceptor must not accept connections when stopped accepting");
+      }
+      catch (Exception e)
+      {
+      }
+      
    }
 
    // Package protected ---------------------------------------------

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/AddressControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/AddressControlTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/AddressControlTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -35,7 +35,7 @@
 import org.jboss.messaging.core.security.CheckType;
 import org.jboss.messaging.core.security.Role;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import static org.jboss.messaging.tests.util.RandomUtil.randomBoolean;
 import static org.jboss.messaging.tests.util.RandomUtil.randomSimpleString;
 import static org.jboss.messaging.tests.util.RandomUtil.randomString;
@@ -58,7 +58,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingService service;
+   private MessagingServer server;
 
    protected ClientSession session;
 
@@ -122,7 +122,7 @@
 
       Set<Role> newRoles = new HashSet<Role>();
       newRoles.add(role);
-      service.getServer().getSecurityRepository().addMatch(address.toString(), newRoles);
+      server.getSecurityRepository().addMatch(address.toString(), newRoles);
 
       tabularData = addressControl.getRoles();
       assertEquals(1, tabularData.size());
@@ -284,8 +284,8 @@
       conf.setSecurityEnabled(false);
       conf.setJMXManagementEnabled(true);
       conf.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
-      service = Messaging.newNullStorageMessagingService(conf, mbeanServer);
-      service.start();
+      server = Messaging.newNullStorageMessagingServer(conf, mbeanServer);
+      server.start();
 
       ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));
       sf.setBlockOnNonPersistentSend(true);
@@ -299,7 +299,7 @@
    {
       session.close();
 
-      service.stop();
+      server.stop();
 
       super.tearDown();
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/BridgeControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/BridgeControlTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/BridgeControlTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -46,8 +46,8 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
-import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
+import org.jboss.messaging.core.server.MessagingServer;
+import org.jboss.messaging.core.server.impl.MessagingServerImpl;
 import org.jboss.messaging.utils.Pair;
 
 /**
@@ -65,16 +65,16 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingService service_0;
+   private MessagingServer server_0;
 
    private BridgeConfiguration bridgeConfig;
 
-   private MessagingServiceImpl service_1;
+   private MessagingServer server_1;
 
    // Constructors --------------------------------------------------
 
    // Public --------------------------------------------------------
-   
+
    public void testAttributes() throws Exception
    {
       checkResource(ObjectNames.getBridgeObjectName(bridgeConfig.getName()));
@@ -87,14 +87,14 @@
       assertEquals(bridgeConfig.getFilterString(), bridgeControl.getFilterString());
       assertEquals(bridgeConfig.getRetryInterval(), bridgeControl.getRetryInterval());
       assertEquals(bridgeConfig.getRetryIntervalMultiplier(), bridgeControl.getRetryIntervalMultiplier());
-      assertEquals(bridgeConfig.getInitialConnectAttempts(), bridgeControl.getInitialConnectAttempts());
       assertEquals(bridgeConfig.getReconnectAttempts(), bridgeControl.getReconnectAttempts());
+      assertEquals(bridgeConfig.isFailoverOnServerShutdown(), bridgeControl.isFailoverOnServerShutdown());
       assertEquals(bridgeConfig.isUseDuplicateDetection(), bridgeControl.isUseDuplicateDetection());
-      
+
       CompositeData connectorPairData = bridgeControl.getConnectorPair();
       assertEquals(bridgeConfig.getConnectorPair().a, connectorPairData.get("a"));
       assertEquals(bridgeConfig.getConnectorPair().b, connectorPairData.get("b"));
-      
+
       assertTrue(bridgeControl.isStarted());
    }
 
@@ -103,7 +103,7 @@
       checkResource(ObjectNames.getBridgeObjectName(bridgeConfig.getName()));
       BridgeControlMBean bridgeControl = createBridgeControl(bridgeConfig.getName(), mbeanServer);
 
-      // started by the service
+      // started by the server
       assertTrue(bridgeControl.isStarted());
 
       bridgeControl.stop();
@@ -124,12 +124,14 @@
 
       Map<String, Object> acceptorParams = new HashMap<String, Object>();
       acceptorParams.put(SERVER_ID_PROP_NAME, 1);
-      TransportConfiguration acceptorConfig = new TransportConfiguration(InVMAcceptorFactory.class.getName(), acceptorParams, randomString());
+      TransportConfiguration acceptorConfig = new TransportConfiguration(InVMAcceptorFactory.class.getName(),
+                                                                         acceptorParams,
+                                                                         randomString());
 
       TransportConfiguration connectorConfig = new TransportConfiguration(InVMConnectorFactory.class.getName(),
                                                                           acceptorParams,
                                                                           randomString());
-      
+
       QueueConfiguration sourceQueueConfig = new QueueConfiguration(randomString(), randomString(), null, false);
       QueueConfiguration targetQueueConfig = new QueueConfiguration(randomString(), randomString(), null, false);
       Pair<String, String> connectorPair = new Pair<String, String>(connectorConfig.getName(), null);
@@ -141,40 +143,39 @@
                                              randomPositiveLong(),
                                              randomDouble(),
                                              randomPositiveInt(),
-                                             randomPositiveInt(),
                                              randomBoolean(),
+                                             randomBoolean(),
                                              connectorPair);
 
-
       Configuration conf_1 = new ConfigurationImpl();
       conf_1.setSecurityEnabled(false);
       conf_1.setJMXManagementEnabled(true);
-      conf_1.setClustered(true);      
+      conf_1.setClustered(true);
       conf_1.getAcceptorConfigurations().add(acceptorConfig);
       conf_1.getQueueConfigurations().add(targetQueueConfig);
 
       Configuration conf_0 = new ConfigurationImpl();
       conf_0.setSecurityEnabled(false);
       conf_0.setJMXManagementEnabled(true);
-      conf_0.setClustered(true);      
+      conf_0.setClustered(true);
       conf_0.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
       conf_0.getConnectorConfigurations().put(connectorConfig.getName(), connectorConfig);
       conf_0.getQueueConfigurations().add(sourceQueueConfig);
       conf_0.getBridgeConfigurations().add(bridgeConfig);
 
-      service_1 = Messaging.newNullStorageMessagingService(conf_1, MBeanServerFactory.createMBeanServer());
-      service_1.start();
+      server_1 = Messaging.newNullStorageMessagingServer(conf_1, MBeanServerFactory.createMBeanServer());
+      server_1.start();
 
-      service_0 = Messaging.newNullStorageMessagingService(conf_0, mbeanServer);
-      service_0.start();
-}
+      server_0 = Messaging.newNullStorageMessagingServer(conf_0, mbeanServer);
+      server_0.start();
+   }
 
    @Override
    protected void tearDown() throws Exception
-   {      
-      service_0.stop();
-      service_1.stop();
-      
+   {
+      server_0.stop();
+      server_1.stop();
+
       super.tearDown();
    }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/BroadcastGroupControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/BroadcastGroupControlTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/BroadcastGroupControlTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -39,7 +39,7 @@
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.management.BroadcastGroupControlMBean;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.integration.transports.netty.NettyConnectorFactory;
 import org.jboss.messaging.utils.Pair;
 
@@ -59,7 +59,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingService service;
+   private MessagingServer service;
 
    // Static --------------------------------------------------------
 
@@ -95,7 +95,7 @@
       conf.setClustered(true);
       conf.getConnectorConfigurations().put(connectorConfiguration.getName(), connectorConfiguration);
       conf.getBroadcastGroupConfigurations().add(broadcastGroupConfig);
-      service = Messaging.newNullStorageMessagingService(conf, mbeanServer);
+      service = Messaging.newNullStorageMessagingServer(conf, mbeanServer);
       service.start();
 
       BroadcastGroupControlMBean broadcastGroupControl = createBroadcastGroupControl(broadcastGroupConfig.getName(), mbeanServer);
@@ -128,12 +128,12 @@
       conf.setClustered(true);
       conf.getConnectorConfigurations().put(connectorConfiguration.getName(), connectorConfiguration);
       conf.getBroadcastGroupConfigurations().add(broadcastGroupConfig);
-      service = Messaging.newNullStorageMessagingService(conf, mbeanServer);
+      service = Messaging.newNullStorageMessagingServer(conf, mbeanServer);
       service.start();
 
       BroadcastGroupControlMBean broadcastGroupControl = createBroadcastGroupControl(broadcastGroupConfig.getName(), mbeanServer);
 
-      // started by the service
+      // started by the server
       assertTrue(broadcastGroupControl.isStarted());
 
       broadcastGroupControl.stop();

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/ClusterConnectionControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/ClusterConnectionControlTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/ClusterConnectionControlTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -48,8 +48,8 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
-import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
+import org.jboss.messaging.core.server.MessagingServer;
+import org.jboss.messaging.core.server.impl.MessagingServerImpl;
 import org.jboss.messaging.utils.Pair;
 
 /**
@@ -67,11 +67,11 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingService service_0;
+   private MessagingServer server_0;
 
    private ClusterConnectionConfiguration clusterConnectionConfig;
 
-   private MessagingServiceImpl service_1;
+   private MessagingServer server_1;
 
    // Constructors --------------------------------------------------
 
@@ -87,12 +87,6 @@
       assertEquals(clusterConnectionConfig.getAddress(), clusterConnectionControl.getAddress());
       assertEquals(clusterConnectionConfig.getDiscoveryGroupName(), clusterConnectionControl.getDiscoveryGroupName());
       assertEquals(clusterConnectionConfig.getRetryInterval(), clusterConnectionControl.getRetryInterval());
-      assertEquals(clusterConnectionConfig.getRetryIntervalMultiplier(),
-                   clusterConnectionControl.getRetryIntervalMultiplier());
-      assertEquals(clusterConnectionConfig.getInitialConnectAttempts(),
-                   clusterConnectionControl.getInitialConnectAttempts());
-      assertEquals(clusterConnectionConfig.getReconnectAttempts(),
-                   clusterConnectionControl.getReconnectAttempts());
       assertEquals(clusterConnectionConfig.isDuplicateDetection(), clusterConnectionControl.isDuplicateDetection());
       assertEquals(clusterConnectionConfig.isForwardWhenNoConsumers(),
                    clusterConnectionControl.isForwardWhenNoConsumers());
@@ -113,7 +107,7 @@
       ClusterConnectionControlMBean clusterConnectionControl = ManagementControlHelper.createClusterConnectionControl(clusterConnectionConfig.getName(),
                                                                                                                       mbeanServer);
 
-      // started by the service
+      // started by the server
       assertTrue(clusterConnectionControl.isStarted());
 
       clusterConnectionControl.stop();
@@ -147,13 +141,10 @@
       Pair<String, String> connectorPair = new Pair<String, String>(connectorConfig.getName(), null);
       List<Pair<String, String>> pairs = new ArrayList<Pair<String, String>>();
       pairs.add(connectorPair);
-      
+
       clusterConnectionConfig = new ClusterConnectionConfiguration(randomString(),
                                                                    queueConfig.getAddress(),
                                                                    randomPositiveLong(),
-                                                                   randomDouble(),
-                                                                   randomPositiveInt(),
-                                                                   randomPositiveInt(),
                                                                    randomBoolean(),
                                                                    randomBoolean(),
                                                                    randomPositiveInt(),
@@ -174,18 +165,18 @@
       conf_0.getConnectorConfigurations().put(connectorConfig.getName(), connectorConfig);
       conf_0.getClusterConfigurations().add(clusterConnectionConfig);
 
-      service_1 = Messaging.newNullStorageMessagingService(conf_1, MBeanServerFactory.createMBeanServer());
-      service_1.start();
+      server_1 = Messaging.newNullStorageMessagingServer(conf_1, MBeanServerFactory.createMBeanServer());
+      server_1.start();
 
-      service_0 = Messaging.newNullStorageMessagingService(conf_0, mbeanServer);
-      service_0.start();
+      server_0 = Messaging.newNullStorageMessagingServer(conf_0, mbeanServer);
+      server_0.start();
    }
 
    @Override
    protected void tearDown() throws Exception
    {
-      service_0.stop();
-      service_1.stop();
+      server_0.stop();
+      server_1.stop();
 
       super.tearDown();
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/DiscoveryGroupControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/DiscoveryGroupControlTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/DiscoveryGroupControlTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -34,7 +34,7 @@
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.management.DiscoveryGroupControlMBean;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.UnitTestCase;
 
 /**
@@ -53,7 +53,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingService service;
+   private MessagingServer service;
 
    // Static --------------------------------------------------------
 
@@ -70,7 +70,7 @@
       conf.setJMXManagementEnabled(true);
       conf.setClustered(true);
       conf.getDiscoveryGroupConfigurations().put(discoveryGroupConfig.getName(), discoveryGroupConfig);
-      service = Messaging.newNullStorageMessagingService(conf, mbeanServer);
+      service = Messaging.newNullStorageMessagingServer(conf, mbeanServer);
       service.start();
 
       DiscoveryGroupControlMBean discoveryGroupControl = createDiscoveryGroupControl(discoveryGroupConfig.getName(), mbeanServer);
@@ -90,12 +90,12 @@
       conf.setJMXManagementEnabled(true);
       conf.setClustered(true);
       conf.getDiscoveryGroupConfigurations().put(discoveryGroupConfig.getName(), discoveryGroupConfig);
-      service = Messaging.newNullStorageMessagingService(conf, mbeanServer);
+      service = Messaging.newNullStorageMessagingServer(conf, mbeanServer);
       service.start();
 
       DiscoveryGroupControlMBean discoveryGroupControl = createDiscoveryGroupControl(discoveryGroupConfig.getName(), mbeanServer);
 
-      // started by the service
+      // started by the server
       assertTrue(discoveryGroupControl.isStarted());
 
       discoveryGroupControl.stop();

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/DivertControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/DivertControlTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/DivertControlTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -34,7 +34,7 @@
 import org.jboss.messaging.core.management.ObjectNames;
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.utils.SimpleString;
 
 /**
@@ -52,7 +52,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingService service;
+   private MessagingServer service;
 
    private DivertConfiguration divertConfig;
 
@@ -112,7 +112,7 @@
       
       conf.getConnectorConfigurations().put(connectorConfig.getName(), connectorConfig);
 
-      service = Messaging.newNullStorageMessagingService(conf, mbeanServer);
+      service = Messaging.newNullStorageMessagingServer(conf, mbeanServer);
       service.start();
    }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/MessagingServerControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/MessagingServerControlTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/MessagingServerControlTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -38,7 +38,7 @@
 import org.jboss.messaging.core.messagecounter.impl.MessageCounterManagerImpl;
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.RandomUtil;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -58,7 +58,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingService service;
+   private MessagingServer server;
 
    private Configuration conf;
 
@@ -74,7 +74,7 @@
    {
       MessagingServerControlMBean serverControl = createManagementControl();
 
-      assertEquals(service.getServer().getVersion().getFullVersion(), serverControl.getVersion());
+      assertEquals(server.getVersion().getFullVersion(), serverControl.getVersion());
 
       assertEquals(conf.isClustered(), serverControl.isClustered());
       assertEquals(conf.isAllowRouteWhenNoBindings(), serverControl.isAllowRouteWhenNoBindings());
@@ -305,17 +305,17 @@
       conf = new ConfigurationImpl();
       conf.setSecurityEnabled(false);
       conf.setJMXManagementEnabled(true);
-      service = Messaging.newNullStorageMessagingService(conf, mbeanServer);
+      server = Messaging.newNullStorageMessagingServer(conf, mbeanServer);
       conf.getConnectorConfigurations().put(connectorConfig.getName(), connectorConfig);
-      service.start();
+      server.start();
    }
 
    @Override
    protected void tearDown() throws Exception
    {
-      if (service != null)
+      if (server != null)
       {
-         service.stop();
+         server.stop();
       }
 
       super.tearDown();

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/NotificationTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/NotificationTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/NotificationTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -47,7 +47,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -64,7 +64,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingService service;
+   private MessagingServer service;
    private ClientSession session;
    private ClientConsumer notifConsumer;
    private SimpleString notifQueue;
@@ -209,7 +209,7 @@
       conf.setJMXManagementEnabled(false);
       conf.getAcceptorConfigurations()
           .add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
-      service = Messaging.newNullStorageMessagingService(conf);
+      service = Messaging.newNullStorageMessagingServer(conf);
       service.start();
       
       ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/QueueControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/QueueControlTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/QueueControlTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -51,7 +51,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.settings.impl.AddressSettings;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -68,7 +68,7 @@
 
    // Attributes ----------------------------------------------------
 
-   protected MessagingService service;
+   protected MessagingServer server;
 
    protected ClientSession session;
 
@@ -123,7 +123,7 @@
       QueueControlMBean queueControl = createManagementControl(address, queue);
       assertNull(queueControl.getDeadLetterAddress());
 
-      service.getServer().getAddressSettingsRepository().addMatch(address.toString(), new AddressSettings()
+      server.getAddressSettingsRepository().addMatch(address.toString(), new AddressSettings()
       {
          @Override
          public SimpleString getDeadLetterAddress()
@@ -164,7 +164,7 @@
       QueueControlMBean queueControl = createManagementControl(address, queue);
       assertNull(queueControl.getExpiryAddress());
 
-      service.getServer().getAddressSettingsRepository().addMatch(address.toString(), new AddressSettings()
+      server.getAddressSettingsRepository().addMatch(address.toString(), new AddressSettings()
       {
          @Override
          public SimpleString getExpiryAddress()
@@ -1135,8 +1135,8 @@
       conf.setSecurityEnabled(false);
       conf.setJMXManagementEnabled(true);
       conf.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
-      service = Messaging.newNullStorageMessagingService(conf, mbeanServer);
-      service.start();
+      server = Messaging.newNullStorageMessagingServer(conf, mbeanServer);
+      server.start();
 
       ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));
       sf.setBlockOnNonPersistentSend(true);
@@ -1150,7 +1150,7 @@
    {
       session.close();
 
-      service.stop();
+      server.stop();
 
       super.tearDown();
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementTestBase.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementTestBase.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -33,7 +33,7 @@
 import org.jboss.messaging.core.config.TransportConfiguration;
 import org.jboss.messaging.core.management.ObjectNames;
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -50,7 +50,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingService service;
+   private MessagingServer service;
 
    // Static --------------------------------------------------------
 
@@ -67,7 +67,7 @@
    {
       super.setUp();
       
-      service = setupAndStartMessagingService();
+      service = setupAndStartMessagingServer();
    }
 
    @Override
@@ -78,7 +78,7 @@
       super.tearDown();
    }
 
-   protected abstract MessagingService setupAndStartMessagingService() throws Exception;
+   protected abstract MessagingServer setupAndStartMessagingServer() throws Exception;
    
    protected void doSendManagementMessage(String user, String password, boolean expectSuccess) throws Exception
    {

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementWithConfiguredAdminUserTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementWithConfiguredAdminUserTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementWithConfiguredAdminUserTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -31,7 +31,7 @@
 import org.jboss.messaging.core.security.impl.JBMSecurityManagerImpl;
 import org.jboss.messaging.core.security.impl.SecurityStoreImpl;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.settings.HierarchicalRepository;
 
 import java.util.HashSet;
@@ -93,15 +93,15 @@
 
    // Protected -----------------------------------------------------
 
-   protected MessagingService setupAndStartMessagingService() throws Exception
+   protected MessagingServer setupAndStartMessagingServer() throws Exception
    {
       Configuration conf = new ConfigurationImpl();
       conf.setSecurityEnabled(true);
       conf.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
-      MessagingService service = Messaging.newNullStorageMessagingService(conf);
-      service.start();
-      HierarchicalRepository<Set<Role>> securityRepository = service.getServer().getSecurityRepository();
-      JBMSecurityManagerImpl securityManager = (JBMSecurityManagerImpl)service.getServer().getSecurityManager();
+      MessagingServer server = Messaging.newNullStorageMessagingServer(conf);
+      server.start();
+      HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
+      JBMSecurityManagerImpl securityManager = (JBMSecurityManagerImpl)server.getSecurityManager();
       securityManager.addUser(validAdminUser, validAdminPassword);
       securityManager.addUser(invalidAdminUser, invalidAdminPassword);
       securityManager.addRole(validAdminUser, "admin");
@@ -115,7 +115,7 @@
       guestRole.add(new Role("guest", true, true, true, true, true, true, true));
       securityRepository.addMatch("*", guestRole);
       
-      return service;
+      return server;
    }
 
    // Private -------------------------------------------------------

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementWithDefaultConfigurationTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementWithDefaultConfigurationTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementWithDefaultConfigurationTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -28,7 +28,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
 import org.jboss.messaging.core.security.impl.SecurityStoreImpl;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 
 /**
  * A SecurityManagementTest
@@ -69,15 +69,15 @@
    // Protected -----------------------------------------------------
 
    @Override
-   protected MessagingService setupAndStartMessagingService() throws Exception
+   protected MessagingServer setupAndStartMessagingServer() throws Exception
    {
       Configuration conf = new ConfigurationImpl();
       conf.setSecurityEnabled(true);
       conf.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
-      MessagingService service = Messaging.newNullStorageMessagingService(conf);
-      service.start();
+      MessagingServer server = Messaging.newNullStorageMessagingServer(conf);
+      server.start();
       
-      return service;
+      return server;
    }
    
    // Private -------------------------------------------------------

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementWithModifiedConfigurationTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementWithModifiedConfigurationTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementWithModifiedConfigurationTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -22,13 +22,12 @@
 
 package org.jboss.messaging.tests.integration.management;
 
-import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.config.TransportConfiguration;
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
 import org.jboss.messaging.core.security.impl.SecurityStoreImpl;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 
 /**
  * A SecurityManagementTest
@@ -77,16 +76,16 @@
    // Protected -----------------------------------------------------
 
    @Override
-   protected MessagingService setupAndStartMessagingService() throws Exception
+   protected MessagingServer setupAndStartMessagingServer() throws Exception
    {
       ConfigurationImpl conf = new ConfigurationImpl();
       conf.setSecurityEnabled(true);
       conf.setManagementClusterPassword(configuredClusterPassword);
       conf.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
-      MessagingService service = Messaging.newNullStorageMessagingService(conf);
-      service.start();
+      MessagingServer server = Messaging.newNullStorageMessagingServer(conf);
+      server.start();
       
-      return service;
+      return server;
    }
    
    // Private -------------------------------------------------------

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityNotificationTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityNotificationTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityNotificationTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -49,7 +49,7 @@
 import org.jboss.messaging.core.security.JBMUpdateableSecurityManager;
 import org.jboss.messaging.core.security.Role;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -66,7 +66,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingService service;
+   private MessagingServer server;
    private ClientSession adminSession;
    private ClientConsumer notifConsumer;
    private SimpleString notifQueue;
@@ -108,8 +108,8 @@
       Role role = new Role("roleCanNotCreateQueue", true, true, false, true, false, true, true);
       Set<Role> roles = new HashSet<Role>();
       roles.add(role);
-      service.getServer().getSecurityRepository().addMatch(address.toString(), roles);
-      JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) service.getServer().getSecurityManager();
+      server.getSecurityRepository().addMatch(address.toString(), roles);
+      JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) server.getSecurityManager();
       securityManager.addRole("guest", "roleCanNotCreateQueue");
       
       flush(notifConsumer);
@@ -148,12 +148,12 @@
       conf.setJMXManagementEnabled(false);
       conf.getAcceptorConfigurations()
           .add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
-      service = Messaging.newNullStorageMessagingService(conf);
-      service.start();
+      server = Messaging.newNullStorageMessagingServer(conf);
+      server.start();
 
       notifQueue = randomSimpleString();
 
-      JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) service.getServer().getSecurityManager();
+      JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) server.getSecurityManager();
       securityManager.addUser("admin", "admin");      
       securityManager.addUser("guest", "guest");
       securityManager.setDefaultUser("guest");
@@ -161,7 +161,7 @@
       Role role = new Role("notif", true, true, true, true, true, true, true);
       Set<Role> roles = new HashSet<Role>();
       roles.add(role);
-      service.getServer().getSecurityRepository().addMatch(DEFAULT_MANAGEMENT_NOTIFICATION_ADDRESS.toString(), roles);
+      server.getSecurityRepository().addMatch(DEFAULT_MANAGEMENT_NOTIFICATION_ADDRESS.toString(), roles);
 
       securityManager.addRole("admin", "notif");
 
@@ -182,7 +182,7 @@
       adminSession.deleteQueue(notifQueue);
       adminSession.close();
       
-      service.stop();
+      server.stop();
 
       super.tearDown();
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/paging/PageCrashTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/paging/PageCrashTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/paging/PageCrashTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -22,6 +22,13 @@
 
 package org.jboss.messaging.tests.integration.paging;
 
+import java.io.File;
+import java.lang.management.ManagementFactory;
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.List;
+import java.util.concurrent.Executor;
+
 import org.jboss.messaging.core.client.ClientConsumer;
 import org.jboss.messaging.core.client.ClientMessage;
 import org.jboss.messaging.core.client.ClientProducer;
@@ -44,21 +51,12 @@
 import org.jboss.messaging.core.security.JBMSecurityManager;
 import org.jboss.messaging.core.security.impl.JBMSecurityManagerImpl;
 import org.jboss.messaging.core.server.MessagingServer;
-import org.jboss.messaging.core.server.MessagingService;
 import org.jboss.messaging.core.server.impl.MessagingServerImpl;
-import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
 import org.jboss.messaging.core.settings.impl.AddressSettings;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.OrderedExecutorFactory;
 import org.jboss.messaging.utils.SimpleString;
 
-import java.io.File;
-import java.lang.management.ManagementFactory;
-import java.lang.reflect.Field;
-import java.util.HashMap;
-import java.util.List;
-import java.util.concurrent.Executor;
-
 /**
  * This test will make sure that a failing depage won't cause duplicated messages
  *
@@ -103,7 +101,7 @@
       config.setPagingMaxGlobalSizeBytes(100 * 1024);
       config.setPagingGlobalWatermarkSize(10 * 1024);
 
-      MessagingService messagingService = createService(true, config, new HashMap<String, AddressSettings>());
+      MessagingServer messagingService = createServer(true, config, new HashMap<String, AddressSettings>());
 
       messagingService.start();
 
@@ -145,9 +143,9 @@
       config.setPagingMaxGlobalSizeBytes(100 * 1024);
       config.setPagingGlobalWatermarkSize(10 * 1024);
 
-      MessagingService service = newMessagingService(config);
+      MessagingServer server = newMessagingServer(config);
 
-      service.start();
+      server.start();
 
       try
       {
@@ -171,7 +169,7 @@
          message = session.createClientMessage(true);
          message.getBody().writeBytes(new byte[1024]);
 
-         PagingStore store = service.getServer().getPostOffice().getPagingManager().getPageStore(ADDRESS);
+         PagingStore store = server.getPostOffice().getPagingManager().getPageStore(ADDRESS);
 
          int messages = 0;
          while (!store.isPaging())
@@ -188,7 +186,7 @@
 
          session.close();
 
-         assertTrue(service.getServer().getPostOffice().getPagingManager().getGlobalSize() > 0);
+         assertTrue(server.getPostOffice().getPagingManager().getGlobalSize() > 0);
 
          session = sf.createSession(null, null, false, true, true, false, 0);
 
@@ -209,14 +207,14 @@
 
          session.close();
 
-         assertEquals(0, service.getServer().getPostOffice().getPagingManager().getGlobalSize());
+         assertEquals(0, server.getPostOffice().getPagingManager().getGlobalSize());
 
       }
       finally
       {
          try
          {
-            service.stop();
+            server.stop();
          }
          catch (Throwable ignored)
          {
@@ -230,9 +228,8 @@
 
    // Private -------------------------------------------------------
 
-   private MessagingServiceImpl newMessagingService(final Configuration configuration)
+   private MessagingServer newMessagingServer(final Configuration configuration)
    {
-
       StorageManager storageManager = new JournalStorageManager(configuration);
 
       RemotingService remotingService = new RemotingServiceImpl(configuration);
@@ -243,7 +240,7 @@
 
       remotingService.setManagementService(managementService);
 
-      MessagingServer server = new FailingMessagingServiceImpl();
+      MessagingServer server = new FailingMessagingServerImpl();
 
       server.setConfiguration(configuration);
 
@@ -254,14 +251,13 @@
       server.setSecurityManager(securityManager);
 
       server.setManagementService(managementService);
-      
+
       AddressSettings defaultSetting = new AddressSettings();
       defaultSetting.setPageSizeBytes(configuration.getPagingGlobalWatermarkSize());
-      
+
       server.getAddressSettingsRepository().addMatch("#", defaultSetting);
 
-
-      return new MessagingServiceImpl(server, storageManager, remotingService);
+      return server;
    }
 
    // Inner classes -------------------------------------------------
@@ -269,7 +265,7 @@
    /** This is hacking MessagingServerImpl, 
     *  to make sure the server will fail right 
     *  before the page-file was removed */
-   class FailingMessagingServiceImpl extends MessagingServerImpl
+   class FailingMessagingServerImpl extends MessagingServerImpl
    {
       @Override
       protected PagingManager createPagingManager()

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/persistence/DeleteQueueRestartTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/persistence/DeleteQueueRestartTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/persistence/DeleteQueueRestartTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -29,7 +29,7 @@
 import org.jboss.messaging.core.client.ClientSession;
 import org.jboss.messaging.core.client.ClientSessionFactory;
 import org.jboss.messaging.core.exception.MessagingException;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 
 /**
@@ -70,11 +70,11 @@
 
    private void internalDeleteQueueAndRestart() throws Exception
    {
-      MessagingService service = createService(true);
+      MessagingServer server = createServer(true);
 
-      service.getServer().getConfiguration().setPagingMaxGlobalSizeBytes(0);
+      server.getConfiguration().setPagingMaxGlobalSizeBytes(0);
 
-      service.start();
+      server.start();
 
       ClientSessionFactory factory = createInVMFactory();
 
@@ -116,11 +116,11 @@
 
       count.await();
 
-      service.stop();
+      server.stop();
 
-      service.start();
+      server.start();
 
-      service.stop();
+      server.stop();
 
    }
    // Package protected ---------------------------------------------

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/persistence/JournalStorageManagerIntegrationTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/persistence/JournalStorageManagerIntegrationTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/persistence/JournalStorageManagerIntegrationTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -22,7 +22,7 @@
 
 package org.jboss.messaging.tests.integration.persistence;
 
-import org.jboss.messaging.core.config.impl.FileConfiguration;
+import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.persistence.impl.journal.JournalStorageManager;
 import org.jboss.messaging.core.server.JournalType;
 import org.jboss.messaging.core.server.LargeServerMessage;
@@ -54,7 +54,7 @@
    public void testLargeMessageCopy() throws Exception
    {
       clearData();
-      FileConfiguration configuration = createFileConfig();
+      Configuration configuration = createConfigForJournal();
 
       configuration.start();
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/remoting/DestroyConsumerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/remoting/DestroyConsumerTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/remoting/DestroyConsumerTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -44,8 +44,8 @@
    
 //   public void testDestroyConsumer() throws Exception
 //   {
-//      MessagingService service = createService(false, false, createDefaultConfig(), new HashMap<String, AddressSettings>());
-//      service.start();
+//      MessagingServer server = createService(false, false, createDefaultConfig(), new HashMap<String, AddressSettings>());
+//      server.start();
 //      
 //      SimpleString queue = new SimpleString("add1");
 //      
@@ -59,7 +59,7 @@
 //      
 //      session.start();
 //      
-//      Binding binding = service.getServer().getPostOffice().getBindingsForAddress(queue).get(0);
+//      Binding binding = server.getServer().getPostOffice().getBindingsForAddress(queue).get(0);
 //
 //      assertEquals(1, binding.getQueue().getConsumerCount());
 //

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/remoting/NetworkAddressTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/remoting/NetworkAddressTestBase.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/remoting/NetworkAddressTestBase.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -38,7 +38,7 @@
 import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
 import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.config.TransportConfiguration;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 
 /**
@@ -199,7 +199,7 @@
 
       Configuration config = createDefaultConfig(true);
       config.setAcceptorConfigurations(transportConfigs);
-      MessagingService messagingService = createService(false, config);
+      MessagingServer messagingService = createServer(false, config);
       messagingService.start();
 
       params = new HashMap<String, Object>();

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/remoting/PingTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/remoting/PingTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/remoting/PingTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -30,14 +30,14 @@
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_TTL;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE;
@@ -59,7 +59,7 @@
 import org.jboss.messaging.core.remoting.RemotingConnection;
 import org.jboss.messaging.core.remoting.impl.RemotingConnectionImpl;
 import org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 
 /**
@@ -79,7 +79,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingService messagingService;
+   private MessagingServer server;
 
    // Static --------------------------------------------------------
 
@@ -92,14 +92,14 @@
    {
       super.setUp();
       Configuration config = createDefaultConfig(true);
-      messagingService = createService(false, config);
-      messagingService.start();
+      server = createServer(false, config);
+      server.start();
    }
 
    @Override
    protected void tearDown() throws Exception
    {
-      messagingService.stop();
+      server.stop();
       super.tearDown();
    }
 
@@ -128,7 +128,8 @@
       TransportConfiguration transportConfig = new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory");
 
       ClientSessionFactory csf = new ClientSessionFactoryImpl(transportConfig,
-                                                              null,
+                                                              null,                                 
+                                                              DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN,
                                                               DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
                                                               PING_INTERVAL,
                                                               DEFAULT_CONNECTION_TTL,
@@ -147,7 +148,6 @@
                                                               DEFAULT_ACK_BATCH_SIZE,
                                                               DEFAULT_RETRY_INTERVAL,
                                                               DEFAULT_RETRY_INTERVAL_MULTIPLIER,
-                                                              DEFAULT_INITIAL_CONNECT_ATTEMPTS,
                                                               DEFAULT_RECONNECT_ATTEMPTS);
 
       ClientSession session = csf.createSession(false, true, true);
@@ -161,11 +161,11 @@
       RemotingConnection serverConn = null;
       while (serverConn == null)
       {
-         Set<RemotingConnection> conns = messagingService.getServer().getRemotingService().getConnections();
+         Set<RemotingConnection> conns = server.getRemotingService().getConnections();
 
          if (!conns.isEmpty())
          {
-            serverConn = messagingService.getServer().getRemotingService().getConnections().iterator().next();
+            serverConn = server.getRemotingService().getConnections().iterator().next();
          }
          else
          {
@@ -184,7 +184,7 @@
 
       assertNull(serverListener.getException());
 
-      RemotingConnection serverConn2 = messagingService.getServer()
+      RemotingConnection serverConn2 = server
                                                        .getRemotingService()
                                                        .getConnections()
                                                        .iterator()
@@ -204,6 +204,7 @@
 
       ClientSessionFactory csf = new ClientSessionFactoryImpl(transportConfig,
                                                               null,
+                                                              DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN,
                                                               DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
                                                               PING_INTERVAL,
                                                               DEFAULT_CONNECTION_TTL,
@@ -221,8 +222,7 @@
                                                               DEFAULT_PRE_ACKNOWLEDGE,
                                                               DEFAULT_ACK_BATCH_SIZE,
                                                               DEFAULT_RETRY_INTERVAL,
-                                                              DEFAULT_RETRY_INTERVAL_MULTIPLIER,
-                                                              DEFAULT_INITIAL_CONNECT_ATTEMPTS,
+                                                              DEFAULT_RETRY_INTERVAL_MULTIPLIER,                                             
                                                               DEFAULT_RECONNECT_ATTEMPTS);
 
       ClientSession session = csf.createSession(false, true, true);
@@ -236,11 +236,11 @@
       RemotingConnection serverConn = null;
       while (serverConn == null)
       {
-         Set<RemotingConnection> conns = messagingService.getServer().getRemotingService().getConnections();
+         Set<RemotingConnection> conns = server.getRemotingService().getConnections();
 
          if (!conns.isEmpty())
          {
-            serverConn = messagingService.getServer().getRemotingService().getConnections().iterator().next();
+            serverConn = server.getRemotingService().getConnections().iterator().next();
          }
          else
          {
@@ -259,7 +259,7 @@
 
       assertNull(serverListener.getException());
 
-      RemotingConnection serverConn2 = messagingService.getServer()
+      RemotingConnection serverConn2 = server
                                                        .getRemotingService()
                                                        .getConnections()
                                                        .iterator()
@@ -279,6 +279,7 @@
 
       ClientSessionFactory csf = new ClientSessionFactoryImpl(transportConfig,
                                                               null,
+                                                              DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN,
                                                               DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
                                                               PING_INTERVAL,
                                                               (long)(PING_INTERVAL * 1.5),
@@ -297,7 +298,6 @@
                                                               DEFAULT_ACK_BATCH_SIZE,
                                                               DEFAULT_RETRY_INTERVAL,
                                                               DEFAULT_RETRY_INTERVAL_MULTIPLIER,
-                                                              DEFAULT_INITIAL_CONNECT_ATTEMPTS,
                                                               DEFAULT_RECONNECT_ATTEMPTS);
 
       Listener clientListener = new Listener();
@@ -317,11 +317,11 @@
 
       while (serverConn == null)
       {
-         Set<RemotingConnection> conns = messagingService.getServer().getRemotingService().getConnections();
+         Set<RemotingConnection> conns = server.getRemotingService().getConnections();
 
          if (!conns.isEmpty())
          {
-            serverConn = messagingService.getServer().getRemotingService().getConnections().iterator().next();
+            serverConn = server.getRemotingService().getConnections().iterator().next();
          }
          else
          {
@@ -337,7 +337,7 @@
       for (int i = 0; i < 40; i++)
       {
          // a few tries to avoid a possible race caused by GCs or similar issues
-         if (messagingService.getServer().getRemotingService().getConnections().isEmpty() && clientListener.getException() != null)
+         if (server.getRemotingService().getConnections().isEmpty() && clientListener.getException() != null)
          {
             break;
          }
@@ -345,7 +345,7 @@
          Thread.sleep(PING_INTERVAL);
       }
 
-      assertTrue(messagingService.getServer().getRemotingService().getConnections().isEmpty());
+      assertTrue(server.getRemotingService().getConnections().isEmpty());
 
       // The client listener should be called too since the server will close it from the server side which will result
       // in the
@@ -379,12 +379,13 @@
          }
       };
 
-      messagingService.getServer().getRemotingService().addInterceptor(noPongInterceptor);
+      server.getRemotingService().addInterceptor(noPongInterceptor);
 
       TransportConfiguration transportConfig = new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory");
 
       ClientSessionFactory csf = new ClientSessionFactoryImpl(transportConfig,
                                                               null,
+                                                              DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN,
                                                               DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
                                                               PING_INTERVAL,
                                                               (long)(PING_INTERVAL * 1.5),
@@ -403,7 +404,6 @@
                                                               DEFAULT_ACK_BATCH_SIZE,
                                                               DEFAULT_RETRY_INTERVAL,
                                                               DEFAULT_RETRY_INTERVAL_MULTIPLIER,
-                                                              DEFAULT_INITIAL_CONNECT_ATTEMPTS,
                                                               DEFAULT_RECONNECT_ATTEMPTS);
 
       ClientSession session = csf.createSession(false, true, true);
@@ -417,11 +417,11 @@
       RemotingConnection serverConn = null;
       while (serverConn == null)
       {
-         Set<RemotingConnection> conns = messagingService.getServer().getRemotingService().getConnections();
+         Set<RemotingConnection> conns = server.getRemotingService().getConnections();
 
          if (!conns.isEmpty())
          {
-            serverConn = messagingService.getServer().getRemotingService().getConnections().iterator().next();
+            serverConn = server.getRemotingService().getConnections().iterator().next();
          }
          else
          {
@@ -437,7 +437,7 @@
       for (int i = 0; i < 40; i++)
       {
          // a few tries to avoid a possible race caused by GCs or similar issues
-         if (messagingService.getServer().getRemotingService().getConnections().isEmpty() && clientListener.getException() != null)
+         if (server.getRemotingService().getConnections().isEmpty() && clientListener.getException() != null)
          {
             break;
          }
@@ -450,9 +450,9 @@
       // We don't receive an exception on the server in this case
       assertNull(serverListener.getException());
 
-      assertTrue(messagingService.getServer().getRemotingService().getConnections().isEmpty());
+      assertTrue(server.getRemotingService().getConnections().isEmpty());
 
-      messagingService.getServer().getRemotingService().removeInterceptor(noPongInterceptor);
+      server.getRemotingService().removeInterceptor(noPongInterceptor);
 
       session.close();
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/scheduling/DelayedMessageTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/scheduling/DelayedMessageTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/scheduling/DelayedMessageTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -28,7 +28,7 @@
 import org.jboss.messaging.core.client.ClientSessionFactory;
 import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.settings.impl.AddressSettings;
 import org.jboss.messaging.jms.client.JBossTextMessage;
 import org.jboss.messaging.tests.util.ServiceTestBase;
@@ -42,7 +42,7 @@
 
    private Configuration configuration;
 
-   private MessagingService messagingService;
+   private MessagingServer server;
 
    private static final long DELAY = 3000;
    
@@ -57,28 +57,28 @@
       configuration.setSecurityEnabled(false);
       configuration.setJournalMinFiles(2);
       configuration.setPagingMaxGlobalSizeBytes(-1);
-      messagingService = createService(true, configuration);
-      messagingService.start();
+      server = createServer(true, configuration);
+      server.start();
       
-      AddressSettings qs = messagingService.getServer().getAddressSettingsRepository().getMatch("*");
+      AddressSettings qs = server.getAddressSettingsRepository().getMatch("*");
       AddressSettings newSets = new AddressSettings();
       newSets.setRedeliveryDelay(DELAY);
       newSets.merge(qs);
-      messagingService.getServer().getAddressSettingsRepository().addMatch(qName, newSets);
+      server.getAddressSettingsRepository().addMatch(qName, newSets);
 
    }
 
    @Override
    protected void tearDown() throws Exception
    {
-      if (messagingService != null)
+      if (server != null)
       {
          try
          {
-            messagingService.getServer().getAddressSettingsRepository().removeMatch(qName);
+            server.getAddressSettingsRepository().removeMatch(qName);
 
-            messagingService.stop();
-            messagingService = null;
+            server.stop();
+            server = null;
          }
          catch (Exception e)
          {

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/scheduling/ScheduledMessageTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/scheduling/ScheduledMessageTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/scheduling/ScheduledMessageTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -34,7 +34,7 @@
 import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.message.impl.MessageImpl;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.settings.impl.AddressSettings;
 import org.jboss.messaging.core.transaction.impl.XidImpl;
 import org.jboss.messaging.jms.client.JBossTextMessage;
@@ -55,7 +55,7 @@
 
    private Configuration configuration;
 
-   private MessagingService messagingService;
+   private MessagingServer server;
 
    @Override
    protected void setUp() throws Exception
@@ -66,19 +66,19 @@
       configuration.setSecurityEnabled(false);
       configuration.setJournalMinFiles(2);
       configuration.setPagingMaxGlobalSizeBytes(-1);
-      messagingService = createService(true, configuration);
-      messagingService.start();
+      server = createServer(true, configuration);
+      server.start();
    }
 
    @Override
    protected void tearDown() throws Exception
    {
-      if (messagingService != null)
+      if (server != null)
       {
          try
          {
-            messagingService.stop();
-            messagingService = null;
+            server.stop();
+            server = null;
          }
          catch (Exception e)
          {
@@ -175,7 +175,7 @@
    {
       AddressSettings qs = new AddressSettings();
       qs.setRedeliveryDelay(5000l);
-      messagingService.getServer().getAddressSettingsRepository().addMatch(atestq.toString(), qs);
+      server.getAddressSettingsRepository().addMatch(atestq.toString(), qs);
       // then we create a client as normal
       ClientSessionFactory sessionFactory = createInVMFactory();
       ClientSession session = sessionFactory.createSession(false, true, false);
@@ -224,7 +224,7 @@
 
       AddressSettings qs = new AddressSettings();
       qs.setRedeliveryDelay(5000l);
-      messagingService.getServer().getAddressSettingsRepository().addMatch(atestq.toString(), qs);
+      server.getAddressSettingsRepository().addMatch(atestq.toString(), qs);
       // then we create a client as normal
       ClientSessionFactory sessionFactory = createInVMFactory();
       ClientSession session = sessionFactory.createSession(false, true, false);
@@ -252,10 +252,10 @@
       consumer2.close();
       producer.close();
       session.close();
-      messagingService.stop();
-      messagingService = null;
-      messagingService = createService(true, configuration);
-      messagingService.start();
+      server.stop();
+      server = null;
+      server = createServer(true, configuration);
+      server.start();
       sessionFactory = createInVMFactory();
       session = sessionFactory.createSession(false, true, true);
       consumer = session.createConsumer(atestq);
@@ -306,10 +306,10 @@
       {
          producer.close();
          session.close();
-         messagingService.stop();
-         messagingService = null;
-         messagingService = createService(true, configuration);
-         messagingService.start();
+         server.stop();
+         server = null;
+         server = createServer(true, configuration);
+         server.start();
          sessionFactory = createInVMFactory();
          session = sessionFactory.createSession(false, true, true);
       }
@@ -364,10 +364,10 @@
       {
          producer.close();
          session.close();
-         messagingService.stop();
-         messagingService = null;
-         messagingService = createService(true, configuration);
-         messagingService.start();
+         server.stop();
+         server = null;
+         server = createServer(true, configuration);
+         server.start();
 
          sessionFactory = createInVMFactory();
 
@@ -445,10 +445,10 @@
       {
          producer.close();
          session.close();
-         messagingService.stop();
-         messagingService = null;
-         messagingService = createService(true, configuration);
-         messagingService.start();
+         server.stop();
+         server = null;
+         server = createServer(true, configuration);
+         server.start();
 
          sessionFactory = createInVMFactory();
 
@@ -522,10 +522,10 @@
       {
          producer.close();
          session.close();
-         messagingService.stop();
-         messagingService = null;
-         messagingService = createService(true, configuration);
-         messagingService.start();
+         server.stop();
+         server = null;
+         server = createServer(true, configuration);
+         server.start();
 
          sessionFactory = createInVMFactory();
 
@@ -585,10 +585,10 @@
       {
          producer.close();
          session.close();
-         messagingService.stop();
-         messagingService = null;
-         messagingService = createService(true, configuration);
-         messagingService.start();
+         server.stop();
+         server = null;
+         server = createServer(true, configuration);
+         server.start();
 
          sessionFactory = createInVMFactory();
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/security/NettySecurityClientTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/security/NettySecurityClientTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/security/NettySecurityClientTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -30,7 +30,7 @@
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory;
 import org.jboss.messaging.integration.transports.netty.NettyConnectorFactory;
 import org.jboss.messaging.tests.util.SpawnedVMSupport;
@@ -50,7 +50,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingService messagingService;
+   private MessagingServer messagingService;
 
    // Static --------------------------------------------------------
 
@@ -84,7 +84,7 @@
       ConfigurationImpl config = new ConfigurationImpl();
       config.setSecurityEnabled(false);
       config.getAcceptorConfigurations().add(new TransportConfiguration(NettyAcceptorFactory.class.getName()));
-      messagingService = Messaging.newNullStorageMessagingService(config);
+      messagingService = Messaging.newNullStorageMessagingServer(config);
       messagingService.start();
    }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/security/SecurityTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/security/SecurityTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/security/SecurityTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -29,7 +29,7 @@
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.security.JBMUpdateableSecurityManager;
 import org.jboss.messaging.core.security.Role;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.Queue;
 import org.jboss.messaging.core.settings.HierarchicalRepository;
 import org.jboss.messaging.integration.security.JAASSecurityManager;
@@ -67,13 +67,13 @@
    {
       Configuration configuration = createDefaultConfig(false);
       configuration.setSecurityEnabled(true);
-      MessagingService messagingService = createService(false, configuration);
-      JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) messagingService.getServer().getSecurityManager();
+      MessagingServer server = createServer(false, configuration);
+      JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) server.getSecurityManager();
       securityManager.addUser("guest", "guest");
       securityManager.setDefaultUser("guest");
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
 
          try
@@ -87,9 +87,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
@@ -98,10 +98,10 @@
    {
       Configuration configuration = createDefaultConfig(false);
       configuration.setSecurityEnabled(true);
-      MessagingService messagingService = createService(false, configuration);
+      MessagingServer server = createServer(false, configuration);
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
          try
          {
@@ -115,9 +115,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
@@ -126,12 +126,12 @@
    {
       Configuration configuration = createDefaultConfig(false);
       configuration.setSecurityEnabled(true);
-      MessagingService messagingService = createService(false, configuration);
-      JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) messagingService.getServer().getSecurityManager();
+      MessagingServer server = createServer(false, configuration);
+      JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) server.getSecurityManager();
       securityManager.addUser("newuser", "apass");
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
 
          try
@@ -146,9 +146,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
@@ -157,12 +157,12 @@
    {
       Configuration configuration = createDefaultConfig(false);
       configuration.setSecurityEnabled(true);
-      MessagingService messagingService = createService(false, configuration);
-      JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) messagingService.getServer().getSecurityManager();
+      MessagingServer server = createServer(false, configuration);
+      JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) server.getSecurityManager();
       securityManager.addUser("newuser", "apass");
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
 
          try
@@ -176,9 +176,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
@@ -188,13 +188,13 @@
    {
       Configuration configuration = createDefaultConfig(false);
       configuration.setSecurityEnabled(true);
-      MessagingService messagingService = createService(false, configuration);
+      MessagingServer server = createServer(false, configuration);
 
       try
       {
-         messagingService.start();
-         HierarchicalRepository<Set<Role>> securityRepository = messagingService.getServer().getSecurityRepository();
-         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) messagingService.getServer().getSecurityManager();
+         server.start();
+         HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
+         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) server.getSecurityManager();
          securityManager.addUser("auser", "pass");
          Role role = new Role("arole", false, false, true, false, false, false, false);
          Set<Role> roles = new HashSet<Role>();
@@ -208,9 +208,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
@@ -219,13 +219,13 @@
    {
       Configuration configuration = createDefaultConfig(false);
       configuration.setSecurityEnabled(true);
-      MessagingService messagingService = createService(false, configuration);
+      MessagingServer server = createServer(false, configuration);
 
       try
       {
-         messagingService.start();
-         HierarchicalRepository<Set<Role>> securityRepository = messagingService.getServer().getSecurityRepository();
-         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) messagingService.getServer().getSecurityManager();
+         server.start();
+         HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
+         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) server.getSecurityManager();
          securityManager.addUser("auser", "pass");
          Role role = new Role("arole", false, false, false, false, false, false, false);
          Set<Role> roles = new HashSet<Role>();
@@ -247,9 +247,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
@@ -258,13 +258,13 @@
    {
       Configuration configuration = createDefaultConfig(false);
       configuration.setSecurityEnabled(true);
-      MessagingService messagingService = createService(false, configuration);
+      MessagingServer server = createServer(false, configuration);
 
       try
       {
-         messagingService.start();
-         HierarchicalRepository<Set<Role>> securityRepository = messagingService.getServer().getSecurityRepository();
-         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) messagingService.getServer().getSecurityManager();
+         server.start();
+         HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
+         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) server.getSecurityManager();
          securityManager.addUser("auser", "pass");
          Role role = new Role("arole", false, false, true, true, false, false, false);
          Set<Role> roles = new HashSet<Role>();
@@ -279,9 +279,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
@@ -290,13 +290,13 @@
    {
       Configuration configuration = createDefaultConfig(false);
       configuration.setSecurityEnabled(true);
-      MessagingService messagingService = createService(false, configuration);
+      MessagingServer server = createServer(false, configuration);
 
       try
       {
-         messagingService.start();
-         HierarchicalRepository<Set<Role>> securityRepository = messagingService.getServer().getSecurityRepository();
-         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) messagingService.getServer().getSecurityManager();
+         server.start();
+         HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
+         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) server.getSecurityManager();
          securityManager.addUser("auser", "pass");
          Role role = new Role("arole", false, false, true, false, false, false, false);
          Set<Role> roles = new HashSet<Role>();
@@ -319,9 +319,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
@@ -330,13 +330,13 @@
    {
       Configuration configuration = createDefaultConfig(false);
       configuration.setSecurityEnabled(true);
-      MessagingService messagingService = createService(false, configuration);
+      MessagingServer server = createServer(false, configuration);
 
       try
       {
-         messagingService.start();
-         HierarchicalRepository<Set<Role>> securityRepository = messagingService.getServer().getSecurityRepository();
-         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) messagingService.getServer().getSecurityManager();
+         server.start();
+         HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
+         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) server.getSecurityManager();
          securityManager.addUser("auser", "pass");
          Role role = new Role("arole", false, false, false, false, true, false, false);
          Set<Role> roles = new HashSet<Role>();
@@ -350,9 +350,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
@@ -362,13 +362,13 @@
    {
       Configuration configuration = createDefaultConfig(false);
       configuration.setSecurityEnabled(true);
-      MessagingService messagingService = createService(false, configuration);
+      MessagingServer server = createServer(false, configuration);
 
       try
       {
-         messagingService.start();
-         HierarchicalRepository<Set<Role>> securityRepository = messagingService.getServer().getSecurityRepository();
-         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) messagingService.getServer().getSecurityManager();
+         server.start();
+         HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
+         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) server.getSecurityManager();
          securityManager.addUser("auser", "pass");
          Role role = new Role("arole", false, false, false, false, false, false, false);
          Set<Role> roles = new HashSet<Role>();
@@ -390,9 +390,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
@@ -401,13 +401,13 @@
    {
       Configuration configuration = createDefaultConfig(false);
       configuration.setSecurityEnabled(true);
-      MessagingService messagingService = createService(false, configuration);
+      MessagingServer server = createServer(false, configuration);
 
       try
       {
-         messagingService.start();
-         HierarchicalRepository<Set<Role>> securityRepository = messagingService.getServer().getSecurityRepository();
-         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) messagingService.getServer().getSecurityManager();
+         server.start();
+         HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
+         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) server.getSecurityManager();
          securityManager.addUser("auser", "pass");
          Role role = new Role("arole", false, false, false, false, true, true, false);
          Set<Role> roles = new HashSet<Role>();
@@ -422,9 +422,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
@@ -433,13 +433,13 @@
    {
       Configuration configuration = createDefaultConfig(false);
       configuration.setSecurityEnabled(true);
-      MessagingService messagingService = createService(false, configuration);
+      MessagingServer server = createServer(false, configuration);
 
       try
       {
-         messagingService.start();
-         HierarchicalRepository<Set<Role>> securityRepository = messagingService.getServer().getSecurityRepository();
-         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) messagingService.getServer().getSecurityManager();
+         server.start();
+         HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
+         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) server.getSecurityManager();
          securityManager.addUser("auser", "pass");
          Role role = new Role("arole", false, false, false, false, true, false, false);
          Set<Role> roles = new HashSet<Role>();
@@ -462,9 +462,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
@@ -474,13 +474,13 @@
    {
       Configuration configuration = createDefaultConfig(false);
       configuration.setSecurityEnabled(true);
-      MessagingService messagingService = createService(false, configuration);
+      MessagingServer server = createServer(false, configuration);
 
       try
       {
-         messagingService.start();
-         HierarchicalRepository<Set<Role>> securityRepository = messagingService.getServer().getSecurityRepository();
-         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) messagingService.getServer().getSecurityManager();
+         server.start();
+         HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
+         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) server.getSecurityManager();
          securityManager.addUser("auser", "pass");
          Role role = new Role("arole", true, false, true, false, false, false, false);
          Set<Role> roles = new HashSet<Role>();
@@ -497,9 +497,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
@@ -508,13 +508,13 @@
    {
       Configuration configuration = createDefaultConfig(false);
       configuration.setSecurityEnabled(true);
-      MessagingService messagingService = createService(false, configuration);
+      MessagingServer server = createServer(false, configuration);
 
       try
       {
-         messagingService.start();
-         HierarchicalRepository<Set<Role>> securityRepository = messagingService.getServer().getSecurityRepository();
-         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) messagingService.getServer().getSecurityManager();
+         server.start();
+         HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
+         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) server.getSecurityManager();
          securityManager.addUser("auser", "pass");
          Role role = new Role("arole", false, false, true, false, false, false, false);
          Set<Role> roles = new HashSet<Role>();
@@ -538,9 +538,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
@@ -549,13 +549,13 @@
    {
       Configuration configuration = createDefaultConfig(false);
       configuration.setSecurityEnabled(true);
-      MessagingService messagingService = createService(false, configuration);
+      MessagingServer server = createServer(false, configuration);
 
       try
       {
-         messagingService.start();
-         HierarchicalRepository<Set<Role>> securityRepository = messagingService.getServer().getSecurityRepository();
-         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) messagingService.getServer().getSecurityManager();
+         server.start();
+         HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
+         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) server.getSecurityManager();
          securityManager.addUser("auser", "pass");
          Role role = new Role("arole", false, false, true, false, false, false, false);
          Set<Role> roles = new HashSet<Role>();
@@ -569,14 +569,14 @@
          cp.send(session.createClientMessage(false));
          session.close();
 
-         Queue binding = (Queue) messagingService.getServer().getPostOffice().getBinding(new SimpleString(queueA)).getBindable();
+         Queue binding = (Queue) server.getPostOffice().getBinding(new SimpleString(queueA)).getBindable();
          assertEquals(0, binding.getMessageCount());
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
@@ -585,13 +585,13 @@
    {
       Configuration configuration = createDefaultConfig(false);
       configuration.setSecurityEnabled(true);
-      MessagingService messagingService = createService(false, configuration);
+      MessagingServer server = createServer(false, configuration);
 
       try
       {
-         messagingService.start();
-         HierarchicalRepository<Set<Role>> securityRepository = messagingService.getServer().getSecurityRepository();
-         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) messagingService.getServer().getSecurityManager();
+         server.start();
+         HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
+         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) server.getSecurityManager();
          securityManager.addUser("auser", "pass");
          securityManager.addUser("guest", "guest");
          securityManager.addRole("guest", "guest");
@@ -615,9 +615,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
@@ -626,13 +626,13 @@
    {
       Configuration configuration = createDefaultConfig(false);
       configuration.setSecurityEnabled(true);
-      MessagingService messagingService = createService(false, configuration);
+      MessagingServer server = createServer(false, configuration);
 
       try
       {
-         messagingService.start();
-         HierarchicalRepository<Set<Role>> securityRepository = messagingService.getServer().getSecurityRepository();
-         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) messagingService.getServer().getSecurityManager();
+         server.start();
+         HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
+         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) server.getSecurityManager();
          securityManager.addUser("auser", "pass");
          securityManager.addUser("guest", "guest");
          securityManager.addRole("guest", "guest");
@@ -663,9 +663,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
@@ -674,13 +674,13 @@
    {
       Configuration configuration = createDefaultConfig(false);
       configuration.setSecurityEnabled(true);
-      MessagingService messagingService = createService(false, configuration);
+      MessagingServer server = createServer(false, configuration);
 
       try
       {
-         messagingService.start();
-         HierarchicalRepository<Set<Role>> securityRepository = messagingService.getServer().getSecurityRepository();
-         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) messagingService.getServer().getSecurityManager();
+         server.start();
+         HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
+         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) server.getSecurityManager();
          securityManager.addUser("auser", "pass");
          Role role = new Role("arole", false, false, false, false, false, false, true);
          Set<Role> roles = new HashSet<Role>();
@@ -696,9 +696,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
@@ -707,13 +707,13 @@
    {
       Configuration configuration = createDefaultConfig(false);
       configuration.setSecurityEnabled(true);
-      MessagingService messagingService = createService(false, configuration);
+      MessagingServer server = createServer(false, configuration);
 
       try
       {
-         messagingService.start();
-         HierarchicalRepository<Set<Role>> securityRepository = messagingService.getServer().getSecurityRepository();
-         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) messagingService.getServer().getSecurityManager();
+         server.start();
+         HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
+         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) server.getSecurityManager();
          securityManager.addUser("auser", "pass");
          Role role = new Role("arole", false, false, true, false, false, false, false);
          Set<Role> roles = new HashSet<Role>();
@@ -737,9 +737,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
@@ -748,13 +748,13 @@
    {
       Configuration configuration = createDefaultConfig(false);
       configuration.setSecurityEnabled(true);
-      MessagingService messagingService = createService(false, configuration);
+      MessagingServer server = createServer(false, configuration);
 
       try
       {
-         messagingService.start();
-         HierarchicalRepository<Set<Role>> securityRepository = messagingService.getServer().getSecurityRepository();
-         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) messagingService.getServer().getSecurityManager();
+         server.start();
+         HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
+         JBMUpdateableSecurityManager securityManager = (JBMUpdateableSecurityManager) server.getSecurityManager();
          securityManager.addUser("auser", "pass");
          Role role = new Role("arole", false, false, true, false, false, false, false);
          Set<Role> roles = new HashSet<Role>();
@@ -768,14 +768,14 @@
          cp.send(session.createClientMessage(false));
          session.close();
 
-         Queue binding = (Queue) messagingService.getServer().getPostOffice().getBinding(new SimpleString(queueA)).getBindable();
+         Queue binding = (Queue) server.getPostOffice().getBinding(new SimpleString(queueA)).getBindable();
          assertEquals(0, binding.getMessageCount());
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
@@ -789,9 +789,9 @@
       String domainName = SimpleLogingModule.class.getName();
       Configuration configuration = createDefaultConfig(false);
       configuration.setSecurityEnabled(true);
-      MessagingService messagingService = createService(false, configuration);
+      MessagingServer server = createServer(false, configuration);
       JAASSecurityManager securityManager = new JAASSecurityManager();
-      messagingService.getServer().setSecurityManager(securityManager);
+      server.setSecurityManager(securityManager);
 
       securityManager.setConfigurationName(domainName);
       securityManager.setCallbackHandler(new CallbackHandler()
@@ -806,7 +806,7 @@
       securityManager.setConfiguration(new SimpleConfiguration(domainName, options));
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
 
          try
@@ -820,9 +820,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }
@@ -832,9 +832,9 @@
       String domainName = SimpleLogingModule.class.getName();
       Configuration configuration = createDefaultConfig(false);
       configuration.setSecurityEnabled(true);
-      MessagingService messagingService = createService(false, configuration);
+      MessagingServer server = createServer(false, configuration);
       JAASSecurityManager securityManager = new JAASSecurityManager();
-      messagingService.getServer().setSecurityManager(securityManager);
+      server.setSecurityManager(securityManager);
 
       securityManager.setConfigurationName(domainName);
       securityManager.setCallbackHandler(new CallbackHandler()
@@ -849,7 +849,7 @@
       securityManager.setConfiguration(new SimpleConfiguration(domainName, options));
       try
       {
-         messagingService.start();
+         server.start();
          ClientSessionFactory cf = createInVMFactory();
 
          try
@@ -864,9 +864,9 @@
       }
       finally
       {
-         if (messagingService.isStarted())
+         if (server.isStarted())
          {
-            messagingService.stop();
+            server.stop();
          }
       }
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/server/ExpiryRunnerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/server/ExpiryRunnerTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/server/ExpiryRunnerTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -34,7 +34,7 @@
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.server.Queue;
 import org.jboss.messaging.core.settings.impl.AddressSettings;
 import org.jboss.messaging.tests.util.UnitTestCase;
@@ -50,7 +50,7 @@
  */
 public class ExpiryRunnerTest extends UnitTestCase
 {
-   private MessagingService messagingService;
+   private MessagingServer server;
 
    private ClientSession clientSession;
 
@@ -74,8 +74,8 @@
          producer.send(m);
       }
       Thread.sleep(1600);
-      assertEquals(0, ((Queue)messagingService.getServer().getPostOffice().getBinding(qName).getBindable()).getMessageCount());
-      assertEquals(0, ((Queue)messagingService.getServer().getPostOffice().getBinding(qName).getBindable()).getDeliveringCount());
+      assertEquals(0, ((Queue)server.getPostOffice().getBinding(qName).getBindable()).getMessageCount());
+      assertEquals(0, ((Queue)server.getPostOffice().getBinding(qName).getBindable()).getDeliveringCount());
 
       ClientConsumer consumer = clientSession.createConsumer(expiryQueue);
       clientSession.start();
@@ -94,7 +94,7 @@
       clientSession.createQueue(qName2, qName2, null, false);
       AddressSettings addressSettings = new AddressSettings();
       addressSettings.setExpiryAddress(expiryAddress);
-      messagingService.getServer().getAddressSettingsRepository().addMatch(qName2.toString(), addressSettings);
+      server.getAddressSettingsRepository().addMatch(qName2.toString(), addressSettings);
       ClientProducer producer2 = clientSession.createProducer(qName2);
       int numMessages = 100;
       long expiration = System.currentTimeMillis();
@@ -108,8 +108,8 @@
          producer2.send(m);
       }
       Thread.sleep(1600);
-      assertEquals(0, ((Queue)messagingService.getServer().getPostOffice().getBinding(qName).getBindable()).getMessageCount());
-      assertEquals(0, ((Queue)messagingService.getServer().getPostOffice().getBinding(qName).getBindable()).getDeliveringCount());
+      assertEquals(0, ((Queue)server.getPostOffice().getBinding(qName).getBindable()).getMessageCount());
+      assertEquals(0, ((Queue)server.getPostOffice().getBinding(qName).getBindable()).getDeliveringCount());
 
       ClientConsumer consumer = clientSession.createConsumer(expiryQueue);
       clientSession.start();
@@ -137,8 +137,8 @@
          producer.send(m);
       }
       Thread.sleep(1600);
-      assertEquals(numMessages / 2, ((Queue)messagingService.getServer().getPostOffice().getBinding(qName).getBindable()).getMessageCount());
-      assertEquals(0, ((Queue)messagingService.getServer().getPostOffice().getBinding(qName).getBindable()).getDeliveringCount());
+      assertEquals(numMessages / 2, ((Queue)server.getPostOffice().getBinding(qName).getBindable()).getMessageCount());
+      assertEquals(0, ((Queue)server.getPostOffice().getBinding(qName).getBindable()).getDeliveringCount());
 
       ClientConsumer consumer = clientSession.createConsumer(expiryQueue);
       clientSession.start();
@@ -173,8 +173,8 @@
       }
       consumer.close();
       Thread.sleep(2100);
-      assertEquals(0, ((Queue)messagingService.getServer().getPostOffice().getBinding(qName).getBindable()).getMessageCount());
-      assertEquals(0, ((Queue)messagingService.getServer().getPostOffice().getBinding(qName).getBindable()).getDeliveringCount());
+      assertEquals(0, ((Queue)server.getPostOffice().getBinding(qName).getBindable()).getMessageCount());
+      assertEquals(0, ((Queue)server.getPostOffice().getBinding(qName).getBindable()).getDeliveringCount());
 
       consumer = clientSession.createConsumer(expiryQueue);
       clientSession.start();
@@ -192,7 +192,7 @@
       clientSession.createQueue(qName, qName2, null, false);
       AddressSettings addressSettings = new AddressSettings();
       addressSettings.setExpiryAddress(expiryAddress);
-      messagingService.getServer().getAddressSettingsRepository().addMatch(qName2.toString(), addressSettings);
+      server.getAddressSettingsRepository().addMatch(qName2.toString(), addressSettings);
       ClientProducer producer = clientSession.createProducer(qName);
       int numMessages = 100;
       long expiration = System.currentTimeMillis();
@@ -203,8 +203,8 @@
          producer.send(m);
       }
       Thread.sleep(1600);
-      assertEquals(0, ((Queue)messagingService.getServer().getPostOffice().getBinding(qName).getBindable()).getMessageCount());
-      assertEquals(0, ((Queue)messagingService.getServer().getPostOffice().getBinding(qName).getBindable()).getDeliveringCount());
+      assertEquals(0, ((Queue)server.getPostOffice().getBinding(qName).getBindable()).getMessageCount());
+      assertEquals(0, ((Queue)server.getPostOffice().getBinding(qName).getBindable()).getDeliveringCount());
 
       ClientConsumer consumer = clientSession.createConsumer(expiryQueue);
       clientSession.start();
@@ -294,9 +294,9 @@
       configuration.setMessageExpiryScanPeriod(1000);
       TransportConfiguration transportConfig = new TransportConfiguration(INVM_ACCEPTOR_FACTORY);
       configuration.getAcceptorConfigurations().add(transportConfig);
-      messagingService = Messaging.newNullStorageMessagingService(configuration);
+      server = Messaging.newNullStorageMessagingServer(configuration);
       // start the server
-      messagingService.start();
+      server.start();
       // then we create a client as normal
       ClientSessionFactory sessionFactory = new ClientSessionFactoryImpl(new TransportConfiguration(INVM_CONNECTOR_FACTORY));
       sessionFactory.setBlockOnAcknowledge(true);
@@ -306,8 +306,8 @@
       expiryQueue = new SimpleString("expiryQ");
       AddressSettings addressSettings = new AddressSettings();
       addressSettings.setExpiryAddress(expiryAddress);
-      messagingService.getServer().getAddressSettingsRepository().addMatch(qName.toString(), addressSettings);
-      messagingService.getServer().getAddressSettingsRepository().addMatch(qName2.toString(), addressSettings);
+      server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings);
+      server.getAddressSettingsRepository().addMatch(qName2.toString(), addressSettings);
       clientSession.createQueue(expiryAddress, expiryQueue, null, false);
    }
 
@@ -325,18 +325,18 @@
             //
          }
       }
-      if (messagingService != null && messagingService.isStarted())
+      if (server != null && server.isStarted())
       {
          try
          {
-            messagingService.stop();
+            server.stop();
          }
          catch (Exception e1)
          {
             //
          }
       }
-      messagingService = null;
+      server = null;
       clientSession = null;
       
       super.tearDown();

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/server/PredefinedQueueTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/server/PredefinedQueueTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/server/PredefinedQueueTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -36,7 +36,7 @@
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.postoffice.Bindings;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -83,9 +83,9 @@
       
       conf.setQueueConfigurations(queueConfs);
       
-      MessagingService messagingService = Messaging.newNullStorageMessagingService(conf);
+      MessagingServer server = Messaging.newNullStorageMessagingServer(conf);
            
-      messagingService.start();
+      server.start();
       
       ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"));
 
@@ -126,7 +126,7 @@
       
       sf.close();
       
-      messagingService.stop();
+      server.stop();
    }
    
    public void testDeploySameNames() throws Exception
@@ -153,11 +153,11 @@
       
       conf.setQueueConfigurations(queueConfs);
       
-      MessagingService messagingService = Messaging.newNullStorageMessagingService(conf);
+      MessagingServer server = Messaging.newNullStorageMessagingServer(conf);
            
-      messagingService.start();
+      server.start();
       
-      Bindings bindings = messagingService.getServer().getPostOffice().getBindingsForAddress(new SimpleString(testAddress));
+      Bindings bindings = server.getPostOffice().getBindingsForAddress(new SimpleString(testAddress));
       
       assertEquals(2, bindings.getBindings().size());
       
@@ -206,7 +206,7 @@
       
       sf.close();
       
-      messagingService.stop();
+      server.stop();
    }
    
    public void testDeployPreexistingQueues() throws Exception
@@ -221,9 +221,9 @@
       
       final String queueName3 = "queue3";
                  
-      MessagingService messagingService = Messaging.newMessagingService(conf);
+      MessagingServer server = Messaging.newMessagingServer(conf);
            
-      messagingService.start();
+      server.start();
       
       ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"));
 
@@ -239,7 +239,7 @@
       
       sf.close();
       
-      messagingService.stop();
+      server.stop();
       
       QueueConfiguration queue1 = new QueueConfiguration(testAddress, queueName1, null, true);
       
@@ -255,7 +255,7 @@
       
       conf.setQueueConfigurations(queueConfs);
       
-      messagingService.start();
+      server.start();
       
       sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"));
 
@@ -310,7 +310,7 @@
       
       sf.close();
       
-      messagingService.stop();
+      server.stop();
    }
    
    public void testDurableNonDurable() throws Exception
@@ -334,9 +334,9 @@
       
       conf.setQueueConfigurations(queueConfs);
       
-      MessagingService messagingService = Messaging.newMessagingService(conf);
+      MessagingServer server = Messaging.newMessagingServer(conf);
            
-      messagingService.start();
+      server.start();
       
       ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"));
 
@@ -365,9 +365,9 @@
       
       sf.close();
       
-      messagingService.stop();
+      server.stop();
       
-      messagingService.start();
+      server.start();
       
       sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"));
 
@@ -398,7 +398,7 @@
       
       sf.close();
       
-      messagingService.stop();
+      server.stop();
    }
    
    
@@ -420,9 +420,9 @@
 
       conf.setQueueConfigurations(queueConfs);
       
-      MessagingService messagingService = Messaging.newNullStorageMessagingService(conf);
+      MessagingServer server = Messaging.newNullStorageMessagingServer(conf);
            
-      messagingService.start();
+      server.start();
       
       ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"));
 
@@ -478,7 +478,7 @@
       
       sf.close();
       
-      messagingService.stop();
+      server.stop();
    }
   
    

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/server/SoloQueueRecoveryTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/server/SoloQueueRecoveryTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/server/SoloQueueRecoveryTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -21,31 +21,31 @@
  */
 package org.jboss.messaging.tests.integration.server;
 
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
 import org.jboss.messaging.core.client.ClientConsumer;
 import org.jboss.messaging.core.client.ClientMessage;
 import org.jboss.messaging.core.client.ClientProducer;
 import org.jboss.messaging.core.client.ClientSession;
 import org.jboss.messaging.core.client.ClientSessionFactory;
 import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
+import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.config.TransportConfiguration;
-import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.message.impl.MessageImpl;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.settings.impl.AddressSettings;
 import org.jboss.messaging.core.transaction.impl.XidImpl;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
 
-import javax.transaction.xa.XAResource;
-import javax.transaction.xa.Xid;
-
 /**
  * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
  */
 public class SoloQueueRecoveryTest extends ServiceTestBase
 {
-   private MessagingService messagingService;
+   private MessagingServer server;
 
    private ClientSession clientSession;
 
@@ -55,7 +55,7 @@
 
    private ClientSession clientSessionXa;
 
-   private ConfigurationImpl configuration;
+   private Configuration configuration;
 
    private AddressSettings qs;
 
@@ -172,18 +172,18 @@
             //
          }
       }
-      if (messagingService != null && messagingService.isStarted())
+      if (server != null && server.isStarted())
       {
          try
          {
-            messagingService.stop();
+            server.stop();
          }
          catch (Exception e1)
          {
             //
          }
       }
-      messagingService = null;
+      server = null;
       clientSession = null;
       
       super.tearDown();
@@ -194,17 +194,17 @@
       super.setUp();
       
       clearData();
-      configuration = createFileConfig();
+      configuration = createConfigForJournal();
       configuration.setSecurityEnabled(false);
       TransportConfiguration transportConfig = new TransportConfiguration(INVM_ACCEPTOR_FACTORY);
       configuration.getAcceptorConfigurations().add(transportConfig);
-      messagingService = createService(true, configuration);
+      server = createServer(true, configuration);
       // start the server
-      messagingService.start();
+      server.start();
 
       qs = new AddressSettings();
       qs.setSoloQueue(true);
-      messagingService.getServer().getAddressSettingsRepository().addMatch(address.toString(), qs);
+      server.getAddressSettingsRepository().addMatch(address.toString(), qs);
       // then we create a client as normal
       ClientSessionFactory sessionFactory = new ClientSessionFactoryImpl(new TransportConfiguration(INVM_CONNECTOR_FACTORY));
       sessionFactory.setBlockOnAcknowledge(true);
@@ -216,16 +216,16 @@
 
    private void restartServer() throws Exception
    {
-      messagingService.stop();
-      messagingService = null;
-      messagingService = createService(true, configuration);
-      messagingService.getServer().getAddressSettingsRepository().addMatch(address.toString(), qs);
+      server.stop();
+      server = null;
+      server = createServer(true, configuration);
+      server.getAddressSettingsRepository().addMatch(address.toString(), qs);
       // start the server
-      messagingService.start();
+      server.start();
 
       AddressSettings qs = new AddressSettings();
       qs.setSoloQueue(true);
-      messagingService.getServer().getAddressSettingsRepository().addMatch(address.toString(), qs);
+      server.getAddressSettingsRepository().addMatch(address.toString(), qs);
       // then we create a client as normal
       ClientSessionFactory sessionFactory = new ClientSessionFactoryImpl(new TransportConfiguration(INVM_CONNECTOR_FACTORY));
       sessionFactory.setBlockOnAcknowledge(true);

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/server/SoloQueueTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/server/SoloQueueTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/server/SoloQueueTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -32,7 +32,7 @@
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.message.impl.MessageImpl;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.settings.impl.AddressSettings;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
@@ -42,7 +42,7 @@
  */
 public class SoloQueueTest extends UnitTestCase
 {
-   private MessagingService messagingService;
+   private MessagingServer server;
 
    private ClientSession clientSession;
 
@@ -539,18 +539,18 @@
             //
          }
       }
-      if (messagingService != null && messagingService.isStarted())
+      if (server != null && server.isStarted())
       {
          try
          {
-            messagingService.stop();
+            server.stop();
          }
          catch (Exception e1)
          {
             //
          }
       }
-      messagingService = null;
+      server = null;
       clientSession = null;
       
       super.tearDown();
@@ -565,13 +565,13 @@
       TransportConfiguration transportConfig = new TransportConfiguration(INVM_ACCEPTOR_FACTORY);
       configuration.getAcceptorConfigurations().add(transportConfig);
       storageManager = new FakeStorageManager();
-      messagingService = Messaging.newMessagingService(configuration, storageManager);
+      server = Messaging.newMessagingServer(configuration, storageManager);
       // start the server
-      messagingService.start();
+      server.start();
 
       AddressSettings qs = new AddressSettings();
       qs.setSoloQueue(true);
-      messagingService.getServer().getAddressSettingsRepository().addMatch(address.toString(), qs);
+      server.getAddressSettingsRepository().addMatch(address.toString(), qs);
       // then we create a client as normal
       ClientSessionFactory sessionFactory = new ClientSessionFactoryImpl(new TransportConfiguration(INVM_CONNECTOR_FACTORY));
       sessionFactory.setBlockOnAcknowledge(true);

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSLTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSLTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSLTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -25,7 +25,7 @@
 import org.jboss.messaging.core.client.ClientConsumer;
 import org.jboss.messaging.core.client.ClientSession;
 import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -50,7 +50,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingService messagingService;
+   private MessagingServer messagingService;
 
    private ClientSession session;
 
@@ -112,8 +112,8 @@
 //      Map<String, Object> params = new HashMap<String, Object>();
 //      params.put(TransportConstants.SSL_ENABLED_PROP_NAME, true);
 //      config.getAcceptorInfos().add(new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory", params));
-//      messagingService = MessagingServiceImpl.newNullStorageMessagingServer(config);      
-//      messagingService.start();
+//      server = MessagingServerImpl.newNullStorageMessagingServer(config);      
+//      server.start();
 //      ConnectorFactory cf = new NettyConnectorFactory();
 //      ClientSessionFactory sf = new ClientSessionFactoryImpl(cf);    
 //      sf.setTransportParams(params);
@@ -129,7 +129,7 @@
 //      consumer.close();
 //      session.close();
 //
-//      messagingService.stop();
+//      server.stop();
 //
 //      super.tearDown();
 //   }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaRecoveryTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaRecoveryTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaRecoveryTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -36,7 +36,7 @@
 import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.settings.impl.AddressSettings;
 import org.jboss.messaging.core.transaction.impl.XidImpl;
 import org.jboss.messaging.jms.client.JBossBytesMessage;
@@ -55,7 +55,7 @@
 
    private final Map<String, AddressSettings> addressSettings = new HashMap<String, AddressSettings>();
 
-   private MessagingService messagingService;
+   private MessagingServer server;
 
    private ClientSession clientSession;
 
@@ -81,10 +81,10 @@
       configuration.setJournalMinFiles(2);
       configuration.setPagingDirectory(getPageDir());
 
-      messagingService = createService(true, configuration, addressSettings);
+      server = createServer(true, configuration, addressSettings);
 
       // start the server
-      messagingService.start();
+      server.start();
 
       // then we create a client as normal
       createClients(true, false);
@@ -104,18 +104,18 @@
             //
          }
       }
-      if (messagingService != null && messagingService.isStarted())
+      if (server != null && server.isStarted())
       {
          try
          {
-            messagingService.stop();
+            server.stop();
          }
          catch (Exception e1)
          {
             //
          }
       }
-      messagingService = null;
+      server = null;
       clientSession = null;
 
       super.tearDown();
@@ -341,7 +341,7 @@
 
       clientSession.createQueue(pageQueue, pageQueue, null, true);
       
-      long initialPageSize = this.messagingService.getServer().getPostOffice().getPagingManager().getGlobalSize();
+      long initialPageSize = this.server.getPostOffice().getPagingManager().getGlobalSize();
 
       clientSession.start(xid, XAResource.TMNOFLAGS);
 
@@ -379,7 +379,7 @@
 
       assertNull(pageConsumer.receive(100));
       
-      long globalSize = this.messagingService.getServer().getPostOffice().getPagingManager().getGlobalSize();
+      long globalSize = this.server.getPostOffice().getPagingManager().getGlobalSize();
       // Management message (from createQueue) will not be taken into account again as it is nonPersistent
       
       log.info("global size is " + globalSize +  " initial page size is " + initialPageSize);
@@ -1213,11 +1213,11 @@
       // now stop and start the server
       clientSession.close();
       clientSession = null;
-      messagingService.stop();
-      messagingService = null;
-      messagingService = createService(true, configuration, addressSettings);
+      server.stop();
+      server = null;
+      server = createServer(true, configuration, addressSettings);
 
-      messagingService.start();
+      server.start();
       createClients();
    }
 
@@ -1225,7 +1225,7 @@
    {
       for (Map.Entry<String, AddressSettings> setting : addressSettings.entrySet())
       {
-         messagingService.getServer().getAddressSettingsRepository().addMatch(setting.getKey(), setting.getValue());
+         server.getAddressSettingsRepository().addMatch(setting.getKey(), setting.getValue());
       }
    }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -39,7 +39,7 @@
 import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.settings.impl.AddressSettings;
 import org.jboss.messaging.core.transaction.impl.XidImpl;
 import org.jboss.messaging.tests.util.ServiceTestBase;
@@ -56,7 +56,7 @@
 
    private final Map<String, AddressSettings> addressSettings = new HashMap<String, AddressSettings>();
 
-   private MessagingService messagingService;
+   private MessagingServer messagingService;
 
    private ClientSession clientSession;
 
@@ -79,7 +79,7 @@
       configuration.setPagingDirectory(getPageDir());
       configuration.setPagingMaxGlobalSizeBytes(0); // no paging for these tests
 
-      messagingService = createService(false, configuration, addressSettings);
+      messagingService = createServer(false, configuration, addressSettings);
 
       // start the server
       messagingService.start();
@@ -340,7 +340,7 @@
       messagingService.stop();
 
       // do the same test with a file persistence now
-      messagingService = createService(true, configuration, addressSettings);
+      messagingService = createServer(true, configuration, addressSettings);
 
       messagingService.start();
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/xa/XaTimeoutTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/xa/XaTimeoutTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/xa/XaTimeoutTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -38,7 +38,7 @@
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.settings.impl.AddressSettings;
 import org.jboss.messaging.core.transaction.impl.XidImpl;
 import org.jboss.messaging.tests.util.UnitTestCase;
@@ -53,7 +53,7 @@
 
    private Map<String, AddressSettings> addressSettings = new HashMap<String, AddressSettings>();
 
-   private MessagingService messagingService;
+   private MessagingServer messagingService;
    
    private ClientSession clientSession;
 
@@ -77,7 +77,7 @@
       configuration.setTransactionTimeoutScanPeriod(500);
       TransportConfiguration transportConfig = new TransportConfiguration(INVM_ACCEPTOR_FACTORY);
       configuration.getAcceptorConfigurations().add(transportConfig);
-      messagingService = Messaging.newNullStorageMessagingService(configuration);
+      messagingService = Messaging.newNullStorageMessagingServer(configuration);
       //start the server
       messagingService.start();
       //then we create a client as normal

Modified: trunk/tests/src/org/jboss/messaging/tests/performance/paging/MeasurePagingMultiThreadTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/performance/paging/MeasurePagingMultiThreadTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/performance/paging/MeasurePagingMultiThreadTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -33,7 +33,7 @@
 import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.settings.impl.AddressSettings;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
@@ -80,7 +80,7 @@
 
       config.setPagingMaxGlobalSizeBytes(20 * 1024);
 
-      MessagingService messagingService = createService(true, config, settings);
+      MessagingServer messagingService = createServer(true, config, settings);
       messagingService.start();
       try
       {

Modified: trunk/tests/src/org/jboss/messaging/tests/stress/paging/PageStressTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/stress/paging/PageStressTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/stress/paging/PageStressTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -22,7 +22,7 @@
 import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.server.JournalType;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.settings.impl.AddressSettings;
 import org.jboss.messaging.tests.util.ServiceTestBase;
 import org.jboss.messaging.utils.SimpleString;
@@ -39,7 +39,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingService messagingService;
+   private MessagingServer messagingService;
 
    // Static --------------------------------------------------------
 
@@ -78,7 +78,7 @@
          settings.put("page-adr", setting);
       }
 
-      messagingService = createService(true, config, settings);
+      messagingService = createServer(true, config, settings);
       messagingService.start();
 
       ClientSessionFactory factory = createInVMFactory();
@@ -139,7 +139,7 @@
 
          System.out.println("server stopped, nr msgs: " + msgs);
 
-         messagingService = createService(true, config, settings);
+         messagingService = createServer(true, config, settings);
          messagingService.start();
 
          factory = createInVMFactory();
@@ -209,7 +209,7 @@
          settings.put("page-adr", setting);
       }
 
-      messagingService = createService(true, config, settings);
+      messagingService = createServer(true, config, settings);
       messagingService.start();
 
       ClientSessionFactory factory = createInVMFactory();

Modified: trunk/tests/src/org/jboss/messaging/tests/stress/remote/PingStressTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/stress/remote/PingStressTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/stress/remote/PingStressTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -28,14 +28,14 @@
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_PERSISTENT_SEND;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_INITIAL_CONNECT_ATTEMPTS;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
 import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE;
@@ -53,7 +53,7 @@
 import org.jboss.messaging.core.remoting.Packet;
 import org.jboss.messaging.core.remoting.RemotingConnection;
 import org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.tests.integration.remoting.PingTest;
 import org.jboss.messaging.tests.util.RandomUtil;
 import org.jboss.messaging.tests.util.ServiceTestBase;
@@ -73,7 +73,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private MessagingService messagingService;
+   private MessagingServer server;
 
    // Static --------------------------------------------------------
 
@@ -86,17 +86,17 @@
    {
       super.setUp();
       Configuration config = createDefaultConfig(true);
-      messagingService = createService(false, config);
-      messagingService.start();
+      server = createServer(false, config);
+      server.start();
    }
 
    @Override
    protected void tearDown() throws Exception
    {
-      if (messagingService != null && messagingService.isStarted())
+      if (server != null && server.isStarted())
       {
-         messagingService.stop();
-         messagingService = null;
+         server.stop();
+         server = null;
       }
       super.tearDown();
    }
@@ -145,15 +145,17 @@
          }
       };
 
-      messagingService.getServer().getRemotingService().addInterceptor(noPongInterceptor);
+      server.getRemotingService().addInterceptor(noPongInterceptor);
 
       final ClientSessionFactory csf1 = new ClientSessionFactoryImpl(transportConfig,
                                                                      null,
+                                                                     DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN,
                                                                      DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
                                                                      PING_INTERVAL,
                                                                      (long)(PING_INTERVAL * 1.5),
-                                                                     PING_INTERVAL * 10, // Using a smaller call timeout
-                                                                                        // for this test
+                                                                     PING_INTERVAL * 10, // Using a smaller call
+                                                                                          // timeout
+                                                                     // for this test
                                                                      DEFAULT_CONSUMER_WINDOW_SIZE,
                                                                      DEFAULT_CONSUMER_MAX_RATE,
                                                                      DEFAULT_SEND_WINDOW_SIZE,
@@ -168,7 +170,6 @@
                                                                      DEFAULT_ACK_BATCH_SIZE,
                                                                      DEFAULT_RETRY_INTERVAL,
                                                                      DEFAULT_RETRY_INTERVAL_MULTIPLIER,
-                                                                     DEFAULT_INITIAL_CONNECT_ATTEMPTS,
                                                                      DEFAULT_RECONNECT_ATTEMPTS);
 
       final int numberOfSessions = 1;
@@ -197,12 +198,14 @@
 
                final ClientSessionFactory csf2 = new ClientSessionFactoryImpl(transportConfig,
                                                                               null,
+                                                                              DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN,
                                                                               DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
                                                                               PING_INTERVAL,
                                                                               (long)(PING_INTERVAL * 1.5),
-                                                                              PING_INTERVAL * 10, // Using a smaller call
-                                                                                                 // timeout for this
-                                                                                                 // test
+                                                                              PING_INTERVAL * 10, // Using a smaller
+                                                                                                   // call
+                                                                              // timeout for this
+                                                                              // test
                                                                               DEFAULT_CONSUMER_WINDOW_SIZE,
                                                                               DEFAULT_CONSUMER_MAX_RATE,
                                                                               DEFAULT_SEND_WINDOW_SIZE,
@@ -217,7 +220,6 @@
                                                                               DEFAULT_ACK_BATCH_SIZE,
                                                                               DEFAULT_RETRY_INTERVAL,
                                                                               DEFAULT_RETRY_INTERVAL_MULTIPLIER,
-                                                                              DEFAULT_INITIAL_CONNECT_ATTEMPTS,
                                                                               DEFAULT_RECONNECT_ATTEMPTS);
 
                // Start all at once to make concurrency worst

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/BasicSecurityDeployerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/BasicSecurityDeployerTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/BasicSecurityDeployerTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -252,6 +252,19 @@
       {
          return false;
       }
+      
+      public void start()
+      {         
+      }
+      
+      public void stop()
+      {         
+      }
+      
+      public boolean isStarted()
+      {
+         return true;
+      }
    }
 
    static class User

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/SequentialFileFactoryTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/SequentialFileFactoryTestBase.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/SequentialFileFactoryTestBase.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -48,6 +48,9 @@
    protected void setUp() throws Exception
    {
       super.setUp();
+      
+      //reset
+      AsynchronousFileImpl.resetMaxAIO();
 
       factory = createFactory();
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory1.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory1.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory1.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -55,6 +55,14 @@
       {  
       }
       
+      public void pause()
+      {         
+      }    
+      
+      public void resume()
+      {         
+      }
+      
       public boolean isStarted()
       {
          return false;

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory2.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory2.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory2.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -55,6 +55,14 @@
       {  
       }
       
+      public void pause()
+      {         
+      }   
+      
+      public void resume()
+      {         
+      }
+      
       public boolean isStarted()
       {
          return false;

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory3.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory3.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory3.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -55,6 +55,14 @@
       {  
       }
       
+      public void pause()
+      {         
+      }   
+      
+      public void resume()
+      {         
+      }
+      
       public boolean isStarted()
       {
          return false;

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -33,7 +33,7 @@
 
 /**
  *
- * A MinaAcceptorTest
+ * A NettyAcceptorTest
  *
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
  *
@@ -48,9 +48,18 @@
       NettyAcceptor acceptor = new NettyAcceptor(params, handler, listener);
 
       acceptor.start();
+      acceptor.pause();
       acceptor.stop();
       acceptor.start();
+      acceptor.pause();
       acceptor.stop();
+      
+      acceptor.start();
+      acceptor.pause();
+      acceptor.resume();
+      acceptor.stop();
+      acceptor.start();
+      acceptor.stop();
 
    }
 }

Modified: trunk/tests/src/org/jboss/messaging/tests/util/ServiceTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/util/ServiceTestBase.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/util/ServiceTestBase.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -22,7 +22,6 @@
 
 package org.jboss.messaging.tests.util;
 
-import java.io.File;
 import java.lang.ref.WeakReference;
 import java.util.HashMap;
 import java.util.Map;
@@ -47,7 +46,7 @@
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
 import org.jboss.messaging.core.server.JournalType;
 import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.core.settings.impl.AddressSettings;
 import org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory;
 import org.jboss.messaging.integration.transports.netty.NettyConnectorFactory;
@@ -120,9 +119,9 @@
       recreateDirectory(getTemporaryDir(testDir));
    }
 
-   protected FileConfiguration createFileConfig()
+   protected Configuration createConfigForJournal()
    {
-      FileConfiguration config = new FileConfiguration();
+      Configuration config = new ConfigurationImpl();
       config.setJournalDirectory(getJournalDir());
       config.setBindingsDirectory(getBindingsDir());
       config.setJournalType(JournalType.NIO);
@@ -130,81 +129,81 @@
       return config;
    }
 
-   protected MessagingService createService(final boolean realFiles,
-                                            final Configuration configuration,
-                                            final Map<String, AddressSettings> settings)
+   protected MessagingServer createServer(final boolean realFiles,
+                                          final Configuration configuration,
+                                          final Map<String, AddressSettings> settings)
    {
-      MessagingService service;
+      MessagingServer service;
 
       if (realFiles)
       {
-         service = Messaging.newMessagingService(configuration);
+         service = Messaging.newMessagingServer(configuration);
       }
       else
       {
-         service = Messaging.newNullStorageMessagingService(configuration);
+         service = Messaging.newNullStorageMessagingServer(configuration);
       }
 
       for (Map.Entry<String, AddressSettings> setting : settings.entrySet())
       {
-         service.getServer().getAddressSettingsRepository().addMatch(setting.getKey(), setting.getValue());
+         service.getAddressSettingsRepository().addMatch(setting.getKey(), setting.getValue());
       }
 
       AddressSettings defaultSetting = new AddressSettings();
       defaultSetting.setPageSizeBytes(configuration.getPagingGlobalWatermarkSize());
 
-      service.getServer().getAddressSettingsRepository().addMatch("#", defaultSetting);
+      service.getAddressSettingsRepository().addMatch("#", defaultSetting);
 
       return service;
    }
 
-   protected MessagingService createService(final boolean realFiles,
-                                            final Configuration configuration,
-                                            final MBeanServer mbeanServer,
-                                            final Map<String, AddressSettings> settings)
+   protected MessagingServer createService(final boolean realFiles,
+                                           final Configuration configuration,
+                                           final MBeanServer mbeanServer,
+                                           final Map<String, AddressSettings> settings)
    {
 
-      MessagingService service;
+      MessagingServer service;
 
       if (realFiles)
       {
-         service = Messaging.newMessagingService(configuration, mbeanServer);
+         service = Messaging.newMessagingServer(configuration, mbeanServer);
       }
       else
       {
-         service = Messaging.newNullStorageMessagingService(configuration, mbeanServer);
+         service = Messaging.newNullStorageMessagingServer(configuration, mbeanServer);
       }
 
       for (Map.Entry<String, AddressSettings> setting : settings.entrySet())
       {
-         service.getServer().getAddressSettingsRepository().addMatch(setting.getKey(), setting.getValue());
+         service.getAddressSettingsRepository().addMatch(setting.getKey(), setting.getValue());
       }
 
       AddressSettings defaultSetting = new AddressSettings();
       defaultSetting.setPageSizeBytes(configuration.getPagingGlobalWatermarkSize());
 
-      service.getServer().getAddressSettingsRepository().addMatch("#", defaultSetting);
+      service.getAddressSettingsRepository().addMatch("#", defaultSetting);
 
       return service;
    }
 
-   protected MessagingService createService(final boolean realFiles)
+   protected MessagingServer createServer(final boolean realFiles)
    {
-      return createService(realFiles, createDefaultConfig(), new HashMap<String, AddressSettings>());
+      return createServer(realFiles, createDefaultConfig(), new HashMap<String, AddressSettings>());
    }
 
-   protected MessagingService createService(final boolean realFiles, final Configuration configuration)
+   protected MessagingServer createServer(final boolean realFiles, final Configuration configuration)
    {
-      return createService(realFiles, configuration, new HashMap<String, AddressSettings>());
+      return createServer(realFiles, configuration, new HashMap<String, AddressSettings>());
    }
 
-   protected MessagingService createClusteredServiceWithParams(final int index,
-                                                               final boolean realFiles,
-                                                               final Map<String, Object> params)
+   protected MessagingServer createClusteredServerWithParams(final int index,
+                                                             final boolean realFiles,
+                                                             final Map<String, Object> params)
    {
-      return createService(realFiles,
-                           createClusteredDefaultConfig(index, params, INVM_ACCEPTOR_FACTORY),
-                           new HashMap<String, AddressSettings>());
+      return createServer(realFiles,
+                          createClusteredDefaultConfig(index, params, INVM_ACCEPTOR_FACTORY),
+                          new HashMap<String, AddressSettings>());
    }
 
    protected Configuration createDefaultConfig()
@@ -241,7 +240,7 @@
       configuration.setSecurityEnabled(false);
       configuration.setBindingsDirectory(getBindingsDir(index));
       configuration.setJournalMinFiles(2);
-      configuration.setJournalDirectory(getJournalDir(index));
+      configuration.setJournalDirectory(getJournalDir(index, false));
       configuration.setJournalFileSize(100 * 1024);
       configuration.setJournalType(JournalType.NIO);
       configuration.setPagingDirectory(getPageDir(index));
@@ -332,9 +331,9 @@
       return message;
    }
 
-   protected int getMessageCount(final MessagingService service, final String address) throws Exception
+   protected int getMessageCount(final MessagingServer service, final String address) throws Exception
    {
-      return getMessageCount(service.getServer().getPostOffice(), address);
+      return getMessageCount(service.getPostOffice(), address);
    }
 
    /**

Modified: trunk/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java	2009-03-30 14:56:10 UTC (rev 6216)
+++ trunk/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java	2009-03-30 17:50:06 UTC (rev 6217)
@@ -23,6 +23,8 @@
 package org.jboss.messaging.tests.util;
 
 import junit.framework.TestCase;
+
+import org.jboss.messaging.core.asyncio.impl.AsynchronousFileImpl;
 import org.jboss.messaging.core.buffers.ChannelBuffers;
 import org.jboss.messaging.core.client.ClientMessage;
 import org.jboss.messaging.core.client.ClientSession;
@@ -221,9 +223,13 @@
       return testDir + "/journal";
    }
    
-   protected String getJournalDir(int index)
+   protected String getJournalDir(int index, boolean backup)
    {
-      return getJournalDir(testDir) + index;
+      String dir =  getJournalDir(testDir) + index + "-" + (backup ? "B" : "L");
+      
+      log.info("dir is " + dir);
+      
+      return dir;
    }
 
    /**
@@ -368,7 +374,7 @@
       
       InVMRegistry.instance.clear();
       
-      log.info("###### starting test " + this.getName());
+      log.info("###### starting test " + this.getClass().getName() + "." + this.getName());
    }
    
    @Override
@@ -376,7 +382,7 @@
    {
       deleteDirectory(new File(getTestDir()));
 
-      assertEquals(0, InVMRegistry.instance.size());
+      assertEquals(0, InVMRegistry.instance.size());          
       
       super.tearDown();
    }




More information about the jboss-cvs-commits mailing list