planet.simulate
Class MessagePool
java.lang.Object
planet.simulate.MessagePool
public class MessagePool
- extends java.lang.Object
- Author:
- Pedro García, Carles Pairot
Method Summary |
static void |
freeMessage(RouteMessage aMsg)
To free a message only pushing it to stack to reuse. |
static RouteMessage |
getMessage(java.lang.String key,
NodeHandle from,
NodeHandle to,
int type,
int mode)
Return a RouteMessage with the specified values. |
static RouteMessage |
getMessage(java.lang.String key,
NodeHandle from,
NodeHandle to,
NodeHandle nextHop,
Message msg,
int type,
int mode,
java.lang.String appId)
Builds a new instance of RouteMessage with all specified values. |
static void |
init()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MessagePool
public MessagePool()
init
public static void init()
throws InitializationException
- Throws:
InitializationException
getMessage
public static RouteMessage getMessage(java.lang.String key,
NodeHandle from,
NodeHandle to,
int type,
int mode)
throws InitializationException
- Return a RouteMessage with the specified values. If there are RouteMessages free,
just build a new one. For generate new instances of RouteMessage will be used
the implementation class that appears in properties file. For accessing it, this
method use planet.util.Properties.routeMessage attribute.
- Parameters:
key
- Identification of communication.from
- Source node.to
- Destination node.type
- Type of message.mode
- Mode of message.
- Returns:
- A RouteMessage with the specified values.
- Throws:
InitializationException
getMessage
public static RouteMessage getMessage(java.lang.String key,
NodeHandle from,
NodeHandle to,
NodeHandle nextHop,
Message msg,
int type,
int mode,
java.lang.String appId)
throws InitializationException
- Builds a new instance of RouteMessage with all specified values.
- Parameters:
key
- Key of the message.from
- NodeHandle who sends this message.to
- NodeHandle that identifies the last receiver.nextHop
- NodeHandle that identifies the next hop.msg
- Message to be send in this RouteMessage.type
- Type of the message.mode
- Mode of the message.appId
- Application that has build this msg.
- Returns:
- A RouteMessage with all specified values.
- Throws:
InitializationException
- if cannot build a new instance
of the RouteMessage.
freeMessage
public static void freeMessage(RouteMessage aMsg)
- To free a message only pushing it to stack to reuse.
- Parameters:
aMsg
- A RouteMessage to be released.