public < T > RemoteService . Response call ( long pause , Functor < T , String > reporter ) throws Exception { String message = null ; while ( true ) { RemoteService . Response response = _caller . call ( ) ; String news = response . params . get ( "message" ) ; if ( news == null ) { if ( _state != null && message != null ) { _state . param = null ; _state . markAttempt ( ) ; } return response ; } else { if ( ! news . equals ( message ) ) { if ( _state != null ) { if ( reporter != null ) reporter . invoke ( "Attempting " + _state . state + ": " + news ) ; _state . param = Progressive . State . clean ( news ) ; _state . markAttempt ( ) ; } else { if ( reporter != null ) reporter . invoke ( news ) ; } message = news ; } Thread . sleep ( pause < PAUSE_BETWEEN_RETRIES ? PAUSE_BETWEEN_RETRIES : pause ) ; } } }
Calls the remote service continuously until a final response is received reporting progress messages via the reporter .