public ProtocolCodec getProtocolCodec() { return next.getProtocolCodec(); }
@Override void process() { if (sasl != null) { sasl = processSaslEvent(sasl); if (sasl == null) { // once sasl handshake is done.. we need to read the protocol header again. ((AmqpProtocolCodec) hawtdispatchTransport.getProtocolCodec()).readProtocolHeader(); } } }
private void scheduleCheckWrites(final short session) { final ProtocolCodec codec = transport.getProtocolCodec(); Task func; if (codec == null) { func = new Task() { public void run() { scheduleCheckWrites(session); } }; } else { final long lastWriteCounter = codec.getWriteCounter(); func = new Task() { public void run() { if (lastWriteCounter == codec.getWriteCounter()) { onKeepAlive.run(); } scheduleCheckWrites(session); } }; } schedule(session, writeInterval, func); }
private void scheduleCheckReads(final short session) { final ProtocolCodec codec = transport.getProtocolCodec(); Task func; if (codec == null) { func = new Task() { public void run() { scheduleCheckReads(session); } }; } else { final long lastReadCounter = codec.getReadCounter(); func = new Task() { public void run() { if (lastReadCounter == codec.getReadCounter() && !readSuspendedInterval && readSuspendCount == 0) { onDead.run(); } readSuspendedInterval = false; scheduleCheckReads(session); } }; } schedule(session, readInterval, func); }
private void bind(final Transport transport) { this.hawtdispatchTransport = transport; this.protonTransport = (ProtonJTransport) org.apache.qpid.proton.engine.Transport.Factory.create(); this.protonTransport.bind(connection); if( transport.getProtocolCodec()==null ) { try { transport.setProtocolCodec(new AmqpProtocolCodec()); } catch (Exception e) { throw new RuntimeException(e); } } }
@Override void process() { if (sasl != null) { sasl = listener.processSaslEvent(sasl); } if (sasl == null) { // once sasl handshake is done.. we need to read the protocol header again. ((AmqpProtocolCodec) hawtdispatchTransport.getProtocolCodec()).readProtocolHeader(); hawtdispatchTransport.setTransportListener(new AmqpTransportListener()); } } }
writeBufferRemaining.set(connection.transport().getProtocolCodec().getWriteBufferSize()); connection.getDispatchQueue().execute(new Task() { public void run() {
writeBufferRemaining.set(connection.transport().getProtocolCodec().getWriteBufferSize()); connection.getDispatchQueue().execute(new Task() { @Override
private void doPumpOut() { switch(state) { case CONNECTING: case CONNECTED: break; default: return; } int size = hawtdispatchTransport.getProtocolCodec().getWriteBufferSize(); byte data[] = new byte[size]; boolean done = false; int pumped = 0; while( !done && !hawtdispatchTransport.full() ) { int count = protonTransport.output(data, 0, size); if( count > 0 ) { pumped += count; boolean accepted = hawtdispatchTransport.offer(new Buffer(data, 0, count)); assert accepted: "Should be accepted since the transport was not full"; } else { done = true; } } if( pumped > 0 && !hawtdispatchTransport.full() ) { listener.processRefill(); } }
public void on_transport_connected() { codec = (MQTTProtocolCodec) connection().transport().getProtocolCodec(); AcceptingConnectorDTO connector_config = (AcceptingConnectorDTO) connection().connector().config(); config = find_config(connector_config);
public void fireListenerEvents() { fireWatches(); if( sasl!=null ) { sasl = listener.processSaslEvent(sasl); if( sasl==null ) { // once sasl handshake is done.. we need to read the protocol header again. ((AmqpProtocolCodec)this.hawtdispatchTransport.getProtocolCodec()).readProtocolHeader(); } } context(connection).fireListenerEvents(listener); Session session = connection.sessionHead(ALL_SET, ALL_SET); while(session != null) { context(session).fireListenerEvents(listener); session = session.next(ALL_SET, ALL_SET); } Link link = connection.linkHead(ALL_SET, ALL_SET); while(link != null) { context(link).fireListenerEvents(listener); link = link.next(ALL_SET, ALL_SET); } Delivery delivery = connection.getWorkHead(); while(delivery != null) { listener.processDelivery(delivery); delivery = delivery.getWorkNext(); } listener.processRefill(); }