本文整理汇总了Java中org.jivesoftware.openfire.cluster.ClusterManager.fireJoinedCluster方法的典型用法代码示例。如果您正苦于以下问题:Java ClusterManager.fireJoinedCluster方法的具体用法?Java ClusterManager.fireJoinedCluster怎么用?Java ClusterManager.fireJoinedCluster使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.openfire.cluster.ClusterManager
的用法示例。
在下文中一共展示了ClusterManager.fireJoinedCluster方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: joinCluster
import org.jivesoftware.openfire.cluster.ClusterManager; //导入方法依赖的package包/类
private synchronized void joinCluster() {
if (!isDone()) { // already joined
return;
}
// Trigger events
ClusterManager.fireJoinedCluster(false);
addEntryListener(C2SCache, new CacheListener(this, C2SCache.getName()));
addEntryListener(anonymousC2SCache, new CacheListener(this, anonymousC2SCache.getName()));
addEntryListener(S2SCache, new S2SCacheListener());
addEntryListener(componentsCache, new ComponentCacheListener());
addEntryListener(sessionInfoCache, new CacheListener(this, sessionInfoCache.getName()));
addEntryListener(componentSessionsCache, new CacheListener(this, componentSessionsCache.getName()));
addEntryListener(multiplexerSessionsCache, new CacheListener(this, multiplexerSessionsCache.getName()));
addEntryListener(incomingServerSessionsCache, new CacheListener(this, incomingServerSessionsCache.getName()));
addEntryListener(directedPresencesCache, new DirectedPresenceListener());
// Simulate insert events of existing cache content
simulateCacheInserts(C2SCache);
simulateCacheInserts(anonymousC2SCache);
simulateCacheInserts(S2SCache);
simulateCacheInserts(componentsCache);
simulateCacheInserts(sessionInfoCache);
simulateCacheInserts(componentSessionsCache);
simulateCacheInserts(multiplexerSessionsCache);
simulateCacheInserts(incomingServerSessionsCache);
simulateCacheInserts(directedPresencesCache);
if (CacheFactory.isSeniorClusterMember()) {
seniorClusterMember = true;
ClusterManager.fireMarkedAsSeniorClusterMember();
}
logger.info("Joined cluster as node: " + cluster.getLocalMember().getUuid() + ". Senior Member: " +
(CacheFactory.isSeniorClusterMember() ? "YES" : "NO"));
done = false;
}
示例2: memberAdded
import org.jivesoftware.openfire.cluster.ClusterManager; //导入方法依赖的package包/类
public void memberAdded(MembershipEvent event) {
// local member only
if (event.getMember().localMember()) { // We left and re-joined the cluster
joinCluster();
} else {
nodePresences.put(NodeID.getInstance(StringUtils.getBytes(event.getMember().getUuid())),
new ConcurrentHashMap<String, Collection<String>>());
// Trigger event that a new node has joined the cluster
ClusterManager.fireJoinedCluster(StringUtils.getBytes(event.getMember().getUuid()), true);
}
clusterNodesInfo.put(event.getMember().getUuid(),
new HazelcastClusterNodeInfo(event.getMember(), cluster.getClusterTime()));
}
示例3: memberJoined
import org.jivesoftware.openfire.cluster.ClusterManager; //导入方法依赖的package包/类
public void memberJoined(MemberEvent memberEvent) {
if (memberEvent.isLocal()) {
done = false;
// We left and re-joined the cluster
Log.info("Rejoining cluster as node: " + new UID(CacheFactory.getClusterMemberID()) + ". Senior Member: " +
(CacheFactory.isSeniorClusterMember() ? "YES" : "NO"));
// Simulate insert events of existing cache content
simuateCacheInserts(C2SCache);
simuateCacheInserts(anonymousC2SCache);
simuateCacheInserts(S2SCache);
simuateCacheInserts(componentsCache);
simuateCacheInserts(componentSessionsCache);
simuateCacheInserts(multiplexerSessionsCache);
simuateCacheInserts(incomingServerSessionsCache);
simuateCacheInserts(directedPresencesCache);
// Set the new ID of this cluster node
XMPPServer.getInstance().setNodeID(NodeID.getInstance(CacheFactory.getClusterMemberID()));
// Trigger events
ClusterManager.fireJoinedCluster(true);
if (CacheFactory.isSeniorClusterMember()) {
seniorClusterMember = true;
ClusterManager.fireMarkedAsSeniorClusterMember();
}
}
else {
nodePresences.put(NodeID.getInstance(memberEvent.getMember().getUid().toByteArray()),
new ConcurrentHashMap<String, Collection<String>>());
// Trigger event that a new node has joined the cluster
ClusterManager.fireJoinedCluster(memberEvent.getMember().getUid().toByteArray(), true);
}
}
示例4: joinCluster
import org.jivesoftware.openfire.cluster.ClusterManager; //导入方法依赖的package包/类
private synchronized void joinCluster() {
if (!isDone()) { // already joined
return;
}
// Trigger events
ClusterManager.fireJoinedCluster(false);
addEntryListener(C2SCache, new CacheListener(this, C2SCache.getName()));
addEntryListener(anonymousC2SCache, new CacheListener(this, anonymousC2SCache.getName()));
addEntryListener(S2SCache, new CacheListener(this, S2SCache.getName()));
addEntryListener(componentsCache, new ComponentCacheListener());
addEntryListener(sessionInfoCache, new CacheListener(this, sessionInfoCache.getName()));
addEntryListener(componentSessionsCache, new CacheListener(this, componentSessionsCache.getName()));
addEntryListener(multiplexerSessionsCache, new CacheListener(this, multiplexerSessionsCache.getName()));
addEntryListener(incomingServerSessionsCache, new CacheListener(this, incomingServerSessionsCache.getName()));
addEntryListener(directedPresencesCache, new DirectedPresenceListener());
// Simulate insert events of existing cache content
simulateCacheInserts(C2SCache);
simulateCacheInserts(anonymousC2SCache);
simulateCacheInserts(S2SCache);
simulateCacheInserts(componentsCache);
simulateCacheInserts(sessionInfoCache);
simulateCacheInserts(componentSessionsCache);
simulateCacheInserts(multiplexerSessionsCache);
simulateCacheInserts(incomingServerSessionsCache);
simulateCacheInserts(directedPresencesCache);
if (CacheFactory.isSeniorClusterMember()) {
seniorClusterMember = true;
ClusterManager.fireMarkedAsSeniorClusterMember();
}
logger.info("Joined cluster as node: " + cluster.getLocalMember().getUuid() + ". Senior Member: " +
(CacheFactory.isSeniorClusterMember() ? "YES" : "NO"));
done = false;
}
示例5: memberAdded
import org.jivesoftware.openfire.cluster.ClusterManager; //导入方法依赖的package包/类
public void memberAdded(MembershipEvent event) {
// local member only
if (event.getMember().localMember()) { // We left and re-joined the cluster
joinCluster();
} else {
nodePresences.put(NodeID.getInstance(StringUtils.getBytes(event.getMember().getUuid())),
new ConcurrentHashMap<String, Collection<String>>());
// Trigger event that a new node has joined the cluster
ClusterManager.fireJoinedCluster(StringUtils.getBytes(event.getMember().getUuid()), true);
}
clusterNodesInfo.put(event.getMember().getUuid(),
new HazelcastClusterNodeInfo(event.getMember(), cluster.getClusterTime()));
}
示例6: startCluster
import org.jivesoftware.openfire.cluster.ClusterManager; //导入方法依赖的package包/类
public boolean startCluster() {
ClassLoader oldLoader = null;
// Set that we are starting up the cluster service
state = State.starting;
try {
// Store previous class loader (in case we change it)
oldLoader = Thread.currentThread().getContextClassLoader();
// See if the license allows for additional cluster members.
int allowedMembers = getMaxClusterNodes();
// If more than 1 cluster member is allowed...
if (allowedMembers > 1) {
ClassLoader loader = new ClusterClassLoader();
Thread.currentThread().setContextClassLoader(loader);
cluster = com.tangosol.net.CacheFactory.ensureCluster();
// Make sure Coherence uses the correct class loader.
cluster.setContextClassLoader(loader);
int memberCount = cluster.getMemberSet().size();
// See if adding this cluster bumps us over the allowed
// number. If so, shut down the cluster and use local cache.
if (memberCount > allowedMembers) {
com.tangosol.net.CacheFactory.shutdown();
cluster = null;
Log.error("Error joining clustered cache: your "
+ "license only allows for " + allowedMembers +
" cluster nodes. Using local cache instead.");
}
else {
com.tangosol.net.CacheFactory.getCache("opt-$cacheStats");
taskService = com.tangosol.net.CacheFactory.getInvocationService("OpenFire Cluster Service");
// Update the running state of the cluster
state = cluster != null ? State.started : State.stopped;
Member localMember = cluster.getLocalMember();
Member seniorMember = cluster.getOldestMember();
// Set the ID of this cluster node
XMPPServer.getInstance().setNodeID(NodeID.getInstance(getClusterMemberID()));
// Trigger cluster events
ClusterManager.fireJoinedCluster(false);
// CacheFactory is now using clustered caches. We can add our listeners.
clusterListener = new ClusterListener();
taskService.addMemberListener(clusterListener);
if (isSeniorClusterMember()) {
ClusterManager.fireMarkedAsSeniorClusterMember();
}
Log.info("Joining cluster as node: " + localMember.getUid() + ". Senior Member: " +
(localMember == seniorMember ? "YES" : "NO"));
}
}
// Only 1 cluster member is allowed, so use local cache.
else {
Log.error("Error joining clustered cache: your " +
"license only allows for " + allowedMembers +
" cluster nodes. Using local cache instead.");
}
return cluster != null;
}
catch (Exception e) {
Log.error("Unable to start clustering - continuing in local mode", e);
}
finally {
if (oldLoader != null) {
// Restore previous class loader
Thread.currentThread().setContextClassLoader(oldLoader);
}
}
// For some reason the cluster was not started so update the status
state = State.stopped;
return false;
}
示例7: startCluster
import org.jivesoftware.openfire.cluster.ClusterManager; //导入方法依赖的package包/类
public boolean startCluster() {
ClassLoader oldLoader = null;
// Set that we are starting up the cluster service
state = State.starting;
// Set the serialization strategy to use for transmitting objects between node clusters
serializationStrategy = ExternalizableUtil.getInstance().getStrategy();
ExternalizableUtil.getInstance().setStrategy(new CoherenceExternalizableUtil());
// Set session locator to use when in a cluster
XMPPServer.getInstance().setRemoteSessionLocator(new RemoteSessionLocator());
// Set packet router to use to deliver packets to remote cluster nodes
XMPPServer.getInstance().getRoutingTable().setRemotePacketRouter(new CoherencePacketRouter());
// Initialize the Coherence cluster configuration
try {
// Store previous class loader (in case we change it)
oldLoader = Thread.currentThread().getContextClassLoader();
// See if the license allows for additional cluster members.
int allowedMembers = getMaxClusterNodes();
// If more than 1 cluster member is allowed...
if (allowedMembers > 1) {
ClassLoader loader = new ClusterClassLoader();
Thread.currentThread().setContextClassLoader(loader);
cluster = com.tangosol.net.CacheFactory.ensureCluster();
// Make sure Coherence uses the correct class loader.
cluster.setContextClassLoader(loader);
int memberCount = cluster.getMemberSet().size();
// See if adding this cluster bumps us over the allowed
// number. If so, shut down the cluster and use local cache.
if (memberCount > allowedMembers) {
com.tangosol.net.CacheFactory.shutdown();
cluster = null;
Log.error("Error joining clustered cache: your "
+ "license only allows for " + allowedMembers +
" cluster nodes. Using local cache instead.");
}
else {
com.tangosol.net.CacheFactory.getCache("opt-$cacheStats");
taskService = (InvocationService) com.tangosol.net.CacheFactory.getService("OpenFire Cluster Service");
// Update the running state of the cluster
state = cluster != null ? State.started : State.stopped;
Member localMember = cluster.getLocalMember();
Member seniorMember = cluster.getOldestMember();
// Set the ID of this cluster node
XMPPServer.getInstance().setNodeID(NodeID.getInstance(getClusterMemberID()));
// Trigger cluster events
ClusterManager.fireJoinedCluster(false);
// CacheFactory is now using clustered caches. We can add our listeners.
clusterListener = new ClusterListener();
taskService.addMemberListener(clusterListener);
if (isSeniorClusterMember()) {
ClusterManager.fireMarkedAsSeniorClusterMember();
}
Log.info("Joining cluster as node: " + localMember.getUid() + ". Senior Member: " +
(localMember == seniorMember ? "YES" : "NO"));
}
}
// Only 1 cluster member is allowed, so use local cache.
else {
Log.error("Error joining clustered cache: your " +
"license only allows for " + allowedMembers +
" cluster nodes. Using local cache instead.");
}
return cluster != null;
}
catch (Exception e) {
Log.error("Unable to start clustering - continuing in local mode", e);
}
finally {
if (oldLoader != null) {
// Restore previous class loader
Thread.currentThread().setContextClassLoader(oldLoader);
}
}
// For some reason the cluster was not started so update the status
state = State.stopped;
return false;
}