예제 #1
0
 public final SrmLsResponse getSrmLsResponse() {
   SrmLsResponse response = new SrmLsResponse();
   response.setReturnStatus(getTReturnStatus());
   if (!response.getReturnStatus().getStatusCode().isProcessing()) {
     response.setDetails(new ArrayOfTMetaDataPathDetail(getPathDetailArray()));
   } else {
     response.setDetails(null);
   }
   response.setRequestToken(getTRequestToken());
   return response;
 }
예제 #2
0
 /**
  * Waits for up to timeout milliseconds for the request to reach a non-queued state and then
  * returns the current SrmLsResponse for this LsRequest.
  */
 public final SrmLsResponse getSrmLsResponse(long timeout) throws InterruptedException {
   /* To avoid a race condition between us querying the
    * current response and us waiting for a state change
    * notification, the notification scheme is counter
    * based. This guarantees that we do not loose any
    * notifications. A simple lock around the whole loop
    * would not have worked, as the call to
    * getSrmLsResponse may itself trigger a state change
    * and thus cause a deadlock when the state change is
    * signaled.
    */
   Date deadline = getDateRelativeToNow(timeout);
   int counter = _stateChangeCounter.get();
   SrmLsResponse response = getSrmLsResponse();
   while (response.getReturnStatus().getStatusCode().isProcessing()
       && _stateChangeCounter.awaitChangeUntil(counter, deadline)) {
     counter = _stateChangeCounter.get();
     response = getSrmLsResponse();
   }
   return response;
 }