|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectplanet.generic.commonapi.factory.RouteMessagePoolImpl
Shows a pool of RouteMessage, reusing any existing RouteMessage as possible.
If it is invoked a getMessage(..) method and no RouteMessage is available,
a new instance is built and returned with the specified values.
This implementation and the released overlays in this distribution
accomplish the RouteMessagePool operation: the addition of built and reused
RouteMessage should be the same as the free ones.
Field Summary | |
protected java.lang.Class |
routeMessage
Class reference of the current RouteMessage implementation. |
Constructor Summary | |
RouteMessagePoolImpl()
Builds a RouteMessagePool. |
Method Summary | |
void |
freeMessage(RouteMessage msg)
To free a message only pushing it to be reused. |
int |
getBuiltRouteMessages()
Gets the total number of built RouteMessages. |
int |
getFreeRouteMessages()
Gets the total number of free RouteMessages. |
RouteMessage |
getMessage(java.lang.String key,
NodeHandle from,
NodeHandle to,
int type,
int mode)
Return a RouteMessage with the specified values, setting the nextHop field with the to value. |
RouteMessage |
getMessage(java.lang.String key,
NodeHandle from,
NodeHandle to,
NodeHandle nextHop,
int type,
int mode,
Message msg,
java.lang.String appId)
Builds a new instance of RouteMessage with these specified values. |
int |
getReusedRouteMessages()
Gets the total number of reused RouteMessages. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.Class routeMessage
Constructor Detail |
public RouteMessagePoolImpl()
Method Detail |
public void freeMessage(RouteMessage msg)
freeMessage
in interface RouteMessagePool
msg
- The RouteMessage to be released.RouteMessagePool.freeMessage(planet.commonapi.RouteMessage)
public RouteMessage getMessage(java.lang.String key, NodeHandle from, NodeHandle to, int type, int mode) throws InitializationException
getMessage
in interface RouteMessagePool
key
- Identification of communication.from
- Source node.to
- Destination node.type
- Type of message.mode
- Mode of message.
InitializationException
- if occurs any error during the
building process.RouteMessagePool.getMessage(java.lang.String, planet.commonapi.NodeHandle, planet.commonapi.NodeHandle, int, int)
public RouteMessage getMessage(java.lang.String key, NodeHandle from, NodeHandle to, NodeHandle nextHop, int type, int mode, Message msg, java.lang.String appId) throws InitializationException
getMessage
in interface RouteMessagePool
key
- Key of the communication.from
- Source node.to
- Destination node.nextHop
- Identifies the next hop node.type
- Type of the message.mode
- Mode of the message.msg
- Message to be send in this RouteMessage.appId
- Application that has build this msg.
InitializationException
- if cannot build a new instance
of the RouteMessage.RouteMessagePool.getMessage(String, NodeHandle, NodeHandle, NodeHandle, int, int, Message, String)
public int getBuiltRouteMessages()
getBuiltRouteMessages
in interface RouteMessagePool
RouteMessagePool.getBuiltRouteMessages()
public int getFreeRouteMessages()
getFreeRouteMessages
in interface RouteMessagePool
RouteMessagePool.getFreeRouteMessages()
public int getReusedRouteMessages()
getReusedRouteMessages
in interface RouteMessagePool
RouteMessagePool.getReusedRouteMessages()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |