net.rim.device.api.io.messaging
Interface BlockingSenderDestination

All Superinterfaces:
Destination, SenderDestination

public interface BlockingSenderDestination
extends SenderDestination

Facilitates the transmission of messages in a way that waits for a response while blocking thread execution.

Since:
BlackBerry API 6.0.0

Method Summary
 Message sendReceive()
          Sends an empty message to this destination and waits for a response.
 Message sendReceive(Message message)
          Sends a message to this destination and waits for a response.
 MessageFuture sendReceiveAsFuture()
          Sends an empty message to this destination and returns a MessageFuture to receive the response later.
 MessageFuture sendReceiveAsFuture(Message message)
          Sends a message to this destination and returns a MessageFuture to receive the response later.
 
Methods inherited from interface net.rim.device.api.io.messaging.SenderDestination
cancel, cancelAllCancellable, createByteMessage, createStreamMessage
 
Methods inherited from interface net.rim.device.api.io.messaging.Destination
destroy, getUri, pause, release, resume
 



Method Detail

sendReceive

Message sendReceive(Message message)
                    throws MessageFailureException
Sends a message to this destination and waits for a response. Blocks the thread execution until the response message has been received. If this method is invoked from an event loop thread, a MessageFailureException is thrown.

Parameters:
message - The message to send.
Returns:
A Message in response to the message sent.
Throws:
MessageFailureException - If the message cannot be sent.
Since:
BlackBerry API 6.0.0

sendReceive

Message sendReceive()
                    throws MessageFailureException
Sends an empty message to this destination and waits for a response. Blocks the thread execution until the response message has been sent. If this method is invoked from an event loop thread, a MessageFailureException is thrown.

Returns:
A Message in response to the message sent.
Throws:
MessageFailureException - If the message cannot be sent.
Since:
BlackBerry API 6.0.0

sendReceiveAsFuture

MessageFuture sendReceiveAsFuture(Message message)
                                  throws MessageFailureException
Sends a message to this destination and returns a MessageFuture to receive the response later. This method will return immediately, however the response in MessageFuture may not be available. This minimizes the amount of time this thread will be blocked.

Parameters:
message - The message to send. If null, an empty message will be sent.
Returns:
A MessageFuture object that will contain the response when it arrives.
Throws:
MessageFailureException - If the message is unable to be sent.
See Also:
MessageFuture
Since:
BlackBerry API 6.0.0

sendReceiveAsFuture

MessageFuture sendReceiveAsFuture()
                                  throws MessageFailureException
Sends an empty message to this destination and returns a MessageFuture to receive the response later. This method will return immediately, however the response in MessageFuture may not be available. This minimizes the amount of time this thread will be blocked.

Returns:
A MessageFuture object that will contain the response when it arrives.
Throws:
MessageFailureException - If the message is unable to be sent.
See Also:
MessageFuture
Since:
BlackBerry API 6.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal