Java 类org.apache.catalina.ha.session.SessionMessage 实例源码

项目:tomcat7    文件:SimpleTcpCluster.java   
/**
 * send a cluster message to one member
 * 
 * @param msg message to transfer
 * @param dest Receiver member
 * @see org.apache.catalina.ha.CatalinaCluster#send(org.apache.catalina.ha.ClusterMessage,
 *      org.apache.catalina.tribes.Member)
 */
@Override
public void send(ClusterMessage msg, Member dest) {
    try {
        msg.setAddress(getLocalMember());
        int sendOptions = channelSendOptions;
        if (msg instanceof SessionMessage
                && ((SessionMessage)msg).getEventType() == SessionMessage.EVT_ALL_SESSION_DATA) {
            sendOptions = Channel.SEND_OPTIONS_SYNCHRONIZED_ACK|Channel.SEND_OPTIONS_USE_ACK;
        }
        if (dest != null) {
            if (!getLocalMember().equals(dest)) {
                channel.send(new Member[] {dest}, msg, sendOptions);
            } else
                log.error("Unable to send message to local member " + msg);
        } else {
            Member[] destmembers = channel.getMembers();
            if (destmembers.length>0)
                channel.send(destmembers,msg, sendOptions);
            else if (log.isDebugEnabled()) 
                log.debug("No members in cluster, ignoring message:"+msg);
        }
    } catch (Exception x) {
        log.error("Unable to send message through cluster sender.", x);
    }
}
项目:apache-tomcat-7.0.73-with-comment    文件:SimpleTcpCluster.java   
/**
 * send a cluster message to one member
 * 
 * @param msg message to transfer
 * @param dest Receiver member
 * @see org.apache.catalina.ha.CatalinaCluster#send(org.apache.catalina.ha.ClusterMessage,
 *      org.apache.catalina.tribes.Member)
 */
@Override
public void send(ClusterMessage msg, Member dest) {
    try {
        msg.setAddress(getLocalMember());
        int sendOptions = channelSendOptions;
        if (msg instanceof SessionMessage
                && ((SessionMessage)msg).getEventType() == SessionMessage.EVT_ALL_SESSION_DATA) {
            sendOptions = Channel.SEND_OPTIONS_SYNCHRONIZED_ACK|Channel.SEND_OPTIONS_USE_ACK;
        }
        if (dest != null) {
            if (!getLocalMember().equals(dest)) {
                channel.send(new Member[] {dest}, msg, sendOptions);
            } else
                log.error("Unable to send message to local member " + msg);
        } else {
            Member[] destmembers = channel.getMembers();
            if (destmembers.length>0)
                channel.send(destmembers,msg, sendOptions);
            else if (log.isDebugEnabled()) 
                log.debug("No members in cluster, ignoring message:"+msg);
        }
    } catch (Exception x) {
        log.error("Unable to send message through cluster sender.", x);
    }
}
项目:lazycat    文件:SimpleTcpCluster.java   
/**
 * send a cluster message to one member
 * 
 * @param msg
 *            message to transfer
 * @param dest
 *            Receiver member
 * @see org.apache.catalina.ha.CatalinaCluster#send(org.apache.catalina.ha.ClusterMessage,
 *      org.apache.catalina.tribes.Member)
 */
@Override
public void send(ClusterMessage msg, Member dest) {
    try {
        msg.setAddress(getLocalMember());
        int sendOptions = channelSendOptions;
        if (msg instanceof SessionMessage
                && ((SessionMessage) msg).getEventType() == SessionMessage.EVT_ALL_SESSION_DATA) {
            sendOptions = Channel.SEND_OPTIONS_SYNCHRONIZED_ACK | Channel.SEND_OPTIONS_USE_ACK;
        }
        if (dest != null) {
            if (!getLocalMember().equals(dest)) {
                channel.send(new Member[] { dest }, msg, sendOptions);
            } else
                log.error("Unable to send message to local member " + msg);
        } else {
            Member[] destmembers = channel.getMembers();
            if (destmembers.length > 0)
                channel.send(destmembers, msg, sendOptions);
            else if (log.isDebugEnabled())
                log.debug("No members in cluster, ignoring message:" + msg);
        }
    } catch (Exception x) {
        log.error("Unable to send message through cluster sender.", x);
    }
}
项目:class-guard    文件:SimpleTcpCluster.java   
/**
 * send a cluster message to one member
 * 
 * @param msg message to transfer
 * @param dest Receiver member
 * @see org.apache.catalina.ha.CatalinaCluster#send(org.apache.catalina.ha.ClusterMessage,
 *      org.apache.catalina.tribes.Member)
 */
@Override
public void send(ClusterMessage msg, Member dest) {
    try {
        msg.setAddress(getLocalMember());
        int sendOptions = channelSendOptions;
        if (msg instanceof SessionMessage
                && ((SessionMessage)msg).getEventType() == SessionMessage.EVT_ALL_SESSION_DATA) {
            sendOptions = Channel.SEND_OPTIONS_SYNCHRONIZED_ACK|Channel.SEND_OPTIONS_USE_ACK;
        }
        if (dest != null) {
            if (!getLocalMember().equals(dest)) {
                channel.send(new Member[] {dest}, msg, sendOptions);
            } else
                log.error("Unable to send message to local member " + msg);
        } else {
            Member[] destmembers = channel.getMembers();
            if (destmembers.length>0)
                channel.send(destmembers,msg, sendOptions);
            else if (log.isDebugEnabled()) 
                log.debug("No members in cluster, ignoring message:"+msg);
        }
    } catch (Exception x) {
        log.error("Unable to send message through cluster sender.", x);
    }
}
项目:apache-tomcat-7.0.57    文件:SimpleTcpCluster.java   
/**
 * send a cluster message to one member
 * 
 * @param msg message to transfer
 * @param dest Receiver member
 * @see org.apache.catalina.ha.CatalinaCluster#send(org.apache.catalina.ha.ClusterMessage,
 *      org.apache.catalina.tribes.Member)
 */
@Override
public void send(ClusterMessage msg, Member dest) {
    try {
        msg.setAddress(getLocalMember());
        int sendOptions = channelSendOptions;
        if (msg instanceof SessionMessage
                && ((SessionMessage)msg).getEventType() == SessionMessage.EVT_ALL_SESSION_DATA) {
            sendOptions = Channel.SEND_OPTIONS_SYNCHRONIZED_ACK|Channel.SEND_OPTIONS_USE_ACK;
        }
        if (dest != null) {
            if (!getLocalMember().equals(dest)) {
                channel.send(new Member[] {dest}, msg, sendOptions);
            } else
                log.error("Unable to send message to local member " + msg);
        } else {
            Member[] destmembers = channel.getMembers();
            if (destmembers.length>0)
                channel.send(destmembers,msg, sendOptions);
            else if (log.isDebugEnabled()) 
                log.debug("No members in cluster, ignoring message:"+msg);
        }
    } catch (Exception x) {
        log.error("Unable to send message through cluster sender.", x);
    }
}
项目:apache-tomcat-7.0.57    文件:SimpleTcpCluster.java   
/**
 * send a cluster message to one member
 * 
 * @param msg message to transfer
 * @param dest Receiver member
 * @see org.apache.catalina.ha.CatalinaCluster#send(org.apache.catalina.ha.ClusterMessage,
 *      org.apache.catalina.tribes.Member)
 */
@Override
public void send(ClusterMessage msg, Member dest) {
    try {
        msg.setAddress(getLocalMember());
        int sendOptions = channelSendOptions;
        if (msg instanceof SessionMessage
                && ((SessionMessage)msg).getEventType() == SessionMessage.EVT_ALL_SESSION_DATA) {
            sendOptions = Channel.SEND_OPTIONS_SYNCHRONIZED_ACK|Channel.SEND_OPTIONS_USE_ACK;
        }
        if (dest != null) {
            if (!getLocalMember().equals(dest)) {
                channel.send(new Member[] {dest}, msg, sendOptions);
            } else
                log.error("Unable to send message to local member " + msg);
        } else {
            Member[] destmembers = channel.getMembers();
            if (destmembers.length>0)
                channel.send(destmembers,msg, sendOptions);
            else if (log.isDebugEnabled()) 
                log.debug("No members in cluster, ignoring message:"+msg);
        }
    } catch (Exception x) {
        log.error("Unable to send message through cluster sender.", x);
    }
}