public void send(ClusterMessage msg, Member dest) {
try
{
msg.setAddress(membershipService.getLocalMember());
Member destination = dest;
if ( msg instanceof SessionMessage ) {
SessionMessage smsg = (SessionMessage) msg;
//if we request session state, send to the oldest of members
if ((destination == null) &&
(smsg.getEventType() == SessionMessage.EVT_GET_ALL_SESSIONS) &&
(membershipService.getMembers().length > 0)) {
destination = membershipService.getMembers()[0];
}//end if
}//end if
msg.setTimestamp(System.currentTimeMillis());
java.io.ByteArrayOutputStream outs = new java.io.ByteArrayOutputStream();
java.io.ObjectOutputStream out = new java.io.ObjectOutputStream(outs);
out.writeObject(msg);
byte[] data = outs.toByteArray();
if(destination != null) {
Member tcpdest = dest;
if ( (tcpdest != null) && (!membershipService.getLocalMember().equals(tcpdest))) {
clusterSender.sendMessage(msg.getUniqueId(), data, tcpdest);
}//end if
}
else {