public <T> StatefulEJBLocator<T> openSession(final StatelessEJBLocator<T> statelessLocator, final ConnectionPeerIdentity identity, EJBSessionCreationInvocationContext clientInvocationContext) throws Exception { SessionOpenInvocation<T> invocation = invocationTracker.addInvocation(id -> new SessionOpenInvocation<>(id, statelessLocator, clientInvocationContext)); try (MessageOutputStream out = invocationTracker.allocateMessage()) { out.write(Protocol.OPEN_SESSION_REQUEST); out.writeShort(invocation.getIndex()); writeRawIdentifier(statelessLocator, out); if (version >= 3) { out.writeInt(identity.getId()); invocation.setOutflowHandle(writeTransaction(clientInvocationContext.getTransaction(), out)); } } catch (IOException e) { CreateException createException = new CreateException(e.getMessage()); createException.initCause(e); throw createException; } // await the response return invocation.getResult(); }
StatefulEJBLocator<T> getResult() throws Exception { Exception e; try (ResponseMessageInputStream response = removeInvocationResult()) { switch (id) { case Protocol.OPEN_SESSION_RESPONSE: { affinity = statelessLocator.getAffinity(); final int cmd = response.readUnsignedByte(); final XAOutflowHandle outflowHandle = getOutflowHandle(); if (outflowHandle != null) { if (cmd == 0) { if (version >= 3) { final int cmd = response.readUnsignedByte(); final XAOutflowHandle outflowHandle = getOutflowHandle(); if (outflowHandle != null) { if (cmd == 0) { final XAOutflowHandle outflowHandle = getOutflowHandle(); if (outflowHandle != null) outflowHandle.forgetEnlistment(); final XAOutflowHandle outflowHandle = getOutflowHandle(); if (outflowHandle != null) outflowHandle.forgetEnlistment(); final XAOutflowHandle outflowHandle = getOutflowHandle(); if (outflowHandle != null) outflowHandle.forgetEnlistment(); final XAOutflowHandle outflowHandle = getOutflowHandle(); if (outflowHandle != null) outflowHandle.forgetEnlistment();
StatefulEJBLocator<T> getResult() throws Exception { Exception e; try (ResponseMessageInputStream response = removeInvocationResult()) { switch (id) { case Protocol.OPEN_SESSION_RESPONSE: { affinity = statelessLocator.getAffinity(); final int cmd = response.readUnsignedByte(); final XAOutflowHandle outflowHandle = getOutflowHandle(); if (outflowHandle != null) { if (cmd == 0) { if (version >= 3) { final int cmd = response.readUnsignedByte(); final XAOutflowHandle outflowHandle = getOutflowHandle(); if (outflowHandle != null) { if (cmd == 0) { final XAOutflowHandle outflowHandle = getOutflowHandle(); if (outflowHandle != null) outflowHandle.forgetEnlistment(); final XAOutflowHandle outflowHandle = getOutflowHandle(); if (outflowHandle != null) outflowHandle.forgetEnlistment(); final XAOutflowHandle outflowHandle = getOutflowHandle(); if (outflowHandle != null) outflowHandle.forgetEnlistment(); final XAOutflowHandle outflowHandle = getOutflowHandle(); if (outflowHandle != null) outflowHandle.forgetEnlistment();
private ResponseMessageInputStream removeInvocationResult() { MessageInputStream mis; int id; try { synchronized (this) { for (; ; ) { id = this.getIndex(); if (inputStream != null) { mis = inputStream; inputStream = null; break; } if (ex != null) { throw new EJBException(ex); } if (id == -1) { throw new EJBException("Connection closed"); } wait(); } } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new EJBException("Session creation interrupted"); } return new ResponseMessageInputStream(mis, id); } }
private ResponseMessageInputStream removeInvocationResult() { MessageInputStream mis; int id; try { synchronized (this) { for (; ; ) { id = this.getIndex(); if (inputStream != null) { mis = inputStream; inputStream = null; break; } if (ex != null) { throw new EJBException(ex); } if (id == -1) { throw new EJBException("Connection closed"); } wait(); } } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new EJBException("Session creation interrupted"); } return new ResponseMessageInputStream(mis, id); } }
public <T> StatefulEJBLocator<T> openSession(final StatelessEJBLocator<T> statelessLocator, final ConnectionPeerIdentity identity, EJBSessionCreationInvocationContext clientInvocationContext) throws Exception { SessionOpenInvocation<T> invocation = invocationTracker.addInvocation(id -> new SessionOpenInvocation<>(id, statelessLocator, clientInvocationContext)); try (MessageOutputStream out = invocationTracker.allocateMessage()) { out.write(Protocol.OPEN_SESSION_REQUEST); out.writeShort(invocation.getIndex()); writeRawIdentifier(statelessLocator, out); if (version >= 3) { out.writeInt(identity.getId()); invocation.setOutflowHandle(writeTransaction(clientInvocationContext.getTransaction(), out)); } } catch (IOException e) { CreateException createException = new CreateException(e.getMessage()); createException.initCause(e); throw createException; } // await the response return invocation.getResult(); }
public <T> StatefulEJBLocator<T> openSession(final StatelessEJBLocator<T> statelessLocator, final ConnectionPeerIdentity identity, EJBSessionCreationInvocationContext clientInvocationContext) throws Exception { SessionOpenInvocation<T> invocation = invocationTracker.addInvocation(id -> new SessionOpenInvocation<>(id, statelessLocator, clientInvocationContext)); try (MessageOutputStream out = invocationTracker.allocateMessage()) { out.write(Protocol.OPEN_SESSION_REQUEST); out.writeShort(invocation.getIndex()); writeRawIdentifier(statelessLocator, out); if (version >= 3) { out.writeInt(identity.getId()); invocation.setOutflowHandle(writeTransaction(clientInvocationContext.getTransaction(), out)); } } catch (IOException e) { CreateException createException = new CreateException(e.getMessage()); createException.initCause(e); throw createException; } // await the response return invocation.getResult(); }
StatefulEJBLocator<T> getResult() throws Exception { Exception e; try (ResponseMessageInputStream response = removeInvocationResult()) { switch (id) { case Protocol.OPEN_SESSION_RESPONSE: { affinity = statelessLocator.getAffinity(); final int cmd = response.readUnsignedByte(); final XAOutflowHandle outflowHandle = getOutflowHandle(); if (outflowHandle != null) { if (cmd == 0) { if (version >= 3) { final int cmd = response.readUnsignedByte(); final XAOutflowHandle outflowHandle = getOutflowHandle(); if (outflowHandle != null) { if (cmd == 0) { final XAOutflowHandle outflowHandle = getOutflowHandle(); if (outflowHandle != null) outflowHandle.forgetEnlistment(); final XAOutflowHandle outflowHandle = getOutflowHandle(); if (outflowHandle != null) outflowHandle.forgetEnlistment(); final XAOutflowHandle outflowHandle = getOutflowHandle(); if (outflowHandle != null) outflowHandle.forgetEnlistment(); final XAOutflowHandle outflowHandle = getOutflowHandle(); if (outflowHandle != null) outflowHandle.forgetEnlistment();
private ResponseMessageInputStream removeInvocationResult() { MessageInputStream mis; int id; try { synchronized (this) { for (; ; ) { id = this.getIndex(); if (inputStream != null) { mis = inputStream; inputStream = null; break; } if (ex != null) { throw new EJBException(ex); } if (id == -1) { throw new EJBException("Connection closed"); } wait(); } } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new EJBException("Session creation interrupted"); } return new ResponseMessageInputStream(mis, id); } }