Java Code Examples for org.apache.catalina.tribes.ChannelMessage#getOptions()

The following examples show how to use org.apache.catalina.tribes.ChannelMessage#getOptions() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChannelCoordinator.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
/**
 * Send a message to one or more members in the cluster
 * @param destination Member[] - the destinations, null or zero length means all
 * @param msg ClusterMessage - the message to send
 * @param payload TBA
 */
@Override
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload)
        throws ChannelException {
    if ( destination == null ) destination = membershipService.getMembers();
    if ((msg.getOptions()&Channel.SEND_OPTIONS_MULTICAST) == Channel.SEND_OPTIONS_MULTICAST) {
        membershipService.broadcast(msg);
    } else {
        clusterSender.sendMessage(msg,destination);
    }
    if ( Logs.MESSAGES.isTraceEnabled() ) {
        Logs.MESSAGES.trace("ChannelCoordinator - Sent msg:" + new UniqueId(msg.getUniqueId()) +
                " at " + new java.sql.Timestamp(System.currentTimeMillis()) + " to " +
                Arrays.toNameString(destination));
    }
}
 
Example 2
Source File: ChannelCoordinator.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * Send a message to one or more members in the cluster
 * @param destination Member[] - the destinations, null or zero length means all
 * @param msg ClusterMessage - the message to send
 * @param payload TBA
 */
@Override
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException {
    if ( destination == null ) destination = membershipService.getMembers();
    if ((msg.getOptions()&Channel.SEND_OPTIONS_MULTICAST) == Channel.SEND_OPTIONS_MULTICAST) {
        membershipService.broadcast(msg);
    } else {
        clusterSender.sendMessage(msg,destination);
    }
    if ( Logs.MESSAGES.isTraceEnabled() ) {
        Logs.MESSAGES.trace("ChannelCoordinator - Sent msg:" + new UniqueId(msg.getUniqueId()) + " at " +new java.sql.Timestamp(System.currentTimeMillis())+ " to "+Arrays.toNameString(destination));
    }
}
 
Example 3
Source File: ChannelCoordinator.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * Send a message to one or more members in the cluster
 * @param destination Member[] - the destinations, null or zero length means all
 * @param msg ClusterMessage - the message to send
 * @param payload TBA
 */
@Override
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException {
    if ( destination == null ) destination = membershipService.getMembers();
    if ((msg.getOptions()&Channel.SEND_OPTIONS_MULTICAST) == Channel.SEND_OPTIONS_MULTICAST) {
        membershipService.broadcast(msg);
    } else {
        clusterSender.sendMessage(msg,destination);
    }
    if ( Logs.MESSAGES.isTraceEnabled() ) {
        Logs.MESSAGES.trace("ChannelCoordinator - Sent msg:" + new UniqueId(msg.getUniqueId()) + " at " +new java.sql.Timestamp(System.currentTimeMillis())+ " to "+Arrays.toNameString(destination));
    }
}