⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 global.java

📁 java开源的企业总线.xmlBlaster
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
   public synchronized final void shutdownHttpServer() {      try {         if (httpServer != null) httpServer.shutdown();         httpServer = null;      }      catch (Throwable e) {         log.warning("Problems during ORB cleanup: " + e.toString());         e.printStackTrace();      }   }   /**    * Get the configured SAXParserFactory.    *    * <p>    * The implementation of the SAXParser factory is decided    * by the property <code>javax.xml.parsers.SAXParserFactory</code>    * if available in Global, otherwise the JDK1.4 default    * <code>org.apache.crimson.jaxp.SAXParserFactoryImpl</code>is returned.    * </p>    * <p>The JDK 1.5 default would be    *    <code>com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl</code>    *    * @see #getDocumentBuilderFactory()    */    public SAXParserFactory getSAXParserFactory() throws XmlBlasterException{      if ( saxFactory == null) {         try {            if (log.isLoggable(Level.FINEST)) log.finest(getProperty().toXml());            String fac = getProperty().get(                "javax.xml.parsers.SAXParserFactory", (String)null);            if (fac == null)  {               saxFactory = JAXPFactory.newSAXParserFactory();            }            else {               saxFactory = JAXPFactory.newSAXParserFactory(fac);            }/*            String defaultFac = (XmlNotPortable.JVM_VERSION<=14) ?                  "org.apache.crimson.jaxp.SAXParserFactoryImpl" :                  "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl";            if (isIbmVM()) {               defaultFac = "org.apache.xerces.jaxp.SAXParserFactoryImpl";            }            saxFactory = JAXPFactory.newSAXParserFactory(               getProperty().get(                  "javax.xml.parsers.SAXParserFactory", defaultFac));*/         } catch (FactoryConfigurationError e) {            throw new XmlBlasterException(this, ErrorCode.RESOURCE_CONFIGURATION_XML, ME, "SAXParserFactoryError", e);         } // end of try-catch      } // end of if ()      return saxFactory;   }   //IBM1.4.2   // <java.vendor>IBM Corporation</java.vendor>   // <java.vm.vendor>IBM Corporation</java.vm.vendor>   // <java.fullversion>J2RE 1.4.2 IBM build cxia32142-20060824 (SR6) (JIT enabled: jitc)</java.fullversion>   // <java.vm.info>J2RE 1.4.2 IBM build cxia32142-20060824 (SR6) (JIT enabled: jitc)</java.vm.info>   //IBM1.5   //  <java.vendor>IBM Corporation</java.vendor>   //  <java.vm.vendor>IBM Corporation</java.vm.vendor>   //  <java.fullversion>J2RE 1.5.0 IBM J9 2.3 Linux amd64-64 j9vmxa6423-20060504 (JIT enabled)   //  <java.vm.info>J2RE 1.5.0 IBM J9 2.3 Linux amd64-64 j9vmxa6423-20060504 (JIT enabled)   //      J9VM - 20060501_06428_LHdSMr   //      JIT  - 20060428_1800_r8   //      GC   - 20060501_AA</java.vm.info>   //  <java.vm.name>IBM J9 VM</java.vm.name>   private final boolean isIbmVM() {      String vm = System.getProperty("java.vm.vendor", "");      if (vm.indexOf("IBM") != -1) return true;      return false;   }   /**    * Get the configured  DocumentBuilderFactoryFactory.    *    * <p>    * The implementation of the  DocumentBuilderFactory is decided by the property    * <code>javax.xml.parsers.DocumentBuilderFactory</code> if available in Global,    * otherwise the default <code>org.apache.crimson.jaxp.DocumentBuilderFactoryImpl</code>    * is returned for JDK 1.3 and smaller.    * </p>    * Currently only crimson is actually possible to use for JDK 1.3 and JDK 1.4    * (see xmlBlaster/lib/parser.jar#/META-INF/services setting)    * </p>    * <p>    * For JDK 1.5 the default delivered parser is used:    * <code>com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl</code>    * and xmlBlaster/lib/parser.jar and jaxp.jar are obsolete.    * For JDK 1.5 or higher any DOM Level 3 compliant parser should be OK.    * </p>    */   public DocumentBuilderFactory getDocumentBuilderFactory() throws XmlBlasterException {      if ( docBuilderFactory == null) {         try {            if (log.isLoggable(Level.FINEST)) log.finest(getProperty().toXml());            String fac = getProperty().get(               "javax.xml.parsers.DocumentBuilderFactory", (String)null);            if (fac == null) {               docBuilderFactory =JAXPFactory.newDocumentBuilderFactory();            }            else {               docBuilderFactory =JAXPFactory.newDocumentBuilderFactory(fac);            }/*            String defaultFac = (XmlNotPortable.JVM_VERSION<=14) ?                  "org.apache.crimson.jaxp.DocumentBuilderFactoryImpl" :                  "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl";            if (isIbmVM()) {               defaultFac =                  "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl";            }            docBuilderFactory =JAXPFactory.newDocumentBuilderFactory(               getProperty().get(                  "javax.xml.parsers.DocumentBuilderFactory", defaultFac));*/               // We need to force "com.sun..." for JDK 1.5 as otherwise               // the xmlBlaster/lib/parser.jar#/META-INF/services settings would choose crimson               // As soon as we drop parser.jar we can leave this property==null         } catch (FactoryConfigurationError e) {            throw new XmlBlasterException(this, ErrorCode.RESOURCE_CONFIGURATION_XML, ME, "DocumentBuilderFactoryError", e);         } // end of try-catch      } // end of if ()      return docBuilderFactory;   }   /**    * Get the configured  TransformerFactory.    *    * <p>The implementation of the   TransformerFactory is decided by the property    * <code>javax.xml.transform.TransformerFactory</code> if available in Global,    * otherwise the default <code>org.apache.xalan.processor.TransformerFactoryImpl</code>    * is returned    * </p>    * <p>The JDK 1.5 default would be    * <code>com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl</code>    *    * @see #getDocumentBuilderFactory()    */   public TransformerFactory getTransformerFactory() throws XmlBlasterException {      if ( transformerFactory == null) {         try {            String fac = getProperty().get(                  "javax.xml.transform.TransformerFactory", (String)null);            if (fac == null) {               transformerFactory =JAXPFactory.newTransformerFactory();            }            else {               transformerFactory =JAXPFactory.newTransformerFactory(fac);            }/*            String defaultFac = (XmlNotPortable.JVM_VERSION<=14) ?               "org.apache.xalan.processor.TransformerFactoryImpl" :               "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl";            if (isIbmVM()) {               defaultFac =               "org.apache.xalan.processor.TransformerFactoryImpl";            }            transformerFactory =JAXPFactory.newTransformerFactory(               getProperty().get(                  "javax.xml.transform.TransformerFactory", defaultFac));*/         } catch (TransformerFactoryConfigurationError e) {            throw new XmlBlasterException(this, ErrorCode.RESOURCE_CONFIGURATION_XML, ME, "TransformerFactoryError", e);         } // end of try-catch      } // end of if ()      return transformerFactory;   }   /**    * The factory creating queue or msgUnitStore entries from persistent store.    * Is overwritten in engine.Global    * @param name A name identifying this plugin.    */   public I_EntryFactory getEntryFactory() {      if (this.entryFactory != null) return this.entryFactory;      synchronized(this) {         this.entryFactory = new ClientEntryFactory();         this.entryFactory.initialize(this);         return this.entryFactory;      }   }   /**    * This notation is URLEncoder since JDK 1.4.    * @param enc If null it defaults to "UTF-8"    */   public static String encode(String s, String enc) {      try {         return java.net.URLEncoder.encode(s, (enc==null) ? Constants.UTF8_ENCODING : enc);      } catch (UnsupportedEncodingException e) {         System.out.println("PANIC in encode(" + s + ", " + enc + "): " + e.toString());         e.printStackTrace();         return s;      }   }   /**    * This notation is URLDecoder since JDK 1.4.    * @param enc If null it defaults to "UTF-8"    */   public static String decode(String s, String enc) {      try {         return java.net.URLDecoder.decode(s, (enc==null) ? Constants.UTF8_ENCODING : enc);      }      catch (Exception e) {         System.out.println("PANIC in decode(" + s + ", " + enc + "): " + e.toString());         e.printStackTrace();         return s;      }   }   /**    * Access the handle of the burst mode timer thread.    * @return The Timeout instance    */   public final ProtocolPluginManager getProtocolPluginManager() {      if (this.protocolPluginManager == null) {         synchronized(this) {            if (this.protocolPluginManager == null)               this.protocolPluginManager = new ProtocolPluginManager(this);         }      }      return this.protocolPluginManager;   }   /**    * Access the handle of the burst mode timer thread.    * @return The Timeout instance    */   public final CbServerPluginManager getCbServerPluginManager() {      if (this.cbServerPluginManager == null) {         synchronized(this) {            if (this.cbServerPluginManager == null)               this.cbServerPluginManager = new CbServerPluginManager(this);         }      }      return this.cbServerPluginManager;   }   /**    * Access the handle of the burst mode timer thread.    * @return The Timeout instance    */   public final Timeout getBurstModeTimer() {      if (this.burstModeTimer == null) {         synchronized(this) {            if (this.burstModeTimer == null)               this.burstModeTimer = new Timeout("XmlBlaster.BurstmodeTimer");         }      }      return this.burstModeTimer;   }   /**    * Access the handle of the ping timer thread to test a client or callback connection.    * @return The Timeout instance    */   public final Timeout getPingTimer() {      if (this.pingTimer == null) {         synchronized(this) {            if (this.pingTimer == null)               this.pingTimer = new Timeout("XmlBlaster.PingTimer");         }      }      return this.pingTimer;   }   /**    * Access the handle of the message expiry timer thread.    * NOTE: This holds only weak references to its callback I_Timeout    * So there is no need to clear the timer registration    * @return The Timeout instance    */   public final Timeout getMessageTimer() {      if (this.messageTimer == null) {         synchronized(this) {            if (this.messageTimer == null) {               boolean useWeakReferences = true;               this.messageTimer = new Timeout("XmlBlaster.MessageTimer", useWeakReferences);            }         }      }      return this.messageTimer;   }   /**    * Access the handle of the jdbcConnectionPool timer (the timer for the    * polling when the connection has been lost).    * @return The Timeout instance    */   public final Timeout getJdbcConnectionPoolTimer() {      if (this.jdbcConnectionPoolTimer == null) {         synchronized(this) {            if (this.jdbcConnectionPoolTimer == null)               this.jdbcConnectionPoolTimer = new Timeout("XmlBlaster.JdbcConnectionPoolTimer");         }      }      return this.jdbcConnectionPoolTimer;   }   /**    * Access the handle of the callback thread pool.    * @return The DispatchWorkerPool instance    */   public final DispatchWorkerPool getDispatchWorkerPool() {      if (this.dispatchWorkerPool == null) {         synchronized(this) {            if (this.dispatchWorkerPool == null)               this.dispatchWorkerPool = new DispatchWorkerPool(this);         }      }      return this.dispatchWorkerPool;   }   /**    * Returns the client access layer implementations 'ClientDispatchConnectionsHandler'    */   public DispatchConnectionsHandler createDispatchConnectionsHandler(DispatchManager dispatchManager) throws XmlBlasterException {      return new ClientDispatchConnectionsHandler(this, dispatchManager);   }   public void finalize() {      if (log.isLoggable(Level.FINE)) log.fine("Entering finalize");      shutdown();   }   public void shutdown() {      if (this.isDoingShutdown) {         return;      }      this.isDoingShutdown = true;      if (log.isLoggable(Level.FINE)) log.fine("Destroying util.Global handle");      /* This is a singleton, so only the last Global instance may do a shutdown      try {         getJmxWrapper().shutdown();      }      catch (XmlBlasterException e) {         log.warn(ME, "Ignoring: " + e.toString());      }      */      /

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -