Package org.apache.catalina.tribes.tipis

Examples of org.apache.catalina.tribes.tipis.LazyReplicatedMap


   
    protected LazyReplicatedMap map;
    protected SimpleTableDemo table;
   
    public MapDemo(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);


    public void unload() throws IOException {
    }
   
    public ClusterMessage requestCompleted(String sessionId) {
        if ( !this.started ) return null;
        LazyReplicatedMap map = (LazyReplicatedMap)sessions;
        map.replicate(sessionId,false);
        return null;
    }

        if ( this.started ) return;
       
        try {
            cluster.registerManager(this);
            CatalinaCluster catclust = (CatalinaCluster)cluster;
            LazyReplicatedMap map = new LazyReplicatedMap(this,
                                                          catclust.getChannel(),
                                                          DEFAULT_REPL_TIMEOUT,
                                                          getMapName(),
                                                          getClassLoaders());
            map.setChannelSendOptions(mapSendOptions);
            this.sessions = map;
            super.start();
            this.started = true;
        catch ( Exception x ) {
            log.error("Unable to start BackupManager",x);

     *  that needs to be reported
     */
    public void stop() throws LifecycleException
    {
       
        LazyReplicatedMap map = (LazyReplicatedMap)sessions;
        if ( map!=null ) {
            map.breakdown();
        }
        if ( !this.started ) return;
        try {
        } catch ( Exception x ){
            log.error("Unable to stop BackupManager",x);

        result.mapSendOptions = mapSendOptions;
        return result;
    }

    public int getActiveSessionsFull() {
        LazyReplicatedMap map = (LazyReplicatedMap)sessions;
        return map.sizeFull();
    }

        return map.sizeFull();
    }

    public String listSessionIdsFull() {
        StringBuffer sb=new StringBuffer();
        LazyReplicatedMap map = (LazyReplicatedMap)sessions;
        Iterator keys = map.keySetFull().iterator();
        while (keys.hasNext()) {
            sb.append(keys.next()).append(" ");
        }
        return sb.toString();
    }

   
    protected LazyReplicatedMap map;
    protected SimpleTableDemo table;
   
    public MapDemo(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);

     * @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


    @Override
    public ClusterMessage requestCompleted(String sessionId) {
        if (!getState().isAvailable()) return null;
        LazyReplicatedMap map = (LazyReplicatedMap)sessions;
        map.replicate(sessionId,false);
        return null;
    }

       
        super.startInternal();

        try {
            cluster.registerManager(this);
            LazyReplicatedMap map = new LazyReplicatedMap(this,
                                                          cluster.getChannel(),
                                                          rpcTimeout,
                                                          getMapName(),
                                                          getClassLoaders());
            map.setChannelSendOptions(mapSendOptions);
            this.sessions = map;
        catch ( Exception x ) {
            log.error("Unable to start BackupManager",x);
            throw new LifecycleException("Failed to start BackupManager",x);
        }

TOP

Related Classes of org.apache.catalina.tribes.tipis.LazyReplicatedMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.