public synchronized void transmit ( Object o , ReceiverQueue t ) { if ( ! closed ) { ArrayList < Receiver > toBeRemoved = new ArrayList < Receiver > ( ) ; for ( Receiver r : receivers ) { //cleanup //TODO separate cleanup from transmit // if ( r instanceof ReceiverQueue && ( ( ReceiverQueue ) r ) . isClosed ( ) ) { toBeRemoved . add ( r ) ; } else { if ( echo || r != t ) { r . onReceive ( o ) ; } } } for ( Receiver r : toBeRemoved ) { receivers . remove ( r ) ; } } }
Dispatches an object to all connected receivers .