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


Java ClusterManager.addListener方法代码示例

本文整理汇总了Java中org.jivesoftware.openfire.cluster.ClusterManager.addListener方法的典型用法代码示例。如果您正苦于以下问题:Java ClusterManager.addListener方法的具体用法?Java ClusterManager.addListener怎么用?Java ClusterManager.addListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jivesoftware.openfire.cluster.ClusterManager的用法示例。


在下文中一共展示了ClusterManager.addListener方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: start

import org.jivesoftware.openfire.cluster.ClusterManager; //导入方法依赖的package包/类
/**
 * Called when manager starts up, to initialize things.
 */
@Override
public void start() {
    super.start();

    loadServices();

    for (MultiUserChatService service : mucServices.values()) {
        registerMultiUserChatService(service);
    }

    // Add statistics
    addTotalRoomStats();
    addTotalOccupantsStats();
    addTotalConnectedUsers();
    addNumberIncomingMessages();
    addNumberOutgoingMessages();

    ClusterManager.addListener(this);
    UserEventDispatcher.addListener(this);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:24,代码来源:MultiUserChatManager.java

示例2: initialize

import org.jivesoftware.openfire.cluster.ClusterManager; //导入方法依赖的package包/类
@Override
public void initialize(XMPPServer server) {
    super.initialize(server);
    localServer = server;
    rosterManager = server.getRosterManager();
    presenceManager = server.getPresenceManager();
    deliverer = server.getPacketDeliverer();
    messageStore = server.getOfflineMessageStore();
    sessionManager = server.getSessionManager();
    userManager = server.getUserManager();
    routingTable = server.getRoutingTable();
    directedPresencesCache = CacheFactory.createCache(PRESENCE_CACHE_NAME);
    // TODO Add as route listener (to remove direct presences info for removed routes). Mainly for c2s sessions which is uncommon.
    // Listen to cluster events
    ClusterManager.addListener(this);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:17,代码来源:PresenceUpdateHandler.java

示例3: start

import org.jivesoftware.openfire.cluster.ClusterManager; //导入方法依赖的package包/类
/**
    * Called when manager starts up, to initialize things.
    */
   @Override
public void start() {
       super.start();

       loadServices();

       for (MultiUserChatService service : mucServices.values()) {
           registerMultiUserChatService(service);
       }

       // Add statistics
       addTotalRoomStats();
       addTotalOccupantsStats();
       addTotalConnectedUsers();
       addNumberIncomingMessages();
       addNumberOutgoingMessages();

       ClusterManager.addListener(this);
       UserEventDispatcher.addListener(this);
   }
 
开发者ID:coodeer,项目名称:g3server,代码行数:24,代码来源:MultiUserChatManager.java

示例4: initialize

import org.jivesoftware.openfire.cluster.ClusterManager; //导入方法依赖的package包/类
@Override
public void initialize(XMPPServer server) {
       super.initialize(server);
       localServer = server;
       rosterManager = server.getRosterManager();
       presenceManager = server.getPresenceManager();
       deliverer = server.getPacketDeliverer();
       messageStore = server.getOfflineMessageStore();
       sessionManager = server.getSessionManager();
       userManager = server.getUserManager();
       routingTable = server.getRoutingTable();
       directedPresencesCache = CacheFactory.createCache(PRESENCE_CACHE_NAME);
       // TODO Add as route listener (to remove direct presences info for removed routes). Mainly for c2s sessions which is uncommon.
       // Listen to cluster events
       ClusterManager.addListener(this);
   }
 
开发者ID:coodeer,项目名称:g3server,代码行数:17,代码来源:PresenceUpdateHandler.java

示例5: initialize

import org.jivesoftware.openfire.cluster.ClusterManager; //导入方法依赖的package包/类
@Override
public void initialize(XMPPServer server) {
    super.initialize(server);
    this.server = server;
    serverName = server.getServerInfo().getXMPPDomain();
    iqRouter = server.getIQRouter();
    messageRouter = server.getMessageRouter();
    presenceRouter = server.getPresenceRouter();
    presenceUpdateHandler = server.getPresenceUpdateHandler();
    // Listen to cluster events
    ClusterManager.addListener(this);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:13,代码来源:RoutingTableImpl.java

示例6: initialize

import org.jivesoftware.openfire.cluster.ClusterManager; //导入方法依赖的package包/类
@Override
public void initialize(XMPPServer server) {
    super.initialize(server);
    serverItems = CacheFactory.createCache("Disco Server Items");
    // Track the implementors of ServerItemsProvider so that we can collect the items
    // provided by the server
    infoHandler = server.getIQDiscoInfoHandler();
    setProvider(server.getServerInfo().getXMPPDomain(), getServerItemsProvider());
    // Listen to cluster events
    ClusterManager.addListener(this);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:12,代码来源:IQDiscoItemsHandler.java

示例7: initializePlugin

import org.jivesoftware.openfire.cluster.ClusterManager; //导入方法依赖的package包/类
public void initializePlugin(PluginManager manager, File pluginDirectory) {
    // Check if we Enterprise is installed and stop loading this plugin if found
    File pluginDir = new File(JiveGlobals.getHomeDirectory(), "plugins");
    File[] jars = pluginDir.listFiles(new FileFilter() {
        public boolean accept(File pathname) {
            String fileName = pathname.getName().toLowerCase();
            return (fileName.equalsIgnoreCase("enterprise.jar"));
        }
    });
    if (jars.length > 0) {
        // Do not load this plugin since Enterprise is still installed
        System.out.println("Enterprise plugin found. Stopping Fastpath Plugin");
        throw new IllegalStateException("This plugin cannot run next to the Enterprise plugin");
    }

    // Make sure that the fastpath folder exists under the home directory
    File fastpathDir = new File(JiveGlobals.getHomeDirectory() +
        File.separator + "fastpath");
    if (!fastpathDir.exists()) {
        fastpathDir.mkdirs();
    }

    workgroupManagerStart();

    // Listen to cluster events
    ClusterManager.addListener(this);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:28,代码来源:FastpathPlugin.java

示例8: initialize

import org.jivesoftware.openfire.cluster.ClusterManager; //导入方法依赖的package包/类
@Override
public void initialize(XMPPServer server) {
       super.initialize(server);
       this.server = server;
       serverName = server.getServerInfo().getXMPPDomain();
       iqRouter = server.getIQRouter();
       messageRouter = server.getMessageRouter();
       presenceRouter = server.getPresenceRouter();
       presenceUpdateHandler = server.getPresenceUpdateHandler();
       // Listen to cluster events
       ClusterManager.addListener(this);
   }
 
开发者ID:coodeer,项目名称:g3server,代码行数:13,代码来源:RoutingTableImpl.java

示例9: initialize

import org.jivesoftware.openfire.cluster.ClusterManager; //导入方法依赖的package包/类
@Override
public void initialize(XMPPServer server) {
       super.initialize(server);
       serverItems = CacheFactory.createCache("Disco Server Items");
       // Track the implementors of ServerItemsProvider so that we can collect the items
       // provided by the server
       infoHandler = server.getIQDiscoInfoHandler();
       setProvider(server.getServerInfo().getXMPPDomain(), getServerItemsProvider());
       // Listen to cluster events
       ClusterManager.addListener(this);
   }
 
开发者ID:coodeer,项目名称:g3server,代码行数:12,代码来源:IQDiscoItemsHandler.java

示例10: initializePlugin

import org.jivesoftware.openfire.cluster.ClusterManager; //导入方法依赖的package包/类
public void initializePlugin(PluginManager manager, File pluginDirectory) {
    System.out.println("Starting Fastpath Server");

    // Check if we Enterprise is installed and stop loading this plugin if found
    File pluginDir = new File(JiveGlobals.getHomeDirectory(), "plugins");
    File[] jars = pluginDir.listFiles(new FileFilter() {
        public boolean accept(File pathname) {
            String fileName = pathname.getName().toLowerCase();
            return (fileName.equalsIgnoreCase("enterprise.jar"));
        }
    });
    if (jars.length > 0) {
        // Do not load this plugin since Enterprise is still installed
        System.out.println("Enterprise plugin found. Stopping Fastpath Plugin");
        throw new IllegalStateException("This plugin cannot run next to the Enterprise plugin");
    }

    // Make sure that the fastpath folder exists under the home directory
    File fastpathDir = new File(JiveGlobals.getHomeDirectory() +
        File.separator + "fastpath");
    if (!fastpathDir.exists()) {
        fastpathDir.mkdirs();
    }

    workgroupManagerStart();

    // Listen to cluster events
    ClusterManager.addListener(this);
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:30,代码来源:FastpathPlugin.java

示例11: startClustering

import org.jivesoftware.openfire.cluster.ClusterManager; //导入方法依赖的package包/类
public static void startClustering() {
    if (isClusteringAvailable()) {
        clusteringStarting = clusteredCacheFactoryStrategy.startCluster();
    }
    if (clusteringStarting) {
        if (statsThread == null) {
            // Start a timing thread with 1 second of accuracy.
            statsThread = new Thread("Cache Stats") {
                private volatile boolean destroyed = false;

                @Override
                public void run() {
                    XMPPServer.getInstance().addServerListener(new XMPPServerListener() {
                        @Override
                        public void serverStarted() {}

                        @Override
                        public void serverStopping() {
                            destroyed = true;
                        }
                    });
                    ClusterManager.addListener(new ClusterEventListener() {
                        @Override
                        public void joinedCluster() {}

                        @Override
                        public void joinedCluster(byte[] nodeID) {}

                        @Override
                        public void leftCluster() {
                            destroyed = true;
                            ClusterManager.removeListener(this);
                        }

                        @Override
                        public void leftCluster(byte[] nodeID) {}

                        @Override
                        public void markedAsSeniorClusterMember() {}
                    });

                    // Run the timer indefinitely.
                    while (!destroyed && ClusterManager.isClusteringEnabled()) {
                        // Publish cache stats for this cluster node (assuming clustering is
                        // enabled and there are stats to publish).
                        try {
                            cacheFactoryStrategy.updateCacheStats(caches);
                        }
                        catch (Exception e) {
                            log.error(e.getMessage(), e);
                        }
                        try {
                            // Sleep 10 seconds.
                            sleep(10000);
                        }
                        catch (InterruptedException ie) {
                            // Ignore.
                        }
                    }
                    statsThread = null;
                    log.debug("Cache stats thread terminated.");
                }
            };
            statsThread.setDaemon(true);
            statsThread.start();
        }
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:69,代码来源:CacheFactory.java

示例12: TransportSessionRouter

import org.jivesoftware.openfire.cluster.ClusterManager; //导入方法依赖的package包/类
/**
 * Creates a transport session router instance associated with the plugin.
 *
 * @param plugin Kraken plugin instance we are associated with.
 */
public TransportSessionRouter(KrakenPlugin plugin) {
    pluginRef = new WeakReference<KrakenPlugin>(plugin);
    sessionLocations = CacheFactory.createCache(TRANSPORTSESSION_CACHE_NAME);
    ClusterManager.addListener(this);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:11,代码来源:TransportSessionRouter.java

示例13: startClustering

import org.jivesoftware.openfire.cluster.ClusterManager; //导入方法依赖的package包/类
public static void startClustering() {
	if (isClusteringAvailable()) {
		clusteringStarting = clusteredCacheFactoryStrategy.startCluster();
	}
    if (clusteringStarting) {
        if (statsThread == null) {
            // Start a timing thread with 1 second of accuracy.
            statsThread = new Thread("Cache Stats") {
                private volatile boolean destroyed = false;

                @Override
	public void run() {
                    XMPPServer.getInstance().addServerListener(new XMPPServerListener() {
                        public void serverStarted() {}

                        public void serverStopping() {
                            destroyed = true;
                        }
                    });
                    ClusterManager.addListener(new ClusterEventListener() {
                        public void joinedCluster() {}

                        public void joinedCluster(byte[] nodeID) {}

                        public void leftCluster() {
                            destroyed = true;
                            ClusterManager.removeListener(this);
                        }

                        public void leftCluster(byte[] nodeID) {}

                        public void markedAsSeniorClusterMember() {}
                    });

                    // Run the timer indefinitely.
                    while (!destroyed && ClusterManager.isClusteringEnabled()) {
                        // Publish cache stats for this cluster node (assuming clustering is
                        // enabled and there are stats to publish).
                        try {
                            cacheFactoryStrategy.updateCacheStats(caches);
                        }
                        catch (Exception e) {
                            log.error(e.getMessage(), e);
                        }
                        try {
                            // Sleep 10 seconds.
                            sleep(10000);
                        }
                        catch (InterruptedException ie) {
                            // Ignore.
                        }
                    }
                    statsThread = null;
                    log.debug("Cache stats thread terminated.");
                }
            };
            statsThread.setDaemon(true);
            statsThread.start();
        }
    }
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:62,代码来源:CacheFactory.java


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