public interface BlockingPolicy
Modifier and Type | Method and Description |
---|---|
long |
block(java.lang.Thread thread,
long userDuration,
UWSJob job,
JobOwner user,
javax.servlet.http.HttpServletRequest request)
Notify this
BlockingPolicy that the given thread is going to
be blocked for the specified duration. |
void |
unblocked(java.lang.Thread unblockedThread,
UWSJob job,
JobOwner user,
javax.servlet.http.HttpServletRequest request)
Notify this
BlockingPolicy that the given thread is not blocked
anymore. |
long block(java.lang.Thread thread, long userDuration, UWSJob job, JobOwner user, javax.servlet.http.HttpServletRequest request) throws java.lang.NullPointerException
BlockingPolicy
that the given thread is going to
be blocked for the specified duration. This function then decides how
long the given thread must really wait before resuming.
The parameter "userDuration" and the returned value are durations expressed in seconds. Both follow the same rules:
Since a timeout or another special behavior may be chosen by this
BlockingPolicy
, the returned value may be different from the
user's asked duration. The value that should be taken into account is
obviously the returned one.
IMPORTANT:
This function may UNblock an older request/thread, in function of
the strategy chosen/implemented by this BlockingPolicy
.
thread
- Thread that is going to be blocked.
MUST NOT be NULL. If NULL this function will
either do nothing and return 0 (no blocking)
or throw a NullPointerException
.userDuration
- Waiting duration (in seconds) asked by the user.
< 0 means indefinite, 0 means no wait and
> 0 means waiting for the specified amount of
seconds.job
- The job associated with the thread.
Should not be NULL.user
- The user who asked for the blocking behavior.
If NULL, the request will be concerned as
anonymous and a decision to identify the user
(e.g. use the IP address) may be chosen by the
BlockingPolicy
implementation if
required.request
- The request which is going to be blocked.
Should not be NULL.java.lang.NullPointerException
- If the given thread is NULL.void unblocked(java.lang.Thread unblockedThread, UWSJob job, JobOwner user, javax.servlet.http.HttpServletRequest request)
BlockingPolicy
that the given thread is not blocked
anymore.unblockedThread
- Thread that is not blocked any more.
MUST be NOT NULL.job
- The job associated with the unblocked Thread.
Should not be NULL.user
- The user who originally asked for the blocking
behavior.
If NULL, the request will be concerned as
anonymous and a decision to identify the user
(e.g. use the IP address) may be chosen by the
BlockingPolicy
implementation if
required.request
- The request which has been unblocked.
Should not be NULL.