@Override public Object getID() { return transportConnection.getID(); }
private void internalClose() { // We close the underlying transport connection getTransportConnection().close(); for (Channel channel : channels.values()) { channel.close(); } }
public String getLocalAddress() { return transportConnection.getLocalAddress(); }
protected void sendHandshake(Connection transportConnection) { if (transportConnection.isUsingProtocolHandling()) { // no need to send handshake on inVM as inVM is not using the NettyProtocolHandling ActiveMQBuffer amqbuffer = connection.createTransportBuffer(handshake.length()); amqbuffer.writeBytes(handshake.getBytes()); transportConnection.write(amqbuffer); } }
@Override public String getRemoteAddress() { return transportConnection.getRemoteAddress(); }
@Override public boolean isWritable(ReadyListener callback) { return transportConnection.isWritable(callback); }
private void shutdown(boolean fail) { if (fail) { transportConnection.forceClose(); } else { transportConnection.close(); } }
@Override public synchronized void run() { if (!cancelled) { for (Connection connection : connections.values()) { connection.checkFlushBatchBuffer(); } } }
private void doWrite(final Packet packet) { final ActiveMQBuffer buffer = packet.encode(connection); connection.getTransportConnection().write(buffer, false, false); }
@Override public ActiveMQBuffer createTransportBuffer(final int size) { return transportConnection.createTransportBuffer(size); }
@Override public void fail(final ActiveMQException me, String scaleDownTargetNodeID) { synchronized (failLock) { if (destroyed) { return; } destroyed = true; } if (!(me instanceof ActiveMQRemoteDisconnectException)) { ActiveMQClientLogger.LOGGER.connectionFailureDetected(me.getMessage(), me.getType()); } try { transportConnection.forceClose(); } catch (Throwable e) { ActiveMQClientLogger.LOGGER.failedForceClose(e); } // Then call the listeners callFailureListeners(me, scaleDownTargetNodeID); callClosingListeners(); internalClose(); for (Channel channel : channels.values()) { channel.returnBlocking(me); } }
private RemotingConnectionImpl(final PacketDecoder packetDecoder, final Connection transportConnection, final long blockingCallTimeout, final long blockingCallFailoverTimeout, final List<Interceptor> incomingInterceptors, final List<Interceptor> outgoingInterceptors, final boolean client, final Executor executor, final SimpleString nodeID) { super(transportConnection, executor); this.packetDecoder = packetDecoder; this.blockingCallTimeout = blockingCallTimeout; this.blockingCallFailoverTimeout = blockingCallFailoverTimeout; this.incomingInterceptors = incomingInterceptors; this.outgoingInterceptors = outgoingInterceptors; this.client = client; this.nodeID = nodeID; transportConnection.setProtocolConnection(this); if (logger.isTraceEnabled()) { logger.trace("RemotingConnectionImpl created: " + this); } }
public void physicalSend(Command command) throws IOException { if (logger.isTraceEnabled()) { tracePhysicalSend(transportConnection, command); } try { final ByteSequence bytes = outWireFormat.marshal(command); final int bufferSize = bytes.length; final ActiveMQBuffer buffer = transportConnection.createTransportBuffer(bufferSize); buffer.writeBytes(bytes.data, bytes.offset, bufferSize); transportConnection.write(buffer, false, false); bufferSent(); } catch (IOException e) { throw e; } catch (Throwable t) { ActiveMQServerLogger.LOGGER.error("error sending", t); } }
@Override public String getRemoteAddress() { return transportConnection.getRemoteAddress(); }
@Override public boolean isWritable(ReadyListener callback) { return transportConnection.isWritable(callback); }
protected void sendHandshake(Connection transportConnection) { if (transportConnection.isUsingProtocolHandling()) { // no need to send handshake on inVM as inVM is not using the NettyProtocolHandling ActiveMQBuffer amqbuffer = connection.createTransportBuffer(handshake.length()); amqbuffer.writeBytes(handshake.getBytes()); transportConnection.write(amqbuffer); } }
@Override public void flush() { transportConnection.checkFlushBatchBuffer(); }
private void sendPacketWithoutLock(final Channel parameterChannel, final Packet packet) { packet.setChannelID(parameterChannel.getID()); Connection conn = parameterChannel.getConnection().getTransportConnection(); ActiveMQBuffer buffer = packet.encode(this.getCoreConnection()); conn.write(buffer, false, false); }
@Override public ActiveMQBuffer createTransportBuffer(final int size) { return transportConnection.createTransportBuffer(size); }
@Override public void disconnect(boolean criticalError) { transportConnection.forceClose(); }