/** * Setup the activation * * @throws Exception Thrown if an error occurs */ protected synchronized void setup() throws Exception { HornetQRALogger.LOGGER.debug("Setting up " + spec); setupCF(); setupDestination(); for (int i = 0; i < spec.getMaxSession(); i++) { ClientSession session = null; try { ClientSessionFactory cf = factory.getServerLocator().createSessionFactory(); session = setupSession(cf); HornetQMessageHandler handler = new HornetQMessageHandler(this, ra.getTM(), (ClientSessionInternal) session, cf, i); handler.setup(); session.start(); handlers.add(handler); } catch (Exception e) { if (session != null) { session.close(); } throw e; } } resourceRecovery = ra.getRecoveryManager().register(factory, spec.getUser(), spec.getPassword()); HornetQRALogger.LOGGER.debug("Setup complete " + this); }