Java Code Examples for org.apache.catalina.tribes.Channel#addMembershipListener()

The following examples show how to use org.apache.catalina.tribes.Channel#addMembershipListener() . 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: MapDemo.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * Constructs a map demo object.
 * @param channel - the Tribes channel object to be used for communication
 * @param mapName - the name of this map
 */
public MapDemo(Channel channel, String mapName ) {
    //instantiate the replicated map
    map = new LazyReplicatedMap<>(null, channel, 5000, mapName, null);
    //create a gui, name it with the member name of this JVM
    table = SimpleTableDemo.createAndShowGUI(map,channel.getLocalMember(false).getName());
    //add ourself as a listener for messages
    channel.addChannelListener(this);
    //add ourself as a listener for memberships
    channel.addMembershipListener(this);
    //initialize the map by receiving a fake message
    this.messageReceived(null,null);
}
 
Example 2
Source File: MapDemo.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs a map demo object.
 * @param channel - the Tribes channel object to be used for communication
 * @param mapName - the name of this map
 */
public MapDemo(Channel channel, String mapName ) {
    //instantiate the replicated map
    map = new LazyReplicatedMap<String,StringBuilder>(null, channel, 5000,
            mapName, null);
    //create a gui, name it with the member name of this JVM
    table = SimpleTableDemo.createAndShowGUI(map,channel.getLocalMember(false).getName());
    //add ourself as a listener for messages
    channel.addChannelListener(this);
    //add ourself as a listener for memberships
    channel.addMembershipListener(this);
    //initialize the map by receiving a fake message
    this.messageReceived(null,null);
}
 
Example 3
Source File: MapDemo.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs a map demo object.
 * @param channel - the Tribes channel object to be used for communication
 * @param mapName - the name of this map
 */
public MapDemo(Channel channel, String mapName ) {
    //instantiate the replicated map
    map = new LazyReplicatedMap<String,StringBuilder>(null, channel, 5000,
            mapName, null);
    //create a gui, name it with the member name of this JVM
    table = SimpleTableDemo.createAndShowGUI(map,channel.getLocalMember(false).getName());
    //add ourself as a listener for messages
    channel.addChannelListener(this);
    //add ourself as a listener for memberships
    channel.addMembershipListener(this);
    //initialize the map by receiving a fake message
    this.messageReceived(null,null);
}
 
Example 4
Source File: MembersWithProperties.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
public MembersWithProperties(Channel channel, Properties props) throws IOException {
    channel.addMembershipListener(this);
    ManagedChannel mchannel = (ManagedChannel)channel;
    mchannel.getMembershipService().setPayload(getPayload(props));
}
 
Example 5
Source File: MembersWithProperties.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
public MembersWithProperties(Channel channel, Properties props) throws IOException {
    channel.addMembershipListener(this);
    ManagedChannel mchannel = (ManagedChannel)channel;
    mchannel.getMembershipService().setPayload(getPayload(props));
}
 
Example 6
Source File: MembersWithProperties.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
public MembersWithProperties(Channel channel, Properties props) throws IOException {
    channel.addMembershipListener(this);
    ManagedChannel mchannel = (ManagedChannel)channel;
    mchannel.getMembershipService().setPayload(getPayload(props));
}