当前位置: 首页>>代码示例>>Java>>正文


Java LazyReplicatedMap类代码示例

本文整理汇总了Java中org.apache.catalina.tribes.tipis.LazyReplicatedMap的典型用法代码示例。如果您正苦于以下问题:Java LazyReplicatedMap类的具体用法?Java LazyReplicatedMap怎么用?Java LazyReplicatedMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LazyReplicatedMap类属于org.apache.catalina.tribes.tipis包,在下文中一共展示了LazyReplicatedMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createAndShowGUI

import org.apache.catalina.tribes.tipis.LazyReplicatedMap; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:27,代码来源:MapDemo.java

示例2: startInternal

import org.apache.catalina.tribes.tipis.LazyReplicatedMap; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:31,代码来源:BackupManager.java

示例3: stopInternal

import org.apache.catalina.tribes.tipis.LazyReplicatedMap; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:27,代码来源:BackupManager.java

示例4: getValueAt

import org.apache.catalina.tribes.tipis.LazyReplicatedMap; //导入依赖的package包/类
@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 "";
    }

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:25,代码来源:MapDemo.java

示例5: startInternal

import org.apache.catalina.tribes.tipis.LazyReplicatedMap; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:32,代码来源:BackupManager.java

示例6: stopInternal

import org.apache.catalina.tribes.tipis.LazyReplicatedMap; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:27,代码来源:BackupManager.java

示例7: stopInternal

import org.apache.catalina.tribes.tipis.LazyReplicatedMap; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:27,代码来源:BackupManager.java

示例8: getValueAt

import org.apache.catalina.tribes.tipis.LazyReplicatedMap; //导入依赖的package包/类
@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 "";
    }

}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:24,代码来源:MapDemo.java

示例9: createAndShowGUI

import org.apache.catalina.tribes.tipis.LazyReplicatedMap; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:26,代码来源:MapDemo.java

示例10: startInternal

import org.apache.catalina.tribes.tipis.LazyReplicatedMap; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:32,代码来源:BackupManager.java

示例11: stopInternal

import org.apache.catalina.tribes.tipis.LazyReplicatedMap; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:27,代码来源:BackupManager.java

示例12: getValueAt

import org.apache.catalina.tribes.tipis.LazyReplicatedMap; //导入依赖的package包/类
@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 "";
    }
    
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:24,代码来源:MapDemo.java

示例13: requestCompleted

import org.apache.catalina.tribes.tipis.LazyReplicatedMap; //导入依赖的package包/类
@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;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:9,代码来源:BackupManager.java

示例14: getSessionIdsFull

import org.apache.catalina.tribes.tipis.LazyReplicatedMap; //导入依赖的package包/类
@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;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:12,代码来源:BackupManager.java

示例15: MapDemo

import org.apache.catalina.tribes.tipis.LazyReplicatedMap; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:19,代码来源:MapDemo.java


注:本文中的org.apache.catalina.tribes.tipis.LazyReplicatedMap类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。