public ServiceBundle startUpCallQueue ( ) { methodQueue . startListener ( new ReceiveQueueListener < MethodCall < Object > > ( ) { long time ; long lastTimeAutoFlush ; /** * When we receive a method call, we call doCall. * @param item item */ @ Override public void receive ( MethodCall < Object > item ) { doCall ( item ) ; //Do call calls forwardEvent but does not flush. Only when the queue is empty do we flush. } /** * If the queue is empty, then go ahead, and flush to each client all incoming requests every 50 milliseconds. */ @ Override public void empty ( ) { time = timer . now ( ) ; if ( time > ( lastTimeAutoFlush + 50 ) ) { //noinspection Convert2streamapi for ( SendQueue < MethodCall < Object > > sendQueue : sendQueues ) { sendQueue . flushSends ( ) ; } lastTimeAutoFlush = time ; } } } ) ; return this ; }
Start the client bundle .