org.jsmpp.extra
Class PendingResponse<T extends Command>

java.lang.Object
  extended by org.jsmpp.extra.PendingResponse<T>

public class PendingResponse<T extends Command>
extends java.lang.Object

This class is utility that able wait for a response for specified timeout.

Since:
1.0
Version:
1.0
Author:
uudashr

Constructor Summary
PendingResponse(long timeout)
          Construct with specified timeout.
 
Method Summary
 void done(T response)
          Done with valid response and notify that response already received.
 void doneWithInvalidResponse(InvalidResponseException e)
          Done with invalid response (negative response/non OK command_status).
 T getResponse()
          Get the response.
 void waitDone()
          Wait until response receive or timeout already reach.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PendingResponse

public PendingResponse(long timeout)
Construct with specified timeout.

Parameters:
timeout - is the timeout in millisecond.
Method Detail

done

public void done(T response)
          throws java.lang.IllegalArgumentException
Done with valid response and notify that response already received.

Parameters:
response - is the response.
Throws:
java.lang.IllegalArgumentException - thrown if response is null.

doneWithInvalidResponse

public void doneWithInvalidResponse(InvalidResponseException e)
Done with invalid response (negative response/non OK command_status).

Parameters:
e - is the InvalidResponseException.

getResponse

public T getResponse()
Get the response.

Returns:
the response.

waitDone

public void waitDone()
              throws ResponseTimeoutException,
                     InvalidResponseException
Wait until response receive or timeout already reach.

Throws:
ResponseTimeoutException - if timeout reach.
InvalidResponseException - if receive invalid response.