com.ibm.wbi
Class RequestRejectedException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--com.ibm.wbi.RequestRejectedException
All Implemented Interfaces:
java.io.Serializable

public class RequestRejectedException
extends java.lang.Exception

This exception may be thrown by a Meg to indicate that it does not want to accept the request is was given. The request will be handled by some other Meg, if appropriate. Important: The Meg forfeits its opportunity to reject the request, that is, it must handle the request, if either of two things occur:

  1. The Meg generates any output. That means any of the following:
  2. The Meg consumes any of its input without properly notifying the RequestEvent first. "Consuming input" means any of the following: See below for a discussion of how to "properly notify" the RequestEvent.
The issue of how to properly notify the RequestEvent deserves some explanation. The Meg can call peek() on the MegReader or MegInputStream all it wants before rejecting the request, and that is not a problem. However, there may be only a limited amount of data available via peek(). In this case read() will allow access to the full amount of data, but this is considered "consumption" of input. If the Meg is receiving a MegObject as input, simply calling RequestEvent.getMegObject() is considered consumption of input. In these cases, the Meg must notify the RequestEvent before consuming input. Otherwise it is obligated to handle the request. To notify the RequestEvent, the Meg calls RequestEvent.mayReject(). This must be done before calling , RequestEvent.getMegReader(), or RequestEvent.getMegObject().

Note that there is no equivalent mechanism to reject a request after writing some output. A Meg that has written output must always handle the request.

If a Meg that has called mayReject() decides that it definitely will not reject the request, it MAY call RequestEvent.wontReject(). This method is optional, because it is always called for the Meg at the time of the first write to the MegOutputStream or MegWriter. But if a Meg knows it will be handling the request, and that it will read and buffer a large amount of data from the MegInputStream/MegReader before doing any writes to the MegOutputStream/MegWriter, calling wontReject() at the earliest opportunity may free up some memory.

See Also:
RequestEvent.mayReject(), RequestEvent.wontReject(), Serialized Form

Constructor Summary
RequestRejectedException()
          Construct a new RequestRejectedException.
RequestRejectedException(java.lang.String msg)
          Construct a new RequestRejectedException with specified message.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getMessage, printStackTrace, printStackTrace, printStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RequestRejectedException

public RequestRejectedException()
Construct a new RequestRejectedException.

RequestRejectedException

public RequestRejectedException(java.lang.String msg)
Construct a new RequestRejectedException with specified message.
Parameters:
msg - The detailed message.