org.objectweb.proactive.core.body.request
Class AwaitedRequest

java.lang.Object
  extended byorg.objectweb.proactive.core.body.request.AwaitedRequest
All Implemented Interfaces:
Message, Request, java.io.Serializable

public class AwaitedRequest
extends java.lang.Object
implements Request, java.io.Serializable

This class defines a particular request that is subject to wait-by-necessity mecanism. It only contains the Id of the awaited sender. When this awaited sender eventually send a request, the corresponding awaited request is updated, and then behaves as a normal ProActive request. If an active object tries to serve an awaited request that is not yet updated, it's activity is suspended until the awaited request is updated. This request can be considered as a "future of request". (@see org.objectweb.proactive.core.body.future.Future)

Since:
ProActive 2.2
Author:
cdelbe
See Also:
Serialized Form

Field Summary
static org.apache.log4j.Logger logger
          Logger
 
Constructor Summary
AwaitedRequest(UniqueID awaitedSender)
          Create a new awaited request.
 
Method Summary
 boolean decrypt(ProActiveSecurityManager psm)
           
 UniqueID getAwaitedSender()
          Return the id of the awaited sender
 FTManager getFTManager()
          Return the FTManager that have to treat this message
 char[] getMessageInfo()
          Returns fault-tolerance infos piggybacked on this message
 MethodCall getMethodCall()
          Returns the MethodCall embedded in the request
 java.lang.String getMethodName()
          Returns the method name of the method call packed in this message
 java.lang.Object getParameter(int index)
          Returns the parameter number index from the method call embedded in the request
 UniversalBody getSender()
          Returns the sender of this request
 long getSequenceNumber()
          Returns a unique sequence number of this message
 long getSessionId()
           
 UniqueID getSourceBodyID()
          Returns the id of the body source of this message
 long getTimeStamp()
          Returns the time this message was created or deserialized
 boolean hasBeenForwarded()
          Returns true if the request has been forwarded
 boolean ignoreIt()
          Return true if this message must be ignored by the receiver
 boolean isCiphered()
           
 boolean isOneWay()
          Returns true if the message will not generate a response message
 void notifyReception(UniversalBody bodyReceiver)
          Notifies the request that it has been received by the destination.
 void resetSendCounter()
          Set the send counter to 0.
 int send(UniversalBody destinationBody)
          Sends this request to the body destination
 Reply serve(Body targetBody)
          Serve the request.
 Reply serveAlternate(Body targetBody, NonFunctionalException nfe)
          Create a fake but valid reply by encapsulating a non functional exception instead of a result
 void setAwaitedRequest(Request r)
          Update this awaited request with a received request from the awaited sender.
 void setFTManager(FTManager ft)
          Set the FTManager that have to treat this message
 void setIgnoreIt(boolean ignore)
          Set or unset the ignore tag.
 void setMessageInfo(char[] mi)
          Set fault-tolerance infos piggybacked on this message
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static org.apache.log4j.Logger logger
Logger

Constructor Detail

AwaitedRequest

public AwaitedRequest(UniqueID awaitedSender)
Create a new awaited request.

Parameters:
awaitedSender - the id of the awaited sender.
Method Detail

setAwaitedRequest

public void setAwaitedRequest(Request r)
Update this awaited request with a received request from the awaited sender.

Parameters:
r - the received request.

getAwaitedSender

public UniqueID getAwaitedSender()
Return the id of the awaited sender

Returns:
the id of the awaited sender

serve

public Reply serve(Body targetBody)
            throws ServeException
Serve the request. This method is subject to wait-by-necessity mechanism.

Specified by:
serve in interface Request
Parameters:
targetBody - the body destination of the call
Returns:
the reply resulting from the service of this request.
Throws:
ServeException - if the method call fails to be served

getMethodCall

public MethodCall getMethodCall()
Description copied from interface: Request
Returns the MethodCall embedded in the request

Specified by:
getMethodCall in interface Request
Returns:
the MethodCall embedded in the request

getParameter

public java.lang.Object getParameter(int index)
Description copied from interface: Request
Returns the parameter number index from the method call embedded in the request

Specified by:
getParameter in interface Request
Parameters:
index - the position of the parameter to return.
Returns:
the object passed in parameter of the method call that matches the given position or null if no match.

getSender

public UniversalBody getSender()
Description copied from interface: Request
Returns the sender of this request

Specified by:
getSender in interface Request
Returns:
the sender of this request

hasBeenForwarded

public boolean hasBeenForwarded()
Description copied from interface: Request
Returns true if the request has been forwarded

Specified by:
hasBeenForwarded in interface Request
Returns:
true if the request has been forwarded

resetSendCounter

public void resetSendCounter()
Description copied from interface: Request
Set the send counter to 0.

Specified by:
resetSendCounter in interface Request

notifyReception

public void notifyReception(UniversalBody bodyReceiver)
                     throws java.io.IOException
Description copied from interface: Request
Notifies the request that it has been received by the destination. When this request gets fowarded, this method must not be called as a fowarder is not the genuine destination of the request.

Specified by:
notifyReception in interface Request
Parameters:
bodyReceiver - the body destination that received the request
Throws:
java.io.IOException - if the request failed to perform a possible operation upon that notification

send

public int send(UniversalBody destinationBody)
         throws java.io.IOException,
                RenegotiateSessionException
Description copied from interface: Request
Sends this request to the body destination

Specified by:
send in interface Request
Parameters:
destinationBody - the body destination of this request
Returns:
value for fault-tolerance protocol
Throws:
java.io.IOException - if the request fails to be sent
RenegotiateSessionException

getMethodName

public java.lang.String getMethodName()
Description copied from interface: Message
Returns the method name of the method call packed in this message

Specified by:
getMethodName in interface Message
Returns:
the method name of the method call packed in this message

getSourceBodyID

public UniqueID getSourceBodyID()
Description copied from interface: Message
Returns the id of the body source of this message

Specified by:
getSourceBodyID in interface Message
Returns:
the id of the body source of this message

getTimeStamp

public long getTimeStamp()
Description copied from interface: Message
Returns the time this message was created or deserialized

Specified by:
getTimeStamp in interface Message
Returns:
the time this message was created or deserialized

isOneWay

public boolean isOneWay()
Description copied from interface: Message
Returns true if the message will not generate a response message

Specified by:
isOneWay in interface Message
Returns:
true if the message will not generate a response message

getSequenceNumber

public long getSequenceNumber()
Description copied from interface: Message
Returns a unique sequence number of this message

Specified by:
getSequenceNumber in interface Message
Returns:
a unique sequence number of this message

setMessageInfo

public void setMessageInfo(char[] mi)
Description copied from interface: Message
Set fault-tolerance infos piggybacked on this message

Specified by:
setMessageInfo in interface Message
Parameters:
mi - an array of chars that contains fault-tolerance infos

getMessageInfo

public char[] getMessageInfo()
Description copied from interface: Message
Returns fault-tolerance infos piggybacked on this message

Specified by:
getMessageInfo in interface Message
Returns:
an array of chars that contains fault-tolerance infos

setIgnoreIt

public void setIgnoreIt(boolean ignore)
Description copied from interface: Message
Set or unset the ignore tag.

Specified by:
setIgnoreIt in interface Message
Parameters:
ignore - true if this request must be ignored, false otherwise.

ignoreIt

public boolean ignoreIt()
Description copied from interface: Message
Return true if this message must be ignored by the receiver

Specified by:
ignoreIt in interface Message
Returns:
true if this message must be ignored by the receiver

setFTManager

public void setFTManager(FTManager ft)
Description copied from interface: Message
Set the FTManager that have to treat this message

Specified by:
setFTManager in interface Message
Parameters:
ft - the FTManager that have to treat this message

getFTManager

public FTManager getFTManager()
Description copied from interface: Message
Return the FTManager that have to treat this message

Specified by:
getFTManager in interface Message
Returns:
the FTManager that have to treat this message

serveAlternate

public Reply serveAlternate(Body targetBody,
                            NonFunctionalException nfe)
Description copied from interface: Request
Create a fake but valid reply by encapsulating a non functional exception instead of a result

Specified by:
serveAlternate in interface Request
Parameters:
targetBody - the body destination of the call
Returns:
the fake reply built using the non functional exception

isCiphered

public boolean isCiphered()
Specified by:
isCiphered in interface Request

getSessionId

public long getSessionId()
Specified by:
getSessionId in interface Request

decrypt

public boolean decrypt(ProActiveSecurityManager psm)
                throws RenegotiateSessionException
Specified by:
decrypt in interface Request
Throws:
RenegotiateSessionException


Copyright ? April 2005 INRIA All Rights Reserved.