本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
}
}
示例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);
}
示例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();
}
}
}