Author: borges
Date: 2011-10-25 08:30:28 -0400 (Tue, 25 Oct 2011)
New Revision: 11583
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ServerLocatorImpl.java
Log:
Handle generic exception inside initialize() instead of after each call
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ServerLocatorImpl.java
===================================================================
---
trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ServerLocatorImpl.java 2011-10-24
09:17:44 UTC (rev 11582)
+++
trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ServerLocatorImpl.java 2011-10-25
12:30:28 UTC (rev 11583)
@@ -329,13 +329,14 @@
});
}
- private synchronized void initialise() throws Exception
+ private synchronized void initialise() throws HornetQException
{
if (readOnly)
{
return;
}
-
+ try
+ {
setThreadPools();
instantiateLoadBalancingPolicy();
@@ -369,6 +370,11 @@
readOnly = true;
}
+ catch (Exception e)
+ {
+ throw new HornetQException(HornetQException.INTERNAL_ERROR, "Failed to
initialise session factory", e);
+ }
+ }
private ServerLocatorImpl(final Topology topology,
final boolean useHA,
@@ -604,14 +610,7 @@
{
assertOpen();
- try
- {
initialise();
- }
- catch (Exception e)
- {
- throw new HornetQException(HornetQException.INTERNAL_ERROR, "Failed to
initialise session factory", e);
- }
synchronized (this)
{
@@ -650,14 +649,7 @@
{
assertOpen();
- try
- {
- initialise();
- }
- catch (Exception e)
- {
- throw new HornetQException(HornetQException.INTERNAL_ERROR, "Failed to
initialise session factory", e);
- }
+ initialise();
if (initialConnectors == null && discoveryGroup != null)
{
@@ -1503,14 +1495,7 @@
throw new IllegalStateException("Cannot create session factory, server
locator is closed (maybe it has been garbage collected)");
}
- try
- {
- initialise();
- }
- catch (Exception e)
- {
- throw new HornetQException(HornetQException.INTERNAL_ERROR, "Failed to
initialise session factory", e);
- }
+ initialise();
ClientSessionFactory csf = null;