private Packet nextPacket ( ) { Packet packet = null ; // Wait until there's a packet or we're done. while ( ! done && ( packet = queue . poll ( ) ) == null ) { try { synchronized ( queue ) { queue . wait ( ) ; } } catch ( InterruptedException ie ) { // Do nothing } } return packet ; }
Returns the next available packet from the queue for writing .