try (MessageInputStream mis = message) { if (version == 1) { try (Unmarshaller unmarshaller = createUnmarshaller(mis, configuration)) { final int parameterType = unmarshaller.readUnsignedByte(); if (parameterType != Protocol.P_NAME) { writeId(mos, version, id); mos.writeByte(Protocol.SUCCESS); if (version == 1) { mos.writeByte(Protocol.P_LIST); mos.writeInt(resultList.size()); try (Marshaller marshaller = createMarshaller(mos, configuration)) { for (NameClassPair nameClassPair : resultList) { marshaller.writeObject(nameClassPair);
final List<MarshallingCompatibilityHelper> helpers = ProtocolUtils.getMarshallingCompatibilityHelpers(); ObjectResolver resolver = null; for (MarshallingCompatibilityHelper helper : helpers) {
public void handleMessage(final Channel channel, final MessageInputStream message) { try { final int messageId = message.readUnsignedByte(); final int id = readId(message, version); final int result = message.readUnsignedByte(); if (result == Protocol.SUCCESS || result == Protocol.FAILURE) { tracker.signalResponse(id, messageId, message, true); } else { throw Messages.log.outcomeNotUnderstood(); } channel.receiveMessage(this); } catch (IOException e) { safeClose(channel); safeClose(message); } } });
private void writeExceptionResponse(final Exception e, final int messageId, final int id) throws IOException { try (MessageOutputStream mos = messageTracker.openMessageUninterruptibly()) { mos.writeByte(messageId); writeId(mos, version, id); mos.writeByte(Protocol.FAILURE); mos.writeByte(Protocol.P_EXCEPTION); try (Marshaller marshaller = createMarshaller(mos, configuration)) { marshaller.writeObject(e); } } }
void handleUnbind(final MessageInputStream message, final int messageId, final int id) throws IOException { try (MessageInputStream mis = message) { if (version == 1) { try (Unmarshaller unmarshaller = createUnmarshaller(mis, configuration)) { final int parameterType = unmarshaller.readUnsignedByte(); if (parameterType != Protocol.P_NAME) { Messages.log.unexpectedParameterType(Protocol.P_NAME, parameterType); } final Name name = unmarshaller.readObject(Name.class); localContext.unbind(name); } catch (ClassNotFoundException e) { throw new IOException(e); } } else { mis.readInt(); // consume authId final String name = mis.readUTF(); localContext.unbind(name); } } catch (NamingException e) { writeExceptionResponse(e, messageId, id); return; } writeSuccessResponse(messageId, id); }
private void writeSuccessResponse(final int messageId, final int id) throws IOException { try (MessageOutputStream mos = messageTracker.openMessageUninterruptibly()) { mos.writeByte(messageId); writeId(mos, version, id); mos.writeByte(Protocol.SUCCESS); } }
private void writeSuccessResponse(final int messageId, final int id, final Object result) throws IOException { try (MessageOutputStream mos = messageTracker.openMessageUninterruptibly()) { mos.writeByte(messageId); writeId(mos, version, id); mos.writeByte(Protocol.SUCCESS); if (result instanceof Context) { mos.writeByte(Protocol.P_CONTEXT); } else { mos.writeByte(Protocol.P_OBJECT); try (Marshaller marshaller = createMarshaller(mos, configuration)) { marshaller.writeObject(result); } } } }
void handleBind(final MessageInputStream message, final int messageId, final int id, final boolean rebind) throws IOException { try (MessageInputStream mis = message) { if (version == 1) { try (Unmarshaller unmarshaller = createUnmarshaller(mis, configuration)) { int parameterType = unmarshaller.readUnsignedByte(); if (parameterType != Protocol.P_NAME) { try (Unmarshaller unmarshaller = createUnmarshaller(mis, configuration)) { final Object object = unmarshaller.readObject(); if (rebind) {
private void writeSuccessResponse(final int messageId, final int id) throws IOException { try (MessageOutputStream mos = messageTracker.openMessageUninterruptibly()) { mos.writeByte(messageId); writeId(mos, version, id); mos.writeByte(Protocol.SUCCESS); } }
try (MessageInputStream mis = message) { if (version == 1) { try (Unmarshaller unmarshaller = createUnmarshaller(mis, configuration)) { final int parameterType = unmarshaller.readUnsignedByte(); if (parameterType != Protocol.P_NAME) { writeId(mos, version, id); mos.writeByte(Protocol.SUCCESS); if (version == 1) { try (Marshaller marshaller = createMarshaller(mos, configuration)) { for (Binding binding : resultList) { if (binding.getObject() instanceof Context) {
writeId(messageOutputStream, version, invocation.getIndex()); if (version == 1) { try (Marshaller marshaller = createMarshaller(messageOutputStream, configuration)) { marshaller.writeByte(Protocol.P_NAME); marshaller.writeObject(compositeName);
try (MessageInputStream mis = message) { if (version == 1) { try (Unmarshaller unmarshaller = createUnmarshaller(mis, configuration)) { final int parameterType = unmarshaller.readUnsignedByte(); if (parameterType != Protocol.P_NAME) {
public void handleMessage(final Channel channel, final MessageInputStream message) { try (MessageInputStream mis = message) { final byte messageId = mis.readByte(); final int id = readId(mis, version); try { switch (messageId) {
configuration.setVersion(version == 2 ? 4 : 2); RemoteClientTransport remoteClientTransport = new RemoteClientTransport(channel, version, configuration); final List<MarshallingCompatibilityHelper> helpers = ProtocolUtils.getMarshallingCompatibilityHelpers(); ObjectResolver resolver = null; for (MarshallingCompatibilityHelper helper : helpers) {
private void writeSuccessResponse(final int messageId, final int id) throws IOException { try (MessageOutputStream mos = messageTracker.openMessageUninterruptibly()) { mos.writeByte(messageId); writeId(mos, version, id); mos.writeByte(Protocol.SUCCESS); } }
writeId(messageOutputStream, version, invocation.getIndex()); if (version == 1) { try (Marshaller marshaller = createMarshaller(messageOutputStream, configuration)) { marshaller.writeByte(Protocol.P_NAME); marshaller.writeObject(NamingUtils.toDecomposedCompositeName(name)); try (Unmarshaller unmarshaller = createUnmarshaller(is, configuration)) { for (int i = 0; i < listSize; i++) { results.add(unmarshaller.readObject(NameClassPair.class));
writeId(messageOutputStream, version, invocation.getIndex()); if (version == 1) { try (Marshaller marshaller = createMarshaller(messageOutputStream, configuration)) { marshaller.writeByte(Protocol.P_NAME); marshaller.writeObject(NamingUtils.toDecomposedCompositeName(name)); messageOutputStream.writeInt(authId); messageOutputStream.writeUTF(NamingUtils.toCompositeName(name).toString()); try (Marshaller marshaller = createMarshaller(messageOutputStream, configuration)) { marshaller.writeObject(obj);
void handleCreateSubcontext(final MessageInputStream message, final int messageId, final int id) throws IOException { final Object result; try (MessageInputStream mis = message) { if (version == 1) { try (Unmarshaller unmarshaller = createUnmarshaller(mis, configuration)) { final int parameterType = unmarshaller.readUnsignedByte(); if (parameterType != Protocol.P_NAME) { Messages.log.unexpectedParameterType(Protocol.P_NAME, parameterType); } final Name name = unmarshaller.readObject(Name.class); result = localContext.createSubcontext(name); } catch (ClassNotFoundException e) { throw new IOException(e); } } else { mis.readInt(); // consume authId final String name = mis.readUTF(); result = localContext.createSubcontext(name); } } catch (NamingException e) { writeExceptionResponse(e, messageId, id); return; } writeSuccessResponse(messageId, id, result); }
public void handleMessage(final Channel channel, final MessageInputStream message) { try { final int messageId = message.readUnsignedByte(); final int id = readId(message, version); final int result = message.readUnsignedByte(); if (result == Protocol.SUCCESS || result == Protocol.FAILURE) { tracker.signalResponse(id, messageId, message, true); } else { throw Messages.log.outcomeNotUnderstood(); } channel.receiveMessage(this); } catch (IOException e) { safeClose(channel); safeClose(message); } } });
final List<MarshallingCompatibilityHelper> helpers = ProtocolUtils.getMarshallingCompatibilityHelpers(); ObjectResolver resolver = null; for (MarshallingCompatibilityHelper helper : helpers) {