private String sendStatusRequestWithRetry(ModifiableSolrParams params,int maxCounter) throws SolrServerException, IOException {
  NamedList status=null;
  String state=null;
  String message=null;
  NamedList r;
  while (maxCounter-- > 0) {
    r=sendRequest(params);
    status=(NamedList)r.get("status");
    state=(String)status.get("state");
    message=(String)status.get("msg");
    if (state.equals("completed") || state.equals("failed"))     return (String)status.get("msg");
    try {
      Thread.sleep(1000);
    }
 catch (    InterruptedException e) {
    }
  }
  return message;
}

private String sendStatusRequestWithRetry ( ModifiableSolrParams params , int maxCounter ) throws SolrServerException , IOException { NamedList status = null ; String state = null ; String message = null ; NamedList r ; while ( maxCounter -- > 0 ) { r = sendRequest ( params ) ; status = ( NamedList ) r . get ( "status" ) ; state = ( String ) status . get ( "state" ) ; message = ( String ) status . get ( "msg" ) ; if ( state . equals ( "completed" ) || state . equals ( "failed" ) ) return ( String ) status . get ( "msg" ) ; try { Thread . sleep ( 1000 ) ; } catch ( InterruptedException e ) { } } return message ; }
helper method to send a status request with specific retry limit and return the message / null from the success response .
