summaryrefslogtreecommitdiff
path: root/qpid/java
diff options
context:
space:
mode:
authorRobert Godfrey <rgodfrey@apache.org>2014-02-14 10:52:47 +0000
committerRobert Godfrey <rgodfrey@apache.org>2014-02-14 10:52:47 +0000
commit50b314a51a2c787fcd412a84cb8464f72e3868b4 (patch)
treefa6e85db6da742fbb9b235ca3e1d036d288ae970 /qpid/java
parent08b64b592cb844cbd746b33e5f17c94b2158a115 (diff)
downloadqpid-python-50b314a51a2c787fcd412a84cb8464f72e3868b4.tar.gz
QPID-5551 : Remove uses of AMQException, add ServerScopedRuntimeException and ConnectionScopedRuntimeException
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1568235 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
-rw-r--r--qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/transport/ConnectionEndpoint.java12
-rw-r--r--qpid/java/bdbstore/jmx/src/main/java/org/apache/qpid/server/store/berkeleydb/jmx/BDBHAMessageStoreManagerMBean.java2
-rw-r--r--qpid/java/bdbstore/jmx/src/test/java/org/apache/qpid/server/store/berkeleydb/jmx/BDBHAMessageStoreManagerMBeanTest.java4
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java129
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBBackup.java11
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAMessageStore.java30
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHost.java12
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostFactory.java2
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java15
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CommitThreadWrapper.java3
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/FieldTableEncoding.java3
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/ConfiguredObjectBinding.java9
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/StoreUpgrade.java5
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom4To5.java51
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6.java68
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom6To7.java6
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/Upgrader.java20
-rw-r--r--qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAMessageStoreSmokeTest.java3
-rw-r--r--qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgraderFailOnNewerVersionTest.java12
-rw-r--r--qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java2
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/TransactionTimeoutHelper.java7
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/JsonConfigurationEntryStore.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/StoreConfigurationChangeListener.java5
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/ChangeAttributesTask.java4
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/ChangeStateTask.java2
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/CreateChildTask.java2
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/SetAttributeTask.java2
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/TaskExecutor.java76
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/connection/IConnectionRegistry.java4
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/consumer/Consumer.java6
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/consumer/ConsumerTarget.java1
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AMQUnknownExchangeType.java (renamed from qpid/java/common/src/main/java/org/apache/qpid/AMQUnknownExchangeType.java)8
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java33
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchange.java19
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.java8
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeRegistry.java7
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DirectExchange.java2
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DirectExchangeType.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/Exchange.java21
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeFactory.java7
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeInitialiser.java9
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeRegistry.java8
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/FanoutExchange.java2
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/FanoutExchangeType.java2
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersBinding.java2
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersExchangeType.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/TopicExchange.java6
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/TopicExchangeType.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/AMQInvalidArgumentException.java (renamed from qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/MessageStoreClosedException.java)29
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/FilterManagerFactory.java4
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/FilterSupport.java1
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/NoConsumerFilter.java48
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/AbstractServerMessageImpl.java5
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/MessageSource.java16
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessage.java10
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaData.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaDataType.java5
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractAdapter.java2
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AmqpPortAdapter.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderAdapter.java5
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BindingAdapter.java5
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java10
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ExchangeAdapter.java9
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileSystemPreferencesProvider.java4
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/KeyStoreAdapter.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/QueueAdapter.java17
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/VirtualHostAdapter.java33
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/ExchangeType.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/QpidServiceLoader.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/VirtualHostFactory.java2
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/protocol/AMQConnectionModel.java7
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/protocol/AMQSessionModel.java7
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueue.java10
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java42
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/BaseQueue.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueConsumer.java14
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueEntryImpl.java1
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueFactory.java5
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueRunner.java14
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java28
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SortedQueue.java3
-rwxr-xr-xqpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SubFlushRunner.java1
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/database/HashedUser.java5
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManager.java21
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ldap/LDAPSSLSocketFactoryGenerator.java17
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HashedSaslServer.java4
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HexSaslServer.java4
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/group/FileGroupDatabase.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AMQStoreException.java (renamed from qpid/java/common/src/main/java/org/apache/qpid/AMQStoreException.java)5
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java171
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractMemoryMessageStore.java20
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationRecoverer.java4
-rwxr-xr-xqpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStore.java4
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStoreHelper.java76
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java96
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/MessageStore.java6
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/NullMessageStore.java16
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/Transaction.java22
-rwxr-xr-xqpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/AsyncAutoCommitTransaction.java41
-rwxr-xr-xqpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/AutoCommitTransaction.java41
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DtxBranch.java17
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DtxRegistry.java2
-rwxr-xr-xqpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/LocalTransaction.java66
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/ConnectionScopedRuntimeException.java17
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/MapJsonSerializer.java4
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/ServerScopedRuntimeException.java17
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java61
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/BindingRecoverer.java5
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeExistsException.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeIsAlternateException.java7
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeRecoverer.java11
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueExistsException.java (renamed from qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/plugins/QueueExistsException.java)5
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueRecoverer.java5
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/RequiredExchangeException.java7
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ReservedExchangeNameException.java4
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHost.java39
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHostFactory.java2
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/UnknownExchangeException.java7
-rwxr-xr-xqpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java13
-rwxr-xr-xqpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostConfigRecoveryHandler.java118
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/updater/TaskExecutorTest.java64
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/consumer/MockConsumer.java10
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/DefaultExchangeFactoryTest.java3
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/FanoutExchangeTest.java12
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java3
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/TopicExchangeTest.java4
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/logging/actors/AMQPConnectionActorTest.java3
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/logging/actors/CurrentActorTest.java4
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/AMQQueueFactoryTest.java2
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java20
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/MockMessageInstance.java1
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/PriorityQueueTest.java8
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/QueueEntryImplTestBase.java3
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/QueueEntryListTestBase.java9
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SimpleAMQQueueTestBase.java31
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SimpleQueueEntryImplTest.java6
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SortedQueueEntryListTest.java5
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SortedQueueEntryTest.java3
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/StandardQueueEntryListTest.java3
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/StandardQueueTest.java2
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/AbstractDurableConfigurationStoreTestCase.java1
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/JsonFileConfigStoreTest.java9
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStore.java11
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/txn/MockStoreTransaction.java16
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java7
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/DurableConfigurationRecovererTest.java2
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java9
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/StandardVirtualHostTest.java13
-rw-r--r--qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ConsumerTarget_0_10.java8
-rw-r--r--qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/MessageConverter_v0_10.java4
-rw-r--r--qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/MessageConverter_v0_10_to_Internal.java5
-rw-r--r--qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerConnection.java28
-rw-r--r--qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSession.java7
-rw-r--r--qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSessionDelegate.java76
-rw-r--r--qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java50
-rw-r--r--qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java131
-rw-r--r--qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolSession.java4
-rw-r--r--qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageConverter_Internal_to_v0_8.java3
-rw-r--r--qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageConverter_v0_8_to_Internal.java5
-rw-r--r--qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageMetaData.java19
-rw-r--r--qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/BasicConsumeMethodHandler.java3
-rw-r--r--qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/BasicGetMethodHandler.java15
-rw-r--r--qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/ChannelOpenHandler.java5
-rw-r--r--qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/ExchangeDeclareHandler.java8
-rw-r--r--qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/QueueDeclareHandler.java12
-rw-r--r--qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/state/AMQStateManager.java39
-rw-r--r--qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/state/IllegalStateTransitionException.java52
-rw-r--r--qpid/java/broker-plugins/amqp-0-8-protocol/src/test/java/org/apache/qpid/server/protocol/v0_8/AckTest.java34
-rw-r--r--qpid/java/broker-plugins/amqp-0-8-protocol/src/test/java/org/apache/qpid/server/protocol/v0_8/InternalTestProtocolSession.java2
-rw-r--r--qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java5
-rw-r--r--qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ConsumerTarget_1_0.java4
-rw-r--r--qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ExchangeDestination.java4
-rw-r--r--qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_Internal_to_v1_0.java3
-rw-r--r--qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_to_1_0.java5
-rw-r--r--qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_v1_0_to_Internal.java9
-rwxr-xr-xqpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageMetaData_1_0.java3
-rw-r--r--qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ProtocolEngine_1_0_0_SASL.java38
-rw-r--r--qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/QueueDestination.java39
-rw-r--r--qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/SendingLink_1_0.java58
-rw-r--r--qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java23
-rw-r--r--qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java11
-rw-r--r--qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStore.java12
-rw-r--r--qpid/java/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNode.java3
-rw-r--r--qpid/java/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNodeConsumer.java3
-rw-r--r--qpid/java/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementResponse.java1
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java7
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementUtil.java3
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/AbstractServlet.java14
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/SaslServlet.java3
-rw-r--r--qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagedObjectRegistry.java3
-rw-r--r--qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagement.java3
-rw-r--r--qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/ConnectionMBean.java3
-rw-r--r--qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/ExchangeMBean.java3
-rw-r--r--qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/LoggingManagementMBean.java3
-rw-r--r--qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/QueueMBean.java3
-rw-r--r--qpid/java/broker-plugins/websocket/src/main/java/org/apache/qpid/server/transport/websocket/WebSocketProvider.java7
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/server/store/QuotaMessageStore.java18
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java53
198 files changed, 1427 insertions, 1666 deletions
diff --git a/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/transport/ConnectionEndpoint.java b/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/transport/ConnectionEndpoint.java
index 9c93c1f0a5..270abef88b 100644
--- a/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/transport/ConnectionEndpoint.java
+++ b/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/transport/ConnectionEndpoint.java
@@ -369,7 +369,7 @@ public class ConnectionEndpoint implements DescribedTypeConstructorRegistry.Sour
Error error = new Error();
error.setCondition(ConnectionError.CONNECTION_FORCED);
error.setDescription("Connection close sent before connection was opened");
- connectionError(error);
+ close(error);
break;
case OPEN:
_state = ConnectionState.CLOSE_RECEIVED;
@@ -386,7 +386,7 @@ public class ConnectionEndpoint implements DescribedTypeConstructorRegistry.Sour
notifyAll();
}
- protected synchronized void connectionError(Error error)
+ public synchronized void close(Error error)
{
Close close = new Close();
close.setError(error);
@@ -476,7 +476,7 @@ public class ConnectionEndpoint implements DescribedTypeConstructorRegistry.Sour
error.setDescription("BEGIN received on channel " + channel + " with given remote-channel "
+ begin.getRemoteChannel() + " which is outside the valid range of 0 to "
+ _channelMax + ".");
- connectionError(error);
+ close(error);
return;
}
if (endpoint != null)
@@ -498,7 +498,7 @@ public class ConnectionEndpoint implements DescribedTypeConstructorRegistry.Sour
final Error error = new Error();
error.setCondition(ConnectionError.FRAMING_ERROR);
error.setDescription("BEGIN received on channel " + channel + " which is already in use.");
- connectionError(error);
+ close(error);
}
}
else
@@ -507,7 +507,7 @@ public class ConnectionEndpoint implements DescribedTypeConstructorRegistry.Sour
error.setCondition(ConnectionError.FRAMING_ERROR);
error.setDescription("BEGIN received on channel " + channel + " with given remote-channel "
+ begin.getRemoteChannel() + " which is not known as a begun session.");
- connectionError(error);
+ close(error);
}
@@ -547,7 +547,7 @@ public class ConnectionEndpoint implements DescribedTypeConstructorRegistry.Sour
final Error error = new Error();
error.setCondition(ConnectionError.FRAMING_ERROR);
error.setDescription("BEGIN received on channel " + channel + " which is already in use.");
- connectionError(error);
+ close(error);
}
}
diff --git a/qpid/java/bdbstore/jmx/src/main/java/org/apache/qpid/server/store/berkeleydb/jmx/BDBHAMessageStoreManagerMBean.java b/qpid/java/bdbstore/jmx/src/main/java/org/apache/qpid/server/store/berkeleydb/jmx/BDBHAMessageStoreManagerMBean.java
index 28528ec83c..bab68c6f07 100644
--- a/qpid/java/bdbstore/jmx/src/main/java/org/apache/qpid/server/store/berkeleydb/jmx/BDBHAMessageStoreManagerMBean.java
+++ b/qpid/java/bdbstore/jmx/src/main/java/org/apache/qpid/server/store/berkeleydb/jmx/BDBHAMessageStoreManagerMBean.java
@@ -36,7 +36,7 @@ import javax.management.openmbean.TabularDataSupport;
import javax.management.openmbean.TabularType;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQStoreException;
+import org.apache.qpid.server.store.AMQStoreException;
import org.apache.qpid.server.jmx.AMQManagedObject;
import org.apache.qpid.server.jmx.ManagedObject;
import org.apache.qpid.server.store.berkeleydb.BDBHAMessageStore;
diff --git a/qpid/java/bdbstore/jmx/src/test/java/org/apache/qpid/server/store/berkeleydb/jmx/BDBHAMessageStoreManagerMBeanTest.java b/qpid/java/bdbstore/jmx/src/test/java/org/apache/qpid/server/store/berkeleydb/jmx/BDBHAMessageStoreManagerMBeanTest.java
index 298d5bc045..a74c9b3c87 100644
--- a/qpid/java/bdbstore/jmx/src/test/java/org/apache/qpid/server/store/berkeleydb/jmx/BDBHAMessageStoreManagerMBeanTest.java
+++ b/qpid/java/bdbstore/jmx/src/test/java/org/apache/qpid/server/store/berkeleydb/jmx/BDBHAMessageStoreManagerMBeanTest.java
@@ -37,15 +37,13 @@ import javax.management.openmbean.TabularData;
import junit.framework.TestCase;
-import org.apache.qpid.AMQStoreException;
+import org.apache.qpid.server.store.AMQStoreException;
import org.apache.qpid.server.jmx.AMQManagedObject;
import org.apache.qpid.server.jmx.ManagedObjectRegistry;
import org.apache.qpid.server.logging.SystemOutMessageLogger;
import org.apache.qpid.server.logging.actors.CurrentActor;
import org.apache.qpid.server.logging.actors.TestLogActor;
import org.apache.qpid.server.store.berkeleydb.BDBHAMessageStore;
-import org.apache.qpid.server.store.berkeleydb.jmx.BDBHAMessageStoreManagerMBean;
-import org.apache.qpid.server.store.berkeleydb.jmx.ManagedBDBHAMessageStore;
public class BDBHAMessageStoreManagerMBeanTest extends TestCase
{
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java
index 35efa55569..53365e6b96 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java
@@ -44,7 +44,7 @@ import java.util.concurrent.atomic.AtomicLong;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQStoreException;
+import org.apache.qpid.server.store.AMQStoreException;
import org.apache.qpid.server.message.EnqueueableMessage;
import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.queue.AMQQueue;
@@ -62,6 +62,7 @@ import org.apache.qpid.server.store.berkeleydb.tuple.QueueEntryBinding;
import org.apache.qpid.server.store.berkeleydb.tuple.UUIDTupleBinding;
import org.apache.qpid.server.store.berkeleydb.tuple.XidBinding;
import org.apache.qpid.server.store.berkeleydb.upgrade.Upgrader;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.util.FileUtils;
public abstract class AbstractBDBMessageStore implements MessageStore, DurableConfigurationStore
@@ -157,7 +158,7 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
_eventManager.addEventListener(eventListener, events);
}
- public void configureConfigStore(VirtualHost virtualHost, ConfigurationRecoveryHandler recoveryHandler) throws Exception
+ public void configureConfigStore(VirtualHost virtualHost, ConfigurationRecoveryHandler recoveryHandler)
{
_stateManager.attainState(State.INITIALISING);
@@ -166,7 +167,7 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
}
public void configureMessageStore(VirtualHost virtualHost, MessageStoreRecoveryHandler messageRecoveryHandler,
- TransactionLogRecoveryHandler tlogRecoveryHandler) throws Exception
+ TransactionLogRecoveryHandler tlogRecoveryHandler)
{
if(_stateManager.isInState(State.INITIAL))
{
@@ -181,14 +182,14 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
completeInitialisation();
}
- private void completeInitialisation() throws Exception
+ private void completeInitialisation()
{
configure(_virtualHost);
_stateManager.attainState(State.INITIALISED);
}
- public synchronized void activate() throws Exception
+ public synchronized void activate()
{
// check if acting as a durable config store, but not a message store
if(_stateManager.isInState(State.INITIALISING))
@@ -228,12 +229,12 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
*
* @throws Exception If any error occurs that means the store is unable to configure itself.
*/
- public void configure(VirtualHost virtualHost) throws Exception
+ public void configure(VirtualHost virtualHost)
{
configure(virtualHost, _messageRecoveryHandler != null);
}
- public void configure(VirtualHost virtualHost, boolean isMessageStore) throws Exception
+ public void configure(VirtualHost virtualHost, boolean isMessageStore)
{
String name = virtualHost.getName();
final String defaultPath = System.getProperty("QPID_WORK") + File.separator + "bdbstore" + File.separator + name;
@@ -337,7 +338,7 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
_stateManager.attainState(State.ACTIVE);
}
- protected void setupStore(File storePath, String name) throws DatabaseException, AMQStoreException
+ protected void setupStore(File storePath, String name)
{
_environment = createEnvironment(storePath);
@@ -387,7 +388,7 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
*
* @throws Exception If the close fails.
*/
- public void close() throws Exception
+ public void close()
{
if (_closed.compareAndSet(false, true))
{
@@ -397,7 +398,7 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
}
}
- protected void closeInternal() throws Exception
+ protected void closeInternal()
{
if (_messageMetaDataDb != null)
{
@@ -472,7 +473,7 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
}
- private void recoverConfig(ConfigurationRecoveryHandler recoveryHandler) throws AMQStoreException
+ private void recoverConfig(ConfigurationRecoveryHandler recoveryHandler)
{
try
{
@@ -488,7 +489,11 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
}
catch (DatabaseException e)
{
- throw new AMQStoreException("Error recovering persistent state: " + e.getMessage(), e);
+ throw new ServerScopedRuntimeException("Error recovering persistent state: " + e.getMessage(), e);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("Error recovering persistent state: " + e.getMessage(), e);
}
}
@@ -1385,7 +1390,7 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
int size = dataAsBytes.length;
if (offset > size)
{
- throw new RuntimeException("Offset " + offset + " is greater than message size " + size
+ throw new ServerScopedRuntimeException("Offset " + offset + " is greater than message size " + size
+ " for message id " + messageId + "!");
}
@@ -1537,7 +1542,7 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
}
catch (AMQStoreException e)
{
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
_metaDataRef = new SoftReference<StorableMessageMetaData>(metaData);
}
@@ -1590,7 +1595,7 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
catch (AMQStoreException e)
{
// TODO maybe should throw a checked exception, or at least log before throwing
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
}
}
@@ -1625,16 +1630,11 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
}
catch(DatabaseException e)
{
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
catch (AMQStoreException e)
{
- throw new RuntimeException(e);
- }
- catch (RuntimeException e)
- {
- LOGGER.error("RuntimeException during store", e);
- throw e;
+ throw new ServerScopedRuntimeException(e);
}
finally
{
@@ -1667,7 +1667,7 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
}
catch (AMQStoreException e)
{
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
}
@@ -1693,11 +1693,11 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
LOGGER.error("Exception during transaction begin, closing store environment.", e);
closeEnvironmentSafely();
- throw new RuntimeException("Exception during transaction begin, store environment closed.", e);
+ throw new ServerScopedRuntimeException("Exception during transaction begin, store environment closed.", e);
}
}
- public void enqueueMessage(TransactionLogResource queue, EnqueueableMessage message) throws AMQStoreException
+ public void enqueueMessage(TransactionLogResource queue, EnqueueableMessage message)
{
if(message.getStoredMessage() instanceof StoredBDBMessage)
{
@@ -1706,40 +1706,89 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
_storeSizeIncrease += storedMessage.getMetaData().getContentSize();
}
- AbstractBDBMessageStore.this.enqueueMessage(_txn, queue, message.getMessageNumber());
+ try
+ {
+ AbstractBDBMessageStore.this.enqueueMessage(_txn, queue, message.getMessageNumber());
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
- public void dequeueMessage(TransactionLogResource queue, EnqueueableMessage message) throws AMQStoreException
+ public void dequeueMessage(TransactionLogResource queue, EnqueueableMessage message)
{
- AbstractBDBMessageStore.this.dequeueMessage(_txn, queue, message.getMessageNumber());
+ try
+ {
+ AbstractBDBMessageStore.this.dequeueMessage(_txn, queue, message.getMessageNumber());
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
- public void commitTran() throws AMQStoreException
+ public void commitTran()
{
- AbstractBDBMessageStore.this.commitTranImpl(_txn, true);
- AbstractBDBMessageStore.this.storedSizeChange(_storeSizeIncrease);
+ try
+ {
+ AbstractBDBMessageStore.this.commitTranImpl(_txn, true);
+ AbstractBDBMessageStore.this.storedSizeChange(_storeSizeIncrease);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
- public StoreFuture commitTranAsync() throws AMQStoreException
+ public StoreFuture commitTranAsync()
{
- AbstractBDBMessageStore.this.storedSizeChange(_storeSizeIncrease);
- return AbstractBDBMessageStore.this.commitTranImpl(_txn, false);
+ try
+ {
+ AbstractBDBMessageStore.this.storedSizeChange(_storeSizeIncrease);
+ return AbstractBDBMessageStore.this.commitTranImpl(_txn, false);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
- public void abortTran() throws AMQStoreException
+ public void abortTran()
{
- AbstractBDBMessageStore.this.abortTran(_txn);
+ try
+ {
+ AbstractBDBMessageStore.this.abortTran(_txn);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
- public void removeXid(long format, byte[] globalId, byte[] branchId) throws AMQStoreException
+ public void removeXid(long format, byte[] globalId, byte[] branchId)
{
- AbstractBDBMessageStore.this.removeXid(_txn, format, globalId, branchId);
+ try
+ {
+ AbstractBDBMessageStore.this.removeXid(_txn, format, globalId, branchId);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
public void recordXid(long format, byte[] globalId, byte[] branchId, Record[] enqueues,
- Record[] dequeues) throws AMQStoreException
+ Record[] dequeues)
{
- AbstractBDBMessageStore.this.recordXid(_txn, format, globalId, branchId, enqueues, dequeues);
+ try
+ {
+ AbstractBDBMessageStore.this.recordXid(_txn, format, globalId, branchId, enqueues, dequeues);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBBackup.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBBackup.java
index 9b97fec479..fee1629743 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBBackup.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBBackup.java
@@ -26,6 +26,7 @@ import com.sleepycat.je.EnvironmentConfig;
import com.sleepycat.je.util.DbBackup;
import org.apache.log4j.Logger;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.util.CommandLineParser;
import org.apache.qpid.util.FileUtils;
@@ -249,7 +250,7 @@ public class BDBBackup
if (fileSet.length == 0)
{
- throw new RuntimeException("There are no BDB log files to backup in the " + fromdir + " directory.");
+ throw new ServerScopedRuntimeException("There are no BDB log files to backup in the " + fromdir + " directory.");
}
for (int i = 0; i < fileSet.length; i++)
@@ -272,7 +273,7 @@ public class BDBBackup
catch (IOException ioEx)
{
// Rethrow this as a runtime exception, as something strange has happened.
- throw new RuntimeException(ioEx);
+ throw new ServerScopedRuntimeException(ioEx);
}
}
}
@@ -292,7 +293,7 @@ public class BDBBackup
long now = System.currentTimeMillis();
if ((now - start) > TIMEOUT)
{
- throw new RuntimeException("Hot backup script failed to complete in " + (TIMEOUT / 1000) + " seconds.");
+ throw new ServerScopedRuntimeException("Hot backup script failed to complete in " + (TIMEOUT / 1000) + " seconds.");
}
}
@@ -311,7 +312,7 @@ public class BDBBackup
Throwable cause = re.getCause();
if ((cause != null) && (cause instanceof IOException))
{
- throw new RuntimeException(re.getMessage() + " fromDir:" + fromdir + " toDir:" + toDirFile, cause);
+ throw new ServerScopedRuntimeException(re.getMessage() + " fromDir:" + fromdir + " toDir:" + toDirFile, cause);
}
else
{
@@ -329,7 +330,7 @@ public class BDBBackup
catch (IOException e)
{
// Rethrow this as a runtime exception, as something strange has happened.
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAMessageStore.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAMessageStore.java
index fb1dc1f1d3..0f33dfb325 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAMessageStore.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAMessageStore.java
@@ -35,7 +35,7 @@ import java.util.concurrent.Executors;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQStoreException;
+import org.apache.qpid.server.store.AMQStoreException;
import org.apache.qpid.server.logging.RootMessageLogger;
import org.apache.qpid.server.logging.actors.AbstractActor;
import org.apache.qpid.server.logging.actors.CurrentActor;
@@ -65,6 +65,7 @@ import com.sleepycat.je.rep.ReplicationNode;
import com.sleepycat.je.rep.StateChangeEvent;
import com.sleepycat.je.rep.StateChangeListener;
import com.sleepycat.je.rep.util.ReplicationGroupAdmin;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class BDBHAMessageStore extends AbstractBDBMessageStore implements HAMessageStore
{
@@ -122,7 +123,7 @@ public class BDBHAMessageStore extends AbstractBDBMessageStore implements HAMess
private Map<String, String> _repConfig;
@Override
- public void configure(VirtualHost virtualHost) throws Exception
+ public void configure(VirtualHost virtualHost)
{
//Mandatory configuration
_groupName = getValidatedStringAttribute(virtualHost, "haGroupName");
@@ -153,7 +154,7 @@ public class BDBHAMessageStore extends AbstractBDBMessageStore implements HAMess
if (_coalescingSync && _durability.getLocalSync() == SyncPolicy.SYNC)
{
- throw new ConfigurationException("Coalescing sync cannot be used with master sync policy " + SyncPolicy.SYNC
+ throw new ServerScopedRuntimeException("Coalescing sync cannot be used with master sync policy " + SyncPolicy.SYNC
+ "! Please set highAvailability.coalescingSync to false in store configuration.");
}
@@ -162,7 +163,6 @@ public class BDBHAMessageStore extends AbstractBDBMessageStore implements HAMess
private String getValidatedStringAttribute(org.apache.qpid.server.model.VirtualHost virtualHost, String attributeName)
- throws ConfigurationException
{
Object attrValue = virtualHost.getAttribute(attributeName);
if(attrValue != null)
@@ -171,7 +171,7 @@ public class BDBHAMessageStore extends AbstractBDBMessageStore implements HAMess
}
else
{
- throw new ConfigurationException("BDB HA configuration key not found. Please specify configuration attribute: "
+ throw new ServerScopedRuntimeException("BDB HA configuration key not found. Please specify configuration attribute: "
+ attributeName);
}
}
@@ -206,7 +206,7 @@ public class BDBHAMessageStore extends AbstractBDBMessageStore implements HAMess
@Override
- protected void setupStore(File storePath, String name) throws DatabaseException, AMQStoreException
+ protected void setupStore(File storePath, String name) throws DatabaseException
{
super.setupStore(storePath, name);
@@ -261,7 +261,7 @@ public class BDBHAMessageStore extends AbstractBDBMessageStore implements HAMess
@Override
public void configureMessageStore(VirtualHost virtualHost, MessageStoreRecoveryHandler messageRecoveryHandler,
- TransactionLogRecoveryHandler tlogRecoveryHandler) throws Exception
+ TransactionLogRecoveryHandler tlogRecoveryHandler)
{
super.configureMessageStore(virtualHost, messageRecoveryHandler, tlogRecoveryHandler);
@@ -271,7 +271,7 @@ public class BDBHAMessageStore extends AbstractBDBMessageStore implements HAMess
}
@Override
- public synchronized void activate() throws Exception
+ public synchronized void activate()
{
// Before proceeding, perform a log flush with an fsync
getEnvironment().flushLog(true);
@@ -441,7 +441,7 @@ public class BDBHAMessageStore extends AbstractBDBMessageStore implements HAMess
}
@Override
- protected void closeInternal() throws Exception
+ protected void closeInternal()
{
substituteNoOpStateChangeListenerOn(getReplicatedEnvironment());
@@ -449,7 +449,14 @@ public class BDBHAMessageStore extends AbstractBDBMessageStore implements HAMess
{
if(_coalescingSync)
{
- _commitThreadWrapper.stopCommitThread();
+ try
+ {
+ _commitThreadWrapper.stopCommitThread();
+ }
+ catch (InterruptedException e)
+ {
+ throw new ServerScopedRuntimeException(e);
+ }
}
}
finally
@@ -507,7 +514,7 @@ public class BDBHAMessageStore extends AbstractBDBMessageStore implements HAMess
private final Executor _executor = Executors.newSingleThreadExecutor();
@Override
- public void stateChange(StateChangeEvent stateChangeEvent) throws RuntimeException
+ public void stateChange(StateChangeEvent stateChangeEvent)
{
com.sleepycat.je.rep.ReplicatedEnvironment.State state = stateChangeEvent.getState();
@@ -645,7 +652,6 @@ public class BDBHAMessageStore extends AbstractBDBMessageStore implements HAMess
{
@Override
public void stateChange(StateChangeEvent stateChangeEvent)
- throws RuntimeException
{
}
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHost.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHost.java
index bb3c7b108d..0d50df1bc6 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHost.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHost.java
@@ -48,14 +48,13 @@ public class BDBHAVirtualHost extends AbstractVirtualHost
org.apache.qpid.server.security.SecurityManager parentSecurityManager,
VirtualHostConfiguration hostConfig,
VirtualHost virtualHost)
- throws Exception
{
super(virtualHostRegistry, brokerStatisticsGatherer, parentSecurityManager, hostConfig, virtualHost);
}
- protected void initialiseStorage(VirtualHostConfiguration hostConfig, VirtualHost virtualHost) throws Exception
+ protected void initialiseStorage(VirtualHostConfiguration hostConfig, VirtualHost virtualHost)
{
_messageStore = new BDBHAMessageStore();
@@ -169,14 +168,7 @@ public class BDBHAVirtualHost extends AbstractVirtualHost
@Override
public void event(Event event)
{
- try
- {
- initialiseModel(getConfiguration());
- }
- catch (Exception e)
- {
- throw new RuntimeException("Failed to initialise virtual host after state change", e);
- }
+ initialiseModel(getConfiguration());
}
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostFactory.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostFactory.java
index 3b564f33fd..7a308920b3 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostFactory.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostFactory.java
@@ -48,7 +48,7 @@ public class BDBHAVirtualHostFactory implements VirtualHostFactory
StatisticsGatherer brokerStatisticsGatherer,
org.apache.qpid.server.security.SecurityManager parentSecurityManager,
VirtualHostConfiguration hostConfig,
- org.apache.qpid.server.model.VirtualHost virtualHost) throws Exception
+ org.apache.qpid.server.model.VirtualHost virtualHost)
{
return new BDBHAVirtualHost(virtualHostRegistry,
brokerStatisticsGatherer,
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java
index 4028de4b80..c9c870b996 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java
@@ -23,13 +23,13 @@ package org.apache.qpid.server.store.berkeleydb;
import java.io.File;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.StoreFuture;
import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.Environment;
import com.sleepycat.je.EnvironmentConfig;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
/**
* BDBMessageStore implements a persistent {@link MessageStore} using the BDB high performance log.
@@ -46,7 +46,7 @@ public class BDBMessageStore extends AbstractBDBMessageStore
private CommitThreadWrapper _commitThreadWrapper;
@Override
- protected void setupStore(File storePath, String name) throws DatabaseException, AMQStoreException
+ protected void setupStore(File storePath, String name) throws DatabaseException
{
super.setupStore(storePath, name);
@@ -79,9 +79,16 @@ public class BDBMessageStore extends AbstractBDBMessageStore
}
@Override
- protected void closeInternal() throws Exception
+ protected void closeInternal()
{
- _commitThreadWrapper.stopCommitThread();
+ try
+ {
+ _commitThreadWrapper.stopCommitThread();
+ }
+ catch (InterruptedException e)
+ {
+ throw new ServerScopedRuntimeException(e);
+ }
super.closeInternal();
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CommitThreadWrapper.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CommitThreadWrapper.java
index 598d20146c..92c4259051 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CommitThreadWrapper.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CommitThreadWrapper.java
@@ -31,6 +31,7 @@ import com.sleepycat.je.CheckpointConfig;
import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.Environment;
import com.sleepycat.je.Transaction;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class CommitThreadWrapper
{
@@ -139,7 +140,7 @@ public class CommitThreadWrapper
}
catch (InterruptedException e)
{
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/FieldTableEncoding.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/FieldTableEncoding.java
index a876a056fc..b8984c42ca 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/FieldTableEncoding.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/FieldTableEncoding.java
@@ -25,6 +25,7 @@ import com.sleepycat.bind.tuple.TupleOutput;
import com.sleepycat.je.DatabaseException;
import org.apache.qpid.framing.FieldTable;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
@@ -55,7 +56,7 @@ public class FieldTableEncoding
}
catch (IOException e)
{
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/ConfiguredObjectBinding.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/ConfiguredObjectBinding.java
index 31cafbe74d..aa2aa2e2a3 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/ConfiguredObjectBinding.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/ConfiguredObjectBinding.java
@@ -29,6 +29,7 @@ import org.apache.qpid.server.store.ConfiguredObjectRecord;
import com.sleepycat.bind.tuple.TupleBinding;
import com.sleepycat.bind.tuple.TupleInput;
import com.sleepycat.bind.tuple.TupleOutput;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
@@ -63,7 +64,7 @@ public class ConfiguredObjectBinding extends TupleBinding<ConfiguredObjectRecord
catch (IOException e)
{
//should never happen
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
}
@@ -79,15 +80,15 @@ public class ConfiguredObjectBinding extends TupleBinding<ConfiguredObjectRecord
}
catch (JsonMappingException e)
{
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
catch (JsonGenerationException e)
{
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
catch (IOException e)
{
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/StoreUpgrade.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/StoreUpgrade.java
index f73e2e5d78..adcaef35ef 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/StoreUpgrade.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/StoreUpgrade.java
@@ -20,12 +20,9 @@
*/
package org.apache.qpid.server.store.berkeleydb.upgrade;
-import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.Environment;
-import org.apache.qpid.AMQStoreException;
public interface StoreUpgrade
{
- void performUpgrade(Environment environment, UpgradeInteractionHandler handler, String virtualHostName)
- throws DatabaseException, AMQStoreException;
+ void performUpgrade(Environment environment, UpgradeInteractionHandler handler, String virtualHostName);
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom4To5.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom4To5.java
index 14793cbfd3..4cb70c1486 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom4To5.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom4To5.java
@@ -31,7 +31,6 @@ import java.util.List;
import java.util.Set;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.common.AMQPFilterTypes;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.framing.AMQFrameDecodingException;
@@ -53,9 +52,9 @@ import com.sleepycat.bind.tuple.TupleInput;
import com.sleepycat.bind.tuple.TupleOutput;
import com.sleepycat.je.Database;
import com.sleepycat.je.DatabaseEntry;
-import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.Environment;
import com.sleepycat.je.Transaction;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class UpgradeFrom4To5 extends AbstractStoreUpgrade
{
@@ -75,45 +74,25 @@ public class UpgradeFrom4To5 extends AbstractStoreUpgrade
private static final Logger _logger = Logger.getLogger(UpgradeFrom4To5.class);
- public void performUpgrade(final Environment environment, final UpgradeInteractionHandler handler, String virtualHostName) throws DatabaseException, AMQStoreException
+ public void performUpgrade(final Environment environment, final UpgradeInteractionHandler handler, String virtualHostName)
{
Transaction transaction = null;
- try
- {
- reportStarting(environment, 4);
-
- transaction = environment.beginTransaction(null, null);
+ reportStarting(environment, 4);
- // find all queues which are bound to a topic exchange and which have a colon in their name
- final List<AMQShortString> potentialDurableSubs = findPotentialDurableSubscriptions(environment, transaction);
+ transaction = environment.beginTransaction(null, null);
- Set<String> existingQueues = upgradeQueues(environment, handler, potentialDurableSubs, transaction);
- upgradeQueueBindings(environment, handler, potentialDurableSubs, transaction);
- Set<Long> messagesToDiscard = upgradeDelivery(environment, existingQueues, handler, transaction);
- upgradeContent(environment, handler, messagesToDiscard, transaction);
- upgradeMetaData(environment, handler, messagesToDiscard, transaction);
- renameRemainingDatabases(environment, handler, transaction);
- transaction.commit();
+ // find all queues which are bound to a topic exchange and which have a colon in their name
+ final List<AMQShortString> potentialDurableSubs = findPotentialDurableSubscriptions(environment, transaction);
- reportFinished(environment, 5);
+ Set<String> existingQueues = upgradeQueues(environment, handler, potentialDurableSubs, transaction);
+ upgradeQueueBindings(environment, handler, potentialDurableSubs, transaction);
+ Set<Long> messagesToDiscard = upgradeDelivery(environment, existingQueues, handler, transaction);
+ upgradeContent(environment, handler, messagesToDiscard, transaction);
+ upgradeMetaData(environment, handler, messagesToDiscard, transaction);
+ renameRemainingDatabases(environment, handler, transaction);
+ transaction.commit();
- }
- catch (Exception e)
- {
- transaction.abort();
- if (e instanceof DatabaseException)
- {
- throw (DatabaseException) e;
- }
- else if (e instanceof AMQStoreException)
- {
- throw (AMQStoreException) e;
- }
- else
- {
- throw new AMQStoreException("Unexpected exception", e);
- }
- }
+ reportFinished(environment, 5);
}
private void upgradeQueueBindings(Environment environment, UpgradeInteractionHandler handler, final List<AMQShortString> potentialDurableSubs,
@@ -275,7 +254,7 @@ public class UpgradeFrom4To5 extends AbstractStoreUpgrade
}
else
{
- throw new RuntimeException("Unable is aborted!");
+ throw new ServerScopedRuntimeException("Unable is aborted!");
}
}
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6.java
index a478872ad0..bba9dbaa74 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6.java
@@ -36,7 +36,6 @@ import java.util.TreeMap;
import java.util.UUID;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.framing.AMQShortString;
import org.apache.qpid.framing.FieldTable;
@@ -45,7 +44,6 @@ import org.apache.qpid.server.model.Exchange;
import org.apache.qpid.server.model.LifetimePolicy;
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.model.UUIDGenerator;
-import org.apache.qpid.server.queue.AMQQueueFactory;
import org.apache.qpid.server.queue.QueueArgumentsConverter;
import org.apache.qpid.server.store.berkeleydb.AMQShortStringEncoding;
import org.apache.qpid.server.store.berkeleydb.FieldTableEncoding;
@@ -59,11 +57,11 @@ import com.sleepycat.je.Cursor;
import com.sleepycat.je.CursorConfig;
import com.sleepycat.je.Database;
import com.sleepycat.je.DatabaseEntry;
-import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.Environment;
import com.sleepycat.je.LockMode;
import com.sleepycat.je.OperationStatus;
import com.sleepycat.je.Transaction;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class UpgradeFrom5To6 extends AbstractStoreUpgrade
{
@@ -121,7 +119,6 @@ public class UpgradeFrom5To6 extends AbstractStoreUpgrade
* in "CONFIGURED_OBJECTS" table.
*/
public void performUpgrade(final Environment environment, final UpgradeInteractionHandler handler, String virtualHostName)
- throws DatabaseException, AMQStoreException
{
reportStarting(environment, 5);
upgradeMessages(environment, handler);
@@ -131,61 +128,21 @@ public class UpgradeFrom5To6 extends AbstractStoreUpgrade
}
private void upgradeConfiguredObjectsAndDependencies(Environment environment, UpgradeInteractionHandler handler, String virtualHostName)
- throws AMQStoreException
{
Transaction transaction = null;
- try
- {
- transaction = environment.beginTransaction(null, null);
- upgradeConfiguredObjects(environment, handler, transaction, virtualHostName);
- upgradeQueueEntries(environment, transaction, virtualHostName);
- upgradeXidEntries(environment, transaction, virtualHostName);
- transaction.commit();
- }
- catch (Exception e)
- {
- transaction.abort();
- if (e instanceof DatabaseException)
- {
- throw (DatabaseException) e;
- }
- else if (e instanceof AMQStoreException)
- {
- throw (AMQStoreException) e;
- }
- else
- {
- throw new AMQStoreException("Unexpected exception", e);
- }
- }
+ transaction = environment.beginTransaction(null, null);
+ upgradeConfiguredObjects(environment, handler, transaction, virtualHostName);
+ upgradeQueueEntries(environment, transaction, virtualHostName);
+ upgradeXidEntries(environment, transaction, virtualHostName);
+ transaction.commit();
}
private void upgradeMessages(final Environment environment, final UpgradeInteractionHandler handler)
- throws AMQStoreException
{
Transaction transaction = null;
- try
- {
- transaction = environment.beginTransaction(null, null);
- upgradeMessages(environment, handler, transaction);
- transaction.commit();
- }
- catch (Exception e)
- {
- transaction.abort();
- if (e instanceof DatabaseException)
- {
- throw (DatabaseException) e;
- }
- else if (e instanceof AMQStoreException)
- {
- throw (AMQStoreException) e;
- }
- else
- {
- throw new AMQStoreException("Unexpected exception", e);
- }
- }
+ transaction = environment.beginTransaction(null, null);
+ upgradeMessages(environment, handler, transaction);
+ transaction.commit();
}
private void renameDatabases(Environment environment, Transaction transaction)
@@ -207,7 +164,7 @@ public class UpgradeFrom5To6 extends AbstractStoreUpgrade
}
private void upgradeMessages(final Environment environment, final UpgradeInteractionHandler handler,
- final Transaction transaction) throws AMQStoreException
+ final Transaction transaction)
{
_logger.info("Message Contents");
if (environment.getDatabaseNames().contains(OLD_CONTENT_DB_NAME))
@@ -285,7 +242,7 @@ public class UpgradeFrom5To6 extends AbstractStoreUpgrade
return;
case ABORT:
_logger.error(message);
- throw new RuntimeException("Unable to upgrade message " + messageId);
+ throw new ServerScopedRuntimeException("Unable to upgrade message " + messageId);
}
}
@@ -356,7 +313,6 @@ public class UpgradeFrom5To6 extends AbstractStoreUpgrade
}
private void upgradeConfiguredObjects(Environment environment, UpgradeInteractionHandler handler, Transaction transaction, String virtualHostName)
- throws AMQStoreException
{
upgradeQueues(environment, transaction, virtualHostName);
upgradeExchanges(environment, transaction, virtualHostName);
@@ -640,7 +596,7 @@ public class UpgradeFrom5To6 extends AbstractStoreUpgrade
OperationStatus status = database.put(txn, key, value);
if (status != OperationStatus.SUCCESS)
{
- throw new RuntimeException("Cannot add record into " + database.getDatabaseName() + ":" + status);
+ throw new ServerScopedRuntimeException("Cannot add record into " + database.getDatabaseName() + ":" + status);
}
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom6To7.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom6To7.java
index e318c3586e..de25c3a6d2 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom6To7.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom6To7.java
@@ -25,10 +25,9 @@ import com.sleepycat.bind.tuple.IntegerBinding;
import com.sleepycat.je.Database;
import com.sleepycat.je.DatabaseConfig;
import com.sleepycat.je.DatabaseEntry;
-import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.Environment;
import com.sleepycat.je.OperationStatus;
-import org.apache.qpid.AMQStoreException;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class UpgradeFrom6To7 extends AbstractStoreUpgrade
{
@@ -37,7 +36,6 @@ public class UpgradeFrom6To7 extends AbstractStoreUpgrade
@Override
public void performUpgrade(Environment environment, UpgradeInteractionHandler handler, String virtualHostName)
- throws DatabaseException, AMQStoreException
{
reportStarting(environment, 6);
DatabaseConfig dbConfig = new DatabaseConfig();
@@ -55,7 +53,7 @@ public class UpgradeFrom6To7 extends AbstractStoreUpgrade
OperationStatus status = versionDb.put(null, key, value);
if (status != OperationStatus.SUCCESS)
{
- throw new AMQStoreException("Error initialising config version: " + status);
+ throw new ServerScopedRuntimeException("Error initialising config version: " + status);
}
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/Upgrader.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/Upgrader.java
index e769bfae81..be6bce4d46 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/Upgrader.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/Upgrader.java
@@ -24,7 +24,6 @@ import com.sleepycat.je.Cursor;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.server.store.berkeleydb.AbstractBDBMessageStore;
import com.sleepycat.bind.tuple.IntegerBinding;
@@ -34,8 +33,8 @@ import com.sleepycat.je.DatabaseConfig;
import com.sleepycat.je.DatabaseEntry;
import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.Environment;
-import com.sleepycat.je.LockMode;
import com.sleepycat.je.OperationStatus;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class Upgrader
{
@@ -50,7 +49,7 @@ public class Upgrader
_virtualHostName = virtualHostName;
}
- public void upgradeIfNecessary() throws AMQStoreException
+ public void upgradeIfNecessary()
{
boolean isEmpty = _environment.getDatabaseNames().isEmpty();
DatabaseConfig dbConfig = new DatabaseConfig();
@@ -76,7 +75,7 @@ public class Upgrader
int version = getSourceVersion(versionDb);
if(version > AbstractBDBMessageStore.VERSION)
{
- throw new AMQStoreException("Database version " + version
+ throw new ServerScopedRuntimeException("Database version " + version
+ " is higher than the most recent known version: "
+ AbstractBDBMessageStore.VERSION);
}
@@ -125,7 +124,6 @@ public class Upgrader
}
void performUpgradeFromVersion(int sourceVersion, Database versionDb)
- throws AMQStoreException
{
while(sourceVersion != AbstractBDBMessageStore.VERSION)
{
@@ -138,7 +136,7 @@ public class Upgrader
}
}
- void upgrade(final int fromVersion, final int toVersion) throws AMQStoreException
+ void upgrade(final int fromVersion, final int toVersion)
{
try
{
@@ -152,27 +150,27 @@ public class Upgrader
}
catch (ClassNotFoundException e)
{
- throw new AMQStoreException("Unable to upgrade BDB data store from version " + fromVersion + " to version"
+ throw new ServerScopedRuntimeException("Unable to upgrade BDB data store from version " + fromVersion + " to version"
+ toVersion, e);
}
catch (NoSuchMethodException e)
{
- throw new AMQStoreException("Unable to upgrade BDB data store from version " + fromVersion + " to version"
+ throw new ServerScopedRuntimeException("Unable to upgrade BDB data store from version " + fromVersion + " to version"
+ toVersion, e);
}
catch (InvocationTargetException e)
{
- throw new AMQStoreException("Unable to upgrade BDB data store from version " + fromVersion + " to version"
+ throw new ServerScopedRuntimeException("Unable to upgrade BDB data store from version " + fromVersion + " to version"
+ toVersion, e);
}
catch (InstantiationException e)
{
- throw new AMQStoreException("Unable to upgrade BDB data store from version " + fromVersion + " to version"
+ throw new ServerScopedRuntimeException("Unable to upgrade BDB data store from version " + fromVersion + " to version"
+ toVersion, e);
}
catch (IllegalAccessException e)
{
- throw new AMQStoreException("Unable to upgrade BDB data store from version " + fromVersion + " to version"
+ throw new ServerScopedRuntimeException("Unable to upgrade BDB data store from version " + fromVersion + " to version"
+ toVersion, e);
}
}
diff --git a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAMessageStoreSmokeTest.java b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAMessageStoreSmokeTest.java
index 3f32df4b0c..7f7b65f315 100644
--- a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAMessageStoreSmokeTest.java
+++ b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAMessageStoreSmokeTest.java
@@ -21,6 +21,7 @@ package org.apache.qpid.server.store.berkeleydb;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.qpid.server.model.VirtualHost;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.test.utils.QpidTestCase;
import static org.mockito.Mockito.mock;
@@ -36,7 +37,7 @@ public class HAMessageStoreSmokeTest extends QpidTestCase
_store.configure(mock(VirtualHost.class));
fail("Expected an exception to be thrown");
}
- catch (ConfigurationException ce)
+ catch (ServerScopedRuntimeException ce)
{
assertTrue(ce.getMessage().contains("BDB HA configuration key not found"));
}
diff --git a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgraderFailOnNewerVersionTest.java b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgraderFailOnNewerVersionTest.java
index 75717120b3..400ac12792 100644
--- a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgraderFailOnNewerVersionTest.java
+++ b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgraderFailOnNewerVersionTest.java
@@ -21,21 +21,13 @@
package org.apache.qpid.server.store.berkeleydb.upgrade;
import com.sleepycat.bind.tuple.IntegerBinding;
-import com.sleepycat.bind.tuple.LongBinding;
import com.sleepycat.je.Cursor;
import com.sleepycat.je.Database;
import com.sleepycat.je.DatabaseConfig;
import com.sleepycat.je.DatabaseEntry;
-import com.sleepycat.je.Environment;
-import com.sleepycat.je.EnvironmentConfig;
import com.sleepycat.je.OperationStatus;
-import com.sleepycat.je.Transaction;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.server.store.berkeleydb.AbstractBDBMessageStore;
-import org.apache.qpid.server.store.berkeleydb.tuple.ContentBinding;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class UpgraderFailOnNewerVersionTest extends AbstractUpgradeTestCase
{
@@ -99,7 +91,7 @@ public class UpgraderFailOnNewerVersionTest extends AbstractUpgradeTestCase
_upgrader.upgradeIfNecessary();
fail("Store should not be able to be upgraded");
}
- catch(AMQStoreException ex)
+ catch(ServerScopedRuntimeException ex)
{
assertEquals("Incorrect exception thrown", "Database version 999 is higher than the most recent known version: "
+ AbstractBDBMessageStore.VERSION, ex.getMessage());
diff --git a/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java b/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java
index cecd39381e..3278c50b52 100644
--- a/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java
+++ b/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java
@@ -25,7 +25,7 @@ import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
-import org.apache.qpid.AMQStoreException;
+import org.apache.qpid.server.store.AMQStoreException;
import org.apache.qpid.framing.AMQShortString;
import org.apache.qpid.framing.BasicContentHeaderProperties;
import org.apache.qpid.framing.ContentHeaderBody;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/TransactionTimeoutHelper.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/TransactionTimeoutHelper.java
index b7007bf768..13f4fbf254 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/TransactionTimeoutHelper.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/TransactionTimeoutHelper.java
@@ -18,7 +18,6 @@
*/
package org.apache.qpid.server;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.logging.LogActor;
import org.apache.qpid.server.logging.LogMessage;
import org.apache.qpid.server.logging.LogSubject;
@@ -41,7 +40,7 @@ public class TransactionTimeoutHelper
_closeAction = closeAction;
}
- public void checkIdleOrOpenTimes(ServerTransaction transaction, long openWarn, long openClose, long idleWarn, long idleClose) throws AMQException
+ public void checkIdleOrOpenTimes(ServerTransaction transaction, long openWarn, long openClose, long idleWarn, long idleClose)
{
if (transaction.isTransactional())
{
@@ -70,7 +69,7 @@ public class TransactionTimeoutHelper
*/
private boolean logAndCloseIfNecessary(final long timeSoFar,
final long warnTimeout, final long closeTimeout,
- final LogMessage warnMessage, final String closeMessage) throws AMQException
+ final LogMessage warnMessage, final String closeMessage)
{
if (isTimedOut(timeSoFar, warnTimeout))
{
@@ -96,7 +95,7 @@ public class TransactionTimeoutHelper
public interface CloseAction
{
- void doTimeoutAction(String reason) throws AMQException;
+ void doTimeoutAction(String reason);
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/JsonConfigurationEntryStore.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/JsonConfigurationEntryStore.java
index df82822a86..4897983caf 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/JsonConfigurationEntryStore.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/JsonConfigurationEntryStore.java
@@ -28,6 +28,7 @@ import java.util.UUID;
import org.apache.qpid.server.configuration.ConfigurationEntry;
import org.apache.qpid.server.configuration.ConfigurationEntryStore;
import org.apache.qpid.server.configuration.IllegalConfigurationException;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class JsonConfigurationEntryStore extends MemoryConfigurationEntryStore
{
@@ -49,7 +50,7 @@ public class JsonConfigurationEntryStore extends MemoryConfigurationEntryStore
{
if(!_storeFile.delete())
{
- throw new RuntimeException("Unable to overwrite existing configuration store file as requested: " + storeLocation);
+ throw new ServerScopedRuntimeException("Unable to overwrite existing configuration store file as requested: " + storeLocation);
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/StoreConfigurationChangeListener.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/StoreConfigurationChangeListener.java
index 6cd3447ebd..076c86fcba 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/StoreConfigurationChangeListener.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/StoreConfigurationChangeListener.java
@@ -37,6 +37,7 @@ import org.apache.qpid.server.model.Model;
import org.apache.qpid.server.model.Port;
import org.apache.qpid.server.model.State;
import org.apache.qpid.server.model.VirtualHost;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class StoreConfigurationChangeListener implements ConfigurationChangeListener
{
@@ -148,7 +149,7 @@ public class StoreConfigurationChangeListener implements ConfigurationChangeList
if (interfaces.size() == 0)
{
- throw new RuntimeException("Can not identify the configured object type");
+ throw new ServerScopedRuntimeException("Can not identify the configured object type");
}
if (interfaces.size() == 1)
@@ -185,7 +186,7 @@ public class StoreConfigurationChangeListener implements ConfigurationChangeList
}
else
{
- throw new RuntimeException("Can not identify the configured object type as an it implements"
+ throw new ServerScopedRuntimeException("Can not identify the configured object type as an it implements"
+ " more than one configured object interfaces: " + interfaces);
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/ChangeAttributesTask.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/ChangeAttributesTask.java
index 4ba4057fee..fb672635b4 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/ChangeAttributesTask.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/ChangeAttributesTask.java
@@ -25,7 +25,7 @@ import java.util.concurrent.Callable;
import org.apache.qpid.server.model.ConfiguredObject;
-public class ChangeAttributesTask implements Callable<Void>
+public class ChangeAttributesTask implements TaskExecutor.Task<Void>
{
private final Map<String, Object> _attributes;
private final ConfiguredObject _object;
@@ -38,7 +38,7 @@ public class ChangeAttributesTask implements Callable<Void>
}
@Override
- public Void call() throws Exception
+ public Void call()
{
_object.setAttributes(_attributes);
return null;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/ChangeStateTask.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/ChangeStateTask.java
index b6de1e136a..42ce1d8c03 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/ChangeStateTask.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/ChangeStateTask.java
@@ -25,7 +25,7 @@ import java.util.concurrent.Callable;
import org.apache.qpid.server.model.ConfiguredObject;
import org.apache.qpid.server.model.State;
-public final class ChangeStateTask implements Callable<State>
+public final class ChangeStateTask implements TaskExecutor.Task<State>
{
private ConfiguredObject _object;
private State _expectedState;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/CreateChildTask.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/CreateChildTask.java
index d3a8f5b797..27bc6d73f6 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/CreateChildTask.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/CreateChildTask.java
@@ -26,7 +26,7 @@ import java.util.concurrent.Callable;
import org.apache.qpid.server.model.ConfiguredObject;
-public final class CreateChildTask implements Callable<ConfiguredObject>
+public final class CreateChildTask implements TaskExecutor.Task<ConfiguredObject>
{
private ConfiguredObject _object;
private Class<? extends ConfiguredObject> _childClass;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/SetAttributeTask.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/SetAttributeTask.java
index 94649434e6..f8d29c368b 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/SetAttributeTask.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/SetAttributeTask.java
@@ -24,7 +24,7 @@ import java.util.concurrent.Callable;
import org.apache.qpid.server.model.ConfiguredObject;
-public final class SetAttributeTask implements Callable<Object>
+public final class SetAttributeTask implements TaskExecutor.Task<Object>
{
private ConfiguredObject _object;
private String _attributeName;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/TaskExecutor.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/TaskExecutor.java
index 22863c089e..3104df6b00 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/TaskExecutor.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/TaskExecutor.java
@@ -42,6 +42,7 @@ import org.apache.qpid.server.logging.LogActor;
import org.apache.qpid.server.logging.actors.CurrentActor;
import org.apache.qpid.server.model.State;
import org.apache.qpid.server.security.SecurityManager;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class TaskExecutor
{
@@ -52,6 +53,11 @@ public class TaskExecutor
private final AtomicReference<State> _state;
private volatile ExecutorService _executor;
+ public static interface Task<X> extends Callable<X>
+ {
+ X call();
+ }
+
public TaskExecutor()
{
_state = new AtomicReference<State>(State.INITIALISING);
@@ -122,17 +128,17 @@ public class TaskExecutor
}
}
- Future<?> submit(Callable<?> task)
+ <T> Future<T> submit(Task<T> task)
{
checkState();
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("Submitting task: " + task);
}
- Future<?> future = null;
+ Future<T> future = null;
if (isTaskExecutorThread())
{
- Object result = executeTaskAndHandleExceptions(task);
+ T result = executeTask(task);
return new ImmediateFuture(result);
}
else
@@ -142,16 +148,16 @@ public class TaskExecutor
return future;
}
- public Object submitAndWait(Callable<?> task) throws CancellationException
+ public <T> T submitAndWait(Task<T> task) throws CancellationException
{
try
{
- Future<?> future = submit(task);
+ Future<T> future = submit(task);
return future.get();
}
catch (InterruptedException e)
{
- throw new RuntimeException("Task execution was interrupted: " + task, e);
+ throw new ServerScopedRuntimeException("Task execution was interrupted: " + task, e);
}
catch (ExecutionException e)
{
@@ -162,7 +168,7 @@ public class TaskExecutor
}
else if (cause instanceof Exception)
{
- throw new RuntimeException("Failed to execute user task: " + task, cause);
+ throw new ServerScopedRuntimeException("Failed to execute user task: " + task, cause);
}
else if (cause instanceof Error)
{
@@ -170,7 +176,7 @@ public class TaskExecutor
}
else
{
- throw new RuntimeException("Failed to execute user task: " + task, cause);
+ throw new ServerScopedRuntimeException("Failed to execute user task: " + task, cause);
}
}
}
@@ -188,29 +194,13 @@ public class TaskExecutor
}
}
- private Object executeTaskAndHandleExceptions(Callable<?> userTask)
- {
- try
- {
- return executeTask(userTask);
- }
- catch (Exception e)
- {
- if (e instanceof RuntimeException)
- {
- throw (RuntimeException) e;
- }
- throw new RuntimeException("Failed to execute user task: " + userTask, e);
- }
- }
-
- private Object executeTask(Callable<?> userTask) throws Exception
+ private <T> T executeTask(Task<T> userTask)
{
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("Performing task " + userTask);
}
- Object result = userTask.call();
+ T result = userTask.call();
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("Task " + userTask + " is performed successfully with result:" + result);
@@ -218,14 +208,14 @@ public class TaskExecutor
return result;
}
- private class CallableWrapper implements Callable<Object>
+ private class CallableWrapper<T> implements Task<T>
{
- private Callable<?> _userTask;
+ private Task<T> _userTask;
private Subject _securityManagerSubject;
private LogActor _actor;
private Subject _contextSubject;
- public CallableWrapper(Callable<?> userWork)
+ public CallableWrapper(Task<T> userWork)
{
_userTask = userWork;
_securityManagerSubject = SecurityManager.getThreadSubject();
@@ -234,20 +224,20 @@ public class TaskExecutor
}
@Override
- public Object call() throws Exception
+ public T call()
{
SecurityManager.setThreadSubject(_securityManagerSubject);
CurrentActor.set(_actor);
try
{
- Object result = null;
+ T result = null;
try
{
- result = Subject.doAs(_contextSubject, new PrivilegedExceptionAction<Object>()
+ result = Subject.doAs(_contextSubject, new PrivilegedExceptionAction<T>()
{
@Override
- public Object run() throws Exception
+ public T run() throws Exception
{
return executeTask(_userTask);
}
@@ -255,7 +245,15 @@ public class TaskExecutor
}
catch (PrivilegedActionException e)
{
- throw e.getException();
+ Exception underlying = e.getException();
+ if(underlying instanceof RuntimeException)
+ {
+ throw (RuntimeException)underlying;
+ }
+ else
+ {
+ throw new ServerScopedRuntimeException(e);
+ }
}
return result;
}
@@ -281,11 +279,11 @@ public class TaskExecutor
}
}
- private class ImmediateFuture implements Future<Object>
+ private class ImmediateFuture<T> implements Future<T>
{
- private Object _result;
+ private T _result;
- public ImmediateFuture(Object result)
+ public ImmediateFuture(T result)
{
super();
this._result = result;
@@ -310,13 +308,13 @@ public class TaskExecutor
}
@Override
- public Object get()
+ public T get()
{
return _result;
}
@Override
- public Object get(long timeout, TimeUnit unit)
+ public T get(long timeout, TimeUnit unit)
{
return get();
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/connection/IConnectionRegistry.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/connection/IConnectionRegistry.java
index 77febd9312..209e2739f4 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/connection/IConnectionRegistry.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/connection/IConnectionRegistry.java
@@ -20,8 +20,6 @@
*/
package org.apache.qpid.server.connection;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.protocol.AMQConstant;
import org.apache.qpid.server.protocol.AMQConnectionModel;
import java.util.List;
@@ -33,7 +31,7 @@ public interface IConnectionRegistry
public void initialise();
- public void close() throws AMQException;
+ public void close();
public void close(String replyText);
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/consumer/Consumer.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/consumer/Consumer.java
index 76eb7e8c14..e23eb397e1 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/consumer/Consumer.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/consumer/Consumer.java
@@ -21,11 +21,7 @@
package org.apache.qpid.server.consumer;
import java.util.concurrent.atomic.AtomicLong;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.logging.LogActor;
-import org.apache.qpid.server.message.MessageInstance;
import org.apache.qpid.server.protocol.AMQSessionModel;
-import org.apache.qpid.server.util.StateChangeListener;
public interface Consumer
{
@@ -64,7 +60,7 @@ public interface Consumer
boolean seesRequeues();
- void close() throws AMQException;
+ void close();
boolean trySendLock();
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/consumer/ConsumerTarget.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/consumer/ConsumerTarget.java
index a32fd7fc59..8f6b008f9b 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/consumer/ConsumerTarget.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/consumer/ConsumerTarget.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.consumer;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.message.MessageInstance;
import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.protocol.AMQSessionModel;
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/AMQUnknownExchangeType.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AMQUnknownExchangeType.java
index 0eefc03016..2e39973c11 100644
--- a/qpid/java/common/src/main/java/org/apache/qpid/AMQUnknownExchangeType.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AMQUnknownExchangeType.java
@@ -19,7 +19,7 @@
*
*/
-package org.apache.qpid;
+package org.apache.qpid.server.exchange;
/**
* AMQUnknownExchangeType represents coding error where unknown exchange type requested from exchange factory.
@@ -29,15 +29,13 @@ package org.apache.qpid;
* <tr><td> Represents unknown exchange type request.
* <tr><td>
*
- * @todo Not an AMQP exception as no status code.
- *
* @todo Represent coding error, where unknown exchange type is requested by passing a string parameter. Use a type safe
* enum for the exchange type, or replace with IllegalArgumentException. Should be runtime.
*/
-public class AMQUnknownExchangeType extends AMQException
+public class AMQUnknownExchangeType extends Exception
{
public AMQUnknownExchangeType(String message, Throwable cause)
{
- super(null, message, cause);
+ super(message, cause);
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java
index 07fb554638..6f1db59b1a 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java
@@ -22,8 +22,6 @@ package org.apache.qpid.server.exchange;
import java.util.ArrayList;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQInternalException;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.server.binding.Binding;
import org.apache.qpid.server.consumer.Consumer;
@@ -113,7 +111,6 @@ public abstract class AbstractExchange implements Exchange
String name,
boolean durable,
boolean autoDelete)
- throws AMQException
{
_virtualHost = host;
_name = name;
@@ -137,7 +134,7 @@ public abstract class AbstractExchange implements Exchange
return _autoDelete;
}
- public void close() throws QpidSecurityException, AMQInternalException
+ public void close() throws QpidSecurityException
{
if(_closed.compareAndSet(false,true))
@@ -457,19 +454,17 @@ public abstract class AbstractExchange implements Exchange
public void postCommit()
{
- for(int i = 0; i < baseQueues.length; i++)
+ try
{
- try
+ for(int i = 0; i < baseQueues.length; i++)
{
baseQueues[i].enqueue(message, postEnqueueAction);
}
- catch (AMQException e)
- {
- // TODO
- throw new RuntimeException(e);
- }
}
- _reference.release();
+ finally
+ {
+ _reference.release();
+ }
}
public void onRollback()
@@ -531,7 +526,7 @@ public abstract class AbstractExchange implements Exchange
@Override
public boolean addBinding(String bindingKey, AMQQueue queue, Map<String, Object> arguments)
- throws QpidSecurityException, AMQInternalException
+ throws QpidSecurityException
{
return makeBinding(null, bindingKey, queue, arguments, false, false);
}
@@ -540,7 +535,7 @@ public abstract class AbstractExchange implements Exchange
public boolean replaceBinding(final UUID id, final String bindingKey,
final AMQQueue queue,
final Map<String, Object> arguments)
- throws QpidSecurityException, AMQInternalException
+ throws QpidSecurityException
{
return makeBinding(id, bindingKey, queue, arguments, false, true);
}
@@ -548,20 +543,20 @@ public abstract class AbstractExchange implements Exchange
@Override
public void restoreBinding(final UUID id, final String bindingKey, final AMQQueue queue,
final Map<String, Object> argumentMap)
- throws QpidSecurityException, AMQInternalException
+ throws QpidSecurityException
{
makeBinding(id, bindingKey,queue, argumentMap,true, false);
}
@Override
- public void removeBinding(final Binding b) throws QpidSecurityException, AMQInternalException
+ public void removeBinding(final Binding b) throws QpidSecurityException
{
removeBinding(b.getBindingKey(), b.getQueue(), b.getArguments());
}
@Override
public Binding removeBinding(String bindingKey, AMQQueue queue, Map<String, Object> arguments)
- throws QpidSecurityException, AMQInternalException
+ throws QpidSecurityException
{
assert queue != null;
@@ -627,7 +622,7 @@ public abstract class AbstractExchange implements Exchange
AMQQueue queue,
Map<String, Object> arguments,
boolean restore,
- boolean force) throws QpidSecurityException, AMQInternalException
+ boolean force) throws QpidSecurityException
{
assert queue != null;
@@ -695,7 +690,7 @@ public abstract class AbstractExchange implements Exchange
}
- public void onClose(final Exchange exchange) throws QpidSecurityException, AMQInternalException
+ public void onClose(final Exchange exchange) throws QpidSecurityException
{
removeBinding(this);
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchange.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchange.java
index acb9a47096..d7dfcfbfc5 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchange.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchange.java
@@ -27,8 +27,6 @@ import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQInternalException;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.server.binding.Binding;
@@ -72,7 +70,7 @@ public class DefaultExchange implements Exchange
VirtualHost host,
String name,
boolean durable,
- boolean autoDelete) throws AMQException
+ boolean autoDelete)
{
_id = id;
_virtualHost = host;
@@ -122,34 +120,34 @@ public class DefaultExchange implements Exchange
@Override
public boolean addBinding(String bindingKey, AMQQueue queue, Map<String, Object> arguments)
- throws QpidSecurityException, AMQInternalException
+ throws QpidSecurityException
{
throw new QpidSecurityException("Cannot add bindings to the default exchange");
}
@Override
public boolean replaceBinding(UUID id, String bindingKey, AMQQueue queue, Map<String, Object> arguments)
- throws QpidSecurityException, AMQInternalException
+ throws QpidSecurityException
{
throw new QpidSecurityException("Cannot replace bindings on the default exchange");
}
@Override
public void restoreBinding(UUID id, String bindingKey, AMQQueue queue, Map<String, Object> argumentMap)
- throws QpidSecurityException, AMQInternalException
+ throws QpidSecurityException
{
_logger.warn("Bindings to the default exchange should not be stored in the configuration store");
}
@Override
- public void removeBinding(Binding b) throws QpidSecurityException, AMQInternalException
+ public void removeBinding(Binding b) throws QpidSecurityException
{
throw new QpidSecurityException("Cannot remove bindings to the default exchange");
}
@Override
public Binding removeBinding(String bindingKey, AMQQueue queue, Map<String, Object> arguments)
- throws QpidSecurityException, AMQInternalException
+ throws QpidSecurityException
{
throw new QpidSecurityException("Cannot remove bindings to the default exchange");
}
@@ -356,11 +354,6 @@ public class DefaultExchange implements Exchange
{
q.enqueue(message, postEnqueueAction);
}
- catch (AMQException e)
- {
- // TODO
- throw new RuntimeException(e);
- }
finally
{
_reference.release();
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.java
index 7229f008d6..a63e1afa3a 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.java
@@ -22,9 +22,7 @@ package org.apache.qpid.server.exchange;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.security.QpidSecurityException;
-import org.apache.qpid.AMQUnknownExchangeType;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.server.model.UUIDGenerator;
import org.apache.qpid.server.plugin.ExchangeType;
@@ -109,7 +107,7 @@ public class DefaultExchangeFactory implements ExchangeFactory
}
public Exchange createExchange(String exchange, String type, boolean durable, boolean autoDelete)
- throws AMQException, QpidSecurityException
+ throws AMQUnknownExchangeType, QpidSecurityException
{
UUID id = UUIDGenerator.generateExchangeUUID(exchange, _host.getName());
@@ -117,7 +115,7 @@ public class DefaultExchangeFactory implements ExchangeFactory
}
public Exchange createExchange(UUID id, String exchange, String type, boolean durable, boolean autoDelete)
- throws QpidSecurityException, AMQException
+ throws QpidSecurityException, AMQUnknownExchangeType
{
// Check access
if (!_host.getSecurityManager().authoriseCreateExchange(autoDelete, durable, exchange, null, null, null, type))
@@ -138,7 +136,7 @@ public class DefaultExchangeFactory implements ExchangeFactory
@Override
public Exchange restoreExchange(UUID id, String exchange, String type, boolean autoDelete)
- throws AMQException, QpidSecurityException
+ throws AMQUnknownExchangeType, QpidSecurityException
{
return createExchange(id, exchange, type, true, autoDelete);
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeRegistry.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeRegistry.java
index 7f1c29f9e5..8d2d04a464 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeRegistry.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeRegistry.java
@@ -21,7 +21,6 @@
package org.apache.qpid.server.exchange;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.server.model.UUIDGenerator;
@@ -59,7 +58,7 @@ public class DefaultExchangeRegistry implements ExchangeRegistry
_queueRegistry = queueRegistry;
}
- public void initialise(ExchangeFactory exchangeFactory) throws AMQException
+ public void initialise(ExchangeFactory exchangeFactory)
{
//create 'standard' exchanges:
new ExchangeInitialiser().initialise(exchangeFactory, this, getDurableConfigurationStore());
@@ -78,7 +77,7 @@ public class DefaultExchangeRegistry implements ExchangeRegistry
return _host.getDurableConfigurationStore();
}
- public void registerExchange(Exchange exchange) throws AMQException
+ public void registerExchange(Exchange exchange)
{
_exchangeMap.put(exchange.getName(), exchange);
synchronized (_listeners)
@@ -101,7 +100,7 @@ public class DefaultExchangeRegistry implements ExchangeRegistry
return _defaultExchange;
}
- public boolean unregisterExchange(String name, boolean inUse) throws AMQException, QpidSecurityException
+ public boolean unregisterExchange(String name, boolean inUse) throws QpidSecurityException
{
final Exchange exchange = _exchangeMap.get(name);
if (exchange != null)
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DirectExchange.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DirectExchange.java
index 2d65c22727..e2db7611eb 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DirectExchange.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DirectExchange.java
@@ -25,8 +25,8 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQInvalidArgumentException;
import org.apache.qpid.server.binding.Binding;
+import org.apache.qpid.server.filter.AMQInvalidArgumentException;
import org.apache.qpid.server.filter.FilterSupport;
import org.apache.qpid.server.filter.Filterable;
import org.apache.qpid.server.filter.MessageFilter;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DirectExchangeType.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DirectExchangeType.java
index 99c913ad07..3a4f7a9a3b 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DirectExchangeType.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DirectExchangeType.java
@@ -22,7 +22,6 @@ package org.apache.qpid.server.exchange;
import java.util.UUID;
-import org.apache.qpid.AMQException;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.server.plugin.ExchangeType;
import org.apache.qpid.server.virtualhost.VirtualHost;
@@ -38,7 +37,7 @@ public class DirectExchangeType implements ExchangeType<DirectExchange>
public DirectExchange newInstance(UUID id, VirtualHost host,
String name,
boolean durable,
- boolean autoDelete) throws AMQException
+ boolean autoDelete)
{
DirectExchange exch = new DirectExchange();
exch.initialise(id, host,name,durable, autoDelete);
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/Exchange.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/Exchange.java
index d20bf788c7..38249e6b1f 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/Exchange.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/Exchange.java
@@ -20,8 +20,6 @@
*/
package org.apache.qpid.server.exchange;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQInternalException;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.server.binding.Binding;
import org.apache.qpid.server.message.MessageDestination;
@@ -35,8 +33,7 @@ import java.util.UUID;
public interface Exchange extends ExchangeReferrer, MessageDestination
{
- void initialise(UUID id, VirtualHost host, String name, boolean durable, boolean autoDelete)
- throws AMQException;
+ void initialise(UUID id, VirtualHost host, String name, boolean durable, boolean autoDelete);
UUID getId();
@@ -70,25 +67,25 @@ public interface Exchange extends ExchangeReferrer, MessageDestination
boolean addBinding(String bindingKey, AMQQueue queue, Map<String, Object> arguments)
- throws QpidSecurityException, AMQInternalException;
+ throws QpidSecurityException;
boolean replaceBinding(UUID id, String bindingKey,
AMQQueue queue,
Map<String, Object> arguments)
- throws QpidSecurityException, AMQInternalException;
+ throws QpidSecurityException;
void restoreBinding(UUID id, String bindingKey, AMQQueue queue,
Map<String, Object> argumentMap)
- throws QpidSecurityException, AMQInternalException;
+ throws QpidSecurityException;
- void removeBinding(Binding b) throws QpidSecurityException, AMQInternalException;
+ void removeBinding(Binding b) throws QpidSecurityException;
Binding removeBinding(String bindingKey, AMQQueue queue, Map<String, Object> arguments)
- throws QpidSecurityException, AMQInternalException;
+ throws QpidSecurityException;
Binding getBinding(String bindingKey, AMQQueue queue, Map<String, Object> arguments);
- void close() throws QpidSecurityException, AMQInternalException;
+ void close() throws QpidSecurityException;
/**
* Determines whether a message would be isBound to a particular queue using a specific routing key and arguments
@@ -96,7 +93,6 @@ public interface Exchange extends ExchangeReferrer, MessageDestination
* @param arguments
* @param queue
* @return
- * @throws AMQException
*/
boolean isBound(String bindingKey, Map<String,Object> arguments, AMQQueue queue);
@@ -106,7 +102,6 @@ public interface Exchange extends ExchangeReferrer, MessageDestination
* @param bindingKey
* @param queue
* @return
- * @throws AMQException
*/
boolean isBound(String bindingKey, AMQQueue queue);
@@ -115,14 +110,12 @@ public interface Exchange extends ExchangeReferrer, MessageDestination
* Determines whether a message is routing to any queue using a specific _routing key
* @param bindingKey
* @return
- * @throws AMQException
*/
boolean isBound(String bindingKey);
/**
* Returns true if this exchange has at least one binding associated with it.
* @return
- * @throws AMQException
*/
boolean hasBindings();
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeFactory.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeFactory.java
index ef2a3358dd..06aa3aee2d 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeFactory.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeFactory.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.exchange;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.plugin.ExchangeType;
import org.apache.qpid.server.security.QpidSecurityException;
@@ -36,11 +35,11 @@ public interface ExchangeFactory
Collection<ExchangeType<? extends Exchange>> getPublicCreatableTypes();
Exchange createExchange(String exchange, String type, boolean durable, boolean autoDelete)
- throws AMQException, QpidSecurityException;
+ throws AMQUnknownExchangeType, QpidSecurityException;
- Exchange createExchange(UUID id, String exchange, String type, boolean durable, boolean autoDelete) throws AMQException,
+ Exchange createExchange(UUID id, String exchange, String type, boolean durable, boolean autoDelete) throws AMQUnknownExchangeType,
QpidSecurityException;
Exchange restoreExchange(UUID id, String exchange, String type, boolean autoDelete)
- throws AMQException, QpidSecurityException;
+ throws AMQUnknownExchangeType, QpidSecurityException;
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeInitialiser.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeInitialiser.java
index 334c1f5411..aa3f0de24f 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeInitialiser.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeInitialiser.java
@@ -20,8 +20,6 @@
*/
package org.apache.qpid.server.exchange;
-
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.plugin.ExchangeType;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.server.store.DurableConfigurationStoreHelper;
@@ -31,7 +29,6 @@ import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class ExchangeInitialiser
{
public void initialise(ExchangeFactory factory, ExchangeRegistry registry, DurableConfigurationStore store)
- throws AMQException
{
for (ExchangeType<? extends Exchange> type : factory.getRegisteredTypes())
{
@@ -42,7 +39,6 @@ public class ExchangeInitialiser
private void define(ExchangeRegistry r, ExchangeFactory f,
String name, String type, DurableConfigurationStore store)
- throws AMQException
{
try
{
@@ -61,5 +57,10 @@ public class ExchangeInitialiser
throw new ServerScopedRuntimeException("Security Exception when attempting to initialise exchanges - " +
"this is likely a programming error", e);
}
+ catch (AMQUnknownExchangeType e)
+ {
+ throw new ServerScopedRuntimeException("Unknown exchange type while attempting to initialise exchanges - " +
+ "this is because necessary jar files are not on the classpath", e);
+ }
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeRegistry.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeRegistry.java
index 6ecbb94235..aa66b98a5c 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeRegistry.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeRegistry.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.exchange;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.security.QpidSecurityException;
import java.util.Collection;
@@ -29,11 +28,11 @@ import java.util.UUID;
public interface ExchangeRegistry
{
- void registerExchange(Exchange exchange) throws AMQException;
+ void registerExchange(Exchange exchange);
Exchange getDefaultExchange();
- void initialise(ExchangeFactory exchangeFactory) throws AMQException;
+ void initialise(ExchangeFactory exchangeFactory);
Exchange getExchange(String exchangeName);
@@ -41,9 +40,8 @@ public interface ExchangeRegistry
* Unregister an exchange
* @param exchange name of the exchange to delete
* @param ifUnused if true, do NOT delete the exchange if it is in use (has queues bound to it)
- * @throws AMQException
*/
- boolean unregisterExchange(String exchange, boolean ifUnused) throws AMQException, QpidSecurityException;
+ boolean unregisterExchange(String exchange, boolean ifUnused) throws QpidSecurityException;
void clearAndUnregisterMbeans();
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/FanoutExchange.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/FanoutExchange.java
index ba60d956fd..fc1a5ea3de 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/FanoutExchange.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/FanoutExchange.java
@@ -27,8 +27,8 @@ import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQInvalidArgumentException;
import org.apache.qpid.server.binding.Binding;
+import org.apache.qpid.server.filter.AMQInvalidArgumentException;
import org.apache.qpid.server.filter.FilterSupport;
import org.apache.qpid.server.filter.Filterable;
import org.apache.qpid.server.filter.MessageFilter;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/FanoutExchangeType.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/FanoutExchangeType.java
index 9fc0d1f071..5e1f6784bd 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/FanoutExchangeType.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/FanoutExchangeType.java
@@ -22,7 +22,6 @@ package org.apache.qpid.server.exchange;
import java.util.UUID;
-import org.apache.qpid.AMQException;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.server.plugin.ExchangeType;
import org.apache.qpid.server.virtualhost.VirtualHost;
@@ -37,7 +36,6 @@ public class FanoutExchangeType implements ExchangeType<FanoutExchange>
public FanoutExchange newInstance(UUID id, VirtualHost host, String name,
boolean durable, boolean autoDelete)
- throws AMQException
{
FanoutExchange exch = new FanoutExchange();
exch.initialise(id, host, name, durable, autoDelete);
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersBinding.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersBinding.java
index 276a38e7f8..4780fae84e 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersBinding.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersBinding.java
@@ -22,8 +22,8 @@ package org.apache.qpid.server.exchange;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQInvalidArgumentException;
import org.apache.qpid.server.binding.Binding;
+import org.apache.qpid.server.filter.AMQInvalidArgumentException;
import org.apache.qpid.server.filter.FilterSupport;
import org.apache.qpid.server.filter.MessageFilter;
import org.apache.qpid.server.message.AMQMessageHeader;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersExchangeType.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersExchangeType.java
index 097a7bd5bd..19b830b6b2 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersExchangeType.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersExchangeType.java
@@ -22,7 +22,6 @@ package org.apache.qpid.server.exchange;
import java.util.UUID;
-import org.apache.qpid.AMQException;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.server.plugin.ExchangeType;
import org.apache.qpid.server.virtualhost.VirtualHost;
@@ -36,7 +35,7 @@ public class HeadersExchangeType implements ExchangeType<HeadersExchange>
}
public HeadersExchange newInstance(UUID id, VirtualHost host, String name, boolean durable,
- boolean autoDelete) throws AMQException
+ boolean autoDelete)
{
HeadersExchange exch = new HeadersExchange();
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/TopicExchange.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/TopicExchange.java
index d86d5cd769..0389638d4f 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/TopicExchange.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/TopicExchange.java
@@ -28,12 +28,12 @@ import java.util.HashSet;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQInvalidArgumentException;
import org.apache.qpid.server.binding.Binding;
import org.apache.qpid.server.exchange.topic.TopicExchangeResult;
import org.apache.qpid.server.exchange.topic.TopicMatcherResult;
import org.apache.qpid.server.exchange.topic.TopicNormalizer;
import org.apache.qpid.server.exchange.topic.TopicParser;
+import org.apache.qpid.server.filter.AMQInvalidArgumentException;
import org.apache.qpid.server.filter.FilterSupport;
import org.apache.qpid.server.filter.Filterable;
import org.apache.qpid.server.message.InstanceProperties;
@@ -41,6 +41,7 @@ import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.plugin.ExchangeType;
import org.apache.qpid.server.queue.AMQQueue;
import org.apache.qpid.server.queue.BaseQueue;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
public class TopicExchange extends AbstractExchange
{
@@ -252,7 +253,8 @@ public class TopicExchange extends AbstractExchange
}
catch (AMQInvalidArgumentException e)
{
- throw new RuntimeException(e);
+ // TODO - this seems incorrect, handling of invalid bindings should be propagated more cleanly
+ throw new ConnectionScopedRuntimeException(e);
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/TopicExchangeType.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/TopicExchangeType.java
index c1f42017bf..f76d556ded 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/TopicExchangeType.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/TopicExchangeType.java
@@ -22,7 +22,6 @@ package org.apache.qpid.server.exchange;
import java.util.UUID;
-import org.apache.qpid.AMQException;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.server.plugin.ExchangeType;
import org.apache.qpid.server.virtualhost.VirtualHost;
@@ -38,7 +37,7 @@ public class TopicExchangeType implements ExchangeType<TopicExchange>
public TopicExchange newInstance(UUID id, VirtualHost host,
String name,
boolean durable,
- boolean autoDelete) throws AMQException
+ boolean autoDelete)
{
TopicExchange exch = new TopicExchange();
exch.initialise(id, host, name, durable, autoDelete);
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/MessageStoreClosedException.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/AMQInvalidArgumentException.java
index b0a736c66c..ec5d68f0a6 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/MessageStoreClosedException.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/AMQInvalidArgumentException.java
@@ -18,21 +18,26 @@
* under the License.
*
*/
+package org.apache.qpid.server.filter;
-package org.apache.qpid.server.store;
+public class AMQInvalidArgumentException extends Exception
+{
+ public AMQInvalidArgumentException(final Throwable cause)
+ {
+ super(cause);
+ }
+
+ public AMQInvalidArgumentException(final String message, final Throwable cause)
+ {
+ super(message, cause);
+ }
-import org.apache.qpid.AMQException;
+ public AMQInvalidArgumentException(final String message)
+ {
+ super(message);
+ }
-/**
- * NOTE: this class currently extends AMQException but
- * we should be using AMQExceptions internally in the code base for Protocol errors hence
- * the message store interface should throw a different super class which this should be
- * moved to reflect
- */
-public class MessageStoreClosedException extends AMQException
-{
- public MessageStoreClosedException()
+ public AMQInvalidArgumentException()
{
- super("Message store closed");
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/FilterManagerFactory.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/FilterManagerFactory.java
index dc6d5d0123..a159a8506b 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/FilterManagerFactory.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/FilterManagerFactory.java
@@ -22,8 +22,6 @@ package org.apache.qpid.server.filter;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQInvalidArgumentException;
import org.apache.qpid.common.AMQPFilterTypes;
import org.apache.qpid.filter.SelectorParsingException;
import org.apache.qpid.filter.selector.ParseException;
@@ -43,7 +41,7 @@ public class FilterManagerFactory
//TODO move to a common class so it can be referred to from client code.
- public static FilterManager createManager(Map<String,Object> filters) throws AMQException
+ public static FilterManager createManager(Map<String,Object> filters) throws AMQInvalidArgumentException
{
FilterManager manager = null;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/FilterSupport.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/FilterSupport.java
index efefec58fd..9870551313 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/FilterSupport.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/FilterSupport.java
@@ -25,7 +25,6 @@ import java.lang.ref.WeakReference;
import java.util.Collections;
import java.util.Map;
import java.util.WeakHashMap;
-import org.apache.qpid.AMQInvalidArgumentException;
import org.apache.qpid.common.AMQPFilterTypes;
import org.apache.qpid.filter.SelectorParsingException;
import org.apache.qpid.filter.selector.ParseException;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/NoConsumerFilter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/NoConsumerFilter.java
deleted file mode 100644
index cf73bfa21f..0000000000
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/NoConsumerFilter.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- *
- */
-package org.apache.qpid.server.filter;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.AMQException;
-
-public class NoConsumerFilter implements MessageFilter
-{
- private final static Logger _logger = org.apache.log4j.Logger.getLogger(NoConsumerFilter.class);
-
-
- public NoConsumerFilter() throws AMQException
- {
- _logger.info("Created NoConsumerFilter");
- }
-
- public boolean matches(Filterable message)
- {
- return true;
- }
-
- @Override
- public String toString()
- {
- return "NoConsumer";
- }
-
-}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/AbstractServerMessageImpl.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/AbstractServerMessageImpl.java
index a2b7dd10e1..556cfcb266 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/AbstractServerMessageImpl.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/AbstractServerMessageImpl.java
@@ -22,6 +22,7 @@ package org.apache.qpid.server.message;
import org.apache.qpid.server.store.StorableMessageMetaData;
import org.apache.qpid.server.store.StoredMessage;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import java.nio.ByteBuffer;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -93,8 +94,8 @@ public abstract class AbstractServerMessageImpl<X extends AbstractServerMessageI
{
if (count < 0)
{
- throw new RuntimeException("Reference count for message id " + debugIdentity()
- + " has gone below 0.");
+ throw new ServerScopedRuntimeException("Reference count for message id " + debugIdentity()
+ + " has gone below 0.");
}
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/MessageSource.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/MessageSource.java
index 86179f9b00..b947bc0ef6 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/MessageSource.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/MessageSource.java
@@ -20,12 +20,10 @@
*/
package org.apache.qpid.server.message;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.consumer.Consumer;
import org.apache.qpid.server.consumer.ConsumerTarget;
import org.apache.qpid.server.filter.FilterManager;
import org.apache.qpid.server.protocol.AMQSessionModel;
-import org.apache.qpid.server.queue.AMQQueue;
import org.apache.qpid.server.security.AuthorizationHolder;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.server.store.TransactionLogResource;
@@ -38,7 +36,7 @@ public interface MessageSource<C extends Consumer, S extends MessageSource<C,S>>
<T extends ConsumerTarget> C addConsumer(T target, FilterManager filters,
Class<? extends ServerMessage> messageClass,
String consumerName, EnumSet<Consumer.Option> options)
- throws AMQException, QpidSecurityException;
+ throws ExistingExclusiveConsumer, ExistingConsumerPreventsExclusive, QpidSecurityException;
Collection<C> getConsumers();
@@ -70,12 +68,10 @@ public interface MessageSource<C extends Consumer, S extends MessageSource<C,S>>
* <tr><th> Responsibilities <th> Collaborations
* <tr><td> Represent failure to create a consumer, because an exclusive consumer already exists.
* </table>
- *
- * @todo Not an AMQP exception as no status code.
- *
+ * *
* @todo Move to top level, used outside this class.
*/
- static final class ExistingExclusiveConsumer extends AMQException
+ static final class ExistingExclusiveConsumer extends Exception
{
public ExistingExclusiveConsumer()
@@ -92,12 +88,10 @@ public interface MessageSource<C extends Consumer, S extends MessageSource<C,S>>
* <tr><th> Responsibilities <th> Collaborations
* <tr><td> Represent failure to create an exclusive consumer, as a consumer already exists.
* </table>
- *
- * @todo Not an AMQP exception as no status code.
- *
+ * *
* @todo Move to top level, used outside this class.
*/
- static final class ExistingConsumerPreventsExclusive extends AMQException
+ static final class ExistingConsumerPreventsExclusive extends Exception
{
public ExistingConsumerPreventsExclusive()
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessage.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessage.java
index f972bd78f6..6375cfb07d 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessage.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessage.java
@@ -25,6 +25,7 @@ import org.apache.qpid.server.message.AbstractServerMessageImpl;
import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.StoreFuture;
import org.apache.qpid.server.store.StoredMessage;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import org.apache.qpid.util.ByteBufferInputStream;
import java.io.ByteArrayOutputStream;
@@ -69,11 +70,12 @@ public class InternalMessage extends AbstractServerMessageImpl<InternalMessage,
}
catch (IOException e)
{
- throw new RuntimeException(e);
+ throw new ConnectionScopedRuntimeException("Unexpected IO Exception in operation in memory", e);
}
catch (ClassNotFoundException e)
{
- throw new RuntimeException(e);
+ throw new ConnectionScopedRuntimeException("Object message contained an object which could not " +
+ "be deserialized", e);
}
}
@@ -142,7 +144,7 @@ public class InternalMessage extends AbstractServerMessageImpl<InternalMessage,
}
catch (IOException e)
{
- throw new RuntimeException(e);
+ throw new ConnectionScopedRuntimeException("Unexpected IO Exception on operation in memory", e);
}
}
@@ -246,7 +248,7 @@ public class InternalMessage extends AbstractServerMessageImpl<InternalMessage,
}
catch (IOException e)
{
- throw new RuntimeException(e);
+ throw new ConnectionScopedRuntimeException("Unexpected IO Exception on operation in memory", e);
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaData.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaData.java
index d7772657a2..ed16335cf2 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaData.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaData.java
@@ -21,6 +21,7 @@
package org.apache.qpid.server.message.internal;
import org.apache.qpid.server.store.StorableMessageMetaData;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -87,7 +88,7 @@ public class InternalMessageMetaData implements StorableMessageMetaData
}
catch (IOException e)
{
- throw new RuntimeException(e);
+ throw new ConnectionScopedRuntimeException("Unexpected IO Exception on in memory operation", e);
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaDataType.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaDataType.java
index eb90599aef..20e506e634 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaDataType.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaDataType.java
@@ -23,6 +23,7 @@ package org.apache.qpid.server.message.internal;
import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.plugin.MessageMetaDataType;
import org.apache.qpid.server.store.StoredMessage;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import org.apache.qpid.util.ByteBufferInputStream;
import java.io.IOException;
@@ -51,11 +52,11 @@ public class InternalMessageMetaDataType implements MessageMetaDataType<Internal
}
catch (IOException e)
{
- throw new RuntimeException("Cannot decode message header");
+ throw new ConnectionScopedRuntimeException("Unexpected IO Exception on operation in memory", e);
}
catch (ClassNotFoundException e)
{
- throw new RuntimeException(e);
+ throw new ConnectionScopedRuntimeException("Unexpected exception when reading meta data, check classpath",e);
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractAdapter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractAdapter.java
index 7cc88f8743..cc669538d8 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractAdapter.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractAdapter.java
@@ -131,7 +131,7 @@ public abstract class AbstractAdapter implements ConfiguredObject
}
else
{
- return (State)_taskExecutor.submitAndWait(new ChangeStateTask(this, currentState, desiredState));
+ return _taskExecutor.submitAndWait(new ChangeStateTask(this, currentState, desiredState));
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AmqpPortAdapter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AmqpPortAdapter.java
index c255ce2f4a..42a234579b 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AmqpPortAdapter.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AmqpPortAdapter.java
@@ -47,6 +47,7 @@ import org.apache.qpid.server.plugin.TransportProviderFactory;
import org.apache.qpid.server.protocol.AmqpProtocolVersion;
import org.apache.qpid.server.transport.AcceptingTransport;
import org.apache.qpid.server.transport.TransportProvider;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.transport.network.security.ssl.QpidMultipleTrustManager;
public class AmqpPortAdapter extends PortAdapter
@@ -187,7 +188,7 @@ public class AmqpPortAdapter extends PortAdapter
}
catch (GeneralSecurityException e)
{
- throw new RuntimeException("Unable to create SSLContext for key or trust store", e);
+ throw new ServerScopedRuntimeException("Unable to create SSLContext for key or trust store", e);
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderAdapter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderAdapter.java
index 033429980f..0fcdb779c1 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderAdapter.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderAdapter.java
@@ -554,8 +554,9 @@ public abstract class AuthenticationProviderAdapter<T extends AuthenticationMana
}
else
{
- //TODO? Silly interface on the PrincipalDatabase at fault
- throw new RuntimeException("Failed to create user");
+ LOGGER.info("Failed to create user " + username + ". User already exists?");
+ return null;
+
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BindingAdapter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BindingAdapter.java
index 79ba45a2f0..88475809c9 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BindingAdapter.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BindingAdapter.java
@@ -26,7 +26,6 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import org.apache.qpid.AMQInternalException;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.server.model.Binding;
import org.apache.qpid.server.model.ConfiguredObject;
@@ -148,10 +147,6 @@ final class BindingAdapter extends AbstractAdapter implements Binding
{
throw new AccessControlException(e.getMessage());
}
- catch(AMQInternalException e)
- {
- throw new IllegalStateException(e);
- }
}
@Override
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java
index dd5fc67b48..dda23f1cfc 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java
@@ -30,7 +30,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import org.apache.qpid.AMQException;
import org.apache.qpid.protocol.AMQConstant;
import org.apache.qpid.server.model.ConfiguredObject;
import org.apache.qpid.server.model.Connection;
@@ -109,14 +108,7 @@ final class ConnectionAdapter extends AbstractAdapter implements Connection
public void delete()
{
- try
- {
- _connection.close(AMQConstant.CONNECTION_FORCED, "Connection closed by external action");
- }
- catch(AMQException e)
- {
- throw new IllegalStateException(e);
- }
+ _connection.close(AMQConstant.CONNECTION_FORCED, "Connection closed by external action");
}
public String getName()
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ExchangeAdapter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ExchangeAdapter.java
index 7958dfab23..f7ecbd323a 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ExchangeAdapter.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ExchangeAdapter.java
@@ -27,8 +27,6 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQInternalException;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.server.binding.Binding;
import org.apache.qpid.server.model.ConfiguredObject;
@@ -41,6 +39,7 @@ import org.apache.qpid.server.model.State;
import org.apache.qpid.server.model.Statistics;
import org.apache.qpid.server.queue.AMQQueue;
import org.apache.qpid.server.util.MapValueConverter;
+import org.apache.qpid.server.virtualhost.ExchangeIsAlternateException;
import org.apache.qpid.server.virtualhost.RequiredExchangeException;
final class ExchangeAdapter extends AbstractAdapter implements Exchange, org.apache.qpid.server.exchange.Exchange.BindingListener
@@ -151,10 +150,6 @@ final class ExchangeAdapter extends AbstractAdapter implements Exchange, org.apa
{
throw new AccessControlException(e.toString());
}
- catch(AMQInternalException e)
- {
- throw new IllegalStateException(e);
- }
}
public void delete()
@@ -167,7 +162,7 @@ final class ExchangeAdapter extends AbstractAdapter implements Exchange, org.apa
{
throw new UnsupportedOperationException("'" + getName() + "' is a reserved exchange and can't be deleted");
}
- catch(AMQException e)
+ catch(ExchangeIsAlternateException e)
{
throw new IllegalStateException(e);
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileSystemPreferencesProvider.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileSystemPreferencesProvider.java
index 39f0017fc3..ea1f735c15 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileSystemPreferencesProvider.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileSystemPreferencesProvider.java
@@ -246,7 +246,7 @@ public class FileSystemPreferencesProvider extends AbstractAdapter implements Pr
_store.open();
return true;
}
- catch (Exception e)
+ catch (RuntimeException e)
{
_state.compareAndSet(State.ACTIVE, State.ERRORED);
Broker broker = getAuthenticationProvider().getParent(Broker.class);
@@ -256,7 +256,7 @@ public class FileSystemPreferencesProvider extends AbstractAdapter implements Pr
}
else
{
- throw new RuntimeException(e);
+ throw e;
}
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/KeyStoreAdapter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/KeyStoreAdapter.java
index 1101232c96..27ecb9ca75 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/KeyStoreAdapter.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/KeyStoreAdapter.java
@@ -45,6 +45,7 @@ import org.apache.qpid.server.model.Port;
import org.apache.qpid.server.model.State;
import org.apache.qpid.server.security.access.Operation;
import org.apache.qpid.server.util.MapValueConverter;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.transport.network.security.ssl.QpidClientX509KeyManager;
import org.apache.qpid.transport.network.security.ssl.SSLUtil;
@@ -195,7 +196,7 @@ public class KeyStoreAdapter extends AbstractKeyStoreAdapter implements KeyStore
catch (KeyStoreException e)
{
// key store should be initialized above
- throw new RuntimeException("Key store has not been initialized", e);
+ throw new ServerScopedRuntimeException("Key store has not been initialized", e);
}
if (cert == null)
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/QueueAdapter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/QueueAdapter.java
index 19a44fc4c3..733b6cecc2 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/QueueAdapter.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/QueueAdapter.java
@@ -28,8 +28,6 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.server.binding.Binding;
import org.apache.qpid.server.configuration.IllegalConfigurationException;
import org.apache.qpid.server.message.MessageSource;
@@ -175,10 +173,6 @@ final class QueueAdapter<Q extends AMQQueue<?,Q,?>> extends AbstractAdapter impl
{
_queue.getVirtualHost().removeQueue(_queue);
}
- catch(AMQException e)
- {
- throw new IllegalStateException(e);
- }
catch (QpidSecurityException e)
{
throw new AccessControlException(e.toString());
@@ -343,15 +337,8 @@ final class QueueAdapter<Q extends AMQQueue<?,Q,?>> extends AbstractAdapter impl
{
if (_queue.isDurable())
{
- try
- {
- DurableConfigurationStoreHelper.updateQueue(_queue.getVirtualHost().getDurableConfigurationStore(),
- _queue);
- }
- catch (AMQStoreException e)
- {
- throw new IllegalStateException(e);
- }
+ DurableConfigurationStoreHelper.updateQueue(_queue.getVirtualHost().getDurableConfigurationStore(),
+ _queue);
}
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/VirtualHostAdapter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/VirtualHostAdapter.java
index bd265fe938..17ce69da4a 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/VirtualHostAdapter.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/VirtualHostAdapter.java
@@ -40,7 +40,7 @@ import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.commons.configuration.SystemConfiguration;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
+import org.apache.qpid.server.exchange.AMQUnknownExchangeType;
import org.apache.qpid.server.configuration.IllegalConfigurationException;
import org.apache.qpid.server.configuration.VirtualHostConfiguration;
import org.apache.qpid.server.configuration.XmlConfigurationUtilities.MyConfiguration;
@@ -76,12 +76,13 @@ import org.apache.qpid.server.txn.LocalTransaction;
import org.apache.qpid.server.txn.ServerTransaction;
import org.apache.qpid.server.util.MapValueConverter;
import org.apache.qpid.server.plugin.VirtualHostFactory;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.server.virtualhost.ExchangeExistsException;
import org.apache.qpid.server.virtualhost.ReservedExchangeNameException;
import org.apache.qpid.server.virtualhost.UnknownExchangeException;
import org.apache.qpid.server.virtualhost.VirtualHostListener;
import org.apache.qpid.server.virtualhost.VirtualHostRegistry;
-import org.apache.qpid.server.virtualhost.plugins.QueueExistsException;
+import org.apache.qpid.server.virtualhost.QueueExistsException;
public final class VirtualHostAdapter extends AbstractAdapter implements VirtualHost, VirtualHostListener
{
@@ -375,7 +376,7 @@ public final class VirtualHostAdapter extends AbstractAdapter implements Virtual
{
throw new IllegalArgumentException("Alternate Exchange with name '" + e.getExchangeName() + "' does not exist");
}
- catch(AMQException e)
+ catch(AMQUnknownExchangeType e)
{
throw new IllegalArgumentException(e);
}
@@ -472,10 +473,6 @@ public final class VirtualHostAdapter extends AbstractAdapter implements Virtual
{
throw new IllegalArgumentException("Queue with name "+name+" already exists");
}
- catch(AMQException e)
- {
- throw new IllegalArgumentException(e);
- }
catch (QpidSecurityException e)
{
throw new AccessControlException(e.toString());
@@ -800,14 +797,7 @@ public final class VirtualHostAdapter extends AbstractAdapter implements Virtual
{
public void postCommit()
{
- try
- {
- toQueue.enqueue(message, null);
- }
- catch(AMQException e)
- {
- throw new RuntimeException(e);
- }
+ toQueue.enqueue(message, null);
}
public void onRollback()
@@ -829,14 +819,7 @@ public final class VirtualHostAdapter extends AbstractAdapter implements Virtual
public void postCommit()
{
- try
- {
- toQueue.enqueue(message, null);
- }
- catch (AMQException e)
- {
- throw new RuntimeException(e);
- }
+ toQueue.enqueue(message, null);
}
public void onRollback()
@@ -1148,9 +1131,9 @@ public final class VirtualHostAdapter extends AbstractAdapter implements Virtual
this);
}
}
- catch (Exception e)
+ catch (ConfigurationException e)
{
- throw new RuntimeException("Failed to create virtual host " + virtualHostName, e);
+ throw new ServerScopedRuntimeException("Failed to create virtual host " + virtualHostName, e);
}
virtualHostRegistry.registerVirtualHost(_virtualHost);
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/ExchangeType.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/ExchangeType.java
index 423b76ab8e..910dfbf33d 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/ExchangeType.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/ExchangeType.java
@@ -22,7 +22,6 @@ package org.apache.qpid.server.plugin;
import java.util.UUID;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.exchange.Exchange;
import org.apache.qpid.server.virtualhost.VirtualHost;
@@ -31,7 +30,7 @@ public interface ExchangeType<T extends Exchange> extends Pluggable
public String getType();
public T newInstance(UUID id, VirtualHost host, String name,
- boolean durable, boolean autoDelete) throws AMQException;
+ boolean durable, boolean autoDelete);
public String getDefaultExchangeName();
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/QpidServiceLoader.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/QpidServiceLoader.java
index 148a306b27..6920d5a879 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/QpidServiceLoader.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/QpidServiceLoader.java
@@ -24,6 +24,7 @@ import java.util.List;
import java.util.ServiceLoader;
import org.apache.log4j.Logger;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
/**
* Simple facade over a {@link ServiceLoader} to instantiate all configured implementations of an interface.
@@ -59,7 +60,7 @@ public class QpidServiceLoader<C extends Pluggable>
if(atLeastOne && serviceImplementations.isEmpty())
{
- throw new RuntimeException("At least one implementation of " + clazz + " expected");
+ throw new ServerScopedRuntimeException("At least one implementation of " + clazz + " expected");
}
if(_logger.isDebugEnabled())
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/VirtualHostFactory.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/VirtualHostFactory.java
index 9549b70c83..a073c89a1b 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/VirtualHostFactory.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/VirtualHostFactory.java
@@ -41,7 +41,7 @@ public interface VirtualHostFactory extends Pluggable
StatisticsGatherer brokerStatisticsGatherer,
SecurityManager parentSecurityManager,
VirtualHostConfiguration hostConfig,
- org.apache.qpid.server.model.VirtualHost virtualHost) throws Exception;
+ org.apache.qpid.server.model.VirtualHost virtualHost);
void validateAttributes(Map<String, Object> attributes);
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/protocol/AMQConnectionModel.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/protocol/AMQConnectionModel.java
index 180653af0e..bc272f13dc 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/protocol/AMQConnectionModel.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/protocol/AMQConnectionModel.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.protocol;
-import org.apache.qpid.AMQException;
import org.apache.qpid.protocol.AMQConstant;
import org.apache.qpid.server.logging.LogSubject;
import org.apache.qpid.server.model.Port;
@@ -37,9 +36,8 @@ public interface AMQConnectionModel extends StatisticsGatherer
*
* @param cause
* @param message
- * @throws org.apache.qpid.AMQException
*/
- public void close(AMQConstant cause, String message) throws AMQException;
+ public void close(AMQConstant cause, String message);
public void block();
@@ -51,9 +49,8 @@ public interface AMQConnectionModel extends StatisticsGatherer
* @param session
* @param cause
* @param message
- * @throws org.apache.qpid.AMQException
*/
- public void closeSession(AMQSessionModel session, AMQConstant cause, String message) throws AMQException;
+ public void closeSession(AMQSessionModel session, AMQConstant cause, String message);
public long getConnectionId();
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/protocol/AMQSessionModel.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/protocol/AMQSessionModel.java
index 28fadd4162..520489ab1f 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/protocol/AMQSessionModel.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/protocol/AMQSessionModel.java
@@ -23,7 +23,6 @@ package org.apache.qpid.server.protocol;
import java.util.UUID;
import java.util.concurrent.ConcurrentSkipListSet;
-import org.apache.qpid.AMQException;
import org.apache.qpid.protocol.AMQConstant;
import org.apache.qpid.server.logging.LogSubject;
import org.apache.qpid.server.queue.AMQQueue;
@@ -41,9 +40,9 @@ public interface AMQSessionModel extends Comparable<AMQSessionModel>
public String getClientID();
- public void close() throws AMQException;
+ public void close();
- public void close(AMQConstant cause, String message) throws AMQException;
+ public void close(AMQConstant cause, String message);
public LogSubject getLogSubject();
@@ -62,7 +61,7 @@ public interface AMQSessionModel extends Comparable<AMQSessionModel>
* @param idleWarn time in milliseconds before alerting on idle transaction
* @param idleClose time in milliseconds before closing connection with idle transaction
*/
- public void checkTransactionStatus(long openWarn, long openClose, long idleWarn, long idleClose) throws AMQException;
+ public void checkTransactionStatus(long openWarn, long openClose, long idleWarn, long idleClose);
void block(AMQQueue queue);
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueue.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueue.java
index 49c8a8f2a1..237f2cd8aa 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueue.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueue.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.queue;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.binding.Binding;
import org.apache.qpid.server.configuration.QueueConfiguration;
import org.apache.qpid.server.exchange.Exchange;
@@ -95,7 +94,7 @@ public interface AMQQueue<E extends QueueEntry<E,Q,C>, Q extends AMQQueue<E,Q,C>
boolean isDeleted();
- int delete() throws AMQException, QpidSecurityException;
+ int delete() throws QpidSecurityException;
void requeue(E entry);
@@ -103,7 +102,7 @@ public interface AMQQueue<E extends QueueEntry<E,Q,C>, Q extends AMQQueue<E,Q,C>
void decrementUnackedMsgCount(E queueEntry);
- boolean resend(final E entry, final C consumer) throws AMQException;
+ boolean resend(final E entry, final C consumer);
void addQueueDeleteTask(Action<AMQQueue> task);
void removeQueueDeleteTask(Action<AMQQueue> task);
@@ -170,13 +169,12 @@ public interface AMQQueue<E extends QueueEntry<E,Q,C>, Q extends AMQQueue<E,Q,C>
void deleteMessageFromTop();
- long clearQueue() throws AMQException, QpidSecurityException;
+ long clearQueue() throws QpidSecurityException;
/**
* Checks the status of messages on the queue, purging expired ones, firing age related alerts etc.
- * @throws AMQException
*/
- void checkMessageStatus() throws AMQException;
+ void checkMessageStatus();
Set<NotificationCheck> getNotificationChecks();
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java
index 1f281b16e9..409c528a4b 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java
@@ -25,7 +25,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-import org.apache.qpid.AMQException;
+import org.apache.qpid.server.exchange.AMQUnknownExchangeType;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.server.configuration.BrokerProperties;
@@ -35,8 +35,13 @@ import org.apache.qpid.server.exchange.Exchange;
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.model.UUIDGenerator;
import org.apache.qpid.server.store.DurableConfigurationStoreHelper;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.server.virtualhost.ExchangeExistsException;
+import org.apache.qpid.server.virtualhost.ReservedExchangeNameException;
+import org.apache.qpid.server.virtualhost.UnknownExchangeException;
import org.apache.qpid.server.virtualhost.VirtualHost;
+import org.apache.qpid.server.virtualhost.QueueExistsException;
public class AMQQueueFactory implements QueueFactory
{
@@ -183,7 +188,7 @@ public class AMQQueueFactory implements QueueFactory
boolean autoDelete,
boolean exclusive,
boolean deleteOnNoConsumer,
- Map<String, Object> arguments) throws QpidSecurityException, AMQException
+ Map<String, Object> arguments) throws QpidSecurityException
{
return createOrRestoreQueue(id, queueName, true, owner, autoDelete, exclusive, deleteOnNoConsumer, arguments, false);
@@ -201,7 +206,7 @@ public class AMQQueueFactory implements QueueFactory
boolean autoDelete,
boolean exclusive,
boolean deleteOnNoConsumer,
- Map<String, Object> arguments) throws QpidSecurityException, AMQException
+ Map<String, Object> arguments) throws QpidSecurityException
{
return createOrRestoreQueue(id, queueName, durable, owner, autoDelete, exclusive, deleteOnNoConsumer, arguments, true);
}
@@ -214,7 +219,7 @@ public class AMQQueueFactory implements QueueFactory
boolean exclusive,
boolean deleteOnNoConsumer,
Map<String, Object> arguments,
- boolean createInStore) throws QpidSecurityException, AMQException
+ boolean createInStore) throws QpidSecurityException
{
if (id == null)
{
@@ -339,6 +344,18 @@ public class AMQQueueFactory implements QueueFactory
// We're ok if the exchange already exists
dlExchange = e.getExistingExchange();
}
+ catch (ReservedExchangeNameException e)
+ {
+ throw new ConnectionScopedRuntimeException("Attempt to create an alternate exchange for a queue failed",e);
+ }
+ catch (AMQUnknownExchangeType e)
+ {
+ throw new ConnectionScopedRuntimeException("Attempt to create an alternate exchange for a queue failed",e);
+ }
+ catch (UnknownExchangeException e)
+ {
+ throw new ConnectionScopedRuntimeException("Attempt to create an alternate exchange for a queue failed",e);
+ }
AMQQueue dlQueue = null;
@@ -353,8 +370,19 @@ public class AMQQueueFactory implements QueueFactory
args.put(Queue.CREATE_DLQ_ON_CREATION, false);
args.put(Queue.MAXIMUM_DELIVERY_ATTEMPTS, 0);
- dlQueue = _virtualHost.createQueue(UUIDGenerator.generateQueueUUID(dlQueueName, _virtualHost.getName()), dlQueueName, true, owner, false, exclusive,
- false, args);
+ try
+ {
+ dlQueue = _virtualHost.createQueue(UUIDGenerator.generateQueueUUID(dlQueueName, _virtualHost.getName()), dlQueueName, true, owner, false, exclusive,
+ false, args);
+ }
+ catch (QueueExistsException e)
+ {
+ throw new ServerScopedRuntimeException("Attempt to create a queue failed because the " +
+ "queue already exists, however this occurred within " +
+ "a block where the queue existence had previously been " +
+ "checked, and no queue creation should have been " +
+ "possible from another thread", e);
+ }
}
}
@@ -391,7 +419,7 @@ public class AMQQueueFactory implements QueueFactory
return q;
}
- public AMQQueue createAMQQueueImpl(QueueConfiguration config) throws AMQException, QpidSecurityException
+ public AMQQueue createAMQQueueImpl(QueueConfiguration config) throws QpidSecurityException
{
String queueName = config.getName();
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/BaseQueue.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/BaseQueue.java
index 31c54dcdd2..4158e51d2f 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/BaseQueue.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/BaseQueue.java
@@ -21,7 +21,6 @@
package org.apache.qpid.server.queue;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.consumer.Consumer;
import org.apache.qpid.server.message.MessageInstance;
import org.apache.qpid.server.message.ServerMessage;
@@ -30,7 +29,7 @@ import org.apache.qpid.server.util.Action;
public interface BaseQueue<C extends Consumer> extends TransactionLogResource
{
- void enqueue(ServerMessage message, Action<? super MessageInstance<?,C>> action) throws AMQException;
+ void enqueue(ServerMessage message, Action<? super MessageInstance<?,C>> action);
boolean isDurable();
boolean isDeleted();
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueConsumer.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueConsumer.java
index bd4724db20..45dc556732 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueConsumer.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueConsumer.java
@@ -21,7 +21,6 @@
package org.apache.qpid.server.queue;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.filter.FilterManager;
import org.apache.qpid.server.logging.LogActor;
import org.apache.qpid.server.logging.LogSubject;
@@ -41,7 +40,6 @@ import java.text.MessageFormat;
import java.util.EnumMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
@@ -149,15 +147,7 @@ class QueueConsumer<T extends ConsumerTarget, E extends QueueEntryImpl<E,Q,L>, Q
if(newState == ConsumerTarget.State.CLOSED && oldState != newState && !_closed.get())
{
- try
- {
- close();
- }
- catch (AMQException e)
- {
- _logger.error("Unable to remove to remove consumer", e);
- throw new RuntimeException(e);
- }
+ close();
}
final StateChangeListener<? super QueueConsumer<T,E,Q,L>, State> stateListener = getStateListener();
if(stateListener != null)
@@ -202,7 +192,7 @@ class QueueConsumer<T extends ConsumerTarget, E extends QueueEntryImpl<E,Q,L>, Q
}
@Override
- public void close() throws AMQException
+ public void close()
{
if(_closed.compareAndSet(false,true))
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueEntryImpl.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueEntryImpl.java
index 433daedee9..1f09fe3fb9 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueEntryImpl.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueEntryImpl.java
@@ -22,7 +22,6 @@ package org.apache.qpid.server.queue;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.exchange.Exchange;
import org.apache.qpid.server.filter.Filterable;
import org.apache.qpid.server.message.InstanceProperties;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueFactory.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueFactory.java
index d58de14000..8c0386c7b4 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueFactory.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueFactory.java
@@ -22,7 +22,6 @@ package org.apache.qpid.server.queue;
import java.util.Map;
import java.util.UUID;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.security.QpidSecurityException;
public interface QueueFactory
@@ -34,7 +33,7 @@ public interface QueueFactory
boolean autoDelete,
boolean exclusive,
boolean deleteOnNoConsumer,
- Map<String, Object> arguments) throws QpidSecurityException, AMQException;
+ Map<String, Object> arguments) throws QpidSecurityException;
AMQQueue restoreQueue(UUID id,
String queueName,
@@ -42,6 +41,6 @@ public interface QueueFactory
boolean autoDelete,
boolean exclusive,
boolean deleteOnNoConsumer,
- Map<String, Object> arguments) throws QpidSecurityException, AMQException;
+ Map<String, Object> arguments) throws QpidSecurityException;
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueRunner.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueRunner.java
index 005d9b66b3..317e184dae 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueRunner.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueRunner.java
@@ -26,8 +26,8 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.logging.actors.CurrentActor;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import org.apache.qpid.transport.TransportException;
/**
@@ -70,9 +70,17 @@ public class QueueRunner implements Runnable
runAgain = _queue.processQueue(this);
}
- catch (final AMQException e)
+ catch (final ConnectionScopedRuntimeException e)
{
- _logger.error("Exception during asynchronous delivery by " + toString(), e);
+ final String errorMessage = "Problem during asynchronous delivery by " + toString();
+ if(_logger.isDebugEnabled())
+ {
+ _logger.debug(errorMessage, e);
+ }
+ else
+ {
+ _logger.info(errorMessage + ' ' + e.getMessage());
+ }
}
catch (final TransportException transe)
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java
index c07264b628..b2408f6dfa 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java
@@ -28,7 +28,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.pool.ReferenceCountingExecutorService;
import org.apache.qpid.server.binding.Binding;
@@ -382,7 +381,7 @@ abstract class SimpleAMQQueue<E extends QueueEntryImpl<E,Q,L>, Q extends SimpleA
final FilterManager filters,
final Class<? extends ServerMessage> messageClass,
final String consumerName,
- EnumSet<Consumer.Option> optionSet) throws AMQException, QpidSecurityException
+ EnumSet<Consumer.Option> optionSet) throws ExistingExclusiveConsumer, ExistingConsumerPreventsExclusive, QpidSecurityException
{
// Access control
@@ -460,7 +459,7 @@ abstract class SimpleAMQQueue<E extends QueueEntryImpl<E,Q,L>, Q extends SimpleA
}
- synchronized void unregisterConsumer(final QueueConsumer<?,E,Q,L> consumer) throws AMQException
+ synchronized void unregisterConsumer(final QueueConsumer<?,E,Q,L> consumer)
{
if (consumer == null)
{
@@ -622,7 +621,7 @@ abstract class SimpleAMQQueue<E extends QueueEntryImpl<E,Q,L>, Q extends SimpleA
// ------ Enqueue / Dequeue
- public void enqueue(ServerMessage message, Action<? super MessageInstance<?, QueueConsumer<?,E,Q,L>>> action) throws AMQException
+ public void enqueue(ServerMessage message, Action<? super MessageInstance<?, QueueConsumer<?,E,Q,L>>> action)
{
incrementQueueCount();
incrementQueueSize(message);
@@ -711,7 +710,6 @@ abstract class SimpleAMQQueue<E extends QueueEntryImpl<E,Q,L>, Q extends SimpleA
}
private void deliverToConsumer(final QueueConsumer<?,E,Q,L> sub, final E entry)
- throws AMQException
{
if(sub.trySendLock())
@@ -810,7 +808,7 @@ abstract class SimpleAMQQueue<E extends QueueEntryImpl<E,Q,L>, Q extends SimpleA
sub.send(entry, batch);
}
- private boolean consumerReadyAndHasInterest(final QueueConsumer<?,E,Q,L> sub, final E entry) throws AMQException
+ private boolean consumerReadyAndHasInterest(final QueueConsumer<?,E,Q,L> sub, final E entry)
{
return sub.hasInterest(entry) && (getNextAvailableEntry(sub) == entry);
}
@@ -1177,7 +1175,7 @@ abstract class SimpleAMQQueue<E extends QueueEntryImpl<E,Q,L>, Q extends SimpleA
}
- public void purge(final long request) throws AMQException, QpidSecurityException
+ public void purge(final long request) throws QpidSecurityException
{
clear(request);
}
@@ -1207,7 +1205,7 @@ abstract class SimpleAMQQueue<E extends QueueEntryImpl<E,Q,L>, Q extends SimpleA
}
}
- public long clearQueue() throws AMQException, QpidSecurityException
+ public long clearQueue() throws QpidSecurityException
{
return clear(0l);
}
@@ -1279,7 +1277,7 @@ abstract class SimpleAMQQueue<E extends QueueEntryImpl<E,Q,L>, Q extends SimpleA
}
// TODO list all thrown exceptions
- public int delete() throws AMQException, QpidSecurityException
+ public int delete() throws QpidSecurityException
{
// Check access
if (!_virtualHost.getSecurityManager().authoriseDelete(this))
@@ -1667,9 +1665,8 @@ abstract class SimpleAMQQueue<E extends QueueEntryImpl<E,Q,L>, Q extends SimpleA
* ends the current instance
*
* @param runner the Runner to schedule
- * @throws AMQException
*/
- public long processQueue(QueueRunner runner) throws AMQException
+ public long processQueue(QueueRunner runner)
{
long stateChangeCount;
long previousStateChangeCount = Long.MIN_VALUE;
@@ -1790,7 +1787,7 @@ abstract class SimpleAMQQueue<E extends QueueEntryImpl<E,Q,L>, Q extends SimpleA
}
- public void checkMessageStatus() throws AMQException
+ public void checkMessageStatus()
{
QueueEntryIterator<E,Q,L,QueueConsumer<?,E,Q,L>> queueListIterator = _entries.iterator();
@@ -2102,7 +2099,7 @@ abstract class SimpleAMQQueue<E extends QueueEntryImpl<E,Q,L>, Q extends SimpleA
/**
* Checks if there is any notification to send to the listeners
*/
- private void checkForNotification(ServerMessage<?> msg) throws AMQException
+ private void checkForNotification(ServerMessage<?> msg)
{
final Set<NotificationCheck> notificationChecks = getNotificationChecks();
final AMQQueue.NotificationListener listener = _notificationListener;
@@ -2164,11 +2161,6 @@ abstract class SimpleAMQQueue<E extends QueueEntryImpl<E,Q,L>, Q extends SimpleA
{
SimpleAMQQueue.this.enqueue(message, postEnqueueAction);
}
- catch (AMQException e)
- {
- // TODO
- throw new RuntimeException(e);
- }
finally
{
_reference.release();
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SortedQueue.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SortedQueue.java
index 2cae18f3ec..f85f9479bb 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SortedQueue.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SortedQueue.java
@@ -19,8 +19,6 @@
*/
package org.apache.qpid.server.queue;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.consumer.Consumer;
import org.apache.qpid.server.message.MessageInstance;
import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.util.Action;
@@ -67,7 +65,6 @@ public class SortedQueue extends OutOfOrderQueue<SortedQueueEntry, SortedQueue,
@Override
public void enqueue(final ServerMessage message,
final Action<? super MessageInstance<?, QueueConsumer<?, SortedQueueEntry, SortedQueue, SortedQueueEntryList>>> action)
- throws AMQException
{
synchronized (_sortedQueueLock)
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SubFlushRunner.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SubFlushRunner.java
index 50af44fed4..2100e3c5cd 100755
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SubFlushRunner.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SubFlushRunner.java
@@ -23,7 +23,6 @@ package org.apache.qpid.server.queue;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.logging.actors.CurrentActor;
import org.apache.qpid.transport.TransportException;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/database/HashedUser.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/database/HashedUser.java
index b9de1587b5..2b2ecd1d92 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/database/HashedUser.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/database/HashedUser.java
@@ -22,6 +22,7 @@ package org.apache.qpid.server.security.auth.database;
import org.apache.commons.codec.binary.Base64;
import org.apache.log4j.Logger;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
@@ -54,7 +55,7 @@ public class HashedUser implements PasswordPrincipal
}
catch (UnsupportedEncodingException e)
{
- throw new RuntimeException("MD5 encoding not supported, even though the Java standard requires it",e);
+ throw new ServerScopedRuntimeException("MD5 encoding not supported, even though the Java standard requires it",e);
}
Base64 b64 = new Base64();
@@ -86,7 +87,7 @@ public class HashedUser implements PasswordPrincipal
}
catch (NoSuchAlgorithmException e)
{
- throw new RuntimeException("MD5 not supported although Java compliance requires it");
+ throw new ServerScopedRuntimeException("MD5 not supported although Java compliance requires it");
}
for (byte b : data)
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManager.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManager.java
index 726284fcce..2cb61b451f 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManager.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManager.java
@@ -20,6 +20,9 @@
package org.apache.qpid.server.security.auth.manager;
import java.io.IOException;
+import java.security.GeneralSecurityException;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
import java.security.Principal;
import java.util.Hashtable;
@@ -49,6 +52,7 @@ import org.apache.qpid.server.security.auth.manager.ldap.AbstractLDAPSSLSocketFa
import org.apache.qpid.server.security.auth.manager.ldap.LDAPSSLSocketFactoryGenerator;
import org.apache.qpid.server.security.auth.sasl.plain.PlainPasswordCallback;
import org.apache.qpid.server.security.auth.sasl.plain.PlainSaslServer;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.server.util.StringUtil;
import org.apache.qpid.ssl.SSLContextFactory;
@@ -267,11 +271,22 @@ public class SimpleLDAPAuthenticationManager implements AuthenticationManager
sslContext = SSLContext.getInstance("TLS");
sslContext.init(null, _trustStore.getTrustManagers(), null);
}
- catch (Exception e)
+ catch (NoSuchAlgorithmException e)
{
_logger.error("Exception creating SSLContext", e);
- throw new RuntimeException("Error creating SSLContext for trust store : " + _trustStore.getName() , e);
+ throw new ServerScopedRuntimeException("Error creating SSLContext for trust store : " + _trustStore.getName() , e);
}
+ catch (KeyManagementException e)
+ {
+ _logger.error("Exception creating SSLContext", e);
+ throw new ServerScopedRuntimeException("Error creating SSLContext for trust store : " + _trustStore.getName() , e);
+ }
+ catch (GeneralSecurityException e)
+ {
+ _logger.error("Exception creating SSLContext", e);
+ throw new ServerScopedRuntimeException("Error creating SSLContext for trust store : " + _trustStore.getName() , e);
+ }
+
Class<? extends AbstractLDAPSSLSocketFactory> clazz = LDAPSSLSocketFactoryGenerator.createSubClass(clazzName, sslContext.getSocketFactory());
if (_logger.isDebugEnabled())
{
@@ -295,7 +310,7 @@ public class SimpleLDAPAuthenticationManager implements AuthenticationManager
}
catch (NamingException e)
{
- throw new RuntimeException("Unable to establish anonymous connection to the ldap server at " + _providerSearchURL, e);
+ throw new ServerScopedRuntimeException("Unable to establish anonymous connection to the ldap server at " + _providerSearchURL, e);
}
finally
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ldap/LDAPSSLSocketFactoryGenerator.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ldap/LDAPSSLSocketFactoryGenerator.java
index 5cfc8b7a0b..6aa900ceaa 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ldap/LDAPSSLSocketFactoryGenerator.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ldap/LDAPSSLSocketFactoryGenerator.java
@@ -42,6 +42,7 @@ import org.apache.bcel.generic.InstructionFactory;
import org.apache.bcel.generic.InstructionList;
import org.apache.bcel.generic.MethodGen;
import org.apache.bcel.generic.Type;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
/**
* This class provides a single method, {@link #createSubClass(String, SSLSocketFactory)}. This creates a
@@ -214,19 +215,19 @@ public class LDAPSSLSocketFactoryGenerator
}
catch (IllegalArgumentException e)
{
- throw new RuntimeException(exceptionMessage, e);
+ throw new ServerScopedRuntimeException(exceptionMessage, e);
}
catch (IllegalAccessException e)
{
- throw new RuntimeException(exceptionMessage, e);
+ throw new ServerScopedRuntimeException(exceptionMessage, e);
}
catch (NoSuchFieldException e)
{
- throw new RuntimeException(exceptionMessage, e);
+ throw new ServerScopedRuntimeException(exceptionMessage, e);
}
catch (SecurityException e)
{
- throw new RuntimeException(exceptionMessage, e);
+ throw new ServerScopedRuntimeException(exceptionMessage, e);
}
}
@@ -252,19 +253,19 @@ public class LDAPSSLSocketFactoryGenerator
}
catch (NoSuchFieldException e)
{
- throw new RuntimeException(exceptionMessage, e);
+ throw new ServerScopedRuntimeException(exceptionMessage, e);
}
catch (SecurityException e)
{
- throw new RuntimeException(exceptionMessage, e);
+ throw new ServerScopedRuntimeException(exceptionMessage, e);
}
catch (IllegalArgumentException e)
{
- throw new RuntimeException(exceptionMessage, e);
+ throw new ServerScopedRuntimeException(exceptionMessage, e);
}
catch (IllegalAccessException e)
{
- throw new RuntimeException(exceptionMessage, e);
+ throw new ServerScopedRuntimeException(exceptionMessage, e);
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HashedSaslServer.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HashedSaslServer.java
index a2d9fa5e3e..6e5dd1aec8 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HashedSaslServer.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HashedSaslServer.java
@@ -20,6 +20,8 @@
*/
package org.apache.qpid.server.security.auth.sasl.crammd5;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
+
import javax.security.auth.callback.CallbackHandler;
import javax.security.sasl.Sasl;
import javax.security.sasl.SaslException;
@@ -60,7 +62,7 @@ public class CRAMMD5HashedSaslServer implements SaslServer
}
}
- throw new RuntimeException("No default SaslServer found for mechanism:" + "CRAM-MD5");
+ throw new ServerScopedRuntimeException("No default SaslServer found for mechanism:" + "CRAM-MD5");
}
public String getMechanismName()
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HexSaslServer.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HexSaslServer.java
index e19baaa7c6..8ae0a0044a 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HexSaslServer.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HexSaslServer.java
@@ -20,6 +20,8 @@
*/
package org.apache.qpid.server.security.auth.sasl.crammd5;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
+
import javax.security.auth.callback.CallbackHandler;
import javax.security.sasl.Sasl;
import javax.security.sasl.SaslException;
@@ -60,7 +62,7 @@ public class CRAMMD5HexSaslServer implements SaslServer
}
}
- throw new RuntimeException("No default SaslServer found for mechanism:" + "CRAM-MD5");
+ throw new ServerScopedRuntimeException("No default SaslServer found for mechanism:" + "CRAM-MD5");
}
public String getMechanismName()
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/group/FileGroupDatabase.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/group/FileGroupDatabase.java
index c66e7fd4e4..0a02ce38fc 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/group/FileGroupDatabase.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/group/FileGroupDatabase.java
@@ -34,6 +34,7 @@ import java.util.concurrent.ConcurrentSkipListSet;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
/**
* A group database that reads/writes the following file format:
@@ -181,7 +182,7 @@ public class FileGroupDatabase implements GroupDatabase
}
catch (IOException e)
{
- throw new RuntimeException("Unable to persist change to file " + _groupFile);
+ throw new ServerScopedRuntimeException("Unable to persist change to file " + _groupFile);
}
}
}
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/AMQStoreException.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AMQStoreException.java
index 45aa36a20b..98ed01efb4 100644
--- a/qpid/java/common/src/main/java/org/apache/qpid/AMQStoreException.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AMQStoreException.java
@@ -18,12 +18,13 @@
* under the License.
*
*/
-package org.apache.qpid;
+package org.apache.qpid.server.store;
+
/**
* StoreException is a specific type of internal error relating to errors in the message store, such as {@link java.sql.SQLException}.
*/
-public class AMQStoreException extends AMQInternalException
+public class AMQStoreException extends Exception
{
/** serialVersionUID */
private static final long serialVersionUID = 2859681947490637496L;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java
index d80fa656e7..dd9f5ebe51 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java
@@ -43,12 +43,11 @@ import java.util.UUID;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.server.message.EnqueueableMessage;
import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.plugin.MessageMetaDataType;
import org.apache.qpid.server.queue.AMQQueue;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
@@ -177,7 +176,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
@Override
- public void configureConfigStore(VirtualHost virtualHost, ConfigurationRecoveryHandler configRecoveryHandler) throws Exception
+ public void configureConfigStore(VirtualHost virtualHost, ConfigurationRecoveryHandler configRecoveryHandler)
{
_stateManager.attainState(State.INITIALISING);
_configRecoveryHandler = configRecoveryHandler;
@@ -187,7 +186,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
@Override
public void configureMessageStore(VirtualHost virtualHost, MessageStoreRecoveryHandler recoveryHandler,
- TransactionLogRecoveryHandler tlogRecoveryHandler) throws Exception
+ TransactionLogRecoveryHandler tlogRecoveryHandler)
{
if(_stateManager.isInState(State.INITIAL))
{
@@ -201,7 +200,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
completeInitialisation();
}
- private void completeInitialisation() throws ClassNotFoundException, SQLException, AMQStoreException
+ private void completeInitialisation()
{
commonConfiguration();
@@ -209,7 +208,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
@Override
- public void activate() throws Exception
+ public void activate()
{
if(_stateManager.isInState(State.INITIALISING))
{
@@ -224,12 +223,28 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
if(_messageRecoveryHandler != null)
{
- recoverMessages(_messageRecoveryHandler);
+ try
+ {
+ recoverMessages(_messageRecoveryHandler);
+ }
+ catch (SQLException e)
+ {
+ throw new ServerScopedRuntimeException("Error encountered when restoring message data from " +
+ "persistent store ", e);
+ }
}
if(_tlogRecoveryHandler != null)
{
- TransactionLogRecoveryHandler.DtxRecordRecoveryHandler dtxrh = recoverQueueEntries(_tlogRecoveryHandler);
- recoverXids(dtxrh);
+ try
+ {
+ TransactionLogRecoveryHandler.DtxRecordRecoveryHandler dtxrh = recoverQueueEntries(_tlogRecoveryHandler);
+ recoverXids(dtxrh);
+ }
+ catch (SQLException e)
+ {
+ throw new ServerScopedRuntimeException("Error encountered when restoring distributed transaction " +
+ "data from persistent store ", e);
+ }
}
@@ -237,14 +252,24 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
private void commonConfiguration()
- throws ClassNotFoundException, SQLException, AMQStoreException
{
- implementationSpecificConfiguration(_virtualHost.getName(), _virtualHost);
- createOrOpenDatabase();
- upgradeIfNecessary();
+ try
+ {
+ implementationSpecificConfiguration(_virtualHost.getName(), _virtualHost);
+ createOrOpenDatabase();
+ upgradeIfNecessary();
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new ServerScopedRuntimeException("Unable to configure message store ", e);
+ }
+ catch (SQLException e)
+ {
+ throw new ServerScopedRuntimeException("Unable to configure message store ", e);
+ }
}
- protected void upgradeIfNecessary() throws SQLException, AMQStoreException
+ protected void upgradeIfNecessary() throws SQLException
{
Connection conn = newAutoCommitConnection();
try
@@ -258,7 +283,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
{
if(!rs.next())
{
- throw new AMQStoreException(DB_VERSION_TABLE_NAME + " does not contain the database version");
+ throw new ServerScopedRuntimeException(DB_VERSION_TABLE_NAME + " does not contain the database version");
}
int version = rs.getInt(1);
switch (version)
@@ -268,7 +293,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
case DB_VERSION:
return;
default:
- throw new AMQStoreException("Unknown database version: " + version);
+ throw new ServerScopedRuntimeException("Unknown database version: " + version);
}
}
finally
@@ -591,7 +616,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
}
- protected void recoverConfiguration(ConfigurationRecoveryHandler recoveryHandler) throws AMQException
+ protected void recoverConfiguration(ConfigurationRecoveryHandler recoveryHandler)
{
try
{
@@ -602,7 +627,11 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
catch (SQLException e)
{
- throw new AMQStoreException("Error recovering persistent state: " + e.getMessage(), e);
+ throw new ServerScopedRuntimeException("Error recovering persistent state: " + e.getMessage(), e);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("Error recovering persistent state: " + e.getMessage(), e);
}
}
@@ -668,7 +697,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
@Override
- public void close() throws Exception
+ public void close()
{
if (_closed.compareAndSet(false, true))
{
@@ -681,7 +710,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
- protected abstract void doClose() throws Exception;
+ protected abstract void doClose();
@Override
public StoredMessage addMessage(StorableMessageMetaData metaData)
@@ -756,7 +785,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
catch (SQLException e)
{
- throw new RuntimeException("Error removing message with id " + messageId + " from database: " + e.getMessage(), e);
+ throw new ServerScopedRuntimeException("Error removing message with id " + messageId + " from database: " + e.getMessage(), e);
}
}
@@ -1208,7 +1237,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
if(result == 0)
{
- throw new RuntimeException("Unable to add meta data for message " +messageId);
+ throw new ServerScopedRuntimeException("Unable to add meta data for message " +messageId);
}
}
finally
@@ -1533,7 +1562,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
else
{
- throw new RuntimeException("Meta data not found for message with id " + messageId);
+ throw new ServerScopedRuntimeException("Meta data not found for message with id " + messageId);
}
}
finally
@@ -1579,7 +1608,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
catch (SQLException e)
{
closeConnection(conn);
- throw new RuntimeException("Error adding content for message " + messageId + ": " + e.getMessage(), e);
+ throw new ServerScopedRuntimeException("Error adding content for message " + messageId + ": " + e.getMessage(), e);
}
finally
{
@@ -1611,7 +1640,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
if (offset > size)
{
- throw new RuntimeException("Offset " + offset + " is greater than message size " + size
+ throw new ServerScopedRuntimeException("Offset " + offset + " is greater than message size " + size
+ " for message id " + messageId + "!");
}
@@ -1630,7 +1659,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
catch (SQLException e)
{
- throw new RuntimeException("Error retrieving content from offset " + offset + " for message " + messageId + ": " + e.getMessage(), e);
+ throw new ServerScopedRuntimeException("Error retrieving content from offset " + offset + " for message " + messageId + ": " + e.getMessage(), e);
}
finally
{
@@ -1662,12 +1691,12 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
catch (SQLException e)
{
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
}
@Override
- public void enqueueMessage(TransactionLogResource queue, EnqueueableMessage message) throws AMQStoreException
+ public void enqueueMessage(TransactionLogResource queue, EnqueueableMessage message)
{
final StoredMessage storedMessage = message.getStoredMessage();
if(storedMessage instanceof StoredJDBCMessage)
@@ -1678,52 +1707,100 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
catch (SQLException e)
{
- throw new AMQStoreException("Exception on enqueuing message " + _messageId, e);
+ throw new ServerScopedRuntimeException("Exception on enqueuing message into message store" + _messageId, e);
}
}
_storeSizeIncrease += storedMessage.getMetaData().getContentSize();
- AbstractJDBCMessageStore.this.enqueueMessage(_connWrapper, queue, message.getMessageNumber());
+ try
+ {
+ AbstractJDBCMessageStore.this.enqueueMessage(_connWrapper, queue, message.getMessageNumber());
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
@Override
- public void dequeueMessage(TransactionLogResource queue, EnqueueableMessage message) throws AMQStoreException
+ public void dequeueMessage(TransactionLogResource queue, EnqueueableMessage message)
{
- AbstractJDBCMessageStore.this.dequeueMessage(_connWrapper, queue, message.getMessageNumber());
+ try
+ {
+ AbstractJDBCMessageStore.this.dequeueMessage(_connWrapper, queue, message.getMessageNumber());
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
@Override
- public void commitTran() throws AMQStoreException
+ public void commitTran()
{
- AbstractJDBCMessageStore.this.commitTran(_connWrapper);
- storedSizeChange(_storeSizeIncrease);
+ try
+ {
+ AbstractJDBCMessageStore.this.commitTran(_connWrapper);
+ storedSizeChange(_storeSizeIncrease);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
@Override
- public StoreFuture commitTranAsync() throws AMQStoreException
+ public StoreFuture commitTranAsync()
{
- final StoreFuture storeFuture = AbstractJDBCMessageStore.this.commitTranAsync(_connWrapper);
- storedSizeChange(_storeSizeIncrease);
- return storeFuture;
+ try
+ {
+ StoreFuture storeFuture = AbstractJDBCMessageStore.this.commitTranAsync(_connWrapper);
+ storedSizeChange(_storeSizeIncrease);
+ return storeFuture;
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
@Override
- public void abortTran() throws AMQStoreException
+ public void abortTran()
{
- AbstractJDBCMessageStore.this.abortTran(_connWrapper);
+ try
+ {
+ AbstractJDBCMessageStore.this.abortTran(_connWrapper);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
@Override
- public void removeXid(long format, byte[] globalId, byte[] branchId) throws AMQStoreException
+ public void removeXid(long format, byte[] globalId, byte[] branchId)
{
- AbstractJDBCMessageStore.this.removeXid(_connWrapper, format, globalId, branchId);
+ try
+ {
+ AbstractJDBCMessageStore.this.removeXid(_connWrapper, format, globalId, branchId);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
@Override
public void recordXid(long format, byte[] globalId, byte[] branchId, Record[] enqueues, Record[] dequeues)
- throws AMQStoreException
{
- AbstractJDBCMessageStore.this.recordXid(_connWrapper, format, globalId, branchId, enqueues, dequeues);
+ try
+ {
+ AbstractJDBCMessageStore.this.recordXid(_connWrapper, format, globalId, branchId, enqueues, dequeues);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
}
@@ -1770,7 +1847,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
catch (SQLException e)
{
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
_metaDataRef = new SoftReference<StorableMessageMetaData>(metaData);
}
@@ -1856,7 +1933,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
{
getLogger().debug("Error when trying to flush message " + _messageId + " to store: " + e);
}
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
finally
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractMemoryMessageStore.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractMemoryMessageStore.java
index 1a7cd72cb6..d72bd1a5bf 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractMemoryMessageStore.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractMemoryMessageStore.java
@@ -22,7 +22,7 @@ package org.apache.qpid.server.store;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
-import org.apache.qpid.AMQStoreException;
+
import org.apache.qpid.server.message.EnqueueableMessage;
import org.apache.qpid.server.model.VirtualHost;
@@ -35,28 +35,28 @@ abstract public class AbstractMemoryMessageStore extends NullMessageStore
private static final Transaction IN_MEMORY_TRANSACTION = new Transaction()
{
@Override
- public StoreFuture commitTranAsync() throws AMQStoreException
+ public StoreFuture commitTranAsync()
{
return StoreFuture.IMMEDIATE_FUTURE;
}
@Override
- public void enqueueMessage(TransactionLogResource queue, EnqueueableMessage message) throws AMQStoreException
+ public void enqueueMessage(TransactionLogResource queue, EnqueueableMessage message)
{
}
@Override
- public void dequeueMessage(TransactionLogResource queue, EnqueueableMessage message) throws AMQStoreException
+ public void dequeueMessage(TransactionLogResource queue, EnqueueableMessage message)
{
}
@Override
- public void commitTran() throws AMQStoreException
+ public void commitTran()
{
}
@Override
- public void abortTran() throws AMQStoreException
+ public void abortTran()
{
}
@@ -80,14 +80,14 @@ abstract public class AbstractMemoryMessageStore extends NullMessageStore
}
@Override
- public void configureConfigStore(VirtualHost virtualHost, ConfigurationRecoveryHandler recoveryHandler) throws Exception
+ public void configureConfigStore(VirtualHost virtualHost, ConfigurationRecoveryHandler recoveryHandler)
{
_stateManager.attainState(State.INITIALISING);
}
@Override
public void configureMessageStore(VirtualHost virtualHost, MessageStoreRecoveryHandler recoveryHandler,
- TransactionLogRecoveryHandler tlogRecoveryHandler) throws Exception
+ TransactionLogRecoveryHandler tlogRecoveryHandler)
{
if(_stateManager.isInState(State.INITIAL))
{
@@ -97,7 +97,7 @@ abstract public class AbstractMemoryMessageStore extends NullMessageStore
}
@Override
- public void activate() throws Exception
+ public void activate()
{
if(_stateManager.isInState(State.INITIALISING))
@@ -131,7 +131,7 @@ abstract public class AbstractMemoryMessageStore extends NullMessageStore
}
@Override
- public void close() throws Exception
+ public void close()
{
if (_closed.compareAndSet(false, true))
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationRecoverer.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationRecoverer.java
index 1caaedf6dc..ced677b005 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationRecoverer.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationRecoverer.java
@@ -27,11 +27,11 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.server.configuration.IllegalConfigurationException;
import org.apache.qpid.server.logging.actors.CurrentActor;
import org.apache.qpid.server.logging.messages.ConfigStoreMessages;
import org.apache.qpid.server.logging.subjects.MessageStoreLogSubject;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import static org.apache.qpid.server.model.VirtualHost.CURRENT_CONFIG_VERSION;
@@ -138,7 +138,7 @@ public class DurableConfigurationRecoverer implements ConfigurationRecoveryHandl
catch (AMQStoreException e)
{
// TODO better exception
- throw new RuntimeException("Unable to update config store when upgrading");
+ throw new ServerScopedRuntimeException("Unable to update config store when upgrading");
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStore.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStore.java
index 9c9ce7df59..6c90247ebc 100755
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStore.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStore.java
@@ -23,7 +23,6 @@ package org.apache.qpid.server.store;
import java.util.Map;
import java.util.UUID;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.server.model.VirtualHost;
public interface DurableConfigurationStore
@@ -44,9 +43,8 @@ public interface DurableConfigurationStore
*
* @param virtualHost
* @param recoveryHandler Handler to be called as the store recovers on start up
- * @throws Exception If any error occurs that means the store is unable to configure itself.
*/
- void configureConfigStore(VirtualHost virtualHost, ConfigurationRecoveryHandler recoveryHandler) throws Exception;
+ void configureConfigStore(VirtualHost virtualHost, ConfigurationRecoveryHandler recoveryHandler);
/**
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStoreHelper.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStoreHelper.java
index eff9bdf433..50837d433e 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStoreHelper.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStoreHelper.java
@@ -28,13 +28,13 @@ import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
-import org.apache.qpid.AMQStoreException;
-import org.apache.qpid.server.consumer.Consumer;
+
import org.apache.qpid.server.model.Binding;
import org.apache.qpid.server.model.Exchange;
import org.apache.qpid.server.model.LifetimePolicy;
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.queue.AMQQueue;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class DurableConfigurationStoreHelper
{
@@ -47,7 +47,7 @@ public class DurableConfigurationStoreHelper
Queue.EXCLUSIVE,
Queue.ALTERNATE_EXCHANGE));
- public static void updateQueue(DurableConfigurationStore store, AMQQueue<?,?,?> queue) throws AMQStoreException
+ public static void updateQueue(DurableConfigurationStore store, AMQQueue<?,?,?> queue)
{
Map<String, Object> attributesMap = new LinkedHashMap<String, Object>();
attributesMap.put(Queue.NAME, queue.getName());
@@ -69,11 +69,17 @@ public class DurableConfigurationStoreHelper
}
}
- store.update(queue.getId(), QUEUE, attributesMap);
+ try
+ {
+ store.update(queue.getId(), QUEUE, attributesMap);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem was encountered with the configuration store ", e);
+ }
}
public static void createQueue(DurableConfigurationStore store, AMQQueue<?,?,?> queue)
- throws AMQStoreException
{
Map<String, Object> attributesMap = new HashMap<String, Object>();
attributesMap.put(Queue.NAME, queue.getName());
@@ -91,35 +97,60 @@ public class DurableConfigurationStoreHelper
attributesMap.put(attrName, queue.getAttribute(attrName));
}
}
- store.create(queue.getId(), QUEUE,attributesMap);
+ try
+ {
+ store.create(queue.getId(), QUEUE, attributesMap);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem was encountered with the configuration store ", e);
+ }
}
- public static void removeQueue(DurableConfigurationStore store, AMQQueue queue) throws AMQStoreException
+ public static void removeQueue(DurableConfigurationStore store, AMQQueue queue)
{
- store.remove(queue.getId(), QUEUE);
+ try
+ {
+ store.remove(queue.getId(), QUEUE);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem was encountered with the configuration store ", e);
+ }
}
public static void createExchange(DurableConfigurationStore store, org.apache.qpid.server.exchange.Exchange exchange)
- throws AMQStoreException
{
Map<String, Object> attributesMap = new HashMap<String, Object>();
attributesMap.put(Exchange.NAME, exchange.getName());
attributesMap.put(Exchange.TYPE, exchange.getTypeName());
attributesMap.put(Exchange.LIFETIME_POLICY, exchange.isAutoDelete() ? LifetimePolicy.AUTO_DELETE.name()
: LifetimePolicy.PERMANENT.name());
- store.create(exchange.getId(), EXCHANGE, attributesMap);
+ try
+ {
+ store.create(exchange.getId(), EXCHANGE, attributesMap);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem was encountered with the configuration store ", e);
+ }
}
public static void removeExchange(DurableConfigurationStore store, org.apache.qpid.server.exchange.Exchange exchange)
- throws AMQStoreException
{
- store.remove(exchange.getId(), EXCHANGE);
+ try
+ {
+ store.remove(exchange.getId(), EXCHANGE);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem was encountered with the configuration store ", e);
+ }
}
public static void createBinding(DurableConfigurationStore store, org.apache.qpid.server.binding.Binding binding)
- throws AMQStoreException
{
Map<String, Object> attributesMap = new HashMap<String, Object>();
attributesMap.put(Binding.NAME, binding.getBindingKey());
@@ -130,14 +161,27 @@ public class DurableConfigurationStoreHelper
{
attributesMap.put(Binding.ARGUMENTS, arguments);
}
- store.create(binding.getId(), BINDING, attributesMap);
+ try
+ {
+ store.create(binding.getId(), BINDING, attributesMap);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem was encountered with the configuration store ", e);
+ }
}
public static void removeBinding(DurableConfigurationStore store, org.apache.qpid.server.binding.Binding binding)
- throws AMQStoreException
{
- store.remove(binding.getId(), BINDING);
+ try
+ {
+ store.remove(binding.getId(), BINDING);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem was encountered with the configuration store ", e);
+ }
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java
index 9b20c9a780..c80158965c 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java
@@ -34,10 +34,13 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-import org.apache.qpid.AMQStoreException;
+
import org.apache.qpid.server.model.ConfiguredObject;
import org.apache.qpid.server.model.Model;
import org.apache.qpid.server.model.VirtualHost;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.SerializationConfig;
@@ -66,14 +69,13 @@ public class JsonFileConfigStore implements DurableConfigurationStore
@Override
public void configureConfigStore(final VirtualHost virtualHost, final ConfigurationRecoveryHandler recoveryHandler)
- throws Exception
{
_name = virtualHost.getName();
Object storePathAttr = virtualHost.getAttribute(VirtualHost.CONFIG_STORE_PATH);
if(!(storePathAttr instanceof String))
{
- throw new AMQStoreException("Cannot determine path for configuration storage");
+ throw new ServerScopedRuntimeException("Cannot determine path for configuration storage");
}
_directoryName = (String) storePathAttr;
_configFileName = _name + ".json";
@@ -86,7 +88,14 @@ public class JsonFileConfigStore implements DurableConfigurationStore
if(!fileExists(_backupFileName))
{
File newFile = new File(_directoryName, _configFileName);
- _objectMapper.writeValue(newFile, Collections.emptyMap());
+ try
+ {
+ _objectMapper.writeValue(newFile, Collections.emptyMap());
+ }
+ catch (IOException e)
+ {
+ throw new ServerScopedRuntimeException("Could not write configuration file " + newFile, e);
+ }
}
else
{
@@ -110,21 +119,21 @@ public class JsonFileConfigStore implements DurableConfigurationStore
}
}
- private void renameFile(String fromFileName, String toFileName) throws AMQStoreException
+ private void renameFile(String fromFileName, String toFileName)
{
File toFile = new File(_directoryName, toFileName);
if(toFile.exists())
{
if(!toFile.delete())
{
- throw new AMQStoreException("Cannot delete file " + toFile.getAbsolutePath());
+ throw new ServerScopedRuntimeException("Cannot delete file " + toFile.getAbsolutePath());
}
}
File fromFile = new File(_directoryName, fromFileName);
if(!fromFile.renameTo(toFile))
{
- throw new AMQStoreException("Cannot rename file " + fromFile.getAbsolutePath() + " to " + toFile.getAbsolutePath());
+ throw new ServerScopedRuntimeException("Cannot rename file " + fromFile.getAbsolutePath() + " to " + toFile.getAbsolutePath());
}
}
@@ -134,7 +143,7 @@ public class JsonFileConfigStore implements DurableConfigurationStore
return file.exists();
}
- private void getFileLock() throws AMQStoreException
+ private void getFileLock()
{
File lockFile = new File(_directoryName, _name + ".lck");
try
@@ -149,7 +158,7 @@ public class JsonFileConfigStore implements DurableConfigurationStore
}
catch (IOException ioe)
{
- throw new AMQStoreException("Cannot create the lock file " + lockFile.getName(), ioe);
+ throw new ServerScopedRuntimeException("Cannot create the lock file " + lockFile.getName(), ioe);
}
catch(OverlappingFileLockException e)
{
@@ -158,11 +167,11 @@ public class JsonFileConfigStore implements DurableConfigurationStore
if(_fileLock == null)
{
- throw new AMQStoreException("Cannot get lock on file " + lockFile.getAbsolutePath() + ". Is another instance running?");
+ throw new ServerScopedRuntimeException("Cannot get lock on file " + lockFile.getAbsolutePath() + ". Is another instance running?");
}
}
- private void checkDirectoryIsWritable(String directoryName) throws AMQStoreException
+ private void checkDirectoryIsWritable(String directoryName)
{
File dir = new File(directoryName);
if(dir.exists())
@@ -171,51 +180,68 @@ public class JsonFileConfigStore implements DurableConfigurationStore
{
if(!dir.canWrite())
{
- throw new AMQStoreException("Configuration path " + directoryName + " exists, but is not writable");
+ throw new ServerScopedRuntimeException("Configuration path " + directoryName + " exists, but is not writable");
}
}
else
{
- throw new AMQStoreException("Configuration path " + directoryName + " exists, but is not a directory");
+ throw new ServerScopedRuntimeException("Configuration path " + directoryName + " exists, but is not a directory");
}
}
else if(!dir.mkdirs())
{
- throw new AMQStoreException("Cannot create directory " + directoryName);
+ throw new ServerScopedRuntimeException("Cannot create directory " + directoryName);
}
}
- private void load() throws IOException
+ private void load()
{
- Map data = _objectMapper.readValue(new File(_directoryName,_configFileName),Map.class);
- Collection<Class<? extends ConfiguredObject>> childClasses =
- MODEL.getChildTypes(VirtualHost.class);
- data.remove("modelVersion");
- Object configVersion;
- if((configVersion = data.remove("configVersion")) instanceof Integer)
- {
- _configVersion = (Integer) configVersion;
- }
- for(Class<? extends ConfiguredObject> childClass : childClasses)
+ final File configFile = new File(_directoryName, _configFileName);
+ try
{
- final String type = childClass.getSimpleName();
- String attrName = type.toLowerCase() + "s";
- Object children = data.remove(attrName);
- if(children != null)
+ Map data = _objectMapper.readValue(configFile,Map.class);
+ Collection<Class<? extends ConfiguredObject>> childClasses =
+ MODEL.getChildTypes(VirtualHost.class);
+ data.remove("modelVersion");
+ Object configVersion;
+ if((configVersion = data.remove("configVersion")) instanceof Integer)
{
- if(children instanceof Collection)
+ _configVersion = (Integer) configVersion;
+ }
+ for(Class<? extends ConfiguredObject> childClass : childClasses)
+ {
+ final String type = childClass.getSimpleName();
+ String attrName = type.toLowerCase() + "s";
+ Object children = data.remove(attrName);
+ if(children != null)
{
- for(Object child : (Collection)children)
+ if(children instanceof Collection)
{
- if(child instanceof Map)
+ for(Object child : (Collection)children)
{
- loadChild(childClass, (Map)child, VirtualHost.class, null);
+ if(child instanceof Map)
+ {
+ loadChild(childClass, (Map)child, VirtualHost.class, null);
+ }
}
}
}
}
}
+ catch (JsonMappingException e)
+ {
+ throw new ServerScopedRuntimeException("Cannot parse the configuration file " + configFile, e);
+ }
+ catch (JsonParseException e)
+ {
+ throw new ServerScopedRuntimeException("Cannot parse the configuration file " + configFile, e);
+ }
+ catch (IOException e)
+ {
+ throw new ServerScopedRuntimeException("Could not load the configuration file " + configFile, e);
+ }
+
}
private void loadChild(final Class<? extends ConfiguredObject> clazz,
@@ -311,7 +337,7 @@ public class JsonFileConfigStore implements DurableConfigurationStore
}
}
- private void save() throws AMQStoreException
+ private void save()
{
Collection<Class<? extends ConfiguredObject>> childClasses =
MODEL.getChildTypes(VirtualHost.class);
@@ -351,7 +377,7 @@ public class JsonFileConfigStore implements DurableConfigurationStore
}
catch (IOException e)
{
- throw new AMQStoreException("Cannot save to store", e);
+ throw new ServerScopedRuntimeException("Cannot save to store", e);
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/MessageStore.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/MessageStore.java
index 996d71d51d..626b999d72 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/MessageStore.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/MessageStore.java
@@ -41,9 +41,9 @@ public interface MessageStore
* @throws Exception If any error occurs that means the store is unable to configure itself.
*/
void configureMessageStore(VirtualHost virtualHost, MessageStoreRecoveryHandler messageRecoveryHandler,
- TransactionLogRecoveryHandler tlogRecoveryHandler) throws Exception;
+ TransactionLogRecoveryHandler tlogRecoveryHandler);
- void activate() throws Exception;
+ void activate();
public <T extends StorableMessageMetaData> StoredMessage<T> addMessage(T metaData);
@@ -62,7 +62,7 @@ public interface MessageStore
*
* @throws Exception If the close fails.
*/
- void close() throws Exception;
+ void close();
void addEventListener(EventListener eventListener, Event... events);
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/NullMessageStore.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/NullMessageStore.java
index 57dbfabaa4..9100d623cd 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/NullMessageStore.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/NullMessageStore.java
@@ -21,13 +21,13 @@ package org.apache.qpid.server.store;
import java.util.Map;
import java.util.UUID;
-import org.apache.qpid.AMQStoreException;
+
import org.apache.qpid.server.model.VirtualHost;
public abstract class NullMessageStore implements MessageStore, DurableConfigurationStore
{
@Override
- public void configureConfigStore(VirtualHost virtualHost, ConfigurationRecoveryHandler recoveryHandler) throws Exception
+ public void configureConfigStore(VirtualHost virtualHost, ConfigurationRecoveryHandler recoveryHandler)
{
}
@@ -37,12 +37,12 @@ public abstract class NullMessageStore implements MessageStore, DurableConfigura
}
@Override
- public void update(ConfiguredObjectRecord... records) throws AMQStoreException
+ public void update(ConfiguredObjectRecord... records)
{
}
@Override
- public void update(boolean createIfNecessary, ConfiguredObjectRecord... records) throws AMQStoreException
+ public void update(boolean createIfNecessary, ConfiguredObjectRecord... records)
{
}
@@ -53,7 +53,7 @@ public abstract class NullMessageStore implements MessageStore, DurableConfigura
}
@Override
- public UUID[] removeConfiguredObjects(final UUID... objects) throws AMQStoreException
+ public UUID[] removeConfiguredObjects(final UUID... objects)
{
return objects;
}
@@ -65,12 +65,12 @@ public abstract class NullMessageStore implements MessageStore, DurableConfigura
@Override
public void configureMessageStore(VirtualHost virtualHost, MessageStoreRecoveryHandler recoveryHandler,
- TransactionLogRecoveryHandler tlogRecoveryHandler) throws Exception
+ TransactionLogRecoveryHandler tlogRecoveryHandler)
{
}
@Override
- public void close() throws Exception
+ public void close()
{
}
@@ -93,7 +93,7 @@ public abstract class NullMessageStore implements MessageStore, DurableConfigura
}
@Override
- public void activate() throws Exception
+ public void activate()
{
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/Transaction.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/Transaction.java
index 74b91dec2d..6f7afccac0 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/Transaction.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/Transaction.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.store;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.server.message.EnqueueableMessage;
public interface Transaction
@@ -32,40 +31,35 @@ public interface Transaction
*
* @param queue The queue to place the message on.
* @param message
- * @throws org.apache.qpid.AMQStoreException If the operation fails for any reason.
*/
- void enqueueMessage(TransactionLogResource queue, EnqueueableMessage message) throws AMQStoreException;
+ void enqueueMessage(TransactionLogResource queue, EnqueueableMessage message);
/**
* Extracts a message from a specified queue, in a given transactional context.
*
* @param queue The queue to place the message on.
* @param message The message to dequeue.
- * @throws AMQStoreException If the operation fails for any reason, or if the specified message does not exist.
*/
- void dequeueMessage(TransactionLogResource queue, EnqueueableMessage message) throws AMQStoreException;
+ void dequeueMessage(TransactionLogResource queue, EnqueueableMessage message);
/**
* Commits all operations performed within a given transactional context.
*
- * @throws AMQStoreException If the operation fails for any reason.
*/
- void commitTran() throws AMQStoreException;
+ void commitTran();
/**
* Commits all operations performed within a given transactional context.
*
- * @throws AMQStoreException If the operation fails for any reason.
*/
- StoreFuture commitTranAsync() throws AMQStoreException;
+ StoreFuture commitTranAsync();
/**
* Abandons all operations performed within a given transactional context.
*
- * @throws AMQStoreException If the operation fails for any reason.
*/
- void abortTran() throws AMQStoreException;
+ void abortTran();
public static interface Record
@@ -74,8 +68,8 @@ public interface Transaction
EnqueueableMessage getMessage();
}
- void removeXid(long format, byte[] globalId, byte[] branchId) throws AMQStoreException;
+ void removeXid(long format, byte[] globalId, byte[] branchId);
- void recordXid(long format, byte[] globalId, byte[] branchId, Transaction.Record[] enqueues, Transaction.Record[] dequeues)
- throws AMQStoreException;
+ void recordXid(long format, byte[] globalId, byte[] branchId, Transaction.Record[] enqueues,
+ Transaction.Record[] dequeues);
} \ No newline at end of file
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/AsyncAutoCommitTransaction.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/AsyncAutoCommitTransaction.java
index 57c67f54cd..013e9f32ed 100755
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/AsyncAutoCommitTransaction.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/AsyncAutoCommitTransaction.java
@@ -22,13 +22,10 @@ package org.apache.qpid.server.txn;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.server.message.EnqueueableMessage;
import org.apache.qpid.server.message.MessageInstance;
import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.queue.BaseQueue;
-import org.apache.qpid.server.queue.QueueEntry;
import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.StoreFuture;
import org.apache.qpid.server.store.Transaction;
@@ -116,11 +113,6 @@ public class AsyncAutoCommitTransaction implements ServerTransaction
addFuture(future, postTransactionAction);
postTransactionAction = null;
}
- catch (AMQException e)
- {
- _logger.error("Error during message dequeue", e);
- throw new RuntimeException("Error during message dequeue", e);
- }
finally
{
rollbackIfNecessary(postTransactionAction, txn);
@@ -199,11 +191,6 @@ public class AsyncAutoCommitTransaction implements ServerTransaction
addFuture(future, postTransactionAction);
postTransactionAction = null;
}
- catch (AMQException e)
- {
- _logger.error("Error during message dequeues", e);
- throw new RuntimeException("Error during message dequeues", e);
- }
finally
{
rollbackIfNecessary(postTransactionAction, txn);
@@ -236,13 +223,7 @@ public class AsyncAutoCommitTransaction implements ServerTransaction
}
addEnqueueFuture(future, postTransactionAction, message.isPersistent());
postTransactionAction = null;
- }
- catch (AMQException e)
- {
- _logger.error("Error during message enqueue", e);
- throw new RuntimeException("Error during message enqueue", e);
- }
- finally
+ }finally
{
rollbackIfNecessary(postTransactionAction, txn);
}
@@ -292,13 +273,7 @@ public class AsyncAutoCommitTransaction implements ServerTransaction
postTransactionAction = null;
- }
- catch (AMQException e)
- {
- _logger.error("Error during message enqueues", e);
- throw new RuntimeException("Error during message enqueues", e);
- }
- finally
+ }finally
{
rollbackIfNecessary(postTransactionAction, txn);
}
@@ -341,17 +316,7 @@ public class AsyncAutoCommitTransaction implements ServerTransaction
{
if (txn != null)
{
- try
- {
- txn.abortTran();
- }
- catch (AMQStoreException e)
- {
- _logger.error("Abort transaction failed", e);
- // Deliberate decision not to re-throw this exception. Rationale: we can only reach here if a previous
- // TransactionLog method has ended in Exception. If we were to re-throw here, we would prevent
- // our caller from receiving the original exception (which is likely to be more revealing of the underlying error).
- }
+ txn.abortTran();
}
if (postTransactionAction != null)
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/AutoCommitTransaction.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/AutoCommitTransaction.java
index 4ea48c6a24..15a5513e11 100755
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/AutoCommitTransaction.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/AutoCommitTransaction.java
@@ -22,13 +22,10 @@ package org.apache.qpid.server.txn;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.server.message.EnqueueableMessage;
import org.apache.qpid.server.message.MessageInstance;
import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.queue.BaseQueue;
-import org.apache.qpid.server.queue.QueueEntry;
import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.Transaction;
import org.apache.qpid.server.store.TransactionLogResource;
@@ -95,11 +92,6 @@ public class AutoCommitTransaction implements ServerTransaction
postTransactionAction.postCommit();
postTransactionAction = null;
}
- catch (AMQException e)
- {
- _logger.error("Error during message dequeue", e);
- throw new RuntimeException("Error during message dequeue", e);
- }
finally
{
rollbackIfNecessary(postTransactionAction, txn);
@@ -140,13 +132,7 @@ public class AutoCommitTransaction implements ServerTransaction
}
postTransactionAction.postCommit();
postTransactionAction = null;
- }
- catch (AMQException e)
- {
- _logger.error("Error during message dequeues", e);
- throw new RuntimeException("Error during message dequeues", e);
- }
- finally
+ }finally
{
rollbackIfNecessary(postTransactionAction, txn);
}
@@ -174,11 +160,6 @@ public class AutoCommitTransaction implements ServerTransaction
postTransactionAction.postCommit();
postTransactionAction = null;
}
- catch (AMQException e)
- {
- _logger.error("Error during message enqueue", e);
- throw new RuntimeException("Error during message enqueue", e);
- }
finally
{
rollbackIfNecessary(postTransactionAction, txn);
@@ -225,13 +206,7 @@ public class AutoCommitTransaction implements ServerTransaction
postTransactionAction = null;
- }
- catch (AMQException e)
- {
- _logger.error("Error during message enqueues", e);
- throw new RuntimeException("Error during message enqueues", e);
- }
- finally
+ }finally
{
rollbackIfNecessary(postTransactionAction, txn);
}
@@ -261,17 +236,7 @@ public class AutoCommitTransaction implements ServerTransaction
{
if (txn != null)
{
- try
- {
- txn.abortTran();
- }
- catch (AMQStoreException e)
- {
- _logger.error("Abort transaction failed", e);
- // Deliberate decision not to re-throw this exception. Rationale: we can only reach here if a previous
- // TransactionLog method has ended in Exception. If we were to re-throw here, we would prevent
- // our caller from receiving the original exception (which is likely to be more revealing of the underlying error).
- }
+ txn.abortTran();
}
if (postTransactionAction != null)
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DtxBranch.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DtxBranch.java
index 2505548ab8..fc16f8a367 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DtxBranch.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DtxBranch.java
@@ -28,13 +28,13 @@ import java.util.Map;
import java.util.concurrent.ScheduledFuture;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQStoreException;
+import org.apache.qpid.server.store.AMQStoreException;
import org.apache.qpid.server.message.EnqueueableMessage;
import org.apache.qpid.server.protocol.AMQSessionModel;
-import org.apache.qpid.server.queue.BaseQueue;
import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.Transaction;
import org.apache.qpid.server.store.TransactionLogResource;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.transport.Xid;
@@ -154,7 +154,7 @@ public class DtxBranch
catch (AMQStoreException e)
{
_logger.error("Unexpected error when attempting to rollback DtxBranch "+ _xid + " due to timeout", e);
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
}
});
@@ -400,15 +400,8 @@ public class DtxBranch
{
if(_transaction != null)
{
- try
- {
- _state = null;
- _transaction.abortTran();
- }
- catch(AMQStoreException e)
- {
- _logger.error("Error while closing DtxBranch " + _xid, e);
- }
+ _state = null;
+ _transaction.abortTran();
}
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DtxRegistry.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DtxRegistry.java
index 117beb82ef..90604b643e 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DtxRegistry.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DtxRegistry.java
@@ -25,7 +25,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.qpid.AMQStoreException;
+import org.apache.qpid.server.store.AMQStoreException;
import org.apache.qpid.server.protocol.AMQSessionModel;
import org.apache.qpid.transport.Xid;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/LocalTransaction.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/LocalTransaction.java
index 4b02d4f8ec..b3d013c99f 100755
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/LocalTransaction.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/LocalTransaction.java
@@ -27,10 +27,8 @@ import org.apache.qpid.server.store.TransactionLogResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.queue.BaseQueue;
-import org.apache.qpid.server.queue.QueueEntry;
import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.Transaction;
@@ -110,11 +108,9 @@ public class LocalTransaction implements ServerTransaction
beginTranIfNecessary();
_transaction.dequeueMessage(queue, message);
-
}
- catch(AMQException e)
+ catch(RuntimeException e)
{
- _logger.error("Error during message dequeues", e);
tidyUpOnError(e);
}
}
@@ -143,17 +139,16 @@ public class LocalTransaction implements ServerTransaction
beginTranIfNecessary();
_transaction.dequeueMessage(queue, message);
}
-
}
+
}
- catch(AMQException e)
+ catch(RuntimeException e)
{
- _logger.error("Error during message dequeues", e);
tidyUpOnError(e);
}
}
- private void tidyUpOnError(Exception e)
+ private void tidyUpOnError(RuntimeException e)
{
try
{
@@ -168,32 +163,20 @@ public class LocalTransaction implements ServerTransaction
_transaction.abortTran();
}
}
- catch (Exception abortException)
- {
- _logger.error("Abort transaction failed while trying to handle previous error", abortException);
- }
finally
{
- resetDetails();
+ resetDetails();
}
}
- throw new RuntimeException(e);
+ throw e;
}
-
private void beginTranIfNecessary()
{
if(_transaction == null)
{
- try
- {
- _transaction = _transactionLog.newTransaction();
- }
- catch (Exception e)
- {
- tidyUpOnError(e);
- }
+ _transaction = _transactionLog.newTransaction();
}
}
@@ -215,10 +198,8 @@ public class LocalTransaction implements ServerTransaction
beginTranIfNecessary();
_transaction.enqueueMessage(queue, message);
}
- catch (Exception e)
+ catch(RuntimeException e)
{
- _logger.error("Error during message enqueue", e);
-
tidyUpOnError(e);
}
}
@@ -245,14 +226,12 @@ public class LocalTransaction implements ServerTransaction
beginTranIfNecessary();
_transaction.enqueueMessage(queue, message);
+
}
}
-
}
- catch (Exception e)
+ catch(RuntimeException e)
{
- _logger.error("Error during message enqueue", e);
-
tidyUpOnError(e);
}
}
@@ -281,12 +260,10 @@ public class LocalTransaction implements ServerTransaction
doPostTransactionActions();
}
- catch (Exception e)
+ catch(RuntimeException e)
{
- _logger.error("Failed to commit transaction", e);
-
doRollbackActions();
- throw new RuntimeException("Failed to commit transaction", e);
+ throw e;
}
finally
{
@@ -348,14 +325,11 @@ public class LocalTransaction implements ServerTransaction
{
doPostTransactionActions();
deferred.run();
-
}
- catch (Exception e)
+ catch (RuntimeException e)
{
- _logger.error("Failed to commit transaction", e);
-
doRollbackActions();
- throw new RuntimeException("Failed to commit transaction", e);
+ throw e;
}
finally
{
@@ -371,7 +345,6 @@ public class LocalTransaction implements ServerTransaction
try
{
doPostTransactionActions();
-
deferred.run();
}
finally
@@ -382,9 +355,8 @@ public class LocalTransaction implements ServerTransaction
return future;
}
- catch (Exception e)
+ catch (RuntimeException e)
{
- _logger.error("Failed to commit transaction", e);
try
{
doRollbackActions();
@@ -393,8 +365,9 @@ public class LocalTransaction implements ServerTransaction
{
resetDetails();
}
- throw new RuntimeException("Failed to commit transaction", e);
+ throw e;
}
+
}
private void doPostTransactionActions()
@@ -425,11 +398,6 @@ public class LocalTransaction implements ServerTransaction
_transaction.abortTran();
}
}
- catch (AMQException e)
- {
- _logger.error("Failed to rollback transaction", e);
- throw new RuntimeException("Failed to rollback transaction", e);
- }
finally
{
try
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/ConnectionScopedRuntimeException.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/ConnectionScopedRuntimeException.java
index 7161846ef5..a7b527f169 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/ConnectionScopedRuntimeException.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/ConnectionScopedRuntimeException.java
@@ -20,32 +20,29 @@
*/
package org.apache.qpid.server.util;
+import org.apache.log4j.Logger;
+
public class ConnectionScopedRuntimeException extends RuntimeException
{
- public ConnectionScopedRuntimeException()
- {
- }
+ private static final Logger LOGGER = Logger.getLogger(ConnectionScopedRuntimeException.class);
+
public ConnectionScopedRuntimeException(final String message)
{
super(message);
+ LOGGER.error(message);
}
public ConnectionScopedRuntimeException(final String message, final Throwable cause)
{
super(message, cause);
+ LOGGER.error(message,cause);
}
public ConnectionScopedRuntimeException(final Throwable cause)
{
super(cause);
+ LOGGER.error("Exception occurred", cause);
}
- public ConnectionScopedRuntimeException(final String message,
- final Throwable cause,
- final boolean enableSuppression,
- final boolean writableStackTrace)
- {
- super(message, cause, enableSuppression, writableStackTrace);
- }
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/MapJsonSerializer.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/MapJsonSerializer.java
index 2d9ba38555..bd68c9e057 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/MapJsonSerializer.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/MapJsonSerializer.java
@@ -48,7 +48,7 @@ public class MapJsonSerializer
}
catch (Exception e)
{
- throw new RuntimeException("Failure to serialize map:" + attributeMap, e);
+ throw new ConnectionScopedRuntimeException("Failure to serialize map:" + attributeMap, e);
}
return stringWriter.toString();
}
@@ -62,7 +62,7 @@ public class MapJsonSerializer
}
catch (Exception e)
{
- throw new RuntimeException("Failure to deserialize json:" + json, e);
+ throw new ConnectionScopedRuntimeException("Failure to deserialize json:" + json, e);
}
return attributesMap;
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/ServerScopedRuntimeException.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/ServerScopedRuntimeException.java
index 8df7b0489c..93ba639af0 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/ServerScopedRuntimeException.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/ServerScopedRuntimeException.java
@@ -20,32 +20,29 @@
*/
package org.apache.qpid.server.util;
+import org.apache.log4j.Logger;
+
public class ServerScopedRuntimeException extends RuntimeException
{
- public ServerScopedRuntimeException()
- {
- }
+ private static final Logger LOGGER = Logger.getLogger(ServerScopedRuntimeException.class);
public ServerScopedRuntimeException(final String message)
{
super(message);
+ LOGGER.error(message);
+
}
public ServerScopedRuntimeException(final String message, final Throwable cause)
{
super(message, cause);
+ LOGGER.error(message, cause);
}
public ServerScopedRuntimeException(final Throwable cause)
{
super(cause);
+ LOGGER.error("Exception occurred", cause);
}
- public ServerScopedRuntimeException(final String message,
- final Throwable cause,
- final boolean enableSuppression,
- final boolean writableStackTrace)
- {
- super(message, cause, enableSuppression, writableStackTrace);
- }
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
index 88cd025728..aa70bb3e8d 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
@@ -33,7 +33,7 @@ import java.util.concurrent.TimeUnit;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
+import org.apache.qpid.server.exchange.AMQUnknownExchangeType;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.server.configuration.ExchangeConfiguration;
import org.apache.qpid.server.configuration.QueueConfiguration;
@@ -70,7 +70,7 @@ import org.apache.qpid.server.store.DurableConfiguredObjectRecoverer;
import org.apache.qpid.server.store.Event;
import org.apache.qpid.server.store.EventListener;
import org.apache.qpid.server.txn.DtxRegistry;
-import org.apache.qpid.server.virtualhost.plugins.QueueExistsException;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public abstract class AbstractVirtualHost implements VirtualHost, IConnectionRegistry.RegistryChangeListener, EventListener
{
@@ -125,7 +125,7 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
StatisticsGatherer brokerStatisticsGatherer,
SecurityManager parentSecurityManager,
VirtualHostConfiguration hostConfig,
- org.apache.qpid.server.model.VirtualHost virtualHost) throws Exception
+ org.apache.qpid.server.model.VirtualHost virtualHost)
{
if (hostConfig == null)
{
@@ -185,7 +185,7 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
}
abstract protected void initialiseStorage(VirtualHostConfiguration hostConfig,
- org.apache.qpid.server.model.VirtualHost virtualHost) throws Exception;
+ org.apache.qpid.server.model.VirtualHost virtualHost);
public IConnectionRegistry getConnectionRegistry()
{
@@ -293,17 +293,36 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
protected void initialiseModel(VirtualHostConfiguration config)
- throws ConfigurationException, AMQException, QpidSecurityException
{
_logger.debug("Loading configuration for virtualhost: " + config.getName());
+
_exchangeRegistry.initialise(_exchangeFactory);
List<String> exchangeNames = config.getExchanges();
for (String exchangeName : exchangeNames)
{
- configureExchange(config.getExchangeConfiguration(exchangeName));
+ try
+ {
+ configureExchange(config.getExchangeConfiguration(exchangeName));
+ }
+ catch (QpidSecurityException e)
+ {
+ throw new ServerScopedRuntimeException("Could not configure exchange " + exchangeName, e);
+ }
+ catch (UnknownExchangeException e)
+ {
+ throw new ServerScopedRuntimeException("Could not configure exchange " + exchangeName, e);
+ }
+ catch (ReservedExchangeNameException e)
+ {
+ throw new ServerScopedRuntimeException("Could not configure exchange " + exchangeName, e);
+ }
+ catch (AMQUnknownExchangeType e)
+ {
+ throw new ServerScopedRuntimeException("Could not configure exchange " + exchangeName, e);
+ }
}
String[] queueNames = config.getQueueNames();
@@ -311,12 +330,24 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
for (Object queueNameObj : queueNames)
{
String queueName = String.valueOf(queueNameObj);
- configureQueue(config.getQueueConfiguration(queueName));
+ try
+ {
+ configureQueue(config.getQueueConfiguration(queueName));
+ }
+ catch (ConfigurationException e)
+ {
+ throw new ServerScopedRuntimeException("Could not configure queue " + queueName, e);
+ }
+ catch (QpidSecurityException e)
+ {
+ throw new ServerScopedRuntimeException("Could not configure queue " + queueName, e);
+ }
}
}
private void configureExchange(ExchangeConfiguration exchangeConfiguration)
- throws AMQException, QpidSecurityException
+ throws QpidSecurityException, UnknownExchangeException, ReservedExchangeNameException,
+ AMQUnknownExchangeType
{
boolean durable = exchangeConfiguration.getDurable();
boolean autodelete = exchangeConfiguration.getAutoDelete();
@@ -333,7 +364,7 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
}
private void configureQueue(QueueConfiguration queueConfiguration)
- throws AMQException, ConfigurationException, QpidSecurityException
+ throws ConfigurationException, QpidSecurityException
{
AMQQueue queue = _queueFactory.createAMQQueueImpl(queueConfiguration);
String queueName = queue.getName();
@@ -384,7 +415,7 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
}
private void configureBinding(AMQQueue queue, Exchange exchange, String routingKey, Map<String,Object> arguments)
- throws AMQException, QpidSecurityException
+ throws QpidSecurityException
{
if (_logger.isInfoEnabled())
{
@@ -491,7 +522,7 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
}
@Override
- public int removeQueue(AMQQueue queue) throws AMQException, QpidSecurityException
+ public int removeQueue(AMQQueue queue) throws QpidSecurityException
{
synchronized (getQueueRegistry())
{
@@ -515,7 +546,7 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
boolean autoDelete,
boolean exclusive,
boolean deleteOnNoConsumer,
- Map<String, Object> arguments) throws AMQException, QpidSecurityException
+ Map<String, Object> arguments) throws QpidSecurityException, QueueExistsException
{
if (queueName == null)
@@ -607,7 +638,8 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
boolean durable,
boolean autoDelete,
String alternateExchangeName)
- throws AMQException, QpidSecurityException
+ throws QpidSecurityException, ExchangeExistsException, ReservedExchangeNameException,
+ UnknownExchangeException, AMQUnknownExchangeType
{
synchronized (_exchangeRegistry)
{
@@ -653,7 +685,8 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
}
@Override
- public void removeExchange(Exchange exchange, boolean force) throws AMQException, QpidSecurityException
+ public void removeExchange(Exchange exchange, boolean force)
+ throws QpidSecurityException, ExchangeIsAlternateException, RequiredExchangeException
{
if(exchange.hasReferrers())
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/BindingRecoverer.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/BindingRecoverer.java
index 7a034647b0..6aa572d81a 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/BindingRecoverer.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/BindingRecoverer.java
@@ -25,7 +25,6 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.binding.Binding;
import org.apache.qpid.server.exchange.Exchange;
import org.apache.qpid.server.exchange.ExchangeRegistry;
@@ -120,10 +119,6 @@ public class BindingRecoverer extends AbstractDurableConfiguredObjectRecoverer<B
}
return _exchange.getBinding(_bindingName, _queue, _bindingArgumentsMap);
}
- catch (AMQException e)
- {
- throw new RuntimeException(e);
- }
catch (QpidSecurityException e)
{
throw new ServerScopedRuntimeException("Security Exception thrown when recovering. The recovery " +
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeExistsException.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeExistsException.java
index f055760efe..4e0e46e57b 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeExistsException.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeExistsException.java
@@ -19,10 +19,9 @@ package org.apache.qpid.server.virtualhost;/*
*
*/
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.exchange.Exchange;
-public class ExchangeExistsException extends AMQException
+public class ExchangeExistsException extends Exception
{
private final Exchange _existing;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeIsAlternateException.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeIsAlternateException.java
index 4be64a3b94..4674a4a534 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeIsAlternateException.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeIsAlternateException.java
@@ -1,4 +1,4 @@
-package org.apache.qpid.server.virtualhost;/*
+/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,10 +18,9 @@ package org.apache.qpid.server.virtualhost;/*
* under the License.
*
*/
+package org.apache.qpid.server.virtualhost;
-import org.apache.qpid.AMQException;
-
-public class ExchangeIsAlternateException extends AMQException
+public class ExchangeIsAlternateException extends Exception
{
public ExchangeIsAlternateException(String name)
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeRecoverer.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeRecoverer.java
index 6375af9933..59ff1ce6a1 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeRecoverer.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeRecoverer.java
@@ -22,7 +22,7 @@ package org.apache.qpid.server.virtualhost;
import java.util.Map;
import java.util.UUID;
-import org.apache.qpid.AMQException;
+import org.apache.qpid.server.exchange.AMQUnknownExchangeType;
import org.apache.qpid.server.exchange.Exchange;
import org.apache.qpid.server.exchange.ExchangeFactory;
import org.apache.qpid.server.exchange.ExchangeRegistry;
@@ -82,17 +82,22 @@ public class ExchangeRecoverer extends AbstractDurableConfiguredObjectRecoverer<
_exchange = _exchangeFactory.restoreExchange(id, exchangeName, exchangeType, autoDelete);
_exchangeRegistry.registerExchange(_exchange);
}
- }
+ }/*
catch (AMQException e)
{
throw new RuntimeException("Error recovering exchange uuid " + id + " name " + exchangeName, e);
- }
+ }*/
catch (QpidSecurityException e)
{
throw new ServerScopedRuntimeException("Security Exception thrown when recovering. The recovery " +
"thread should not be bound by permissions, this is likely " +
"a programming error.",e);
}
+ catch (AMQUnknownExchangeType e)
+ {
+ throw new ServerScopedRuntimeException("Unknown exchange type found when attempting to restore " +
+ "exchanges, check classpath", e);
+ }
}
@Override
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/plugins/QueueExistsException.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueExistsException.java
index 54f7d0d172..2fe8ce1caf 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/plugins/QueueExistsException.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueExistsException.java
@@ -18,12 +18,11 @@
* under the License.
*
*/
-package org.apache.qpid.server.virtualhost.plugins;
+package org.apache.qpid.server.virtualhost;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.queue.AMQQueue;
-public class QueueExistsException extends AMQException
+public class QueueExistsException extends Exception
{
private final AMQQueue _existing;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueRecoverer.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueRecoverer.java
index f6dd510894..fd836fdd98 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueRecoverer.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueRecoverer.java
@@ -26,7 +26,6 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.exchange.Exchange;
import org.apache.qpid.server.exchange.ExchangeRegistry;
import org.apache.qpid.server.model.Queue;
@@ -127,10 +126,6 @@ public class QueueRecoverer extends AbstractDurableConfiguredObjectRecoverer<AMQ
false, queueArgumentsMap);
}
}
- catch (AMQException e)
- {
- throw new RuntimeException("Error recovering queue uuid " + _id + " name " + queueName, e);
- }
catch (QpidSecurityException e)
{
throw new ServerScopedRuntimeException("Security Exception thrown when recovering. The recovery " +
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/RequiredExchangeException.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/RequiredExchangeException.java
index da4c9825b1..5073c558da 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/RequiredExchangeException.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/RequiredExchangeException.java
@@ -1,4 +1,4 @@
-package org.apache.qpid.server.virtualhost;/*
+/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,10 +18,9 @@ package org.apache.qpid.server.virtualhost;/*
* under the License.
*
*/
+package org.apache.qpid.server.virtualhost;
-import org.apache.qpid.AMQException;
-
-public class RequiredExchangeException extends AMQException
+public class RequiredExchangeException extends Exception
{
public RequiredExchangeException(String name)
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ReservedExchangeNameException.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ReservedExchangeNameException.java
index 585f045ad9..2db2227de3 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ReservedExchangeNameException.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ReservedExchangeNameException.java
@@ -19,9 +19,7 @@ package org.apache.qpid.server.virtualhost;/*
*
*/
-import org.apache.qpid.AMQException;
-
-public class ReservedExchangeNameException extends AMQException
+public class ReservedExchangeNameException extends Exception
{
private final String _name;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHost.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHost.java
index b7e51d88d3..3ab6a57839 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHost.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHost.java
@@ -29,6 +29,7 @@ import org.apache.qpid.server.store.DurableConfigurationStoreCreator;
import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.MessageStoreCreator;
import org.apache.qpid.server.store.OperationalLoggingListener;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class StandardVirtualHost extends AbstractVirtualHost
{
@@ -39,29 +40,47 @@ public class StandardVirtualHost extends AbstractVirtualHost
StandardVirtualHost(VirtualHostRegistry virtualHostRegistry,
StatisticsGatherer brokerStatisticsGatherer,
org.apache.qpid.server.security.SecurityManager parentSecurityManager,
- VirtualHostConfiguration hostConfig, VirtualHost virtualHost) throws Exception
+ VirtualHostConfiguration hostConfig, VirtualHost virtualHost)
{
super(virtualHostRegistry, brokerStatisticsGatherer, parentSecurityManager, hostConfig, virtualHost);
}
- private MessageStore initialiseMessageStore(VirtualHostConfiguration hostConfig, VirtualHost virtualHost) throws Exception
+ private MessageStore initialiseMessageStore(VirtualHostConfiguration hostConfig, VirtualHost virtualHost)
{
final Object storeTypeAttr = virtualHost.getAttribute(VirtualHost.STORE_TYPE);
String storeType = storeTypeAttr == null ? null : String.valueOf(storeTypeAttr);
MessageStore messageStore = null;
if (storeType == null)
{
- final Class<?> clazz = Class.forName(hostConfig.getMessageStoreClass());
- final Object o = clazz.newInstance();
+ try
+ {
+ final Class<?> clazz = Class.forName(hostConfig.getMessageStoreClass());
+ final Object o = clazz.newInstance();
+
+ if (!(o instanceof MessageStore))
+ {
+ throw new ClassCastException(clazz + " does not implement " + MessageStore.class);
+ }
- if (!(o instanceof MessageStore))
+ messageStore = (MessageStore) o;
+ }
+ catch (ClassNotFoundException e)
{
- throw new ClassCastException(clazz + " does not implement " + MessageStore.class);
+ throw new ServerScopedRuntimeException("Failed to fina virtual host message store implementation, " +
+ "check the classpath and the configuration", e);
+ }
+ catch (InstantiationException e)
+ {
+ throw new ServerScopedRuntimeException("Failed to initialise virtual host store, " +
+ "check the configuration", e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new ServerScopedRuntimeException("Failed to initialise virtual host store, " +
+ "check the configuration", e);
}
-
- messageStore = (MessageStore) o;
}
else
{
@@ -76,7 +95,7 @@ public class StandardVirtualHost extends AbstractVirtualHost
return messageStore;
}
- private DurableConfigurationStore initialiseConfigurationStore(VirtualHost virtualHost) throws Exception
+ private DurableConfigurationStore initialiseConfigurationStore(VirtualHost virtualHost)
{
DurableConfigurationStore configurationStore;
final Object storeTypeAttr = virtualHost.getAttribute(VirtualHost.CONFIG_STORE_TYPE);
@@ -99,7 +118,7 @@ public class StandardVirtualHost extends AbstractVirtualHost
}
- protected void initialiseStorage(VirtualHostConfiguration hostConfig, VirtualHost virtualHost) throws Exception
+ protected void initialiseStorage(VirtualHostConfiguration hostConfig, VirtualHost virtualHost)
{
_messageStore = initialiseMessageStore(hostConfig, virtualHost);
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHostFactory.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHostFactory.java
index 08f35c08f9..c28bcb977f 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHostFactory.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHostFactory.java
@@ -46,7 +46,7 @@ public class StandardVirtualHostFactory implements VirtualHostFactory
StatisticsGatherer brokerStatisticsGatherer,
org.apache.qpid.server.security.SecurityManager parentSecurityManager,
VirtualHostConfiguration hostConfig,
- org.apache.qpid.server.model.VirtualHost virtualHost) throws Exception
+ org.apache.qpid.server.model.VirtualHost virtualHost)
{
return new StandardVirtualHost(virtualHostRegistry, brokerStatisticsGatherer, parentSecurityManager, hostConfig, virtualHost);
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/UnknownExchangeException.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/UnknownExchangeException.java
index 5704126f62..9b9029d330 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/UnknownExchangeException.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/UnknownExchangeException.java
@@ -1,4 +1,4 @@
-package org.apache.qpid.server.virtualhost;/*
+/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,10 +18,9 @@ package org.apache.qpid.server.virtualhost;/*
* under the License.
*
*/
+package org.apache.qpid.server.virtualhost;
-import org.apache.qpid.AMQException;
-
-public class UnknownExchangeException extends AMQException
+public class UnknownExchangeException extends Exception
{
private final String _exchangeName;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java
index 1f925d13b5..7cd9045af8 100755
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java
@@ -24,7 +24,8 @@ import java.util.Collection;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ScheduledFuture;
-import org.apache.qpid.AMQException;
+
+import org.apache.qpid.server.exchange.AMQUnknownExchangeType;
import org.apache.qpid.common.Closeable;
import org.apache.qpid.server.configuration.VirtualHostConfiguration;
import org.apache.qpid.server.connection.IConnectionRegistry;
@@ -56,7 +57,7 @@ public interface VirtualHost extends DurableConfigurationStore.Source, Closeable
Collection<AMQQueue> getQueues();
- int removeQueue(AMQQueue queue) throws AMQException, QpidSecurityException;
+ int removeQueue(AMQQueue queue) throws QpidSecurityException;
AMQQueue createQueue(UUID id,
String queueName,
@@ -65,7 +66,7 @@ public interface VirtualHost extends DurableConfigurationStore.Source, Closeable
boolean autoDelete,
boolean exclusive,
boolean deleteOnNoConsumer,
- Map<String, Object> arguments) throws AMQException, QpidSecurityException;
+ Map<String, Object> arguments) throws QueueExistsException, QpidSecurityException;
Exchange createExchange(UUID id,
@@ -74,9 +75,11 @@ public interface VirtualHost extends DurableConfigurationStore.Source, Closeable
boolean durable,
boolean autoDelete,
String alternateExchange)
- throws AMQException, QpidSecurityException;
+ throws QpidSecurityException, ExchangeExistsException, ReservedExchangeNameException,
+ UnknownExchangeException, AMQUnknownExchangeType;
- void removeExchange(Exchange exchange, boolean force) throws AMQException, QpidSecurityException;
+ void removeExchange(Exchange exchange, boolean force) throws QpidSecurityException, ExchangeIsAlternateException,
+ RequiredExchangeException;
MessageDestination getMessageDestination(String name);
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostConfigRecoveryHandler.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostConfigRecoveryHandler.java
index 6e36cdfa94..eac118ba8a 100755
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostConfigRecoveryHandler.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostConfigRecoveryHandler.java
@@ -26,8 +26,7 @@ import java.util.TreeMap;
import java.util.UUID;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQStoreException;
+import org.apache.qpid.server.store.AMQStoreException;
import org.apache.qpid.server.exchange.ExchangeFactory;
import org.apache.qpid.server.exchange.ExchangeRegistry;
import org.apache.qpid.server.logging.actors.CurrentActor;
@@ -47,6 +46,7 @@ import org.apache.qpid.server.store.TransactionLogResource;
import org.apache.qpid.server.txn.DtxBranch;
import org.apache.qpid.server.txn.DtxRegistry;
import org.apache.qpid.server.txn.ServerTransaction;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.transport.Xid;
import org.apache.qpid.transport.util.Functions;
@@ -138,18 +138,8 @@ public class VirtualHostConfigRecoveryHandler implements
public void postCommit()
{
- try
- {
-
- queue.enqueue(message, null);
- ref.release();
- }
- catch (AMQException e)
- {
- _logger.error("Unable to enqueue message " + message.getMessageNumber() + " into " +
- "queue " + queue.getName() + " (from XA transaction)", e);
- throw new RuntimeException(e);
- }
+ queue.enqueue(message, null);
+ ref.release();
}
public void onRollback()
@@ -237,7 +227,7 @@ public class VirtualHostConfigRecoveryHandler implements
{
_logger.error("Unexpected database exception when attempting to prepare a recovered XA transaction " +
xidAsString(id), e);
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
}
@@ -269,74 +259,66 @@ public class VirtualHostConfigRecoveryHandler implements
public void queueEntry(final UUID queueId, long messageId)
{
AMQQueue queue = _virtualHost.getQueue(queueId);
- try
+ if(queue != null)
{
- if(queue != null)
- {
- String queueName = queue.getName();
- ServerMessage message = _recoveredMessages.get(messageId);
- _unusedMessages.remove(messageId);
-
- if(message != null)
- {
+ String queueName = queue.getName();
+ ServerMessage message = _recoveredMessages.get(messageId);
+ _unusedMessages.remove(messageId);
+ if(message != null)
+ {
- if (_logger.isDebugEnabled())
- {
- _logger.debug("On recovery, delivering " + message.getMessageNumber() + " to " + queueName);
- }
-
- Integer count = _queueRecoveries.get(queueName);
- if (count == null)
- {
- count = 0;
- }
-
- queue.enqueue(message,null);
- _queueRecoveries.put(queueName, ++count);
+ if (_logger.isDebugEnabled())
+ {
+ _logger.debug("On recovery, delivering " + message.getMessageNumber() + " to " + queueName);
}
- else
+
+ Integer count = _queueRecoveries.get(queueName);
+ if (count == null)
{
- _logger.warn("Message id " + messageId + " referenced in log as enqueued in queue " + queueName + " is unknown, entry will be discarded");
- Transaction txn = _store.newTransaction();
- txn.dequeueMessage(queue, new DummyMessage(messageId));
- txn.commitTranAsync();
+ count = 0;
}
+
+ queue.enqueue(message,null);
+
+ _queueRecoveries.put(queueName, ++count);
}
else
{
- _logger.warn("Message id " + messageId + " in log references queue with id " + queueId + " which is not in the configuration, entry will be discarded");
+ _logger.warn("Message id " + messageId + " referenced in log as enqueued in queue " + queueName + " is unknown, entry will be discarded");
Transaction txn = _store.newTransaction();
- TransactionLogResource mockQueue =
- new TransactionLogResource()
- {
- @Override
- public String getName()
- {
- return "<<UNKNOWN>>";
- }
-
- @Override
- public UUID getId()
- {
- return queueId;
- }
-
- @Override
- public boolean isDurable()
- {
- return false;
- }
- };
- txn.dequeueMessage(mockQueue, new DummyMessage(messageId));
+ txn.dequeueMessage(queue, new DummyMessage(messageId));
txn.commitTranAsync();
}
-
}
- catch(AMQException e)
+ else
{
- throw new RuntimeException(e);
+ _logger.warn("Message id " + messageId + " in log references queue with id " + queueId + " which is not in the configuration, entry will be discarded");
+ Transaction txn = _store.newTransaction();
+ TransactionLogResource mockQueue =
+ new TransactionLogResource()
+ {
+ @Override
+ public String getName()
+ {
+ return "<<UNKNOWN>>";
+ }
+
+ @Override
+ public UUID getId()
+ {
+ return queueId;
+ }
+
+ @Override
+ public boolean isDurable()
+ {
+ return false;
+ }
+ };
+ txn.dequeueMessage(mockQueue, new DummyMessage(messageId));
+ txn.commitTranAsync();
}
}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/updater/TaskExecutorTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/updater/TaskExecutorTest.java
index 27d7dd1241..9dc4fb768e 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/updater/TaskExecutorTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/updater/TaskExecutorTest.java
@@ -42,6 +42,7 @@ import org.apache.qpid.server.logging.actors.CurrentActor;
import org.apache.qpid.server.logging.actors.TestLogActor;
import org.apache.qpid.server.model.State;
import org.apache.qpid.server.security.SecurityManager;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class TaskExecutorTest extends TestCase
{
@@ -90,7 +91,7 @@ public class TaskExecutorTest extends TestCase
{
try
{
- Future<?> f = _executor.submit(new NeverEndingCallable(waitForCallLatch));
+ Future<Void> f = _executor.submit(new NeverEndingCallable(waitForCallLatch));
submitLatch.countDown();
f.get();
}
@@ -100,7 +101,14 @@ public class TaskExecutorTest extends TestCase
{
e = (Exception) e.getCause();
}
- submitExceptions.add(e);
+ if(e instanceof RuntimeException && e.getCause() instanceof Exception)
+ {
+ submitExceptions.add((Exception)e.getCause());
+ }
+ else
+ {
+ submitExceptions.add(e);
+ }
}
}
};
@@ -133,10 +141,10 @@ public class TaskExecutorTest extends TestCase
public void testSubmitAndWait() throws Exception
{
_executor.start();
- Object result = _executor.submitAndWait(new Callable<String>()
+ Object result = _executor.submitAndWait(new TaskExecutor.Task<Object>()
{
@Override
- public String call() throws Exception
+ public String call()
{
return "DONE";
}
@@ -186,11 +194,11 @@ public class TaskExecutorTest extends TestCase
_executor.start();
try
{
- _executor.submitAndWait(new Callable<Void>()
+ _executor.submitAndWait(new TaskExecutor.Task<Object>()
{
@Override
- public Void call() throws Exception
+ public Void call()
{
throw exception;
}
@@ -203,29 +211,6 @@ public class TaskExecutorTest extends TestCase
}
}
- public void testSubmitAndWaitPassesOriginalCheckedException()
- {
- final Exception exception = new Exception();
- _executor.start();
- try
- {
- _executor.submitAndWait(new Callable<Void>()
- {
-
- @Override
- public Void call() throws Exception
- {
- throw exception;
- }
- });
- fail("Exception is expected");
- }
- catch (Exception e)
- {
- assertEquals("Unexpected exception", exception, e.getCause());
- }
- }
-
public void testSubmitAndWaitCurrentActorAndSecurityManagerSubjectAreRespected() throws Exception
{
_executor.start();
@@ -238,10 +223,10 @@ public class TaskExecutorTest extends TestCase
{
CurrentActor.set(actor);
SecurityManager.setThreadSubject(subject);
- _executor.submitAndWait(new Callable<Void>()
+ _executor.submitAndWait(new TaskExecutor.Task<Object>()
{
@Override
- public Void call() throws Exception
+ public Void call()
{
taskLogActor.set(CurrentActor.get());
taskSubject.set(SecurityManager.getThreadSubject());
@@ -258,16 +243,16 @@ public class TaskExecutorTest extends TestCase
assertEquals("Unexpected security manager subject", subject, taskSubject.get());
}
- private class SubjectRetriever implements Callable<Subject>
+ private class SubjectRetriever implements TaskExecutor.Task<Subject>
{
@Override
- public Subject call() throws Exception
+ public Subject call()
{
return Subject.getSubject(AccessController.getContext());
}
}
- private class NeverEndingCallable implements Callable<Void>
+ private class NeverEndingCallable implements TaskExecutor.Task<Void>
{
private CountDownLatch _waitLatch;
@@ -278,7 +263,7 @@ public class TaskExecutorTest extends TestCase
}
@Override
- public Void call() throws Exception
+ public Void call()
{
if (_waitLatch != null)
{
@@ -288,7 +273,14 @@ public class TaskExecutorTest extends TestCase
// wait forever
synchronized (this)
{
- this.wait();
+ try
+ {
+ this.wait();
+ }
+ catch (InterruptedException e)
+ {
+ throw new ServerScopedRuntimeException(e);
+ }
}
return null;
}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/consumer/MockConsumer.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/consumer/MockConsumer.java
index 2401aaed23..5a12a411cf 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/consumer/MockConsumer.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/consumer/MockConsumer.java
@@ -21,7 +21,6 @@
package org.apache.qpid.server.consumer;
-import org.apache.qpid.AMQException;
import org.apache.qpid.protocol.AMQConstant;
import org.apache.qpid.server.filter.FilterManager;
import org.apache.qpid.server.filter.Filterable;
@@ -243,7 +242,7 @@ public class MockConsumer implements ConsumerTarget
}
@Override
- public void close() throws AMQException
+ public void close()
{
}
@@ -255,7 +254,7 @@ public class MockConsumer implements ConsumerTarget
@Override
public void checkTransactionStatus(long openWarn, long openClose,
- long idleWarn, long idleClose) throws AMQException
+ long idleWarn, long idleClose)
{
}
@@ -340,7 +339,7 @@ public class MockConsumer implements ConsumerTarget
}
@Override
- public void close(AMQConstant cause, String message) throws AMQException
+ public void close(AMQConstant cause, String message)
{
}
}
@@ -394,13 +393,12 @@ public class MockConsumer implements ConsumerTarget
@Override
public void close(AMQConstant cause, String message)
- throws AMQException
{
}
@Override
public void closeSession(AMQSessionModel session, AMQConstant cause,
- String message) throws AMQException
+ String message)
{
}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/DefaultExchangeFactoryTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/DefaultExchangeFactoryTest.java
index f57ef037b3..c5ff2a8900 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/DefaultExchangeFactoryTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/DefaultExchangeFactoryTest.java
@@ -25,7 +25,6 @@ import java.util.Collection;
import java.util.List;
import java.util.UUID;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.plugin.ExchangeType;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.test.utils.QpidTestCase;
@@ -179,7 +178,7 @@ public class DefaultExchangeFactoryTest extends QpidTestCase
@Override
public Exchange newInstance(UUID id, VirtualHost host, String name, boolean durable,
- boolean autoDelete) throws AMQException
+ boolean autoDelete)
{
return null;
}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/FanoutExchangeTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/FanoutExchangeTest.java
index 70ac5128c1..8cbc6b49ca 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/FanoutExchangeTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/FanoutExchangeTest.java
@@ -33,8 +33,6 @@ import java.util.Set;
import java.util.UUID;
import junit.framework.TestCase;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQInternalException;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.common.AMQPFilterTypes;
import org.apache.qpid.server.logging.LogActor;
@@ -54,7 +52,7 @@ public class FanoutExchangeTest extends TestCase
private FanoutExchange _exchange;
private VirtualHost _virtualHost;
- public void setUp() throws AMQException
+ public void setUp()
{
CurrentActor.setDefault(mock(LogActor.class));
@@ -85,28 +83,28 @@ public class FanoutExchangeTest extends TestCase
assertFalse("calling isBound(AMQQueue) with null queue should return false", _exchange.isBound((AMQQueue) null));
}
- public void testIsBoundStringMapAMQQueue() throws QpidSecurityException, AMQInternalException
+ public void testIsBoundStringMapAMQQueue() throws QpidSecurityException
{
AMQQueue queue = bindQueue();
assertTrue("Should return true for a bound queue",
_exchange.isBound("matters", null, queue));
}
- public void testIsBoundStringAMQQueue() throws QpidSecurityException, AMQInternalException
+ public void testIsBoundStringAMQQueue() throws QpidSecurityException
{
AMQQueue queue = bindQueue();
assertTrue("Should return true for a bound queue",
_exchange.isBound("matters", queue));
}
- public void testIsBoundAMQQueue() throws QpidSecurityException, AMQInternalException
+ public void testIsBoundAMQQueue() throws QpidSecurityException
{
AMQQueue queue = bindQueue();
assertTrue("Should return true for a bound queue",
_exchange.isBound(queue));
}
- private AMQQueue bindQueue() throws QpidSecurityException, AMQInternalException
+ private AMQQueue bindQueue() throws QpidSecurityException
{
AMQQueue queue = mockQueue();
_exchange.addBinding("matters", queue, null);
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java
index 54b0c3c529..fdaa147ae6 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java
@@ -29,7 +29,6 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
import junit.framework.TestCase;
-import org.apache.qpid.AMQInternalException;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.common.AMQPFilterTypes;
import org.apache.qpid.server.logging.LogActor;
@@ -119,7 +118,7 @@ public class HeadersExchangeTest extends TestCase
}
private void bind(String bindingKey, Map<String, Object> arguments, AMQQueue q)
- throws QpidSecurityException, AMQInternalException
+ throws QpidSecurityException
{
_exchange.addBinding(bindingKey,q,arguments);
}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/TopicExchangeTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/TopicExchangeTest.java
index 4a7bc33365..573f4a4aaa 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/TopicExchangeTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/TopicExchangeTest.java
@@ -23,9 +23,7 @@ package org.apache.qpid.server.exchange;
import java.util.List;
import junit.framework.Assert;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.binding.Binding;
-import org.apache.qpid.server.consumer.Consumer;
import org.apache.qpid.server.message.InstanceProperties;
import org.apache.qpid.server.message.MessageReference;
import org.apache.qpid.server.message.ServerMessage;
@@ -311,7 +309,7 @@ public class TopicExchangeTest extends QpidTestCase
}
- private int routeMessage(String routingKey, long messageNumber) throws AMQException
+ private int routeMessage(String routingKey, long messageNumber)
{
ServerMessage message = mock(ServerMessage.class);
when(message.getRoutingKey()).thenReturn(routingKey);
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/logging/actors/AMQPConnectionActorTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/logging/actors/AMQPConnectionActorTest.java
index 8b7f9ec5ca..bee2930fd7 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/logging/actors/AMQPConnectionActorTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/logging/actors/AMQPConnectionActorTest.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.logging.actors;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.logging.LogMessage;
import org.apache.qpid.server.logging.LogSubject;
@@ -79,7 +78,7 @@ public class AMQPConnectionActorTest extends BaseConnectionActorTestCase
logs.get(0).toString().contains("/ch:"));
}
- public void testConnectionLoggingOff() throws Exception, AMQException
+ public void testConnectionLoggingOff() throws Exception
{
setStatusUpdatesEnabled(false);
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/logging/actors/CurrentActorTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/logging/actors/CurrentActorTest.java
index 1fc42fe636..300fcd70d3 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/logging/actors/CurrentActorTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/logging/actors/CurrentActorTest.java
@@ -22,7 +22,6 @@ package org.apache.qpid.server.logging.actors;
import org.apache.commons.configuration.ConfigurationException;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.protocol.AMQSessionModel;
import org.apache.qpid.server.logging.LogActor;
import org.apache.qpid.server.logging.NullRootMessageLogger;
@@ -66,10 +65,9 @@ public class CurrentActorTest extends BaseConnectionActorTestCase
* And then finally validates that removing the Connection actor results
* in there being no actors set.
*
- * @throws AMQException
* @throws org.apache.commons.configuration.ConfigurationException
*/
- public void testLIFO() throws AMQException, ConfigurationException
+ public void testLIFO() throws ConfigurationException
{
assertTrue("Unexpected actor: " + CurrentActor.get(), CurrentActor.get() instanceof TestLogActor);
AMQPConnectionActor connectionActor = new AMQPConnectionActor(getConnection(),
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/AMQQueueFactoryTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/AMQQueueFactoryTest.java
index e59b9f614e..35ffd08863 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/AMQQueueFactoryTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/AMQQueueFactoryTest.java
@@ -36,8 +36,6 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
-
-import org.apache.qpid.AMQException;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.server.configuration.BrokerProperties;
import org.apache.qpid.server.configuration.QueueConfiguration;
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java
index d1bc5effc0..c462468819 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java
@@ -20,20 +20,17 @@
*/
package org.apache.qpid.server.queue;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.binding.Binding;
import org.apache.qpid.server.configuration.QueueConfiguration;
import org.apache.qpid.server.exchange.Exchange;
import org.apache.qpid.server.filter.FilterManager;
import org.apache.qpid.server.logging.LogSubject;
import org.apache.qpid.server.message.InstanceProperties;
-import org.apache.qpid.server.message.MessageInstance;
import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.protocol.AMQSessionModel;
import org.apache.qpid.server.security.AuthorizationHolder;
import org.apache.qpid.server.consumer.Consumer;
import org.apache.qpid.server.consumer.ConsumerTarget;
-import org.apache.qpid.server.store.StorableMessageMetaData;
import org.apache.qpid.server.txn.ServerTransaction;
import org.apache.qpid.server.util.Action;
import org.apache.qpid.server.virtualhost.VirtualHost;
@@ -213,7 +210,7 @@ public class MockAMQQueue implements AMQQueue
}
@Override
- public boolean resend(final QueueEntry entry, final Consumer consumer) throws AMQException
+ public boolean resend(final QueueEntry entry, final Consumer consumer)
{
return false;
}
@@ -225,7 +222,7 @@ public class MockAMQQueue implements AMQQueue
}
@Override
- public void enqueue(final ServerMessage message, final Action action) throws AMQException
+ public void enqueue(final ServerMessage message, final Action action)
{
}
@@ -241,7 +238,7 @@ public class MockAMQQueue implements AMQQueue
final FilterManager filters,
final Class messageClass,
final String consumerName,
- final EnumSet options) throws AMQException
+ final EnumSet options)
{
return new QueueConsumer(filters, messageClass, options.contains(Consumer.Option.ACQUIRES),
options.contains(Consumer.Option.SEES_REQUEUES), consumerName,
@@ -332,7 +329,7 @@ public class MockAMQQueue implements AMQQueue
return _deleted;
}
- public int delete() throws AMQException
+ public int delete()
{
_deleted = true;
return getMessageCount();
@@ -347,11 +344,6 @@ public class MockAMQQueue implements AMQQueue
{
}
- public boolean resend(QueueEntry entry, QueueConsumer consumer) throws AMQException
- {
- return false;
- }
-
@Override
public void removeQueueDeleteTask(final Action task)
{
@@ -451,7 +443,7 @@ public class MockAMQQueue implements AMQQueue
}
- public void checkMessageStatus() throws AMQException
+ public void checkMessageStatus()
{
}
@@ -461,7 +453,7 @@ public class MockAMQQueue implements AMQQueue
return null;
}
- public void flushConsumer(Consumer sub) throws AMQException
+ public void flushConsumer(Consumer sub)
{
}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/MockMessageInstance.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/MockMessageInstance.java
index 8594ba19a3..4df8f91ede 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/MockMessageInstance.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/MockMessageInstance.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.queue;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.filter.Filterable;
import org.apache.qpid.server.message.AMQMessageHeader;
import org.apache.qpid.server.message.InstanceProperties;
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/PriorityQueueTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/PriorityQueueTest.java
index b71e4cd6d3..acddd49c04 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/PriorityQueueTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/PriorityQueueTest.java
@@ -23,9 +23,6 @@ package org.apache.qpid.server.queue;
import java.util.Collections;
import junit.framework.AssertionFailedError;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.logging.LogActor;
-import org.apache.qpid.server.logging.actors.CurrentActor;
import org.apache.qpid.server.message.AMQMessageHeader;
import org.apache.qpid.server.message.MessageInstance;
import org.apache.qpid.server.message.ServerMessage;
@@ -36,7 +33,6 @@ import java.util.EnumSet;
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.consumer.Consumer;
-import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class PriorityQueueTest extends SimpleAMQQueueTestBase
@@ -102,7 +98,7 @@ public class PriorityQueueTest extends SimpleAMQQueueTestBase
}
- protected ServerMessage createMessage(Long id, byte i) throws AMQException
+ protected ServerMessage createMessage(Long id, byte i)
{
ServerMessage msg = super.createMessage(id);
@@ -111,7 +107,7 @@ public class PriorityQueueTest extends SimpleAMQQueueTestBase
return msg;
}
- protected ServerMessage createMessage(Long id) throws AMQException
+ protected ServerMessage createMessage(Long id)
{
return createMessage(id, (byte) 0);
}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/QueueEntryImplTestBase.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/QueueEntryImplTestBase.java
index b67b2dda32..66e4286df7 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/QueueEntryImplTestBase.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/QueueEntryImplTestBase.java
@@ -20,7 +20,6 @@ package org.apache.qpid.server.queue;
import junit.framework.TestCase;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.consumer.ConsumerTarget;
import org.apache.qpid.server.logging.LogActor;
import org.apache.qpid.server.logging.RootMessageLogger;
@@ -48,7 +47,7 @@ public abstract class QueueEntryImplTestBase extends TestCase
protected QueueEntryImpl _queueEntry2;
protected QueueEntryImpl _queueEntry3;
- public abstract QueueEntryImpl getQueueEntryImpl(int msgId) throws AMQException;
+ public abstract QueueEntryImpl getQueueEntryImpl(int msgId);
public abstract void testCompareTo();
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/QueueEntryListTestBase.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/QueueEntryListTestBase.java
index 3af268c189..07d00daba5 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/QueueEntryListTestBase.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/QueueEntryListTestBase.java
@@ -21,7 +21,6 @@ package org.apache.qpid.server.queue;
import junit.framework.TestCase;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.message.AMQMessageHeader;
import org.apache.qpid.server.message.MessageReference;
import org.apache.qpid.server.message.ServerMessage;
@@ -39,7 +38,7 @@ public abstract class QueueEntryListTestBase<E extends QueueEntry<E,Q,C>, Q exte
public abstract L getTestList(boolean newList);
public abstract long getExpectedFirstMsgId();
public abstract int getExpectedListLength();
- public abstract ServerMessage getTestMessageToAdd() throws AMQException;
+ public abstract ServerMessage getTestMessageToAdd();
public void testGetQueue()
{
@@ -52,9 +51,8 @@ public abstract class QueueEntryListTestBase<E extends QueueEntry<E,Q,C>, Q exte
* Test to add a message with properties specific to the queue type.
* @see QueueEntryListTestBase#getTestList()
* @see QueueEntryListTestBase#getTestMessageToAdd()
- * @throws AMQException
*/
- public void testAddSpecificMessage() throws AMQException
+ public void testAddSpecificMessage()
{
final L list = getTestList();
list.add(getTestMessageToAdd());
@@ -73,9 +71,8 @@ public abstract class QueueEntryListTestBase<E extends QueueEntry<E,Q,C>, Q exte
* Test to add a generic mock message.
* @see QueueEntryListTestBase#getTestList()
* @see QueueEntryListTestBase#getExpectedListLength()
- * @throws AMQException
*/
- public void testAddGenericMessage() throws AMQException
+ public void testAddGenericMessage()
{
final L list = getTestList();
final ServerMessage message = createServerMessage(666l);
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SimpleAMQQueueTestBase.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SimpleAMQQueueTestBase.java
index 9330df5bea..1934349a62 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SimpleAMQQueueTestBase.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SimpleAMQQueueTestBase.java
@@ -34,8 +34,7 @@ import java.util.EnumSet;
import java.util.Map;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQInternalException;
+import org.apache.qpid.server.message.MessageSource;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.server.exchange.DirectExchange;
@@ -129,7 +128,7 @@ abstract class SimpleAMQQueueTestBase<E extends QueueEntryImpl<E,Q,L>, Q extends
assertEquals("Virtual host was wrong", _virtualHost, _queue.getVirtualHost());
}
- public void testBinding() throws QpidSecurityException, AMQInternalException
+ public void testBinding() throws QpidSecurityException
{
_exchange.addBinding(_routingKey, _queue, Collections.EMPTY_MAP);
@@ -456,7 +455,7 @@ abstract class SimpleAMQQueueTestBase<E extends QueueEntryImpl<E,Q,L>, Q extends
Consumer.Option.SEES_REQUEUES));
}
- catch (AMQException e)
+ catch (MessageSource.ExistingExclusiveConsumer e)
{
ex = e;
}
@@ -476,7 +475,7 @@ abstract class SimpleAMQQueueTestBase<E extends QueueEntryImpl<E,Q,L>, Q extends
EnumSet.of(Consumer.Option.EXCLUSIVE));
}
- catch (AMQException e)
+ catch (MessageSource.ExistingConsumerPreventsExclusive e)
{
ex = e;
}
@@ -929,23 +928,11 @@ abstract class SimpleAMQQueueTestBase<E extends QueueEntryImpl<E,Q,L>, Q extends
{
// Create message
ServerMessage message = null;
- try
- {
- message = createMessage((long)i);
- }
- catch (AMQException e)
- {
- fail("Failure to create a test message:" + e.getMessage());
- }
+ message = createMessage((long)i);
+
// Put message on queue
- try
- {
- queue.enqueue(message,null);
- }
- catch (AMQException e)
- {
- fail("Failure to put message on queue:" + e.getMessage());
- }
+ queue.enqueue(message,null);
+
}
try
{
@@ -1024,7 +1011,7 @@ abstract class SimpleAMQQueueTestBase<E extends QueueEntryImpl<E,Q,L>, Q extends
}
- protected ServerMessage createMessage(Long id) throws AMQException
+ protected ServerMessage createMessage(Long id)
{
AMQMessageHeader header = mock(AMQMessageHeader.class);
when(header.getMessageId()).thenReturn(String.valueOf(id));
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SimpleQueueEntryImplTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SimpleQueueEntryImplTest.java
index 36425761be..9457d59300 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SimpleQueueEntryImplTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SimpleQueueEntryImplTest.java
@@ -20,10 +20,6 @@
*/
package org.apache.qpid.server.queue;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.logging.LogActor;
-import org.apache.qpid.server.logging.RootMessageLogger;
-import org.apache.qpid.server.logging.actors.CurrentActor;
import org.apache.qpid.server.message.MessageReference;
import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.virtualhost.VirtualHost;
@@ -51,7 +47,7 @@ public class SimpleQueueEntryImplTest extends QueueEntryImplTestBase
}
- public QueueEntryImpl getQueueEntryImpl(int msgId) throws AMQException
+ public QueueEntryImpl getQueueEntryImpl(int msgId)
{
ServerMessage message = mock(ServerMessage.class);
when(message.getMessageNumber()).thenReturn((long)msgId);
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SortedQueueEntryListTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SortedQueueEntryListTest.java
index b6b3843ad2..f8953bb7cc 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SortedQueueEntryListTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SortedQueueEntryListTest.java
@@ -20,7 +20,6 @@
package org.apache.qpid.server.queue;
import java.util.Collections;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.logging.LogActor;
import org.apache.qpid.server.logging.RootMessageLogger;
import org.apache.qpid.server.logging.actors.CurrentActor;
@@ -140,7 +139,7 @@ public class SortedQueueEntryListTest extends QueueEntryListTestBase<SortedQueue
return 67L;
}
- public ServerMessage getTestMessageToAdd() throws AMQException
+ public ServerMessage getTestMessageToAdd()
{
return generateTestMessage(1, "test value");
}
@@ -151,7 +150,7 @@ public class SortedQueueEntryListTest extends QueueEntryListTestBase<SortedQueue
return _testQueue;
}
- private ServerMessage generateTestMessage(final long id, final String keyValue) throws AMQException
+ private ServerMessage generateTestMessage(final long id, final String keyValue)
{
final ServerMessage message = mock(ServerMessage.class);
AMQMessageHeader hdr = mock(AMQMessageHeader.class);
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SortedQueueEntryTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SortedQueueEntryTest.java
index a406c1c26f..25d6dbba60 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SortedQueueEntryTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SortedQueueEntryTest.java
@@ -22,7 +22,6 @@ package org.apache.qpid.server.queue;
import java.util.Collections;
import java.util.UUID;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.message.AMQMessageHeader;
import org.apache.qpid.server.message.MessageReference;
import org.apache.qpid.server.message.ServerMessage;
@@ -56,7 +55,7 @@ public class SortedQueueEntryTest extends QueueEntryImplTestBase
super.setUp();
}
- public QueueEntryImpl getQueueEntryImpl(int msgId) throws AMQException
+ public QueueEntryImpl getQueueEntryImpl(int msgId)
{
final ServerMessage message = mock(ServerMessage.class);
AMQMessageHeader hdr = mock(AMQMessageHeader.class);
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/StandardQueueEntryListTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/StandardQueueEntryListTest.java
index c053957e2a..2c697cfe2b 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/StandardQueueEntryListTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/StandardQueueEntryListTest.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.queue;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.message.MessageReference;
import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.virtualhost.VirtualHost;
@@ -112,7 +111,7 @@ public class StandardQueueEntryListTest extends QueueEntryListTestBase<StandardQ
}
@Override
- public ServerMessage getTestMessageToAdd() throws AMQException
+ public ServerMessage getTestMessageToAdd()
{
ServerMessage msg = mock(ServerMessage.class);
when(msg.getMessageNumber()).thenReturn(1l);
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/StandardQueueTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/StandardQueueTest.java
index 6a32eff9ed..c7b812effe 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/StandardQueueTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/StandardQueueTest.java
@@ -20,8 +20,6 @@
*/
package org.apache.qpid.server.queue;
-
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.consumer.Consumer;
import org.apache.qpid.server.consumer.ConsumerTarget;
import org.apache.qpid.server.consumer.MockConsumer;
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/AbstractDurableConfigurationStoreTestCase.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/AbstractDurableConfigurationStoreTestCase.java
index d3ee938586..963309592c 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/AbstractDurableConfigurationStoreTestCase.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/AbstractDurableConfigurationStoreTestCase.java
@@ -36,7 +36,6 @@ import java.util.Map;
import java.util.UUID;
import org.apache.commons.configuration.Configuration;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.common.AMQPFilterTypes;
import org.apache.qpid.server.binding.Binding;
import org.apache.qpid.server.exchange.Exchange;
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/JsonFileConfigStoreTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/JsonFileConfigStoreTest.java
index b6300e6f48..0d3b2c637d 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/JsonFileConfigStoreTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/JsonFileConfigStoreTest.java
@@ -25,10 +25,11 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-import org.apache.qpid.AMQStoreException;
+
import org.apache.qpid.server.model.Binding;
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.model.VirtualHost;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.test.utils.QpidTestCase;
import org.mockito.InOrder;
@@ -82,7 +83,7 @@ public class JsonFileConfigStoreTest extends QpidTestCase
_store.configureConfigStore(_virtualHost, _recoveryHandler);
fail("Store should not successfully configure if there is no path set");
}
- catch (AMQStoreException e)
+ catch (ServerScopedRuntimeException e)
{
// pass
}
@@ -97,7 +98,7 @@ public class JsonFileConfigStoreTest extends QpidTestCase
_store.configureConfigStore(_virtualHost, _recoveryHandler);
fail("Store should not successfully configure if there is an invalid path set");
}
- catch (AMQStoreException e)
+ catch (ServerScopedRuntimeException e)
{
// pass
}
@@ -250,7 +251,7 @@ public class JsonFileConfigStoreTest extends QpidTestCase
secondStore.configureConfigStore(_virtualHost, _recoveryHandler);
fail("Should not be able to open a second store with the same path");
}
- catch(AMQStoreException e)
+ catch(ServerScopedRuntimeException e)
{
// pass
}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStore.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStore.java
index 9dde7d26d0..6b9bb08aa9 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStore.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStore.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.store;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.server.message.EnqueueableMessage;
import org.apache.qpid.server.queue.AMQQueue;
@@ -56,29 +55,29 @@ public class TestableMemoryMessageStore extends TestMemoryMessageStore
private class TestableTransaction implements Transaction
{
@Override
- public void enqueueMessage(TransactionLogResource queue, EnqueueableMessage message) throws AMQStoreException
+ public void enqueueMessage(TransactionLogResource queue, EnqueueableMessage message)
{
getMessages().put(message.getMessageNumber(), (AMQQueue)queue);
}
@Override
- public void dequeueMessage(TransactionLogResource queue, EnqueueableMessage message) throws AMQStoreException
+ public void dequeueMessage(TransactionLogResource queue, EnqueueableMessage message)
{
getMessages().remove(message.getMessageNumber());
}
@Override
- public void commitTran() throws AMQStoreException
+ public void commitTran()
{
}
@Override
- public StoreFuture commitTranAsync() throws AMQStoreException
+ public StoreFuture commitTranAsync()
{
return StoreFuture.IMMEDIATE_FUTURE;
}
- public void abortTran() throws AMQStoreException
+ public void abortTran()
{
}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/txn/MockStoreTransaction.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/txn/MockStoreTransaction.java
index 17955a8d52..ab18c8f41d 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/txn/MockStoreTransaction.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/txn/MockStoreTransaction.java
@@ -21,13 +21,13 @@
package org.apache.qpid.server.txn;
import org.apache.commons.lang.NotImplementedException;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.server.message.EnqueueableMessage;
import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.NullMessageStore;
import org.apache.qpid.server.store.StoreFuture;
import org.apache.qpid.server.store.Transaction;
import org.apache.qpid.server.store.TransactionLogResource;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
/**
* Mock implementation of a (Store) Transaction allow its state to be observed.
@@ -60,12 +60,12 @@ class MockStoreTransaction implements Transaction
return _state;
}
- public void enqueueMessage(TransactionLogResource queue, EnqueueableMessage message) throws AMQStoreException
+ public void enqueueMessage(TransactionLogResource queue, EnqueueableMessage message)
{
if (_throwExceptionOnQueueOp)
{
- throw new AMQStoreException("Mocked exception");
+ throw new ServerScopedRuntimeException("Mocked exception");
}
_numberOfEnqueuedMessages++;
@@ -81,27 +81,27 @@ class MockStoreTransaction implements Transaction
return _numberOfEnqueuedMessages;
}
- public void dequeueMessage(TransactionLogResource queue, EnqueueableMessage message) throws AMQStoreException
+ public void dequeueMessage(TransactionLogResource queue, EnqueueableMessage message)
{
if (_throwExceptionOnQueueOp)
{
- throw new AMQStoreException("Mocked exception");
+ throw new ServerScopedRuntimeException("Mocked exception");
}
_numberOfDequeuedMessages++;
}
- public void commitTran() throws AMQStoreException
+ public void commitTran()
{
_state = TransactionState.COMMITTED;
}
- public StoreFuture commitTranAsync() throws AMQStoreException
+ public StoreFuture commitTranAsync()
{
throw new NotImplementedException();
}
- public void abortTran() throws AMQStoreException
+ public void abortTran()
{
_state = TransactionState.ABORTED;
}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java
index a00baebd5e..fb63fefb88 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java
@@ -30,7 +30,6 @@ import java.util.UUID;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.protocol.AMQConnectionModel;
import org.apache.qpid.server.protocol.AMQSessionModel;
import org.apache.qpid.server.configuration.VirtualHostConfiguration;
@@ -45,7 +44,6 @@ import org.apache.qpid.server.logging.actors.TestLogActor;
import org.apache.qpid.server.model.Broker;
import org.apache.qpid.server.model.UUIDGenerator;
import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.queue.AMQQueueFactory;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.server.security.SecurityManager;
import org.apache.qpid.server.security.SubjectCreator;
@@ -55,6 +53,7 @@ import org.apache.qpid.server.virtualhost.StandardVirtualHostFactory;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.server.plugin.VirtualHostFactory;
import org.apache.qpid.server.virtualhost.VirtualHostRegistry;
+import org.apache.qpid.server.virtualhost.QueueExistsException;
public class BrokerTestHelper
{
@@ -139,7 +138,7 @@ public class BrokerTestHelper
return vhostConfig;
}
- public static AMQSessionModel createSession(int channelId, AMQConnectionModel connection) throws AMQException
+ public static AMQSessionModel createSession(int channelId, AMQConnectionModel connection)
{
AMQSessionModel session = mock(AMQSessionModel.class);
when(session.getConnectionModel()).thenReturn(connection);
@@ -181,7 +180,7 @@ public class BrokerTestHelper
}
public static AMQQueue createQueue(String queueName, VirtualHost virtualHost)
- throws AMQException, QpidSecurityException
+ throws QpidSecurityException, QueueExistsException
{
AMQQueue queue = virtualHost.createQueue(UUIDGenerator.generateRandomUUID(), queueName, false, null,
false, false, false, Collections.<String, Object>emptyMap());
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/DurableConfigurationRecovererTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/DurableConfigurationRecovererTest.java
index b71c6a92e6..ffd153b790 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/DurableConfigurationRecovererTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/DurableConfigurationRecovererTest.java
@@ -27,7 +27,7 @@ import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.UUID;
-import org.apache.qpid.AMQStoreException;
+import org.apache.qpid.server.store.AMQStoreException;
import org.apache.qpid.server.configuration.IllegalConfigurationException;
import org.apache.qpid.server.exchange.DirectExchange;
import org.apache.qpid.server.exchange.Exchange;
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java
index 832b89c81a..f7eecc73fc 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java
@@ -23,7 +23,6 @@ package org.apache.qpid.server.virtualhost;
import java.util.Collection;
import java.util.Map;
import java.util.concurrent.ScheduledFuture;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.configuration.VirtualHostConfiguration;
import org.apache.qpid.server.connection.IConnectionRegistry;
import org.apache.qpid.server.exchange.Exchange;
@@ -147,7 +146,7 @@ public class MockVirtualHost implements VirtualHost
}
@Override
- public int removeQueue(AMQQueue queue) throws AMQException
+ public int removeQueue(AMQQueue queue)
{
return 0;
}
@@ -160,7 +159,7 @@ public class MockVirtualHost implements VirtualHost
boolean autoDelete,
boolean exclusive,
boolean deleteOnNoConsumer,
- Map<String, Object> arguments) throws AMQException
+ Map<String, Object> arguments)
{
return null;
}
@@ -171,13 +170,13 @@ public class MockVirtualHost implements VirtualHost
String type,
boolean durable,
boolean autoDelete,
- String alternateExchange) throws AMQException
+ String alternateExchange)
{
return null;
}
@Override
- public void removeExchange(Exchange exchange, boolean force) throws AMQException
+ public void removeExchange(Exchange exchange, boolean force)
{
}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/StandardVirtualHostTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/StandardVirtualHostTest.java
index f46349daa4..9dfd8833aa 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/StandardVirtualHostTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/StandardVirtualHostTest.java
@@ -38,6 +38,7 @@ import org.apache.qpid.server.security.SecurityManager;
import org.apache.qpid.server.stats.StatisticsGatherer;
import org.apache.qpid.server.store.TestMemoryMessageStore;
import org.apache.qpid.server.util.BrokerTestHelper;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.test.utils.QpidTestCase;
import java.io.BufferedWriter;
@@ -111,9 +112,11 @@ public class StandardVirtualHostTest extends QpidTestCase
createVirtualHost(queueName, config);
fail("virtualhost creation should have failed due to illegal configuration");
}
- catch (ConfigurationException e)
+ catch (ServerScopedRuntimeException e)
{
- assertEquals("Illegal attempt to bind queue '" + queueName + "' to the default exchange with a key other than the queue name: " + customBinding, e.getMessage());
+ Throwable cause = e.getCause();
+ assertNotNull(cause);
+ assertEquals("Illegal attempt to bind queue '" + queueName + "' to the default exchange with a key other than the queue name: " + customBinding, cause.getMessage());
}
}
@@ -169,9 +172,11 @@ public class StandardVirtualHostTest extends QpidTestCase
createVirtualHost(queueName, config);
fail("virtualhost creation should have failed due to illegal configuration");
}
- catch (ConfigurationException e)
+ catch (ServerScopedRuntimeException e)
{
- assertEquals("Attempt to bind queue '" + queueName + "' to unknown exchange:" + exchangeName, e.getMessage());
+ Throwable cause = e.getCause();
+ assertNotNull(cause);
+ assertEquals("Attempt to bind queue '" + queueName + "' to unknown exchange:" + exchangeName, cause.getMessage());
}
}
diff --git a/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ConsumerTarget_0_10.java b/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ConsumerTarget_0_10.java
index c1ee0bc108..ff4bd1dc2e 100644
--- a/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ConsumerTarget_0_10.java
+++ b/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ConsumerTarget_0_10.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.protocol.v0_10;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.exchange.Exchange;
import org.apache.qpid.server.flow.FlowCreditManager;
import org.apache.qpid.server.logging.LogActor;
@@ -31,13 +30,13 @@ import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.plugin.MessageConverter;
import org.apache.qpid.server.protocol.MessageConverterRegistry;
import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.queue.QueueEntry;
import org.apache.qpid.server.store.TransactionLogResource;
import org.apache.qpid.server.consumer.AbstractConsumerTarget;
import org.apache.qpid.server.consumer.Consumer;
import org.apache.qpid.server.txn.AutoCommitTransaction;
import org.apache.qpid.server.txn.ServerTransaction;
import org.apache.qpid.server.util.Action;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import org.apache.qpid.transport.*;
import java.util.Collections;
@@ -507,7 +506,8 @@ public class ConsumerTarget_0_10 extends AbstractConsumerTarget implements FlowC
_creditManager = new WindowCreditManager(0l,0l);
break;
default:
- throw new RuntimeException("Unknown message flow mode: " + flowMode);
+ // this should never happen, as 0-10 is finalised and so the enum should never change
+ throw new ConnectionScopedRuntimeException("Unknown message flow mode: " + flowMode);
}
_flowMode = flowMode;
updateState(State.ACTIVE, State.SUSPENDED);
@@ -532,7 +532,7 @@ public class ConsumerTarget_0_10 extends AbstractConsumerTarget implements FlowC
}
}
- public void flush() throws AMQException
+ public void flush()
{
flushCreditState(true);
getConsumer().flush();
diff --git a/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/MessageConverter_v0_10.java b/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/MessageConverter_v0_10.java
index 32ecc6bd0e..df4c398115 100644
--- a/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/MessageConverter_v0_10.java
+++ b/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/MessageConverter_v0_10.java
@@ -32,6 +32,8 @@ import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.plugin.MessageConverter;
import org.apache.qpid.server.store.StoreFuture;
import org.apache.qpid.server.store.StoredMessage;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.transport.DeliveryProperties;
import org.apache.qpid.transport.Header;
@@ -183,7 +185,7 @@ public class MessageConverter_v0_10 implements MessageConverter<ServerMessage, M
}
catch (IOException e)
{
- throw new RuntimeException(e);
+ throw new ConnectionScopedRuntimeException(e);
}
}
}
diff --git a/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/MessageConverter_v0_10_to_Internal.java b/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/MessageConverter_v0_10_to_Internal.java
index bc5f8899f2..68997bbb01 100644
--- a/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/MessageConverter_v0_10_to_Internal.java
+++ b/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/MessageConverter_v0_10_to_Internal.java
@@ -27,6 +27,7 @@ import org.apache.qpid.server.message.internal.InternalMessageMetaData;
import org.apache.qpid.server.plugin.MessageConverter;
import org.apache.qpid.server.store.StoreFuture;
import org.apache.qpid.server.store.StoredMessage;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.transport.DeliveryProperties;
import org.apache.qpid.transport.Header;
@@ -247,11 +248,11 @@ public class MessageConverter_v0_10_to_Internal implements MessageConverter<Mess
}
catch (TypedBytesFormatException e)
{
- throw new RuntimeException(e); // TODO - Implement
+ throw new ConnectionScopedRuntimeException(e);
}
catch (EOFException e)
{
- throw new RuntimeException(e); // TODO - Implement
+ throw new ConnectionScopedRuntimeException(e); // TODO - Implement
}
}
return list;
diff --git a/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerConnection.java b/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerConnection.java
index 66ffd1ef94..f94026d0af 100644
--- a/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerConnection.java
+++ b/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerConnection.java
@@ -28,13 +28,11 @@ import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import javax.security.auth.Subject;
-import org.apache.qpid.AMQException;
import org.apache.qpid.protocol.AMQConstant;
import org.apache.qpid.server.logging.LogActor;
import org.apache.qpid.server.logging.LogSubject;
import org.apache.qpid.server.logging.actors.AMQPConnectionActor;
import org.apache.qpid.server.logging.actors.CurrentActor;
-import org.apache.qpid.server.logging.actors.GenericActor;
import org.apache.qpid.server.logging.messages.ConnectionMessages;
import org.apache.qpid.server.model.Broker;
import org.apache.qpid.server.model.Port;
@@ -44,6 +42,7 @@ import org.apache.qpid.server.protocol.AMQSessionModel;
import org.apache.qpid.server.security.AuthorizationHolder;
import org.apache.qpid.server.security.auth.AuthenticatedPrincipal;
import org.apache.qpid.server.stats.StatisticsCounter;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.transport.Connection;
import org.apache.qpid.transport.ConnectionCloseCode;
@@ -52,7 +51,6 @@ import org.apache.qpid.transport.ExecutionException;
import org.apache.qpid.transport.Method;
import org.apache.qpid.transport.ProtocolEvent;
import org.apache.qpid.transport.Session;
-import org.apache.qpid.transport.network.NetworkConnection;
import static org.apache.qpid.server.logging.subjects.LogSubjectFormat.CONNECTION_FORMAT;
import static org.apache.qpid.server.logging.subjects.LogSubjectFormat.SOCKET_FORMAT;
@@ -199,7 +197,7 @@ public class ServerConnection extends Connection implements AMQConnectionModel,
_onOpenTask = task;
}
- public void closeSession(AMQSessionModel session, AMQConstant cause, String message) throws AMQException
+ public void closeSession(AMQSessionModel session, AMQConstant cause, String message)
{
ExecutionException ex = new ExecutionException();
ExecutionErrorCode code = ExecutionErrorCode.INTERNAL_ERROR;
@@ -224,6 +222,26 @@ public class ServerConnection extends Connection implements AMQConnectionModel,
}
@Override
+ public void exception(final Throwable t)
+ {
+ try
+ {
+ super.exception(t);
+ }
+ finally
+ {
+ if(t instanceof Error)
+ {
+ throw (Error) t;
+ }
+ if(t instanceof ServerScopedRuntimeException)
+ {
+ throw (ServerScopedRuntimeException) t;
+ }
+ }
+ }
+
+ @Override
public void received(ProtocolEvent event)
{
_lastIoTime.set(System.currentTimeMillis());
@@ -294,7 +312,7 @@ public class ServerConnection extends Connection implements AMQConnectionModel,
return _actor;
}
- public void close(AMQConstant cause, String message) throws AMQException
+ public void close(AMQConstant cause, String message)
{
closeSubscriptions();
ConnectionCloseCode replyCode = ConnectionCloseCode.NORMAL;
diff --git a/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSession.java b/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSession.java
index 87a02b99c1..7e2d614b99 100644
--- a/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSession.java
+++ b/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSession.java
@@ -41,8 +41,7 @@ import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import javax.security.auth.Subject;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQStoreException;
+import org.apache.qpid.server.store.AMQStoreException;
import org.apache.qpid.protocol.AMQConstant;
import org.apache.qpid.server.TransactionTimeoutHelper;
import org.apache.qpid.server.TransactionTimeoutHelper.CloseAction;
@@ -148,7 +147,7 @@ public class ServerSession extends Session
_transactionTimeoutHelper = new TransactionTimeoutHelper(_logSubject, new CloseAction()
{
@Override
- public void doTimeoutAction(String reason) throws AMQException
+ public void doTimeoutAction(String reason)
{
getConnectionModel().closeSession(ServerSession.this, AMQConstant.RESOURCE_ERROR, reason);
}
@@ -679,7 +678,7 @@ public class ServerSession extends Session
return (LogSubject) this;
}
- public void checkTransactionStatus(long openWarn, long openClose, long idleWarn, long idleClose) throws AMQException
+ public void checkTransactionStatus(long openWarn, long openClose, long idleWarn, long idleClose)
{
_transactionTimeoutHelper.checkIdleOrOpenTimes(_transaction, openWarn, openClose, idleWarn, idleClose);
}
diff --git a/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSessionDelegate.java b/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSessionDelegate.java
index 3d50da6ed5..3961bcb080 100644
--- a/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSessionDelegate.java
+++ b/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSessionDelegate.java
@@ -25,11 +25,11 @@ import java.util.LinkedHashMap;
import java.util.UUID;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQStoreException;
-import org.apache.qpid.AMQUnknownExchangeType;
+import org.apache.qpid.server.store.AMQStoreException;
+import org.apache.qpid.server.exchange.AMQUnknownExchangeType;
import org.apache.qpid.server.exchange.Exchange;
import org.apache.qpid.server.exchange.HeadersExchange;
+import org.apache.qpid.server.filter.AMQInvalidArgumentException;
import org.apache.qpid.server.filter.FilterManager;
import org.apache.qpid.server.filter.FilterManagerFactory;
import org.apache.qpid.server.logging.messages.ExchangeMessages;
@@ -66,7 +66,7 @@ import org.apache.qpid.server.virtualhost.RequiredExchangeException;
import org.apache.qpid.server.virtualhost.ReservedExchangeNameException;
import org.apache.qpid.server.virtualhost.UnknownExchangeException;
import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.qpid.server.virtualhost.plugins.QueueExistsException;
+import org.apache.qpid.server.virtualhost.QueueExistsException;
import org.apache.qpid.transport.*;
import java.nio.ByteBuffer;
@@ -253,7 +253,7 @@ public class ServerSessionDelegate extends SessionDelegate
{
filterManager = FilterManagerFactory.createManager(method.getArguments());
}
- catch (AMQException amqe)
+ catch (AMQInvalidArgumentException amqe)
{
exception(session, method, ExecutionErrorCode.ILLEGAL_ARGUMENT, "Exception Creating FilterManager");
return;
@@ -298,10 +298,6 @@ public class ServerSessionDelegate extends SessionDelegate
{
exception(session, method, ExecutionErrorCode.RESOURCE_LOCKED, "Queue has an existing consumer - can't subscribe exclusively");
}
- catch (AMQException e)
- {
- exception(session, method, e, "Cannot subscribe to queue '" + queueName + "' with destination '" + destination);
- }
catch (QpidSecurityException e)
{
exception(session, method, ExecutionErrorCode.UNAUTHORIZED_ACCESS, e.getMessage());
@@ -435,15 +431,7 @@ public class ServerSessionDelegate extends SessionDelegate
}
else
{
-
- try
- {
- sub.flush();
- }
- catch (AMQException e)
- {
- exception(session, method, e, "Cannot flush subscription '" + destination);
- }
+ sub.flush();
}
}
@@ -787,10 +775,6 @@ public class ServerSessionDelegate extends SessionDelegate
+ " to " + method.getAlternateExchange() +".");
}
}
- catch (AMQException e)
- {
- exception(session, method, e, "Cannot declare exchange '" + exchangeName);
- }
catch (QpidSecurityException e)
{
exception(session, method, ExecutionErrorCode.UNAUTHORIZED_ACCESS, e.getMessage());
@@ -801,26 +785,6 @@ public class ServerSessionDelegate extends SessionDelegate
}
- // TODO decouple AMQException and AMQConstant error codes
- private void exception(Session session, Method method, AMQException exception, String message)
- {
- ExecutionErrorCode errorCode = ExecutionErrorCode.INTERNAL_ERROR;
- if (exception.getErrorCode() != null)
- {
- try
- {
- errorCode = ExecutionErrorCode.get(exception.getErrorCode().getCode());
- }
- catch (IllegalArgumentException iae)
- {
- // ignore, already set to INTERNAL_ERROR
- }
- }
- String description = message + "': " + exception.getMessage();
-
- exception(session, method, errorCode, description);
- }
-
private void exception(Session session, Method method, ExecutionErrorCode errorCode, String description)
{
ExecutionException ex = new ExecutionException();
@@ -903,10 +867,6 @@ public class ServerSessionDelegate extends SessionDelegate
{
exception(session, method, ExecutionErrorCode.NOT_ALLOWED, "Exchange '"+method.getExchange()+"' cannot be deleted");
}
- catch (AMQException e)
- {
- exception(session, method, e, "Cannot delete exchange '" + method.getExchange() );
- }
catch (QpidSecurityException e)
{
exception(session, method, ExecutionErrorCode.UNAUTHORIZED_ACCESS, e.getMessage());
@@ -1001,10 +961,6 @@ public class ServerSessionDelegate extends SessionDelegate
{
exchange.addBinding(method.getBindingKey(), queue, method.getArguments());
}
- catch (AMQException e)
- {
- exception(session, method, e, "Cannot add binding '" + method.getBindingKey());
- }
catch (QpidSecurityException e)
{
exception(session, method, ExecutionErrorCode.UNAUTHORIZED_ACCESS, e.getMessage());
@@ -1058,10 +1014,6 @@ public class ServerSessionDelegate extends SessionDelegate
{
exchange.removeBinding(method.getBindingKey(), queue, null);
}
- catch (AMQException e)
- {
- exception(session, method, e, "Cannot remove binding '" + method.getBindingKey());
- }
catch (QpidSecurityException e)
{
exception(session, method, ExecutionErrorCode.UNAUTHORIZED_ACCESS, e.getMessage());
@@ -1289,10 +1241,6 @@ public class ServerSessionDelegate extends SessionDelegate
{
virtualHost.removeQueue(q);
}
- catch (AMQException e)
- {
- exception(session, method, e, "Cannot delete '" + method.getQueue());
- }
catch (QpidSecurityException e)
{
exception(session, method, ExecutionErrorCode.UNAUTHORIZED_ACCESS, e.getMessage());
@@ -1345,10 +1293,6 @@ public class ServerSessionDelegate extends SessionDelegate
exception(session, method, errorCode, description);
}
}
- catch (AMQException e)
- {
- exception(session, method, e, "Cannot declare queue '" + queueName);
- }
catch (QpidSecurityException e)
{
exception(session, method, ExecutionErrorCode.UNAUTHORIZED_ACCESS, e.getMessage());
@@ -1426,10 +1370,6 @@ public class ServerSessionDelegate extends SessionDelegate
{
virtualHost.removeQueue(queue);
}
- catch (AMQException e)
- {
- exception(session, method, e, "Cannot delete queue '" + queueName);
- }
catch (QpidSecurityException e)
{
exception(session, method, ExecutionErrorCode.UNAUTHORIZED_ACCESS, e.getMessage());
@@ -1461,10 +1401,6 @@ public class ServerSessionDelegate extends SessionDelegate
{
queue.clearQueue();
}
- catch (AMQException e)
- {
- exception(session, method, e, "Cannot purge queue '" + queueName);
- }
catch (QpidSecurityException e)
{
exception(session, method, ExecutionErrorCode.UNAUTHORIZED_ACCESS, e.getMessage());
diff --git a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java b/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java
index 4eeb9d8fb2..b15b3f0bfa 100644
--- a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java
+++ b/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java
@@ -29,6 +29,7 @@ import java.util.concurrent.locks.Lock;
import org.apache.log4j.Logger;
import org.apache.qpid.AMQConnectionException;
import org.apache.qpid.AMQException;
+import org.apache.qpid.server.filter.AMQInvalidArgumentException;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.common.AMQPFilterTypes;
import org.apache.qpid.framing.AMQMethodBody;
@@ -81,6 +82,7 @@ import org.apache.qpid.server.txn.LocalTransaction;
import org.apache.qpid.server.txn.LocalTransaction.ActivityTimeAccessor;
import org.apache.qpid.server.txn.ServerTransaction;
import org.apache.qpid.server.util.Action;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.transport.TransportException;
@@ -186,9 +188,16 @@ public class AMQChannel implements AMQSessionModel, AsyncAutoCommitTransaction.F
_transactionTimeoutHelper = new TransactionTimeoutHelper(_logSubject, new CloseAction()
{
@Override
- public void doTimeoutAction(String reason) throws AMQException
+ public void doTimeoutAction(String reason)
{
- closeConnection(reason);
+ try
+ {
+ closeConnection(reason);
+ }
+ catch (AMQException e)
+ {
+ throw new ConnectionScopedRuntimeException(e);
+ }
}
});
}
@@ -516,7 +525,8 @@ public class AMQChannel implements AMQSessionModel, AsyncAutoCommitTransaction.F
*/
public AMQShortString consumeFromSource(AMQShortString tag, MessageSource source, boolean acks,
FieldTable filters, boolean exclusive, boolean noLocal)
- throws AMQException, QpidSecurityException
+ throws AMQException, QpidSecurityException, MessageSource.ExistingConsumerPreventsExclusive,
+ MessageSource.ExistingExclusiveConsumer, AMQInvalidArgumentException
{
if (tag == null)
{
@@ -579,17 +589,22 @@ public class AMQChannel implements AMQSessionModel, AsyncAutoCommitTransaction.F
AMQShortString.toString(tag),
options);
}
- catch (AMQException e)
+ catch (QpidSecurityException e)
{
_tag2SubscriptionTargetMap.remove(tag);
throw e;
}
- catch (RuntimeException e)
+ catch (MessageSource.ExistingExclusiveConsumer e)
{
_tag2SubscriptionTargetMap.remove(tag);
throw e;
}
- catch (QpidSecurityException e)
+ catch (MessageSource.ExistingConsumerPreventsExclusive e)
+ {
+ _tag2SubscriptionTargetMap.remove(tag);
+ throw e;
+ }
+ catch (AMQInvalidArgumentException e)
{
_tag2SubscriptionTargetMap.remove(tag);
throw e;
@@ -601,9 +616,8 @@ public class AMQChannel implements AMQSessionModel, AsyncAutoCommitTransaction.F
* Unsubscribe a consumer from a queue.
* @param consumerTag
* @return true if the consumerTag had a mapped queue that could be unregistered.
- * @throws AMQException
*/
- public boolean unsubscribeConsumer(AMQShortString consumerTag) throws AMQException
+ public boolean unsubscribeConsumer(AMQShortString consumerTag)
{
ConsumerTarget_0_8 target = _tag2SubscriptionTargetMap.remove(consumerTag);
@@ -622,16 +636,14 @@ public class AMQChannel implements AMQSessionModel, AsyncAutoCommitTransaction.F
/**
* Called from the protocol session to close this channel and clean up. T
- *
- * @throws AMQException if there is an error during closure
*/
@Override
- public void close() throws AMQException
+ public void close()
{
close(null, null);
}
- public void close(AMQConstant cause, String message) throws AMQException
+ public void close(AMQConstant cause, String message)
{
if(!_closing.compareAndSet(false, true))
{
@@ -651,17 +663,13 @@ public class AMQChannel implements AMQSessionModel, AsyncAutoCommitTransaction.F
{
requeue();
}
- catch (AMQException e)
- {
- _logger.error("Caught AMQException whilst attempting to requeue:" + e);
- }
catch (TransportException e)
{
_logger.error("Caught TransportException whilst attempting to requeue:" + e);
}
}
- private void unsubscribeAllConsumers() throws AMQException
+ private void unsubscribeAllConsumers()
{
if (_logger.isInfoEnabled())
{
@@ -724,9 +732,8 @@ public class AMQChannel implements AMQSessionModel, AsyncAutoCommitTransaction.F
* Called to attempt re-delivery all outstanding unacknowledged messages on the channel. May result in delivery to
* this same channel or to other subscribers.
*
- * @throws org.apache.qpid.AMQException if the requeue fails
*/
- public void requeue() throws AMQException
+ public void requeue()
{
// we must create a new map since all the messages will get a new delivery tag when they are redelivered
Collection<MessageInstance> messagesToBeDelivered = _unacknowledgedMessageMap.cancelAllMessages();
@@ -756,9 +763,8 @@ public class AMQChannel implements AMQSessionModel, AsyncAutoCommitTransaction.F
*
* @param deliveryTag The message to requeue
*
- * @throws AMQException If something goes wrong.
*/
- public void requeue(long deliveryTag) throws AMQException
+ public void requeue(long deliveryTag)
{
MessageInstance unacked = _unacknowledgedMessageMap.remove(deliveryTag);
@@ -1455,7 +1461,7 @@ public class AMQChannel implements AMQSessionModel, AsyncAutoCommitTransaction.F
return getProtocolSession().getVirtualHost();
}
- public void checkTransactionStatus(long openWarn, long openClose, long idleWarn, long idleClose) throws AMQException
+ public void checkTransactionStatus(long openWarn, long openClose, long idleWarn, long idleClose)
{
_transactionTimeoutHelper.checkIdleOrOpenTimes(_transaction, openWarn, openClose, idleWarn, idleClose);
}
diff --git a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java b/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java
index 329aa396b0..5e95701e5a 100644
--- a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java
+++ b/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java
@@ -46,28 +46,11 @@ import org.apache.log4j.Logger;
import org.apache.qpid.AMQChannelException;
import org.apache.qpid.AMQConnectionException;
import org.apache.qpid.AMQException;
+import org.apache.qpid.framing.*;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.codec.AMQCodecFactory;
import org.apache.qpid.common.QpidProperties;
import org.apache.qpid.common.ServerPropertyNames;
-import org.apache.qpid.framing.AMQBody;
-import org.apache.qpid.framing.AMQDataBlock;
-import org.apache.qpid.framing.AMQFrame;
-import org.apache.qpid.framing.AMQMethodBody;
-import org.apache.qpid.framing.AMQProtocolHeaderException;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.ChannelCloseBody;
-import org.apache.qpid.framing.ChannelCloseOkBody;
-import org.apache.qpid.framing.ConnectionCloseBody;
-import org.apache.qpid.framing.ContentBody;
-import org.apache.qpid.framing.ContentHeaderBody;
-import org.apache.qpid.framing.FieldTable;
-import org.apache.qpid.framing.FieldTableFactory;
-import org.apache.qpid.framing.HeartbeatBody;
-import org.apache.qpid.framing.MethodDispatcher;
-import org.apache.qpid.framing.MethodRegistry;
-import org.apache.qpid.framing.ProtocolInitiation;
-import org.apache.qpid.framing.ProtocolVersion;
import org.apache.qpid.properties.ConnectionStartProperties;
import org.apache.qpid.protocol.AMQConstant;
import org.apache.qpid.protocol.AMQMethodEvent;
@@ -95,6 +78,8 @@ import org.apache.qpid.server.protocol.v0_8.state.AMQState;
import org.apache.qpid.server.protocol.v0_8.state.AMQStateManager;
import org.apache.qpid.server.stats.StatisticsCounter;
import org.apache.qpid.server.consumer.Consumer;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.transport.Sender;
import org.apache.qpid.transport.TransportException;
@@ -303,9 +288,24 @@ public class AMQProtocolEngine implements ServerProtocolEngine, AMQProtocolSessi
}
receivedComplete();
}
- catch (Exception e)
+ catch (ConnectionScopedRuntimeException e)
+ {
+ _logger.error("Unexpected exception", e);
+ closeProtocolSession();
+ }
+ catch (AMQProtocolVersionException e)
+ {
+ _logger.error("Unexpected protocol version", e);
+ closeProtocolSession();
+ }
+ catch (AMQFrameDecodingException e)
{
- _logger.error("Unexpected exception when processing datablocks", e);
+ _logger.error("Frame decoding", e);
+ closeProtocolSession();
+ }
+ catch (IOException e)
+ {
+ _logger.error("I/O Exception", e);
closeProtocolSession();
}
finally
@@ -314,34 +314,14 @@ public class AMQProtocolEngine implements ServerProtocolEngine, AMQProtocolSessi
}
}
- private void receivedComplete() throws AMQException
+ private void receivedComplete()
{
- Exception exception = null;
for (AMQChannel channel : _channelsForCurrentMessage)
{
- try
- {
- channel.receivedComplete();
- }
- catch(Exception exceptionForThisChannel)
- {
- if(exception == null)
- {
- exception = exceptionForThisChannel;
- }
- _logger.error("Error informing channel that receiving is complete. Channel: " + channel, exceptionForThisChannel);
- }
+ channel.receivedComplete();
}
_channelsForCurrentMessage.clear();
-
- if(exception != null)
- {
- throw new AMQException(
- AMQConstant.INTERNAL_ERROR,
- "Error informing channel that receiving is complete: " + exception.getMessage(),
- exception);
- }
}
/**
@@ -549,7 +529,7 @@ public class AMQProtocolEngine implements ServerProtocolEngine, AMQProtocolSessi
}
catch (IOException e)
{
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
final ByteBuffer buf;
@@ -812,16 +792,15 @@ public class AMQProtocolEngine implements ServerProtocolEngine, AMQProtocolSessi
*
* @param channelId id of the channel to close
*
- * @throws AMQException if an error occurs closing the channel
* @throws IllegalArgumentException if the channel id is not valid
*/
@Override
- public void closeChannel(int channelId) throws AMQException
+ public void closeChannel(int channelId)
{
closeChannel(channelId, null, null);
}
- public void closeChannel(int channelId, AMQConstant cause, String message) throws AMQException
+ public void closeChannel(int channelId, AMQConstant cause, String message)
{
final AMQChannel channel = getChannel(channelId);
if (channel == null)
@@ -903,7 +882,7 @@ public class AMQProtocolEngine implements ServerProtocolEngine, AMQProtocolSessi
*
* @throws AMQException if an error occurs while closing any channel
*/
- private void closeAllChannels() throws AMQException
+ private void closeAllChannels()
{
for (AMQChannel channel : getChannels())
{
@@ -921,7 +900,7 @@ public class AMQProtocolEngine implements ServerProtocolEngine, AMQProtocolSessi
/** This must be called when the session is _closed in order to free up any resources managed by the session. */
@Override
- public void closeSession() throws AMQException
+ public void closeSession()
{
if(_closing.compareAndSet(false,true))
{
@@ -996,7 +975,7 @@ public class AMQProtocolEngine implements ServerProtocolEngine, AMQProtocolSessi
}
}
- private void closeConnection(int channelId, AMQConnectionException e) throws AMQException
+ private void closeConnection(int channelId, AMQConnectionException e)
{
try
{
@@ -1033,7 +1012,7 @@ public class AMQProtocolEngine implements ServerProtocolEngine, AMQProtocolSessi
{
_stateManager.changeState(AMQState.CONNECTION_CLOSED);
}
- catch (AMQException e)
+ catch (ConnectionScopedRuntimeException e)
{
_logger.info(e.getMessage());
}
@@ -1234,9 +1213,9 @@ public class AMQProtocolEngine implements ServerProtocolEngine, AMQProtocolSessi
closeProtocolSession();
}
}
- catch (AMQException e)
+ catch (ConnectionScopedRuntimeException e)
{
- _logger.error("Could not close protocol engine", e);
+ _logger.error("Could not close protocol engine", e);
}
catch (TransportException e)
{
@@ -1269,15 +1248,30 @@ public class AMQProtocolEngine implements ServerProtocolEngine, AMQProtocolSessi
}
else
{
- _logger.error("Exception caught in " + this + ", closing connection explicitly: " + throwable, throwable);
+ try
+ {
+ _logger.error("Exception caught in " + this + ", closing connection explicitly: " + throwable, throwable);
- MethodRegistry methodRegistry = MethodRegistry.getMethodRegistry(getProtocolVersion());
- ConnectionCloseBody closeBody = methodRegistry.createConnectionCloseBody(200,new AMQShortString(throwable.getMessage()),0,0);
+ MethodRegistry methodRegistry = MethodRegistry.getMethodRegistry(getProtocolVersion());
+ ConnectionCloseBody closeBody = methodRegistry.createConnectionCloseBody(200,new AMQShortString(throwable.getMessage()),0,0);
- writeFrame(closeBody.generateFrame(0));
+ writeFrame(closeBody.generateFrame(0));
- _sender.close();
+ _sender.close();
+ }
+ finally
+ {
+ if(throwable instanceof Error)
+ {
+ throw (Error) throwable;
+ }
+ if(throwable instanceof ServerScopedRuntimeException)
+ {
+ throw (ServerScopedRuntimeException) throwable;
+ }
+
+ }
}
}
@@ -1441,15 +1435,8 @@ public class AMQProtocolEngine implements ServerProtocolEngine, AMQProtocolSessi
{
writeFrame(responseBody.generateFrame(0));
- try
- {
+ closeSession();
- closeSession();
- }
- catch (AMQException ex)
- {
- throw new RuntimeException(ex);
- }
}
finally
{
@@ -1483,15 +1470,7 @@ public class AMQProtocolEngine implements ServerProtocolEngine, AMQProtocolSessi
try
{
writeFrame(responseBody.generateFrame(channelId));
-
- try
- {
- closeChannel(channelId);
- }
- catch (AMQException ex)
- {
- throw new RuntimeException(ex);
- }
+ closeChannel(channelId);
}
finally
{
@@ -1507,7 +1486,7 @@ public class AMQProtocolEngine implements ServerProtocolEngine, AMQProtocolSessi
return getContextKey().toString();
}
- public void closeSession(AMQSessionModel session, AMQConstant cause, String message) throws AMQException
+ public void closeSession(AMQSessionModel session, AMQConstant cause, String message)
{
int channelId = ((AMQChannel)session).getChannelId();
closeChannel(channelId, cause, message);
@@ -1522,7 +1501,7 @@ public class AMQProtocolEngine implements ServerProtocolEngine, AMQProtocolSessi
writeFrame(responseBody.generateFrame(channelId));
}
- public void close(AMQConstant cause, String message) throws AMQException
+ public void close(AMQConstant cause, String message)
{
closeConnection(0, new AMQConnectionException(cause, message, 0, 0,
getProtocolOutputConverter().getProtocolMajorVersion(),
diff --git a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolSession.java b/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolSession.java
index 6bcd4b9d49..58a3b5df12 100644
--- a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolSession.java
+++ b/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolSession.java
@@ -71,7 +71,7 @@ public interface AMQProtocolSession extends AMQVersionAwareProtocolSession, Auth
public static interface Task
{
- public void doTask(AMQProtocolSession session) throws AMQException;
+ public void doTask(AMQProtocolSession session);
}
/**
@@ -152,7 +152,7 @@ public interface AMQProtocolSession extends AMQVersionAwareProtocolSession, Auth
void initHeartbeats(int delay);
/** This must be called when the session is _closed in order to free up any resources managed by the session. */
- void closeSession() throws AMQException;
+ void closeSession();
void closeProtocolSession();
diff --git a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageConverter_Internal_to_v0_8.java b/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageConverter_Internal_to_v0_8.java
index b80ad3e7b8..f2bb95c8d5 100644
--- a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageConverter_Internal_to_v0_8.java
+++ b/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageConverter_Internal_to_v0_8.java
@@ -29,6 +29,7 @@ import org.apache.qpid.server.message.internal.InternalMessage;
import org.apache.qpid.server.plugin.MessageConverter;
import org.apache.qpid.server.store.StoreFuture;
import org.apache.qpid.server.store.StoredMessage;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.transport.codec.BBEncoder;
@@ -236,7 +237,7 @@ public class MessageConverter_Internal_to_v0_8 implements MessageConverter<Inter
}
catch (IOException e)
{
- throw new RuntimeException(e);
+ throw new ConnectionScopedRuntimeException(e);
}
}
}
diff --git a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageConverter_v0_8_to_Internal.java b/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageConverter_v0_8_to_Internal.java
index 6076ff66c7..f35d37ecbd 100644
--- a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageConverter_v0_8_to_Internal.java
+++ b/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageConverter_v0_8_to_Internal.java
@@ -22,6 +22,7 @@ package org.apache.qpid.server.protocol.v0_8;
import org.apache.qpid.server.message.internal.InternalMessage;
import org.apache.qpid.server.plugin.MessageConverter;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.transport.codec.BBDecoder;
import org.apache.qpid.typedmessage.TypedBytesContentReader;
@@ -124,11 +125,11 @@ public class MessageConverter_v0_8_to_Internal implements MessageConverter<AMQMe
}
catch (TypedBytesFormatException e)
{
- throw new RuntimeException(e); // TODO - Implement
+ throw new ConnectionScopedRuntimeException(e);
}
catch (EOFException e)
{
- throw new RuntimeException(e); // TODO - Implement
+ throw new ConnectionScopedRuntimeException(e);
}
}
return list;
diff --git a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageMetaData.java b/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageMetaData.java
index 3665e7f135..fd7fb9ca80 100644
--- a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageMetaData.java
+++ b/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageMetaData.java
@@ -22,6 +22,8 @@ package org.apache.qpid.server.protocol.v0_8;
import java.util.Collection;
import org.apache.qpid.AMQException;
+import org.apache.qpid.framing.AMQFrameDecodingException;
+import org.apache.qpid.framing.AMQProtocolVersionException;
import org.apache.qpid.framing.AMQShortString;
import org.apache.qpid.framing.BasicContentHeaderProperties;
import org.apache.qpid.framing.ContentHeaderBody;
@@ -32,6 +34,7 @@ import org.apache.qpid.server.message.AMQMessageHeader;
import org.apache.qpid.server.plugin.MessageMetaDataType;
import org.apache.qpid.server.store.StorableMessageMetaData;
import org.apache.qpid.server.util.ByteBufferOutputStream;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import org.apache.qpid.util.ByteBufferInputStream;
import java.io.DataInputStream;
@@ -132,7 +135,7 @@ public class MessageMetaData implements StorableMessageMetaData
catch (IOException e)
{
// This shouldn't happen as we are not actually using anything that can throw an IO Exception
- throw new RuntimeException(e);
+ throw new ConnectionScopedRuntimeException(e);
}
return dest.position()-oldPosition;
@@ -196,17 +199,21 @@ public class MessageMetaData implements StorableMessageMetaData
};
return new MessageMetaData(publishBody, chb, arrivalTime);
}
- catch (AMQException e)
+ catch (IOException e)
{
- throw new RuntimeException(e);
+ throw new ConnectionScopedRuntimeException(e);
}
- catch (IOException e)
+ catch (AMQProtocolVersionException e)
{
- throw new RuntimeException(e);
+ throw new ConnectionScopedRuntimeException(e);
+ }
+ catch (AMQFrameDecodingException e)
+ {
+ throw new ConnectionScopedRuntimeException(e);
}
}
- };
+ }
public AMQMessageHeader getMessageHeader()
{
diff --git a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/BasicConsumeMethodHandler.java b/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/BasicConsumeMethodHandler.java
index ad4235b786..ce90de7aac 100644
--- a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/BasicConsumeMethodHandler.java
+++ b/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/BasicConsumeMethodHandler.java
@@ -28,6 +28,7 @@ import org.apache.qpid.framing.AMQShortString;
import org.apache.qpid.framing.BasicConsumeBody;
import org.apache.qpid.framing.MethodRegistry;
import org.apache.qpid.protocol.AMQConstant;
+import org.apache.qpid.server.filter.AMQInvalidArgumentException;
import org.apache.qpid.server.message.MessageSource;
import org.apache.qpid.server.protocol.v0_8.AMQChannel;
import org.apache.qpid.server.protocol.v0_8.AMQProtocolSession;
@@ -149,7 +150,7 @@ public class BasicConsumeMethodHandler implements StateAwareMethodListener<Basic
}
}
- catch (org.apache.qpid.AMQInvalidArgumentException ise)
+ catch (AMQInvalidArgumentException ise)
{
_logger.debug("Closing connection due to invalid selector");
diff --git a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/BasicGetMethodHandler.java b/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/BasicGetMethodHandler.java
index f55a120a2d..c9a7cc69a1 100644
--- a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/BasicGetMethodHandler.java
+++ b/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/BasicGetMethodHandler.java
@@ -31,6 +31,7 @@ import org.apache.qpid.framing.MethodRegistry;
import org.apache.qpid.protocol.AMQConstant;
import org.apache.qpid.server.message.InstanceProperties;
import org.apache.qpid.server.message.MessageInstance;
+import org.apache.qpid.server.message.MessageSource;
import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.protocol.v0_8.AMQChannel;
import org.apache.qpid.server.flow.FlowCreditManager;
@@ -124,6 +125,17 @@ public class BasicGetMethodHandler implements StateAwareMethodListener<BasicGetB
throw body.getConnectionException(AMQConstant.ACCESS_REFUSED,
e.getMessage());
}
+ catch (MessageSource.ExistingExclusiveConsumer e)
+ {
+ throw body.getConnectionException(AMQConstant.NOT_ALLOWED,
+ "Queue has an exclusive consumer");
+ }
+ catch (MessageSource.ExistingConsumerPreventsExclusive e)
+ {
+ throw body.getConnectionException(AMQConstant.INTERNAL_ERROR,
+ "The GET request has been evaluated as an exclusive consumer, " +
+ "this is likely due to a programming error in the Qpid broker");
+ }
}
}
}
@@ -132,7 +144,8 @@ public class BasicGetMethodHandler implements StateAwareMethodListener<BasicGetB
final AMQProtocolSession session,
final AMQChannel channel,
final boolean acks)
- throws AMQException, QpidSecurityException
+ throws AMQException, QpidSecurityException, MessageSource.ExistingConsumerPreventsExclusive,
+ MessageSource.ExistingExclusiveConsumer
{
final FlowCreditManager singleMessageCredit = new MessageOnlyCreditManager(1L);
diff --git a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/ChannelOpenHandler.java b/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/ChannelOpenHandler.java
index 442c912032..2594242db4 100644
--- a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/ChannelOpenHandler.java
+++ b/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/ChannelOpenHandler.java
@@ -35,6 +35,7 @@ import org.apache.qpid.server.protocol.v0_8.AMQChannel;
import org.apache.qpid.server.protocol.v0_8.AMQProtocolSession;
import org.apache.qpid.server.protocol.v0_8.state.AMQStateManager;
import org.apache.qpid.server.protocol.v0_8.state.StateAwareMethodListener;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import org.apache.qpid.server.virtualhost.VirtualHost;
import java.io.ByteArrayOutputStream;
@@ -99,7 +100,7 @@ public class ChannelOpenHandler implements StateAwareMethodListener<ChannelOpenB
catch (IOException e)
{
// This *really* shouldn't happen as we're not doing any I/O
- throw new RuntimeException("I/O exception when writing to byte array", e);
+ throw new ConnectionScopedRuntimeException("I/O exception when writing to byte array", e);
}
// should really associate this channelId to the session
@@ -123,7 +124,7 @@ public class ChannelOpenHandler implements StateAwareMethodListener<ChannelOpenB
catch (IOException e)
{
// This *really* shouldn't happen as we're not doing any I/O
- throw new RuntimeException("I/O exception when writing to byte array", e);
+ throw new ConnectionScopedRuntimeException("I/O exception when writing to byte array", e);
}
// should really associate this channelId to the session
diff --git a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/ExchangeDeclareHandler.java b/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/ExchangeDeclareHandler.java
index fa513486a4..5c5b1f141b 100644
--- a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/ExchangeDeclareHandler.java
+++ b/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/ExchangeDeclareHandler.java
@@ -24,7 +24,7 @@ import org.apache.log4j.Logger;
import org.apache.qpid.AMQConnectionException;
import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQUnknownExchangeType;
+import org.apache.qpid.server.exchange.AMQUnknownExchangeType;
import org.apache.qpid.framing.AMQMethodBody;
import org.apache.qpid.framing.AMQShortString;
import org.apache.qpid.framing.ExchangeDeclareBody;
@@ -38,6 +38,7 @@ import org.apache.qpid.server.protocol.v0_8.state.StateAwareMethodListener;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.server.virtualhost.ExchangeExistsException;
import org.apache.qpid.server.virtualhost.ReservedExchangeNameException;
+import org.apache.qpid.server.virtualhost.UnknownExchangeException;
import org.apache.qpid.server.virtualhost.VirtualHost;
public class ExchangeDeclareHandler implements StateAwareMethodListener<ExchangeDeclareBody>
@@ -129,6 +130,11 @@ public class ExchangeDeclareHandler implements StateAwareMethodListener<Exchange
{
throw body.getConnectionException(AMQConstant.ACCESS_REFUSED, e.getMessage());
}
+ catch (UnknownExchangeException e)
+ {
+ // note - since 0-8/9/9-1 can't set the alt. exchange this exception should never occur
+ throw body.getConnectionException(AMQConstant.NOT_FOUND, "Unknown alternate exchange",e);
+ }
}
diff --git a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/QueueDeclareHandler.java b/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/QueueDeclareHandler.java
index 1286a20970..5b5525643c 100644
--- a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/QueueDeclareHandler.java
+++ b/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/QueueDeclareHandler.java
@@ -34,21 +34,17 @@ import org.apache.qpid.server.model.UUIDGenerator;
import org.apache.qpid.server.protocol.v0_8.AMQProtocolSession;
import org.apache.qpid.server.protocol.AMQSessionModel;
import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.queue.AMQQueueFactory;
import org.apache.qpid.server.queue.QueueArgumentsConverter;
-import org.apache.qpid.server.queue.QueueRegistry;
import org.apache.qpid.server.protocol.v0_8.state.AMQStateManager;
import org.apache.qpid.server.protocol.v0_8.state.StateAwareMethodListener;
import org.apache.qpid.server.security.QpidSecurityException;
-import org.apache.qpid.server.store.DurableConfigurationStoreHelper;
-import org.apache.qpid.server.store.DurableConfigurationStore;
import org.apache.qpid.server.util.Action;
import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import org.apache.qpid.server.virtualhost.VirtualHost;
import java.util.Map;
import java.util.UUID;
-import org.apache.qpid.server.virtualhost.plugins.QueueExistsException;
+import org.apache.qpid.server.virtualhost.QueueExistsException;
public class QueueDeclareHandler implements StateAwareMethodListener<QueueDeclareBody>
{
@@ -131,7 +127,7 @@ public class QueueDeclareHandler implements StateAwareMethodListener<QueueDeclar
final AMQQueue q = queue;
final AMQProtocolSession.Task sessionCloseTask = new AMQProtocolSession.Task()
{
- public void doTask(AMQProtocolSession session) throws AMQException
+ public void doTask(AMQProtocolSession session)
{
q.setExclusiveOwningSession(null);
}
@@ -219,7 +215,7 @@ public class QueueDeclareHandler implements StateAwareMethodListener<QueueDeclar
QueueDeclareBody body,
final VirtualHost virtualHost,
final AMQProtocolSession session)
- throws AMQException, QpidSecurityException
+ throws AMQException, QpidSecurityException, QueueExistsException
{
final boolean durable = body.getDurable();
@@ -241,7 +237,7 @@ public class QueueDeclareHandler implements StateAwareMethodListener<QueueDeclar
final AMQProtocolSession.Task deleteQueueTask =
new AMQProtocolSession.Task()
{
- public void doTask(AMQProtocolSession session) throws AMQException
+ public void doTask(AMQProtocolSession session)
{
if (virtualHost.getQueue(queueName.toString()) == queue)
{
diff --git a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/state/AMQStateManager.java b/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/state/AMQStateManager.java
index 0555bba98b..c3cbb5e26f 100644
--- a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/state/AMQStateManager.java
+++ b/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/state/AMQStateManager.java
@@ -52,8 +52,6 @@ public class AMQStateManager implements AMQMethodListener
/** The current state */
private AMQState _currentState;
- private CopyOnWriteArraySet<StateListener> _stateListeners = new CopyOnWriteArraySet<StateListener>();
-
public AMQStateManager(Broker broker, AMQProtocolSession protocolSession)
{
_broker = broker;
@@ -72,30 +70,17 @@ public class AMQStateManager implements AMQMethodListener
return _broker;
}
- public AMQState getCurrentState()
- {
- return _currentState;
- }
-
- public void changeState(AMQState newState) throws AMQException
+ public void changeState(AMQState newState)
{
_logger.debug("State changing to " + newState + " from old state " + _currentState);
final AMQState oldState = _currentState;
_currentState = newState;
- for (StateListener l : _stateListeners)
- {
- l.stateChanged(oldState, newState);
- }
}
public void error(Exception e)
{
_logger.error("State manager received error notification[Current State:" + _currentState + "]: " + e, e);
- for (StateListener l : _stateListeners)
- {
- l.error(e);
- }
}
public <B extends AMQMethodBody> boolean methodReceived(AMQMethodEvent<B> evt) throws AMQException
@@ -121,28 +106,6 @@ public class AMQStateManager implements AMQMethodListener
}
- private <B extends AMQMethodBody> void checkChannel(AMQMethodEvent<B> evt, AMQProtocolSession protocolSession)
- throws AMQException
- {
- if ((evt.getChannelId() != 0) && !(evt.getMethod() instanceof ChannelOpenBody)
- && (protocolSession.getChannel(evt.getChannelId()) == null)
- && !protocolSession.channelAwaitingClosure(evt.getChannelId()))
- {
- throw evt.getMethod().getChannelNotFoundException(evt.getChannelId());
- }
- }
-
- public void addStateListener(StateListener listener)
- {
- _logger.debug("Adding state listener");
- _stateListeners.add(listener);
- }
-
- public void removeStateListener(StateListener listener)
- {
- _stateListeners.remove(listener);
- }
-
public VirtualHostRegistry getVirtualHostRegistry()
{
return _broker.getVirtualHostRegistry();
diff --git a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/state/IllegalStateTransitionException.java b/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/state/IllegalStateTransitionException.java
deleted file mode 100644
index f61553f8a2..0000000000
--- a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/state/IllegalStateTransitionException.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.server.protocol.v0_8.state;
-
-import org.apache.qpid.AMQException;
-
-/**
- * @todo Not an AMQP exception as no status code.
- *
- * @todo Not used! Delete.
- */
-public class IllegalStateTransitionException extends AMQException
-{
- private AMQState _originalState;
-
- private Class _frame;
-
- public IllegalStateTransitionException(AMQState originalState, Class frame)
- {
- super("No valid state transition defined for receiving frame " + frame + " from state " + originalState);
- _originalState = originalState;
- _frame = frame;
- }
-
- public AMQState getOriginalState()
- {
- return _originalState;
- }
-
- public Class getFrameClass()
- {
- return _frame;
- }
-}
diff --git a/qpid/java/broker-plugins/amqp-0-8-protocol/src/test/java/org/apache/qpid/server/protocol/v0_8/AckTest.java b/qpid/java/broker-plugins/amqp-0-8-protocol/src/test/java/org/apache/qpid/server/protocol/v0_8/AckTest.java
index 23c32f988d..8d7de4cd93 100644
--- a/qpid/java/broker-plugins/amqp-0-8-protocol/src/test/java/org/apache/qpid/server/protocol/v0_8/AckTest.java
+++ b/qpid/java/broker-plugins/amqp-0-8-protocol/src/test/java/org/apache/qpid/server/protocol/v0_8/AckTest.java
@@ -139,28 +139,20 @@ public class AckTest extends QpidTestCase
final StoredMessage storedMessage = _messageStore.addMessage(mmd);
final AMQMessage message = new AMQMessage(storedMessage);
ServerTransaction txn = new AutoCommitTransaction(_messageStore);
- txn.enqueue(_queue, message, new ServerTransaction.Action() {
- public void postCommit()
- {
- try
- {
-
- _queue.enqueue(message,null);
- }
- catch (AMQException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- public void onRollback()
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
- });
+ txn.enqueue(_queue, message,
+ new ServerTransaction.Action()
+ {
+ public void postCommit()
+ {
+ _queue.enqueue(message,null);
+ }
+
+ public void onRollback()
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ });
- // we manually send the message to the subscription
- //_subscription.send(new QueueEntry(_queue,msg), _queue);
}
try
{
diff --git a/qpid/java/broker-plugins/amqp-0-8-protocol/src/test/java/org/apache/qpid/server/protocol/v0_8/InternalTestProtocolSession.java b/qpid/java/broker-plugins/amqp-0-8-protocol/src/test/java/org/apache/qpid/server/protocol/v0_8/InternalTestProtocolSession.java
index 4a2fbe44fa..7661d98cb4 100644
--- a/qpid/java/broker-plugins/amqp-0-8-protocol/src/test/java/org/apache/qpid/server/protocol/v0_8/InternalTestProtocolSession.java
+++ b/qpid/java/broker-plugins/amqp-0-8-protocol/src/test/java/org/apache/qpid/server/protocol/v0_8/InternalTestProtocolSession.java
@@ -223,7 +223,7 @@ public class InternalTestProtocolSession extends AMQProtocolEngine implements Pr
// Then the AMQMinaProtocolSession can join on the returning future without a NPE.
}
- public void closeSession(AMQSessionModel session, AMQConstant cause, String message) throws AMQException
+ public void closeSession(AMQSessionModel session, AMQConstant cause, String message)
{
super.closeSession(session, cause, message);
diff --git a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java
index 41e2fef03f..cae61f9d80 100644
--- a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java
+++ b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java
@@ -22,7 +22,6 @@ package org.apache.qpid.server.protocol.v1_0;
import java.text.MessageFormat;
import java.util.Collection;
-import org.apache.qpid.AMQException;
import org.apache.qpid.amqp_1_0.transport.ConnectionEndpoint;
import org.apache.qpid.amqp_1_0.transport.ConnectionEventListener;
import org.apache.qpid.amqp_1_0.transport.SessionEndpoint;
@@ -152,7 +151,7 @@ public class Connection_1_0 implements ConnectionEventListener
private volatile boolean _stopped;
@Override
- public void close(AMQConstant cause, String message) throws AMQException
+ public void close(AMQConstant cause, String message)
{
_conn.close();
}
@@ -170,7 +169,7 @@ public class Connection_1_0 implements ConnectionEventListener
}
@Override
- public void closeSession(AMQSessionModel session, AMQConstant cause, String message) throws AMQException
+ public void closeSession(AMQSessionModel session, AMQConstant cause, String message)
{
// TODO
}
diff --git a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ConsumerTarget_1_0.java b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ConsumerTarget_1_0.java
index dbfb8f5fc4..f3417710a5 100644
--- a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ConsumerTarget_1_0.java
+++ b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ConsumerTarget_1_0.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.protocol.v1_0;
-import org.apache.qpid.AMQException;
import org.apache.qpid.amqp_1_0.codec.ValueHandler;
import org.apache.qpid.amqp_1_0.messaging.SectionEncoder;
import org.apache.qpid.amqp_1_0.messaging.SectionEncoderImpl;
@@ -46,6 +45,7 @@ import org.apache.qpid.server.protocol.MessageConverterRegistry;
import org.apache.qpid.server.consumer.AbstractConsumerTarget;
import org.apache.qpid.server.consumer.Consumer;
import org.apache.qpid.server.txn.ServerTransaction;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import java.nio.ByteBuffer;
import java.util.List;
@@ -187,7 +187,7 @@ class ConsumerTarget_1_0 extends AbstractConsumerTarget
catch (AmqpErrorException e)
{
//TODO
- throw new RuntimeException(e);
+ throw new ConnectionScopedRuntimeException(e);
}
Header header = new Header();
diff --git a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ExchangeDestination.java b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ExchangeDestination.java
index 3d030890e0..5356a6e6a3 100644
--- a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ExchangeDestination.java
+++ b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ExchangeDestination.java
@@ -20,8 +20,6 @@
*/
package org.apache.qpid.server.protocol.v1_0;
-import java.util.List;
-import org.apache.qpid.AMQException;
import org.apache.qpid.amqp_1_0.type.Outcome;
import org.apache.qpid.amqp_1_0.type.messaging.Accepted;
import org.apache.qpid.amqp_1_0.type.messaging.Rejected;
@@ -29,8 +27,6 @@ import org.apache.qpid.amqp_1_0.type.messaging.TerminusDurability;
import org.apache.qpid.amqp_1_0.type.messaging.TerminusExpiryPolicy;
import org.apache.qpid.server.exchange.Exchange;
import org.apache.qpid.server.message.InstanceProperties;
-import org.apache.qpid.server.message.MessageReference;
-import org.apache.qpid.server.queue.BaseQueue;
import org.apache.qpid.server.txn.ServerTransaction;
public class ExchangeDestination implements ReceivingDestination, SendingDestination
diff --git a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_Internal_to_v1_0.java b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_Internal_to_v1_0.java
index f02908391a..1764eec84d 100644
--- a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_Internal_to_v1_0.java
+++ b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_Internal_to_v1_0.java
@@ -31,6 +31,7 @@ import org.apache.qpid.amqp_1_0.type.messaging.Data;
import org.apache.qpid.amqp_1_0.type.messaging.Header;
import org.apache.qpid.amqp_1_0.type.messaging.Properties;
import org.apache.qpid.server.message.internal.InternalMessage;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -132,7 +133,7 @@ public class MessageConverter_Internal_to_v1_0 extends MessageConverter_to_1_0<I
}
catch (IOException e)
{
- throw new RuntimeException(e);
+ throw new ConnectionScopedRuntimeException(e);
}
}
}
diff --git a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_to_1_0.java b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_to_1_0.java
index a8a203b247..40f738b8e7 100644
--- a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_to_1_0.java
+++ b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_to_1_0.java
@@ -39,6 +39,7 @@ import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.plugin.MessageConverter;
import org.apache.qpid.server.store.StoreFuture;
import org.apache.qpid.server.store.StoredMessage;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.transport.codec.BBDecoder;
import org.apache.qpid.typedmessage.TypedBytesContentReader;
@@ -140,11 +141,11 @@ public abstract class MessageConverter_to_1_0<M extends ServerMessage> implement
}
catch (TypedBytesFormatException e)
{
- throw new RuntimeException(e); // TODO - Implement
+ throw new ConnectionScopedRuntimeException(e);
}
catch (EOFException e)
{
- throw new RuntimeException(e); // TODO - Implement
+ throw new ConnectionScopedRuntimeException(e);
}
}
return new AmqpValue(list);
diff --git a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_v1_0_to_Internal.java b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_v1_0_to_Internal.java
index f639f98dba..ec6d5a924c 100644
--- a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_v1_0_to_Internal.java
+++ b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_v1_0_to_Internal.java
@@ -30,6 +30,7 @@ import org.apache.qpid.amqp_1_0.type.messaging.AmqpValue;
import org.apache.qpid.amqp_1_0.type.messaging.Data;
import org.apache.qpid.server.message.internal.InternalMessage;
import org.apache.qpid.server.plugin.MessageConverter;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.transport.codec.BBDecoder;
import org.apache.qpid.typedmessage.TypedBytesContentReader;
@@ -96,7 +97,7 @@ public class MessageConverter_v1_0_to_Internal implements MessageConverter<Messa
{
if(previousSection != null && (previousSection.getClass() != section.getClass() || section instanceof AmqpValue))
{
- throw new RuntimeException("Message is badly formed and has multiple body section which are not all Data or not all AmqpSequence");
+ throw new ConnectionScopedRuntimeException("Message is badly formed and has multiple body section which are not all Data or not all AmqpSequence");
}
else
{
@@ -149,7 +150,7 @@ public class MessageConverter_v1_0_to_Internal implements MessageConverter<Messa
}
catch (AmqpErrorException e)
{
- throw new RuntimeException(e);
+ throw new ConnectionScopedRuntimeException(e);
}
@@ -257,11 +258,11 @@ public class MessageConverter_v1_0_to_Internal implements MessageConverter<Messa
}
catch (TypedBytesFormatException e)
{
- throw new RuntimeException(e); // TODO - Implement
+ throw new ConnectionScopedRuntimeException(e);
}
catch (EOFException e)
{
- throw new RuntimeException(e); // TODO - Implement
+ throw new ConnectionScopedRuntimeException(e);
}
}
return list;
diff --git a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageMetaData_1_0.java b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageMetaData_1_0.java
index be9d7a2d60..f28e25e080 100755
--- a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageMetaData_1_0.java
+++ b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageMetaData_1_0.java
@@ -43,6 +43,7 @@ import org.apache.qpid.amqp_1_0.type.messaging.Properties;
import org.apache.qpid.server.message.AMQMessageHeader;
import org.apache.qpid.server.plugin.MessageMetaDataType;
import org.apache.qpid.server.store.StorableMessageMetaData;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
public class MessageMetaData_1_0 implements StorableMessageMetaData
{
@@ -394,7 +395,7 @@ public class MessageMetaData_1_0 implements StorableMessageMetaData
catch (AmqpErrorException e)
{
//TODO
- throw new RuntimeException(e);
+ throw new ConnectionScopedRuntimeException(e);
}
}
diff --git a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ProtocolEngine_1_0_0_SASL.java b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ProtocolEngine_1_0_0_SASL.java
index d614f44981..58c3597a5c 100644
--- a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ProtocolEngine_1_0_0_SASL.java
+++ b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ProtocolEngine_1_0_0_SASL.java
@@ -20,6 +20,7 @@
*/
package org.apache.qpid.server.protocol.v1_0;
+import java.io.IOException;
import java.io.PrintWriter;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
@@ -40,8 +41,11 @@ import org.apache.qpid.amqp_1_0.transport.ConnectionEndpoint;
import org.apache.qpid.amqp_1_0.transport.Container;
import org.apache.qpid.amqp_1_0.transport.FrameOutputHandler;
import org.apache.qpid.amqp_1_0.type.Binary;
+import org.apache.qpid.amqp_1_0.type.ErrorCondition;
import org.apache.qpid.amqp_1_0.type.FrameBody;
import org.apache.qpid.amqp_1_0.type.Symbol;
+import org.apache.qpid.amqp_1_0.type.transport.*;
+import org.apache.qpid.amqp_1_0.type.transport.Error;
import org.apache.qpid.common.QpidProperties;
import org.apache.qpid.common.ServerPropertyNames;
import org.apache.qpid.protocol.ServerProtocolEngine;
@@ -51,12 +55,16 @@ import org.apache.qpid.server.model.Transport;
import org.apache.qpid.server.protocol.v1_0.Connection_1_0;
import org.apache.qpid.server.security.SubjectCreator;
import org.apache.qpid.server.security.auth.UsernamePrincipal;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.transport.Sender;
import org.apache.qpid.transport.network.NetworkConnection;
public class ProtocolEngine_1_0_0_SASL implements ServerProtocolEngine, FrameOutputHandler
{
+ private static final org.apache.log4j.Logger
+ _logger = org.apache.log4j.Logger.getLogger(ProtocolEngine_1_0_0_SASL.class);
+
private final Port _port;
private final Transport _transport;
private long _readBytes;
@@ -353,9 +361,35 @@ public class ProtocolEngine_1_0_0_SASL implements ServerProtocolEngine, FrameOut
}
- public void exception(Throwable t)
+ public void exception(Throwable throwable)
{
- t.printStackTrace();
+ if (throwable instanceof IOException)
+ {
+ _logger.info("IOException caught in " + this + ", connection closed implicitly: " + throwable);
+ }
+ else
+ {
+
+ try
+ {
+ final Error err = new Error();
+ err.setCondition(AmqpError.INTERNAL_ERROR);
+ err.setDescription(throwable.getMessage());
+ _conn.close(err);
+ close();
+ }
+ finally
+ {
+ if(throwable instanceof java.lang.Error)
+ {
+ throw (java.lang.Error) throwable;
+ }
+ if(throwable instanceof ServerScopedRuntimeException)
+ {
+ throw (ServerScopedRuntimeException) throwable;
+ }
+ }
+ }
}
public void closed()
diff --git a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/QueueDestination.java b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/QueueDestination.java
index 3d6bb5e3db..4fefbe9f7d 100644
--- a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/QueueDestination.java
+++ b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/QueueDestination.java
@@ -49,37 +49,22 @@ public class QueueDestination extends MessageSourceDestination implements Sendin
public Outcome send(final Message_1_0 message, ServerTransaction txn)
{
- try
+ txn.enqueue(getQueue(),message, new ServerTransaction.Action()
{
- txn.enqueue(getQueue(),message, new ServerTransaction.Action()
+
+
+ public void postCommit()
{
+ getQueue().enqueue(message,null);
+ }
+
+ public void onRollback()
+ {
+ // NO-OP
+ }
+ });
- public void postCommit()
- {
- try
- {
- getQueue().enqueue(message,null);
- }
- catch (Exception e)
- {
- // TODO
- throw new RuntimeException(e);
- }
-
- }
-
- public void onRollback()
- {
- // NO-OP
- }
- });
- }
- catch(Exception e)
- {
- _logger.error("Send error", e);
- throw new RuntimeException(e);
- }
return ACCEPTED;
}
diff --git a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/SendingLink_1_0.java b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/SendingLink_1_0.java
index 56b574685f..546cc79f9e 100644
--- a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/SendingLink_1_0.java
+++ b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/SendingLink_1_0.java
@@ -30,8 +30,6 @@ import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQInternalException;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.amqp_1_0.transport.DeliveryStateHandler;
import org.apache.qpid.amqp_1_0.transport.LinkEndpoint;
@@ -64,7 +62,9 @@ import org.apache.qpid.server.consumer.Consumer;
import org.apache.qpid.server.txn.AutoCommitTransaction;
import org.apache.qpid.server.txn.ServerTransaction;
import org.apache.qpid.server.util.Action;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import org.apache.qpid.server.virtualhost.VirtualHost;
+import org.apache.qpid.server.virtualhost.QueueExistsException;
public class SendingLink_1_0 implements SendingLinkListener, Link_1_0, DeliveryStateHandler
{
@@ -324,11 +324,6 @@ public class SendingLink_1_0 implements SendingLinkListener, Link_1_0, DeliveryS
{
_vhost.removeQueue(tempQueue);
}
- catch (AMQException e)
- {
- //TODO
- _logger.error("Error removing queue", e);
- }
catch (QpidSecurityException e)
{
//TODO
@@ -356,17 +351,12 @@ public class SendingLink_1_0 implements SendingLinkListener, Link_1_0, DeliveryS
catch (QpidSecurityException e)
{
_logger.error("Security error", e);
- throw new RuntimeException(e);
- }
- catch (AMQInternalException e)
- {
- _logger.error("Internal error", e);
- throw new RuntimeException(e);
+ throw new ConnectionScopedRuntimeException(e);
}
- catch (AMQException e)
+ catch (QueueExistsException e)
{
- _logger.error("Error", e);
- throw new RuntimeException(e);
+ _logger.error("A randomly generated temporary queue name collided with an existing queue",e);
+ throw new ConnectionScopedRuntimeException(e);
}
@@ -377,7 +367,7 @@ public class SendingLink_1_0 implements SendingLinkListener, Link_1_0, DeliveryS
}
else
{
- throw new RuntimeException("Unknown destination type");
+ throw new ConnectionScopedRuntimeException("Unknown destination type");
}
if(_target != null)
@@ -403,15 +393,21 @@ public class SendingLink_1_0 implements SendingLinkListener, Link_1_0, DeliveryS
messageFilter == null ? null : new SimpleFilterManager(messageFilter),
Message_1_0.class, name, options);
}
- catch (AMQException e)
+ catch (QpidSecurityException e)
{
//TODO
- _logger.error("Error registering subscription", e);
+ _logger.info("Error registering subscription", e);
+ throw new ConnectionScopedRuntimeException(e);
}
- catch (QpidSecurityException e)
+ catch (MessageSource.ExistingExclusiveConsumer e)
{
- //TODO
- _logger.error("Error registering subscription", e);
+ _logger.info("Cannot add a consumer to the destination as there is already an exclusive consumer");
+ throw new ConnectionScopedRuntimeException(e);
+ }
+ catch (MessageSource.ExistingConsumerPreventsExclusive e)
+ {
+ _logger.info("Cannot add an exclusive consumer to the destination as there is already a consumer");
+ throw new ConnectionScopedRuntimeException(e);
}
}
@@ -429,18 +425,7 @@ public class SendingLink_1_0 implements SendingLinkListener, Link_1_0, DeliveryS
// if not durable or close
if(!TerminusDurability.UNSETTLED_STATE.equals(_durability))
{
-
- try
- {
-
- _consumer.close();
-
- }
- catch (AMQException e)
- {
- //TODO
- _logger.error("Error unregistering subscription", e);
- }
+ _consumer.close();
Modified state = new Modified();
state.setDeliveryFailed(true);
@@ -462,11 +447,6 @@ public class SendingLink_1_0 implements SendingLinkListener, Link_1_0, DeliveryS
{
_vhost.removeQueue((AMQQueue)_queue);
}
- catch(AMQException e)
- {
- //TODO
- _logger.error("Error registering subscription", e);
- }
catch (QpidSecurityException e)
{
//TODO
diff --git a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
index a0b2fc5289..c055d1e840 100644
--- a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
+++ b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
@@ -36,7 +36,6 @@ import org.apache.qpid.amqp_1_0.type.transaction.TxnCapability;
import org.apache.qpid.amqp_1_0.type.transport.*;
import org.apache.qpid.amqp_1_0.type.transport.Error;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.protocol.AMQConstant;
import org.apache.qpid.server.exchange.Exchange;
@@ -51,7 +50,9 @@ import org.apache.qpid.server.queue.AMQQueue;
import org.apache.qpid.server.txn.AutoCommitTransaction;
import org.apache.qpid.server.txn.ServerTransaction;
import org.apache.qpid.server.util.Action;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import org.apache.qpid.server.virtualhost.VirtualHost;
+import org.apache.qpid.server.virtualhost.QueueExistsException;
import java.util.*;
@@ -357,11 +358,6 @@ public class Session_1_0 implements SessionEventListener, AMQSessionModel, LogSu
{
_vhost.removeQueue(tempQueue);
}
- catch (AMQException e)
- {
- //TODO
- _logger.error("Error removing queue from vhost", e);
- }
catch (QpidSecurityException e)
{
//TODO
@@ -399,12 +395,13 @@ public class Session_1_0 implements SessionEventListener, AMQSessionModel, LogSu
catch (QpidSecurityException e)
{
//TODO
- _logger.error("Security error", e);
+ _logger.info("Security error", e);
+ throw new ConnectionScopedRuntimeException(e);
}
- catch (AMQException e)
+ catch (QueueExistsException e)
{
- //TODO
- _logger.error("Error", e);
+ _logger.error("A temporary queue was created with a name which collided with an existing queue name");
+ throw new ConnectionScopedRuntimeException(e);
}
return queue;
@@ -490,14 +487,14 @@ public class Session_1_0 implements SessionEventListener, AMQSessionModel, LogSu
}
@Override
- public void close() throws AMQException
+ public void close()
{
// TODO - required for AMQSessionModel / management initiated closing
}
@Override
- public void close(AMQConstant cause, String message) throws AMQException
+ public void close(AMQConstant cause, String message)
{
// TODO - required for AMQSessionModel
}
@@ -509,7 +506,7 @@ public class Session_1_0 implements SessionEventListener, AMQSessionModel, LogSu
}
@Override
- public void checkTransactionStatus(long openWarn, long openClose, long idleWarn, long idleClose) throws AMQException
+ public void checkTransactionStatus(long openWarn, long openClose, long idleWarn, long idleClose)
{
// TODO - required for AMQSessionModel / long running transaction detection
}
diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java b/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java
index bc8d157346..d32ea49e60 100644
--- a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java
+++ b/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java
@@ -40,6 +40,7 @@ import org.apache.qpid.server.store.Event;
import org.apache.qpid.server.store.EventListener;
import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.MessageStoreConstants;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.util.FileUtils;
/**
@@ -99,7 +100,7 @@ public class DerbyMessageStore extends AbstractJDBCMessageStore implements Messa
return "bigint";
}
- protected void doClose() throws SQLException
+ protected void doClose()
{
try
{
@@ -117,7 +118,7 @@ public class DerbyMessageStore extends AbstractJDBCMessageStore implements Messa
else
{
getLogger().error("Exception whilst shutting down the store: " + e);
- throw e;
+ throw new ServerScopedRuntimeException("Error closing message store", e);
}
}
}
@@ -307,7 +308,7 @@ public class DerbyMessageStore extends AbstractJDBCMessageStore implements Messa
catch (SQLException e)
{
closeConnection(conn);
- throw new RuntimeException("Exception while processing store size change", e);
+ throw new ServerScopedRuntimeException("Exception while processing store size change", e);
}
}
}
@@ -359,7 +360,7 @@ public class DerbyMessageStore extends AbstractJDBCMessageStore implements Messa
catch (SQLException e)
{
closeConnection(conn);
- throw new RuntimeException("Error reducing on disk size", e);
+ throw new ServerScopedRuntimeException("Error reducing on disk size", e);
}
finally
{
@@ -407,7 +408,7 @@ public class DerbyMessageStore extends AbstractJDBCMessageStore implements Messa
catch (SQLException e)
{
closeConnection(conn);
- throw new RuntimeException("Error establishing on disk size", e);
+ throw new ServerScopedRuntimeException("Error establishing on disk size", e);
}
finally
{
diff --git a/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStore.java b/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStore.java
index 6fdfa40561..3fac83f5a3 100644
--- a/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStore.java
+++ b/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStore.java
@@ -30,13 +30,13 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.plugin.JDBCConnectionProviderFactory;
import org.apache.qpid.server.store.AbstractJDBCMessageStore;
import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.StoreFuture;
import org.apache.qpid.server.store.Transaction;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
/**
* An implementation of a {@link org.apache.qpid.server.store.MessageStore} that uses a JDBC database as the persistence
@@ -252,7 +252,7 @@ public class JDBCMessageStore extends AbstractJDBCMessageStore implements Messag
}
@Override
- protected void doClose() throws AMQStoreException
+ protected void doClose()
{
while(!_transactions.isEmpty())
{
@@ -265,7 +265,7 @@ public class JDBCMessageStore extends AbstractJDBCMessageStore implements Messag
}
catch (SQLException e)
{
- throw new AMQStoreException("Unable to close connection provider ", e);
+ throw new ServerScopedRuntimeException("Unable to close connection provider ", e);
}
}
@@ -430,7 +430,7 @@ public class JDBCMessageStore extends AbstractJDBCMessageStore implements Messag
}
@Override
- public void commitTran() throws AMQStoreException
+ public void commitTran()
{
try
{
@@ -443,7 +443,7 @@ public class JDBCMessageStore extends AbstractJDBCMessageStore implements Messag
}
@Override
- public StoreFuture commitTranAsync() throws AMQStoreException
+ public StoreFuture commitTranAsync()
{
try
{
@@ -456,7 +456,7 @@ public class JDBCMessageStore extends AbstractJDBCMessageStore implements Messag
}
@Override
- public void abortTran() throws AMQStoreException
+ public void abortTran()
{
try
{
diff --git a/qpid/java/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNode.java b/qpid/java/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNode.java
index 4921db5c07..7d76a0ee8e 100644
--- a/qpid/java/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNode.java
+++ b/qpid/java/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNode.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.management.amqp;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.server.consumer.Consumer;
import org.apache.qpid.server.consumer.ConsumerTarget;
@@ -940,7 +939,7 @@ class ManagementNode implements MessageSource<ManagementNodeConsumer,ManagementN
final FilterManager filters,
final Class<? extends ServerMessage> messageClass,
final String consumerName,
- final EnumSet<Consumer.Option> options) throws AMQException
+ final EnumSet<Consumer.Option> options)
{
final ManagementNodeConsumer managementNodeConsumer = new ManagementNodeConsumer(consumerName,this, target);
diff --git a/qpid/java/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNodeConsumer.java b/qpid/java/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNodeConsumer.java
index ea4b60da13..008f16883a 100644
--- a/qpid/java/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNodeConsumer.java
+++ b/qpid/java/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNodeConsumer.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.management.amqp;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.consumer.Consumer;
import org.apache.qpid.server.consumer.ConsumerTarget;
import org.apache.qpid.server.message.internal.InternalMessage;
@@ -124,7 +123,7 @@ class ManagementNodeConsumer implements Consumer
}
@Override
- public void close() throws AMQException
+ public void close()
{
}
diff --git a/qpid/java/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementResponse.java b/qpid/java/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementResponse.java
index 283dec0f30..59ab849848 100644
--- a/qpid/java/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementResponse.java
+++ b/qpid/java/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementResponse.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.management.amqp;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.consumer.Consumer;
import org.apache.qpid.server.filter.Filterable;
import org.apache.qpid.server.message.InstanceProperties;
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java
index 3375a784ea..08b99a206d 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java
+++ b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java
@@ -76,6 +76,7 @@ import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.model.adapter.AbstractPluginAdapter;
import org.apache.qpid.server.plugin.PluginFactory;
import org.apache.qpid.server.util.MapValueConverter;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.transport.network.security.ssl.QpidMultipleTrustManager;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
@@ -181,7 +182,7 @@ public class HttpManagement extends AbstractPluginAdapter implements HttpManagem
}
catch (Exception e)
{
- throw new RuntimeException("Failed to start HTTP management on ports : " + httpPorts, e);
+ throw new ServerScopedRuntimeException("Failed to start HTTP management on ports : " + httpPorts, e);
}
CurrentActor.get().message(ManagementConsoleMessages.READY(OPERATIONAL_LOGGING_NAME));
@@ -198,7 +199,7 @@ public class HttpManagement extends AbstractPluginAdapter implements HttpManagem
}
catch (Exception e)
{
- throw new RuntimeException("Failed to stop HTTP management on ports : " + getHttpPorts(getBroker().getPorts()), e);
+ throw new ServerScopedRuntimeException("Failed to stop HTTP management on ports : " + getHttpPorts(getBroker().getPorts()), e);
}
}
@@ -310,7 +311,7 @@ public class HttpManagement extends AbstractPluginAdapter implements HttpManagem
}
catch (GeneralSecurityException e)
{
- throw new RuntimeException("Cannot configure port " + port.getName() + " for transport " + Transport.SSL, e);
+ throw new ServerScopedRuntimeException("Cannot configure port " + port.getName() + " for transport " + Transport.SSL, e);
}
connector = new SslSocketConnector(factory);
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementUtil.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementUtil.java
index f6674b5152..9a2f0dd1f6 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementUtil.java
+++ b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementUtil.java
@@ -50,6 +50,7 @@ import org.apache.qpid.server.security.auth.SubjectAuthenticationResult;
import org.apache.qpid.server.security.auth.UsernamePrincipal;
import org.apache.qpid.server.security.auth.manager.ExternalAuthenticationManager;
import org.apache.qpid.server.security.auth.manager.ExternalAuthenticationManagerFactory;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.transport.network.security.ssl.SSLUtil;
public class HttpManagementUtil
@@ -138,7 +139,7 @@ public class HttpManagementUtil
}
catch (PrivilegedActionException e)
{
- throw new RuntimeException("Unable to perform access check", e);
+ throw new ServerScopedRuntimeException("Unable to perform access check", e);
}
}
finally
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/AbstractServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/AbstractServlet.java
index ee481ebdbe..0381b711bc 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/AbstractServlet.java
+++ b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/AbstractServlet.java
@@ -40,6 +40,7 @@ import org.apache.qpid.server.management.plugin.HttpManagementConfiguration;
import org.apache.qpid.server.management.plugin.HttpManagementUtil;
import org.apache.qpid.server.model.Broker;
import org.apache.qpid.server.security.SecurityManager;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
@@ -214,7 +215,16 @@ public abstract class AbstractServlet extends HttpServlet
catch (PrivilegedActionException e)
{
LOGGER.error("Unable to perform action", e);
- throw new RuntimeException(e.getCause());
+ Throwable cause = e.getCause();
+ if(cause instanceof RuntimeException)
+ {
+ throw (RuntimeException)cause;
+ }
+ if(cause instanceof Error)
+ {
+ throw (Error)cause;
+ }
+ throw new ConnectionScopedRuntimeException(e.getCause());
}
finally
{
@@ -255,7 +265,7 @@ public abstract class AbstractServlet extends HttpServlet
}
catch (IOException e)
{
- throw new RuntimeException("Failed to send error response code " + errorCode, e);
+ throw new ConnectionScopedRuntimeException("Failed to send error response code " + errorCode, e);
}
}
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/SaslServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/SaslServlet.java
index 9ad52007ab..a29a875071 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/SaslServlet.java
+++ b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/SaslServlet.java
@@ -21,6 +21,7 @@
package org.apache.qpid.server.management.plugin.servlet.rest;
import org.apache.commons.codec.binary.Base64;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.SerializationConfig;
@@ -210,7 +211,7 @@ public class SaslServlet extends AbstractServlet
}
if (!saslAuthEnabled)
{
- throw new RuntimeException("Sasl authentication disabled.");
+ throw new ConnectionScopedRuntimeException("Sasl authentication disabled.");
}
}
diff --git a/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagedObjectRegistry.java b/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagedObjectRegistry.java
index 32aac51008..e2b9a98784 100644
--- a/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagedObjectRegistry.java
+++ b/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagedObjectRegistry.java
@@ -31,6 +31,7 @@ import org.apache.qpid.server.model.Port;
import org.apache.qpid.server.model.Transport;
import org.apache.qpid.server.security.auth.jmx.JMXPasswordAuthenticator;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.ssl.SSLContextFactory;
import javax.management.JMException;
@@ -134,7 +135,7 @@ public class JMXManagedObjectRegistry implements ManagedObjectRegistry
}
catch (GeneralSecurityException e)
{
- throw new RuntimeException("Unable to create SSLContext for key store", e);
+ throw new ServerScopedRuntimeException("Unable to create SSLContext for key store", e);
}
CurrentActor.get().message(ManagementConsoleMessages.SSL_KEYSTORE(keyStore.getName()));
diff --git a/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagement.java b/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagement.java
index 18e9f9f809..e418275d7e 100644
--- a/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagement.java
+++ b/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagement.java
@@ -54,6 +54,7 @@ import org.apache.qpid.server.model.adapter.AbstractPluginAdapter;
import org.apache.qpid.server.plugin.PluginFactory;
import org.apache.qpid.server.plugin.QpidServiceLoader;
import org.apache.qpid.server.util.MapValueConverter;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class JMXManagement extends AbstractPluginAdapter implements ConfigurationChangeListener
{
@@ -110,7 +111,7 @@ public class JMXManagement extends AbstractPluginAdapter implements Configuratio
}
catch (Exception e)
{
- throw new RuntimeException("Couldn't start JMX management", e);
+ throw new ServerScopedRuntimeException("Couldn't start JMX management", e);
}
return true;
}
diff --git a/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/ConnectionMBean.java b/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/ConnectionMBean.java
index d0c0d5e73f..34366a196c 100644
--- a/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/ConnectionMBean.java
+++ b/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/ConnectionMBean.java
@@ -40,6 +40,7 @@ import org.apache.qpid.server.jmx.ManagedObject;
import org.apache.qpid.server.model.Connection;
import org.apache.qpid.server.model.Session;
import org.apache.qpid.server.model.Statistics;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class ConnectionMBean extends AbstractStatisticsGatheringMBean<Connection> implements ManagedConnection
{
@@ -60,7 +61,7 @@ public class ConnectionMBean extends AbstractStatisticsGatheringMBean<Connection
catch (JMException ex)
{
// This is not expected to ever occur.
- throw new RuntimeException("Got JMException in static initializer.", ex);
+ throw new ServerScopedRuntimeException("Got JMException in static initializer.", ex);
}
}
diff --git a/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/ExchangeMBean.java b/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/ExchangeMBean.java
index 3e1a47c431..407da0fd3f 100644
--- a/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/ExchangeMBean.java
+++ b/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/ExchangeMBean.java
@@ -29,6 +29,7 @@ import org.apache.qpid.server.model.Exchange;
import org.apache.qpid.server.model.LifetimePolicy;
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.model.VirtualHost;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import javax.management.JMException;
import javax.management.MalformedObjectNameException;
@@ -106,7 +107,7 @@ public class ExchangeMBean extends AMQManagedObject implements ManagedExchange
}
catch(OpenDataException e)
{
- throw new RuntimeException("Unexpected Error creating ArrayType", e);
+ throw new ServerScopedRuntimeException("Unexpected Error creating ArrayType", e);
}
}
diff --git a/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/LoggingManagementMBean.java b/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/LoggingManagementMBean.java
index d6f4b5d8c9..848a846911 100644
--- a/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/LoggingManagementMBean.java
+++ b/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/LoggingManagementMBean.java
@@ -28,6 +28,7 @@ import org.apache.qpid.server.jmx.ManagedObject;
import org.apache.qpid.server.jmx.ManagedObjectRegistry;
import org.apache.qpid.server.logging.log4j.LoggingManagementFacade;
import org.apache.qpid.server.logging.log4j.LoggingFacadeException;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import javax.management.JMException;
import javax.management.openmbean.CompositeData;
@@ -314,7 +315,7 @@ public class LoggingManagementMBean extends AMQManagedObject implements LoggingM
catch (OpenDataException ode)
{
// Should not happen
- throw new RuntimeException(ode);
+ throw new ConnectionScopedRuntimeException(ode);
}
}
diff --git a/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/QueueMBean.java b/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/QueueMBean.java
index d74aa41244..1365ceb06a 100644
--- a/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/QueueMBean.java
+++ b/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/QueueMBean.java
@@ -57,6 +57,7 @@ import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.queue.NotificationCheck;
import org.apache.qpid.server.queue.QueueEntry;
import org.apache.qpid.server.queue.QueueEntryVisitor;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class QueueMBean extends AMQManagedObject implements ManagedQueue, QueueNotificationListener
{
@@ -109,7 +110,7 @@ public class QueueMBean extends AMQManagedObject implements ManagedQueue, QueueN
}
catch (OpenDataException e)
{
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
}
diff --git a/qpid/java/broker-plugins/websocket/src/main/java/org/apache/qpid/server/transport/websocket/WebSocketProvider.java b/qpid/java/broker-plugins/websocket/src/main/java/org/apache/qpid/server/transport/websocket/WebSocketProvider.java
index fde93a27e3..81dcb05a41 100644
--- a/qpid/java/broker-plugins/websocket/src/main/java/org/apache/qpid/server/transport/websocket/WebSocketProvider.java
+++ b/qpid/java/broker-plugins/websocket/src/main/java/org/apache/qpid/server/transport/websocket/WebSocketProvider.java
@@ -28,6 +28,7 @@ import org.apache.qpid.server.model.Transport;
import org.apache.qpid.server.protocol.AmqpProtocolVersion;
import org.apache.qpid.server.protocol.MultiVersionProtocolEngineFactory;
import org.apache.qpid.server.transport.AcceptingTransport;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.transport.Binary;
import org.apache.qpid.transport.Sender;
import org.apache.qpid.transport.network.NetworkConnection;
@@ -144,9 +145,13 @@ class WebSocketProvider implements AcceptingTransport
{
_server.start();
}
+ catch(RuntimeException e)
+ {
+ throw e;
+ }
catch (Exception e)
{
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/store/QuotaMessageStore.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/QuotaMessageStore.java
index 75ce0e68d8..19e258d060 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/server/store/QuotaMessageStore.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/QuotaMessageStore.java
@@ -23,7 +23,6 @@ package org.apache.qpid.server.store;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.server.message.EnqueueableMessage;
import org.apache.qpid.server.message.MessageContentSource;
import org.apache.qpid.server.model.VirtualHost;
@@ -49,7 +48,6 @@ public class
@Override
public void configureConfigStore(VirtualHost virtualHost, ConfigurationRecoveryHandler recoveryHandler)
- throws Exception
{
Object overfullAttr = virtualHost.getAttribute(MessageStoreConstants.OVERFULL_SIZE_ATTRIBUTE);
_persistentSizeHighThreshold = overfullAttr == null
@@ -76,13 +74,13 @@ public class
@Override
public void configureMessageStore(VirtualHost virtualHost, MessageStoreRecoveryHandler recoveryHandler,
- TransactionLogRecoveryHandler tlogRecoveryHandler) throws Exception
+ TransactionLogRecoveryHandler tlogRecoveryHandler)
{
_stateManager.attainState(State.INITIALISED);
}
@Override
- public void activate() throws Exception
+ public void activate()
{
_stateManager.attainState(State.ACTIVATING);
_stateManager.attainState(State.ACTIVE);
@@ -104,32 +102,32 @@ public class
private AtomicLong _storeSizeIncrease = new AtomicLong();
@Override
- public StoreFuture commitTranAsync() throws AMQStoreException
+ public StoreFuture commitTranAsync()
{
QuotaMessageStore.this.storedSizeChange(_storeSizeIncrease.intValue());
return StoreFuture.IMMEDIATE_FUTURE;
}
@Override
- public void enqueueMessage(TransactionLogResource queue, EnqueueableMessage message) throws AMQStoreException
+ public void enqueueMessage(TransactionLogResource queue, EnqueueableMessage message)
{
_storeSizeIncrease.addAndGet(((MessageContentSource)message).getSize());
}
@Override
- public void dequeueMessage(TransactionLogResource queue, EnqueueableMessage message) throws AMQStoreException
+ public void dequeueMessage(TransactionLogResource queue, EnqueueableMessage message)
{
_storeSizeIncrease.addAndGet(-((MessageContentSource)message).getSize());
}
@Override
- public void commitTran() throws AMQStoreException
+ public void commitTran()
{
QuotaMessageStore.this.storedSizeChange(_storeSizeIncrease.intValue());
}
@Override
- public void abortTran() throws AMQStoreException
+ public void abortTran()
{
}
@@ -152,7 +150,7 @@ public class
}
@Override
- public void close() throws Exception
+ public void close()
{
if (_closed.compareAndSet(false, true))
{
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java
index cc0205085b..093cd6a200 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java
@@ -25,10 +25,10 @@ import java.util.Map;
import java.util.UUID;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.server.message.EnqueueableMessage;
import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.model.VirtualHost;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import java.nio.ByteBuffer;
import java.util.HashMap;
@@ -48,7 +48,7 @@ public class SlowMessageStore implements MessageStore, DurableConfigurationStore
// ***** MessageStore Interface.
- public void configureConfigStore(VirtualHost virtualHost, ConfigurationRecoveryHandler recoveryHandler) throws Exception
+ public void configureConfigStore(VirtualHost virtualHost, ConfigurationRecoveryHandler recoveryHandler)
{
_logger.info("Starting SlowMessageStore on Virtualhost:" + virtualHost.getName());
@@ -67,19 +67,34 @@ public class SlowMessageStore implements MessageStore, DurableConfigurationStore
if (messageStoreClass != null)
{
- Class<?> clazz = Class.forName(messageStoreClass);
-
- Object o = clazz.newInstance();
-
- if (!(o instanceof MessageStore))
+ try
+ {
+ Class<?> clazz = Class.forName(messageStoreClass);
+
+ Object o = clazz.newInstance();
+
+ if (!(o instanceof MessageStore))
+ {
+ throw new ClassCastException("Message store class must implement " + MessageStore.class + ". Class " + clazz +
+ " does not.");
+ }
+ _realStore = (MessageStore) o;
+ if(o instanceof DurableConfigurationStore)
+ {
+ _durableConfigurationStore = (DurableConfigurationStore)o;
+ }
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new ServerScopedRuntimeException("Unable to find message store class", e);
+ }
+ catch (InstantiationException e)
{
- throw new ClassCastException("Message store class must implement " + MessageStore.class + ". Class " + clazz +
- " does not.");
+ throw new ServerScopedRuntimeException("Unable to initialise message store class", e);
}
- _realStore = (MessageStore) o;
- if(o instanceof DurableConfigurationStore)
+ catch (IllegalAccessException e)
{
- _durableConfigurationStore = (DurableConfigurationStore)o;
+ throw new ServerScopedRuntimeException("Unable to access message store class", e);
}
}
_durableConfigurationStore.configureConfigStore(virtualHost, recoveryHandler);
@@ -152,12 +167,12 @@ public class SlowMessageStore implements MessageStore, DurableConfigurationStore
public void configureMessageStore(VirtualHost virtualHost, MessageStoreRecoveryHandler messageRecoveryHandler,
- TransactionLogRecoveryHandler tlogRecoveryHandler) throws Exception
+ TransactionLogRecoveryHandler tlogRecoveryHandler)
{
_realStore.configureMessageStore(virtualHost, messageRecoveryHandler, tlogRecoveryHandler);
}
- public void close() throws Exception
+ public void close()
{
doPreDelay("close");
_realStore.close();
@@ -258,7 +273,6 @@ public class SlowMessageStore implements MessageStore, DurableConfigurationStore
}
public void enqueueMessage(TransactionLogResource queue, EnqueueableMessage message)
- throws AMQStoreException
{
doPreDelay("enqueueMessage");
_underlying.enqueueMessage(queue, message);
@@ -266,7 +280,6 @@ public class SlowMessageStore implements MessageStore, DurableConfigurationStore
}
public void dequeueMessage(TransactionLogResource queue, EnqueueableMessage message)
- throws AMQStoreException
{
doPreDelay("dequeueMessage");
_underlying.dequeueMessage(queue, message);
@@ -274,7 +287,6 @@ public class SlowMessageStore implements MessageStore, DurableConfigurationStore
}
public void commitTran()
- throws AMQStoreException
{
doPreDelay("commitTran");
_underlying.commitTran();
@@ -282,7 +294,6 @@ public class SlowMessageStore implements MessageStore, DurableConfigurationStore
}
public StoreFuture commitTranAsync()
- throws AMQStoreException
{
doPreDelay("commitTran");
StoreFuture future = _underlying.commitTranAsync();
@@ -291,27 +302,25 @@ public class SlowMessageStore implements MessageStore, DurableConfigurationStore
}
public void abortTran()
- throws AMQStoreException
{
doPreDelay("abortTran");
_underlying.abortTran();
doPostDelay("abortTran");
}
- public void removeXid(long format, byte[] globalId, byte[] branchId) throws AMQStoreException
+ public void removeXid(long format, byte[] globalId, byte[] branchId)
{
_underlying.removeXid(format, globalId, branchId);
}
public void recordXid(long format, byte[] globalId, byte[] branchId, Record[] enqueues, Record[] dequeues)
- throws AMQStoreException
{
_underlying.recordXid(format, globalId, branchId, enqueues, dequeues);
}
}
@Override
- public void activate() throws Exception
+ public void activate()
{
_realStore.activate();
}