📄 serverscope.java
字号:
this.useCluster = useCluster; } /** * Implicitely sets useCluster to true * @param clusterManager */ public void setClusterManager(ClusterManager clusterManager) { this.clusterManager = clusterManager; this.useCluster = (this.clusterManager != null); } /** * Since v1.1 the clusterManager is loaded via xmlBlasterPlugins.xml * See useCluster() to check if clustering is switched on * First checks if ClusterManager is loaded already and if its state is ready. * @return */ public final boolean isClusterManagerReady() { return (this.clusterManager != null && this.clusterManager.isReady()); } /** * Access instance which manages myself in a cluster environment. * @return null if cluster support is switched off */ public final ClusterManager getClusterManager() throws XmlBlasterException { if (this.clusterManager == null) { if (!useCluster()) return null; log.severe("Internal problem: please intialize ClusterManager first"); Thread.dumpStack(); throw new XmlBlasterException(this, ErrorCode.INTERNAL_ILLEGALARGUMENT, ME, "Internal problem: please intialize ClusterManager first - Please ask on mailing list for support"); } return this.clusterManager; } /** * Is cluster support switched on? */ public final boolean useCluster() { if (firstUseCluster) { useCluster = getProperty().get("cluster", useCluster); firstUseCluster = false; } return useCluster; } /** * Returns for no cluster an empty string, in * cluster environment if more than one node is known * it returns the node id like "/node/heron". * <p /> * Used for logging */ public final String getLogPrefix() { if (useCluster()) { /* Switch of too much logging if no other cluster is around does if (this.clusterManager == null) return ""; if (this.clusterManager.getNumNodes() == 1) return ""; */ return "/node/" + getId(); //getStrippedId(); } else return ""; } /** * Returns for no cluster the given post string. * In cluster environment if more than one node is known * it returns the node id like "/node/heron/client" if post="client". * <p /> * Used for logging * @param post the postfix string like "client" */ public final String getLogPrefixDashed(String post) { String prae = getLogPrefix(); // getStrippedId return (prae.length() < 1) ? ("-" + post) : ("-/node/" + getId() + "/" + post); // relativ or absolute addressed } /** * Same as getLogPrefix() but if in cluster environment a "-" is prefixed * like "-/node/heron/". * <p /> * Useful for logging information of classes like Authenticate.java */ public final String getLogPrefixDashed() { String prae = getLogPrefix(); if (prae.length() > 0) return "-" + prae; return ""; } /** * Initialize the instance which manages myself in a cluster environment. * Only the first call will set the sessionInfo * @param An internal sessionInfo instance, see RequestBroker. * @return null if cluster support is switched off */ public final ClusterManager getClusterManager(org.xmlBlaster.authentication.SessionInfo sessionInfo) throws XmlBlasterException { if (this.clusterManager == null) { if (!useCluster()) return null; synchronized(this) { if (this.clusterManager == null) { this.clusterManager = new ClusterManager(this, sessionInfo); this.ME = "Global" + getLogPrefixDashed(); } } } return this.clusterManager; } /** * Initialize cb protocol manager. * <p>To administer CORBA/RMI etc. plugins</p> */ public final CbProtocolManager getCbProtocolManager() throws XmlBlasterException { if (this.cbProtocolManager == null) { synchronized(this) { if (this.cbProtocolManager == null) this.cbProtocolManager = new CbProtocolManager(this); } } return this.cbProtocolManager; } public final StoragePluginManager getStoragePluginManager() { if (topicStorePluginManager == null) { synchronized (StoragePluginManager.class) { if (topicStorePluginManager == null) topicStorePluginManager = new StoragePluginManager(this); } } return topicStorePluginManager; } /** * A helper to dump a message to a file. */ public final MsgFileDumper getMsgFileDumper() throws XmlBlasterException { if (this.msgFileDumper == null) { synchronized(this) { if (this.msgFileDumper == null) { this.msgFileDumper = new MsgFileDumper(); this.msgFileDumper.init(this); } } } return this.msgFileDumper; } /* * Sets the unique node id of this xmlBlaster server instance (needed for clustering). * <p /> * The new node ID is only set if my current instance is null! * <p /> * See private org.xmlBlaster.Main#createNodeId() *//* public void setUniqueNodeIdName(String uniqueNodeIdName) { if (this.nodeId == null && uniqueNodeIdName != null) { this.nodeId = new NodeId(uniqueNodeIdName); super.id = this.nodeId.getId(); this.contextNode = new ContextNode(this, ContextNode.CLUSTER_MARKER_TAG, getStrippedId(), (ContextNode)null); log.info(ME, "Setting xmlBlaster instance name to '" + this.nodeId.toString() + "'"); getRunlevelManager().setId(this.nodeId.getId()); Thread.currentThread().dumpStack(); } }*/ /** * Access the handle of the user session timer thread. * @return The Timeout instance */ public final Timeout getSessionTimer() { if (this.sessionTimer == null) { synchronized(this) { if (this.sessionTimer == null) this.sessionTimer = new Timeout("XmlBlaster.SessionTimer"); } } return this.sessionTimer; } /** * Access the handle of the TopicHandler timer thread. * @return The Timeout instance */ public final Timeout getTopicTimer() { if (this.topicTimer == null) { synchronized(this) { if (this.topicTimer == null) this.topicTimer = new Timeout("XmlBlaster.TopicTimer"); } } return this.topicTimer; } /** * Access the handle of the TopicHandler timer thread. * @return The Timeout instance */ public final Timeout getTelnetSessionTimer() { if (this.telnetSessionTimer == null) { synchronized(this) { if (this.telnetSessionTimer == null) this.telnetSessionTimer = new Timeout("XmlBlaster.TelnetSessionTimer"); } } return this.telnetSessionTimer; } public final boolean hasTelnetSessionTimer() { return this.telnetSessionTimer != null; } public final void removeTelnetSessionTimer() { if (this.telnetSessionTimer != null) { synchronized(this) { if (this.telnetSessionTimer != null) { this.telnetSessionTimer.shutdown(); this.telnetSessionTimer = null; } } } } /** * The factory creating queue or msgUnitStore entries from persistent store. * Is derived from util.Global */ public I_EntryFactory getEntryFactory() { if (this.entryFactory != null) return this.entryFactory; synchronized(this) { this.entryFactory = new ServerEntryFactory(); this.entryFactory.initialize(this); return this.entryFactory; } } /** * Access instance of remote command administration manager. * @return null if command administration support is switched off */ public final CommandManager getCommandManager() throws XmlBlasterException { if (this.commandManager == null) { if (!useAdminManager()) return null; log.severe("Internal problem: please intialize CommandManager first"); Thread.dumpStack(); throw new XmlBlasterException(this, ErrorCode.INTERNAL_UNKNOWN, ME, "please intialize CommandManager first - Please ask on mailing list for support"); } return this.commandManager; } /** * @return Is command administration support switched on? */ public final boolean useAdminManager() { if (firstUseAdminManager) { useAdminManager = getProperty().get("admin", useAdminManager); firstUseAdminManager = false; } return useAdminManager; } /** * Initialize instance of remote command administration manager. * Only the first call will set the sessionInfo * @param An internal sessionInfo instance, see RequestBroker. * @return null if command support is switched off */ public final CommandManager getCommandManager(org.xmlBlaster.authentication.SessionInfo sessionInfo) throws XmlBlasterException { if (this.commandManager == null) { if (!useAdminManager()) return null; synchronized(this) { if (this.commandManager == null) this.commandManager = new CommandManager(this, sessionInfo); } } return this.commandManager; } /** * Access handler to forward messages beginning with "__cmd:" (administrative messages) * @return null if no available. Is guaranteed to be not null if isAdministrationCommand(XmlKey) * returned true. */ public final MomClientGateway getMomClientGateway() { return this.momClientGateway; } public final boolean supportAdministrative() { return this.momClientGateway != null; } /** * Invoked by CommandManager to register message command handler */ public final void registerMomClientGateway(MomClientGateway momClientGateway) { this.momClientGateway = momClientGateway;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -