com.resilientedge.jockey.peerbridge
Class SimpSockMessenger

java.lang.Object
  |
  +--com.resilientedge.jockey.peerbridge.SimpSockMessenger
All Implemented Interfaces:
PBMessenger, SimpSockRequestListener

public class SimpSockMessenger
extends java.lang.Object
implements PBMessenger, SimpSockRequestListener

The PBMessenger is responsible for transmitting messages (generic, requests, replies) from the peer network.

Version:
$Revision: 1.1.1.1 $
Author:
John Gardner

Constructor Summary
SimpSockMessenger(SimpSockPeerGroup group, SimpSockConnector connector)
          Constructor.
 
Method Summary
 void addMessageObserver(PBMessageObserver observer)
          Add a observer that wishes to receive message notifications.
 PBMessage createMessage()
          Creates a new peer message instance to be sent.
 Response doCall(Request req)
          Handle a request
 void doVoidCall(Request req)
          Handle a request which won't receive a response.
 java.lang.String getRequesteeName()
          Return the name by which this listener can be identified.
 void removeMessageObserver(PBMessageObserver observer)
          Remove an entity from the list of those interested in messages notifications.
 PBResponseMarker sendAsyncRequest(PBApplication app, PBMessage request, int timeout)
          Transmits a message over the peer network to the target app
 PBSendMarker sendMessage(PBApplication app, PBMessage message)
          Transmits a message over the peer network to the target app
 PBMessage sendRequest(PBApplication app, PBMessage request, int timeout)
          Transmits a request over the peer network to the target app
 PBSendMarker sendResponse(PBMessage request, PBMessage reply)
          Transmits a response over the peer network to the target app
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpSockMessenger

public SimpSockMessenger(SimpSockPeerGroup group,
                         SimpSockConnector connector)
Constructor.
Method Detail

createMessage

public PBMessage createMessage()
Creates a new peer message instance to be sent.
Specified by:
createMessage in interface PBMessenger
Returns:
new empty, message

sendMessage

public PBSendMarker sendMessage(PBApplication app,
                                PBMessage message)
                         throws java.io.IOException
Transmits a message over the peer network to the target app
Specified by:
sendMessage in interface PBMessenger
Parameters:
app - Description of Parameter
message - Description of Parameter
Returns:
Description of the Returned Value

sendRequest

public PBMessage sendRequest(PBApplication app,
                             PBMessage request,
                             int timeout)
Transmits a request over the peer network to the target app
Specified by:
sendRequest in interface PBMessenger
Parameters:
app - Description of Parameter
request - Description of Parameter
timeout - Description of Parameter
Returns:
Description of the Returned Value

sendAsyncRequest

public PBResponseMarker sendAsyncRequest(PBApplication app,
                                         PBMessage request,
                                         int timeout)
                                  throws java.io.IOException
Transmits a message over the peer network to the target app
Specified by:
sendAsyncRequest in interface PBMessenger
Parameters:
app - Description of Parameter
request - Description of Parameter
timeout - Description of Parameter
Returns:
Description of the Returned Value

sendResponse

public PBSendMarker sendResponse(PBMessage request,
                                 PBMessage reply)
                          throws java.io.IOException
Transmits a response over the peer network to the target app
Specified by:
sendResponse in interface PBMessenger
Parameters:
request - Description of Parameter
reply - Description of Parameter
Returns:
Description of the Returned Value

addMessageObserver

public void addMessageObserver(PBMessageObserver observer)
Add a observer that wishes to receive message notifications.
Specified by:
addMessageObserver in interface PBMessenger
Parameters:
observer - entity to add

removeMessageObserver

public void removeMessageObserver(PBMessageObserver observer)
Remove an entity from the list of those interested in messages notifications.
Specified by:
removeMessageObserver in interface PBMessenger
Parameters:
observer - entity to remove

getRequesteeName

public java.lang.String getRequesteeName()
Return the name by which this listener can be identified.
Specified by:
getRequesteeName in interface SimpSockRequestListener
Returns:
listener name

doCall

public Response doCall(Request req)
Handle a request
Specified by:
doCall in interface SimpSockRequestListener
Parameters:
req - the request to handle
Returns:
a response

doVoidCall

public void doVoidCall(Request req)
Handle a request which won't receive a response.
Specified by:
doVoidCall in interface SimpSockRequestListener
Parameters:
req - the request to handle


Copyright © 2001 Resilient Edge, Inc. All Rights Reserved.