This content has been marked as final.
Show 2 replies
-
1. Re: Throwable from unregisterConnection
darranl Dec 22, 2004 10:36 AM (in response to andrzejros)Where would your try catch statements go?
Why did you strip them, they are a very important part of the code.
Is your close in a finally block? -
2. Re: Throwable from unregisterConnection
andrzejros Dec 27, 2004 4:08 AM (in response to andrzejros)"darranl" wrote:
Where would your try catch statements go?
Why did you strip them, they are a very important part of the code.
Is your close in a finally block?
here it goes ...ConnectionFactory cFactory; ECSConnectionSpecImpl connectionSpec = new ECSConnectionSpecImpl("host", port); Connection conn = null; ECSInteractionSpec interactionSpec = new ECSInteractionSpec(); RecordFactory rFactory = null; Interaction interaction = null; IndexedRecord input = null; try { conn = factory.getConnection(connectionSpec); } catch (ResourceException ex) { throw new RemoteException("unable to obtain connection from factory"); } try { rFactory = factory.getRecordFactory(); interaction = conn.createInteraction(); input = rFactory.createIndexedRecord("noop"); interactionSpec.setFunctionName(ECSInteractionSpec.CMD_NOOP); interaction.execute(interactionSpec, input); interaction.close(); } catch (ResourceException ex) { throw new RemoteException("unable to send noop command"); } finally { if (logger.isDebugEnabled()) { logger.debug("noop() - finally"); } if (conn != null) { try { conn.close(); } catch (ResourceException ex1) { } } input = null; rFactory = null; interactionSpec = null; conn = null; }