Java 类org.apache.catalina.tribes.tipis.LazyReplicatedMap 实例源码

项目:tomcat7    文件:BackupManager.java   
/**
 * Start this component and implement the requirements
 * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
 *
 * Starts the cluster communication channel, this will connect with the
 * other nodes in the cluster, and request the current session state to be
 * transferred to this node.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected synchronized void startInternal() throws LifecycleException {

    super.startInternal();

    try {
        if (cluster == null) throw new LifecycleException(sm.getString("backupManager.noCluster", getName()));
        LazyReplicatedMap<String,Session> map =
                new LazyReplicatedMap<String,Session>(this,
                        cluster.getChannel(), rpcTimeout, getMapName(),
                        getClassLoaders(), terminateOnStartFailure);
        map.setChannelSendOptions(mapSendOptions);
        this.sessions = map;
    }  catch ( Exception x ) {
        log.error(sm.getString("backupManager.startUnable", getName()),x);
        throw new LifecycleException(sm.getString("backupManager.startFailed", getName()),x);
    }
    setState(LifecycleState.STARTING);
}
项目:tomcat7    文件:BackupManager.java   
/**
 * Stop this component and implement the requirements
 * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
 *
 * This will disconnect the cluster communication channel and stop the
 * listener thread.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected synchronized void stopInternal() throws LifecycleException {

    if (log.isDebugEnabled())
        log.debug(sm.getString("backupManager.stopped", getName()));

    setState(LifecycleState.STOPPING);

    if (sessions instanceof LazyReplicatedMap) {
        LazyReplicatedMap<String,Session> map =
                (LazyReplicatedMap<String,Session>)sessions;
        map.breakdown();
    }

    super.stopInternal();
}
项目:tomcat7    文件:MapDemo.java   
@Override
public Object getValueAt(int row, int col) {
    if ( row==-1 ) {
        update();
        return "";
    }
    if ( row == 0 ) return columnNames[col];
    Object[] keys = map.keySetFull().toArray();
    String key = (String)keys [row-1];
    LazyReplicatedMap.MapEntry<String,StringBuilder> entry =
            map.getInternal(key);
    switch (col) {
        case 0: return String.valueOf(row);
        case 1: return entry.getKey();
        case 2: return entry.getValue();
        case 3: return entry.getPrimary()!=null?entry.getPrimary().getName():"null";
        case 4: return getMemberNames(entry.getBackupNodes());
        case 5: return Boolean.valueOf(entry.isPrimary());
        case 6: return Boolean.valueOf(entry.isProxy());
        case 7: return Boolean.valueOf(entry.isBackup());
        default: return "";
    }

}
项目:tomcat7    文件:MapDemo.java   
/**
 * Create the GUI and show it.  For thread safety,
 * this method should be invoked from the
 * event-dispatching thread.
 */
public static SimpleTableDemo createAndShowGUI(
        LazyReplicatedMap<String,StringBuilder> map, String title) {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);

    //Create and set up the window.
    JFrame frame = new JFrame("SimpleTableDemo - "+title);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Create and set up the content pane.
    SimpleTableDemo newContentPane = new SimpleTableDemo(map);
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);

    //Display the window.
    frame.setSize(450,250);
    newContentPane.setSize(450,300);
    frame.pack();
    frame.setVisible(true);
    return newContentPane;
}
项目:apache-tomcat-7.0.73-with-comment    文件:BackupManager.java   
/**
 * Start this component and implement the requirements
 * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
 *
 * Starts the cluster communication channel, this will connect with the
 * other nodes in the cluster, and request the current session state to be
 * transferred to this node.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected synchronized void startInternal() throws LifecycleException {

    super.startInternal();

    try {
        if (cluster == null) throw new LifecycleException(sm.getString("backupManager.noCluster", getName()));
        LazyReplicatedMap<String,Session> map =
                new LazyReplicatedMap<String,Session>(this,
                        cluster.getChannel(), rpcTimeout, getMapName(),
                        getClassLoaders(), terminateOnStartFailure);
        map.setChannelSendOptions(mapSendOptions);
        this.sessions = map;
    }  catch ( Exception x ) {
        log.error(sm.getString("backupManager.startUnable", getName()),x);
        throw new LifecycleException(sm.getString("backupManager.startFailed", getName()),x);
    }
    setState(LifecycleState.STARTING);
}
项目:apache-tomcat-7.0.73-with-comment    文件:BackupManager.java   
/**
 * Stop this component and implement the requirements
 * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
 *
 * This will disconnect the cluster communication channel and stop the
 * listener thread.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected synchronized void stopInternal() throws LifecycleException {

    if (log.isDebugEnabled())
        log.debug(sm.getString("backupManager.stopped", getName()));

    setState(LifecycleState.STOPPING);

    if (sessions instanceof LazyReplicatedMap) {
        LazyReplicatedMap<String,Session> map =
                (LazyReplicatedMap<String,Session>)sessions;
        map.breakdown();
    }

    super.stopInternal();
}
项目:apache-tomcat-7.0.73-with-comment    文件:MapDemo.java   
@Override
public Object getValueAt(int row, int col) {
    if ( row==-1 ) {
        update();
        return "";
    }
    if ( row == 0 ) return columnNames[col];
    Object[] keys = map.keySetFull().toArray();
    String key = (String)keys [row-1];
    LazyReplicatedMap.MapEntry<String,StringBuilder> entry =
            map.getInternal(key);
    switch (col) {
        case 0: return String.valueOf(row);
        case 1: return entry.getKey();
        case 2: return entry.getValue();
        case 3: return entry.getPrimary()!=null?entry.getPrimary().getName():"null";
        case 4: return getMemberNames(entry.getBackupNodes());
        case 5: return Boolean.valueOf(entry.isPrimary());
        case 6: return Boolean.valueOf(entry.isProxy());
        case 7: return Boolean.valueOf(entry.isBackup());
        default: return "";
    }

}
项目:apache-tomcat-7.0.73-with-comment    文件:MapDemo.java   
/**
 * Create the GUI and show it.  For thread safety,
 * this method should be invoked from the
 * event-dispatching thread.
 */
public static SimpleTableDemo createAndShowGUI(
        LazyReplicatedMap<String,StringBuilder> map, String title) {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);

    //Create and set up the window.
    JFrame frame = new JFrame("SimpleTableDemo - "+title);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Create and set up the content pane.
    SimpleTableDemo newContentPane = new SimpleTableDemo(map);
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);

    //Display the window.
    frame.setSize(450,250);
    newContentPane.setSize(450,300);
    frame.pack();
    frame.setVisible(true);
    return newContentPane;
}
项目:lazycat    文件:BackupManager.java   
/**
 * Start this component and implement the requirements of
 * {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
 *
 * Starts the cluster communication channel, this will connect with the
 * other nodes in the cluster, and request the current session state to be
 * transferred to this node.
 *
 * @exception LifecycleException
 *                if this component detects a fatal error that prevents this
 *                component from being used
 */
@Override
protected synchronized void startInternal() throws LifecycleException {

    super.startInternal();

    try {
        if (cluster == null)
            throw new LifecycleException(sm.getString("backupManager.noCluster", getName()));
        LazyReplicatedMap<String, Session> map = new LazyReplicatedMap<String, Session>(this, cluster.getChannel(),
                rpcTimeout, getMapName(), getClassLoaders(), terminateOnStartFailure);
        map.setChannelSendOptions(mapSendOptions);
        map.setAccessTimeout(accessTimeout);
        this.sessions = map;
    } catch (Exception x) {
        log.error(sm.getString("backupManager.startUnable", getName()), x);
        throw new LifecycleException(sm.getString("backupManager.startFailed", getName()), x);
    }
    setState(LifecycleState.STARTING);
}
项目:lazycat    文件:BackupManager.java   
/**
 * Stop this component and implement the requirements of
 * {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
 *
 * This will disconnect the cluster communication channel and stop the
 * listener thread.
 *
 * @exception LifecycleException
 *                if this component detects a fatal error that prevents this
 *                component from being used
 */
@Override
protected synchronized void stopInternal() throws LifecycleException {

    if (log.isDebugEnabled())
        log.debug(sm.getString("backupManager.stopped", getName()));

    setState(LifecycleState.STOPPING);

    if (sessions instanceof LazyReplicatedMap) {
        LazyReplicatedMap<String, Session> map = (LazyReplicatedMap<String, Session>) sessions;
        map.breakdown();
    }

    super.stopInternal();
}
项目:class-guard    文件:BackupManager.java   
/**
 * Stop this component and implement the requirements
 * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
 *
 * This will disconnect the cluster communication channel and stop the
 * listener thread.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected synchronized void stopInternal() throws LifecycleException {

    if (log.isDebugEnabled())
        log.debug(sm.getString("backupManager.stopped", getName()));

    setState(LifecycleState.STOPPING);

    if (sessions instanceof LazyReplicatedMap) {
        LazyReplicatedMap map = (LazyReplicatedMap)sessions;
        map.breakdown();
    }

    cluster.removeManager(this);
    super.stopInternal();
}
项目:class-guard    文件:MapDemo.java   
@Override
public Object getValueAt(int row, int col) {
    if ( row==-1 ) {
        update();
        return "";
    }
    if ( row == 0 ) return columnNames[col];
    Object[] keys = map.keySetFull().toArray();
    String key = (String)keys [row-1];
    LazyReplicatedMap.MapEntry entry = map.getInternal(key);
    switch (col) {
        case 0: return String.valueOf(row);
        case 1: return entry.getKey();
        case 2: return entry.getValue();
        case 3: return entry.getPrimary()!=null?entry.getPrimary().getName():"null";
        case 4: return getMemberNames(entry.getBackupNodes());
        case 5: return Boolean.valueOf(entry.isPrimary());
        case 6: return Boolean.valueOf(entry.isProxy());
        case 7: return Boolean.valueOf(entry.isBackup());
        default: return "";
    }

}
项目:class-guard    文件:MapDemo.java   
/**
 * Create the GUI and show it.  For thread safety,
 * this method should be invoked from the
 * event-dispatching thread.
 */
public static SimpleTableDemo createAndShowGUI(LazyReplicatedMap map, String title) {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);

    //Create and set up the window.
    JFrame frame = new JFrame("SimpleTableDemo - "+title);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Create and set up the content pane.
    SimpleTableDemo newContentPane = new SimpleTableDemo(map);
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);

    //Display the window.
    frame.setSize(450,250);
    newContentPane.setSize(450,300);
    frame.pack();
    frame.setVisible(true);
    return newContentPane;
}
项目:apache-tomcat-7.0.57    文件:BackupManager.java   
/**
 * Start this component and implement the requirements
 * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
 *
 * Starts the cluster communication channel, this will connect with the
 * other nodes in the cluster, and request the current session state to be
 * transferred to this node.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected synchronized void startInternal() throws LifecycleException {

    super.startInternal();

    try {
        if (cluster == null) throw new LifecycleException(sm.getString("backupManager.noCluster", getName()));
        LazyReplicatedMap<String,Session> map =
                new LazyReplicatedMap<String,Session>(this,
                        cluster.getChannel(), rpcTimeout, getMapName(),
                        getClassLoaders(), terminateOnStartFailure);
        map.setChannelSendOptions(mapSendOptions);
        this.sessions = map;
    }  catch ( Exception x ) {
        log.error(sm.getString("backupManager.startUnable", getName()),x);
        throw new LifecycleException(sm.getString("backupManager.startFailed", getName()),x);
    }
    setState(LifecycleState.STARTING);
}
项目:apache-tomcat-7.0.57    文件:BackupManager.java   
/**
 * Stop this component and implement the requirements
 * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
 *
 * This will disconnect the cluster communication channel and stop the
 * listener thread.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected synchronized void stopInternal() throws LifecycleException {

    if (log.isDebugEnabled())
        log.debug(sm.getString("backupManager.stopped", getName()));

    setState(LifecycleState.STOPPING);

    if (sessions instanceof LazyReplicatedMap) {
        LazyReplicatedMap<String,Session> map =
                (LazyReplicatedMap<String,Session>)sessions;
        map.breakdown();
    }

    super.stopInternal();
}
项目:apache-tomcat-7.0.57    文件:MapDemo.java   
@Override
public Object getValueAt(int row, int col) {
    if ( row==-1 ) {
        update();
        return "";
    }
    if ( row == 0 ) return columnNames[col];
    Object[] keys = map.keySetFull().toArray();
    String key = (String)keys [row-1];
    LazyReplicatedMap.MapEntry<String,StringBuilder> entry =
            map.getInternal(key);
    switch (col) {
        case 0: return String.valueOf(row);
        case 1: return entry.getKey();
        case 2: return entry.getValue();
        case 3: return entry.getPrimary()!=null?entry.getPrimary().getName():"null";
        case 4: return getMemberNames(entry.getBackupNodes());
        case 5: return Boolean.valueOf(entry.isPrimary());
        case 6: return Boolean.valueOf(entry.isProxy());
        case 7: return Boolean.valueOf(entry.isBackup());
        default: return "";
    }

}
项目:apache-tomcat-7.0.57    文件:MapDemo.java   
/**
 * Create the GUI and show it.  For thread safety,
 * this method should be invoked from the
 * event-dispatching thread.
 */
public static SimpleTableDemo createAndShowGUI(
        LazyReplicatedMap<String,StringBuilder> map, String title) {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);

    //Create and set up the window.
    JFrame frame = new JFrame("SimpleTableDemo - "+title);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Create and set up the content pane.
    SimpleTableDemo newContentPane = new SimpleTableDemo(map);
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);

    //Display the window.
    frame.setSize(450,250);
    newContentPane.setSize(450,300);
    frame.pack();
    frame.setVisible(true);
    return newContentPane;
}
项目:apache-tomcat-7.0.57    文件:MapDemo.java   
@Override
public Object getValueAt(int row, int col) {
    if ( row==-1 ) {
        update();
        return "";
    }
    if ( row == 0 ) return columnNames[col];
    Object[] keys = map.keySetFull().toArray();
    String key = (String)keys [row-1];
    LazyReplicatedMap.MapEntry<String,StringBuilder> entry =
            map.getInternal(key);
    switch (col) {
        case 0: return String.valueOf(row);
        case 1: return entry.getKey();
        case 2: return entry.getValue();
        case 3: return entry.getPrimary()!=null?entry.getPrimary().getName():"null";
        case 4: return getMemberNames(entry.getBackupNodes());
        case 5: return Boolean.valueOf(entry.isPrimary());
        case 6: return Boolean.valueOf(entry.isProxy());
        case 7: return Boolean.valueOf(entry.isBackup());
        default: return "";
    }

}
项目:apache-tomcat-7.0.57    文件:MapDemo.java   
/**
 * Create the GUI and show it.  For thread safety,
 * this method should be invoked from the
 * event-dispatching thread.
 */
public static SimpleTableDemo createAndShowGUI(
        LazyReplicatedMap<String,StringBuilder> map, String title) {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);

    //Create and set up the window.
    JFrame frame = new JFrame("SimpleTableDemo - "+title);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Create and set up the content pane.
    SimpleTableDemo newContentPane = new SimpleTableDemo(map);
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);

    //Display the window.
    frame.setSize(450,250);
    newContentPane.setSize(450,300);
    frame.pack();
    frame.setVisible(true);
    return newContentPane;
}
项目:apache-tomcat-7.0.57    文件:BackupManager.java   
/**
 * Start this component and implement the requirements
 * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
 *
 * Starts the cluster communication channel, this will connect with the
 * other nodes in the cluster, and request the current session state to be
 * transferred to this node.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected synchronized void startInternal() throws LifecycleException {

    super.startInternal();

    try {
        if (cluster == null) throw new LifecycleException(sm.getString("backupManager.noCluster", getName()));
        LazyReplicatedMap<String,Session> map =
                new LazyReplicatedMap<String,Session>(this,
                        cluster.getChannel(), rpcTimeout, getMapName(),
                        getClassLoaders(), terminateOnStartFailure);
        map.setChannelSendOptions(mapSendOptions);
        this.sessions = map;
    }  catch ( Exception x ) {
        log.error(sm.getString("backupManager.startUnable", getName()),x);
        throw new LifecycleException(sm.getString("backupManager.startFailed", getName()),x);
    }
    setState(LifecycleState.STARTING);
}
项目:apache-tomcat-7.0.57    文件:BackupManager.java   
/**
 * Stop this component and implement the requirements
 * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
 *
 * This will disconnect the cluster communication channel and stop the
 * listener thread.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected synchronized void stopInternal() throws LifecycleException {

    if (log.isDebugEnabled())
        log.debug(sm.getString("backupManager.stopped", getName()));

    setState(LifecycleState.STOPPING);

    if (sessions instanceof LazyReplicatedMap) {
        LazyReplicatedMap<String,Session> map =
                (LazyReplicatedMap<String,Session>)sessions;
        map.breakdown();
    }

    super.stopInternal();
}
项目:WBSAirback    文件:BackupManager.java   
/**
 * Start this component and implement the requirements
 * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
 *
 * Starts the cluster communication channel, this will connect with the
 * other nodes in the cluster, and request the current session state to be
 * transferred to this node.
 * 
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected synchronized void startInternal() throws LifecycleException {

    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);
    }
    setState(LifecycleState.STARTING);
}
项目:WBSAirback    文件:BackupManager.java   
/**
 * Stop this component and implement the requirements
 * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
 * 
 * This will disconnect the cluster communication channel and stop the
 * listener thread.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected synchronized void stopInternal() throws LifecycleException {

    if (log.isDebugEnabled())
        log.debug("Stopping");

    setState(LifecycleState.STOPPING);

    if (sessions instanceof LazyReplicatedMap) {
        LazyReplicatedMap map = (LazyReplicatedMap)sessions;
        map.breakdown();
    }

    cluster.removeManager(this);
    super.stopInternal();
}
项目:WBSAirback    文件:MapDemo.java   
@Override
public Object getValueAt(int row, int col) {
    if ( row==-1 ) {
        update();
        return "";
    }
    if ( row == 0 ) return columnNames[col];
    Object[] keys = map.keySetFull().toArray();
    String key = (String)keys [row-1];
    LazyReplicatedMap.MapEntry entry = map.getInternal(key);
    switch (col) {
        case 0: return String.valueOf(row);
        case 1: return entry.getKey();
        case 2: return entry.getValue();
        case 3: return entry.getPrimary()!=null?entry.getPrimary().getName():"null";
        case 4: return getMemberNames(entry.getBackupNodes());
        case 5: return Boolean.valueOf(entry.isPrimary());
        case 6: return Boolean.valueOf(entry.isProxy());
        case 7: return Boolean.valueOf(entry.isBackup());
        default: return "";
    }

}
项目:WBSAirback    文件:MapDemo.java   
/**
 * Create the GUI and show it.  For thread safety,
 * this method should be invoked from the
 * event-dispatching thread.
 */
public static SimpleTableDemo createAndShowGUI(LazyReplicatedMap map, String title) {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);

    //Create and set up the window.
    JFrame frame = new JFrame("SimpleTableDemo - "+title);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Create and set up the content pane.
    SimpleTableDemo newContentPane = new SimpleTableDemo(map);
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);

    //Display the window.
    frame.setSize(450,250);
    newContentPane.setSize(450,300);
    frame.pack();
    frame.setVisible(true);
    return newContentPane;
}
项目:tomcat7    文件:BackupManager.java   
@Override
public ClusterMessage requestCompleted(String sessionId) {
    if (!getState().isAvailable()) return null;
    LazyReplicatedMap<String,Session> map =
            (LazyReplicatedMap<String,Session>)sessions;
    map.replicate(sessionId,false);
    return null;
}
项目:tomcat7    文件:BackupManager.java   
@Override
public Set<String> getSessionIdsFull() {
    Set<String> sessionIds = new HashSet<String>();
    LazyReplicatedMap<String,Session> map =
            (LazyReplicatedMap<String,Session>)sessions;
    Iterator<String> keys = map.keySetFull().iterator();
    while (keys.hasNext()) {
        sessionIds.add(keys.next());
    }
    return sessionIds;
}
项目:tomcat7    文件:MapDemo.java   
/**
 * 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);
}
项目:apache-tomcat-7.0.73-with-comment    文件:BackupManager.java   
@Override
public ClusterMessage requestCompleted(String sessionId) {
    if (!getState().isAvailable()) return null;
    LazyReplicatedMap<String,Session> map =
            (LazyReplicatedMap<String,Session>)sessions;
    map.replicate(sessionId,false);
    return null;
}
项目:apache-tomcat-7.0.73-with-comment    文件:BackupManager.java   
@Override
public Set<String> getSessionIdsFull() {
    Set<String> sessionIds = new HashSet<String>();
    LazyReplicatedMap<String,Session> map =
            (LazyReplicatedMap<String,Session>)sessions;
    Iterator<String> keys = map.keySetFull().iterator();
    while (keys.hasNext()) {
        sessionIds.add(keys.next());
    }
    return sessionIds;
}
项目:apache-tomcat-7.0.73-with-comment    文件:MapDemo.java   
/**
 * 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);
}
项目:lazycat    文件:BackupManager.java   
@Override
public ClusterMessage requestCompleted(String sessionId) {
    if (!getState().isAvailable())
        return null;
    LazyReplicatedMap<String, Session> map = (LazyReplicatedMap<String, Session>) sessions;
    map.replicate(sessionId, false);
    return null;
}
项目:lazycat    文件:BackupManager.java   
@Override
public Set<String> getSessionIdsFull() {
    Set<String> sessionIds = new HashSet<String>();
    LazyReplicatedMap<String, Session> map = (LazyReplicatedMap<String, Session>) sessions;
    Iterator<String> keys = map.keySetFull().iterator();
    while (keys.hasNext()) {
        sessionIds.add(keys.next());
    }
    return sessionIds;
}
项目:class-guard    文件:BackupManager.java   
@Override
public ClusterMessage requestCompleted(String sessionId) {
    if (!getState().isAvailable()) return null;
    LazyReplicatedMap map = (LazyReplicatedMap)sessions;
    map.replicate(sessionId,false);
    return null;
}
项目:class-guard    文件:BackupManager.java   
/**
 * Start this component and implement the requirements
 * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
 *
 * Starts the cluster communication channel, this will connect with the
 * other nodes in the cluster, and request the current session state to be
 * transferred to this node.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@SuppressWarnings("unchecked")
@Override
protected synchronized void startInternal() throws LifecycleException {

    super.startInternal();

    try {
        if (getCluster() == null) {
            Cluster cluster = getContainer().getCluster();
            if (cluster instanceof CatalinaCluster) {
                setCluster((CatalinaCluster)cluster);
            } else {
                throw new LifecycleException(
                        sm.getString("backupManager.noCluster", getName()));
            }
        }
        cluster.registerManager(this);
        LazyReplicatedMap map = new LazyReplicatedMap(this,
                                                      cluster.getChannel(),
                                                      rpcTimeout,
                                                      getMapName(),
                                                      getClassLoaders(),
                                                      terminateOnStartFailure);
        map.setChannelSendOptions(mapSendOptions);
        this.sessions = map;
    }  catch ( Exception x ) {
        log.error(sm.getString("backupManager.startUnable", getName()),x);
        throw new LifecycleException(sm.getString("backupManager.startFailed", getName()),x);
    }
    setState(LifecycleState.STARTING);
}
项目:class-guard    文件:BackupManager.java   
@Override
public Set<String> getSessionIdsFull() {
    Set<String> sessionIds = new HashSet<String>();
    LazyReplicatedMap map = (LazyReplicatedMap)sessions;
    @SuppressWarnings("unchecked") // sessions is of type Map<String, Session>
    Iterator<String> keys = map.keySetFull().iterator();
    while (keys.hasNext()) {
        sessionIds.add(keys.next());
    }
    return sessionIds;
}
项目:class-guard    文件:MapDemo.java   
/**
 * 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);
}
项目:apache-tomcat-7.0.57    文件:BackupManager.java   
@Override
public ClusterMessage requestCompleted(String sessionId) {
    if (!getState().isAvailable()) return null;
    LazyReplicatedMap<String,Session> map =
            (LazyReplicatedMap<String,Session>)sessions;
    map.replicate(sessionId,false);
    return null;
}
项目:apache-tomcat-7.0.57    文件:BackupManager.java   
@Override
public Set<String> getSessionIdsFull() {
    Set<String> sessionIds = new HashSet<String>();
    LazyReplicatedMap<String,Session> map =
            (LazyReplicatedMap<String,Session>)sessions;
    Iterator<String> keys = map.keySetFull().iterator();
    while (keys.hasNext()) {
        sessionIds.add(keys.next());
    }
    return sessionIds;
}
项目:apache-tomcat-7.0.57    文件:MapDemo.java   
/**
 * 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);
}