FileDocCategorySizeDatePackage
MapDemo.javaAPI DocApache Tomcat 6.0.1416612Fri Jul 20 04:20:30 BST 2007org.apache.catalina.tribes.demos

MapDemo

public class MapDemo extends Object implements org.apache.catalina.tribes.ChannelListener, org.apache.catalina.tribes.MembershipListener

Title:

Description:

Company:

author
not attributable
version
1.0

Fields Summary
protected org.apache.catalina.tribes.tipis.LazyReplicatedMap
map
protected SimpleTableDemo
table
Constructors Summary
public MapDemo(org.apache.catalina.tribes.Channel channel, String mapName)

        map = new LazyReplicatedMap(null,channel,5000, mapName,null);
        table = SimpleTableDemo.createAndShowGUI(map,channel.getLocalMember(false).getName());
        channel.addChannelListener(this);
        channel.addMembershipListener(this);
//        for ( int i=0; i<1000; i++ ) {
//            map.put("MyKey-"+i,"My String Value-"+i);
//        }
        this.messageReceived(null,null);
    
Methods Summary
public booleanaccept(java.io.Serializable msg, org.apache.catalina.tribes.Member source)

        table.dataModel.getValueAt(-1,-1);
        return false;
    
public static voidmain(java.lang.String[] args)

        long start = System.currentTimeMillis();
        ManagedChannel channel = (ManagedChannel) ChannelCreator.createChannel(args);
        String mapName = "MapDemo";
        if ( args.length > 0 && (!args[args.length-1].startsWith("-"))) {
            mapName = args[args.length-1];
        }
        channel.start(channel.DEFAULT);
        Runtime.getRuntime().addShutdownHook(new Shutdown(channel));
        MapDemo demo = new MapDemo(channel,mapName);
        
        System.out.println("System test complete, time to start="+(System.currentTimeMillis()-start)+" ms. Sleeping to let threads finish.");
        Thread.sleep(60 * 1000 * 60);
    
public voidmemberAdded(org.apache.catalina.tribes.Member member)

    
public voidmemberDisappeared(org.apache.catalina.tribes.Member member)

        table.dataModel.getValueAt(-1,-1);
    
public voidmessageReceived(java.io.Serializable msg, org.apache.catalina.tribes.Member source)

        
    
public static voidusage()

        System.out.println("Tribes MapDemo.");
        System.out.println("Usage:\n\t" + 
                           "java MapDemo [channel options] mapName\n\t" +
                           "\tChannel options:" +
                           ChannelCreator.usage());