@Override
	public void queueEnvelope(Envelope envelope) {
		if (envelope.hasBuffer()) {
			throw new IllegalStateException("Envelope for OutputChannel has Buffer attached.");
		}

		for (AbstractEvent event : envelope.deserializeEvents()) {
			if (event.getClass() == ChannelCloseEvent.class) {
				synchronized (this.closeLock) {
					this.receiverCloseRequested = true;
					this.closeLock.notifyAll();
				}
			} 
			else if (event instanceof AbstractTaskEvent) {
				if (LOG.isDebugEnabled()) {
					LOG.debug("OutputChannel received task event: " + event);
				}
				
				this.outputGate.deliverEvent((AbstractTaskEvent) event);
			}
			else {
				throw new RuntimeException("OutputChannel received an event that is neither close nor task event.");
			}
		}
	}
@ Override public void queueEnvelope ( Envelope envelope ) { if ( envelope . hasBuffer ( ) ) { throw new IllegalStateException ( "Envelope for OutputChannel has Buffer attached." ) ; } for ( AbstractEvent event : envelope . deserializeEvents ( ) ) { if ( event . getClass ( ) == ChannelCloseEvent . class ) { synchronized ( this . closeLock ) { this . receiverCloseRequested = true ; this . closeLock . notifyAll ( ) ; } } else if ( event instanceof AbstractTaskEvent ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "OutputChannel received task event: " + event ) ; } this . outputGate . deliverEvent ( ( AbstractTaskEvent ) event ) ; } else { throw new RuntimeException ( "OutputChannel received an event that is neither close nor task event." ) ; } } }
-----------------------------------------------------------------------------------------------------------------