<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    agapple

    BlogJava 首頁 新隨筆 聯系 聚合 管理
      13 Posts :: 1 Stories :: 1 Comments :: 0 Trackbacks

    1.  概念介紹

    UCL : org.jboss.mx.loading.UnifiedClassLoader3 ,它繼承標準的java.net.URLClassLoader,覆蓋了標準parent delegation模型以使用共享class和資源倉庫

     

    倉庫(responsitory): org.jboss.mx.loading.UnifiedLoaderRepository3。

     

    平面模型:為了熱deploy模塊的需要,JBoss實現了自己的類裝載器UnifiedClassLoader3,一般來說,一個頂層的deployment就有一個UnifiedClassLoader3實例為之工作。一個deployment所裝載的類,其他 deployment是可見的。全局唯一的UnifiedLoaderRepository3實例用于管理這些類,以及裝載它們的UnifiedClassLoader3。UnifiedLoaderRepository3實例和UnifiedClassLoader3實例是一對多的關系。

    2. jboss classloader機制
       

    <mbean code="org.jboss.management.j2ee.LocalJBossServerDomain"
          name
    ="jboss.management.local:j2eeType=J2EEDomain,name=Manager">
          
    <attribute name="MainDeployer">jboss.system:service=MainDeployer</attribute>
          
    <attribute name="SARDeployer">jboss.system:service=ServiceDeployer</attribute>
          
    <attribute name="EARDeployer">jboss.j2ee:service=EARDeployer</attribute>
          
    <attribute name="EJBDeployer">jboss.ejb:service=EJBDeployer</attribute>
          
    <attribute name="RARDeployer">jboss.jca:service=RARDeployer</attribute>
          
    <attribute name="CMDeployer">jboss.jca:service=ConnectionFactoryDeployer</attribute>
          
    <attribute name="WARDeployer">jboss.web:service=WebServer</attribute>
          
    <attribute name="CARDeployer">jboss.j2ee:service=ClientDeployer</attribute>
          
    <attribute name="MailService">jboss:service=Mail</attribute>
          
    <attribute name="JMSService">jboss.mq:service=DestinationManager</attribute>
          
    <attribute name="JNDIService">jboss:service=Naming</attribute>
          
    <attribute name="JTAService">jboss:service=TransactionManager</attribute>
          
    <attribute name="UserTransactionService">jboss:service=ClientUserTransaction</attribute>
          
    <attribute name="RMI_IIOPService">jboss:service=CorbaORB</attribute>
       
    </mbean>


       首先看一下各種類型的deployer。不同的deployer是根據文件的后綴進行區分。MainDeployer起到一個controller的作用,根據不用的后綴分發到不同的deployer進行處理。如果是*.ear,則會由EARDeployer進行載入。
    應用的加載時一個 Top Level Deployer + Top Level Ucl。 舉個例子,比如發布一個a.ear應用,ear應用中會包含一個*.war。這時候就會涉及deployer選擇問題。jboss采取的原則就是按Top Level,根據最頂層的應用選擇deployer,繼而也有了top level ucl的概念。由頂級的ucl來加載整個應用。這里需要注意的是war的部署有點特別。它只是將自身添加到ucl的classpath域中,而war下的WEB-INF/lib/*.jar,則是由WebAppClassloader來加載。可調整ear下的 META-INF/jboss-service.xml中的UseJbossWebLoader屬性。如果設置為true,故名思義就是用ucl來加載war下的jar包。否則就是采用獨立的classloader加載。
       再看一下ucl的加載過程,首先會調用倉庫去loadclass,倉庫在查找無果的情況下會回調各自的UCL去加載本地庫。


    3. jboss scope配置

    ClassLoadingConfiguration一書中描述:

    There are two levels of scoping, isolation from other deployments, and isolation that overrides the loading of JBoss server classes. With nested modules, only the top level file may specify class loader scoping. If you have a .ear file containing other modules, only scoping specified in the .ear 's META-INF/jboss-app.xml is used. This also applies for any other deployment which contains sub-deployments. For example, if a .sar contains a .war deployment, only the .sar META-INF/jboss-service.xml scoping has effect.

     

       意思是說,scope配置只能是頂級下的配置,比如一個.sar中包含.war都配置了scope,只有.sar下的 META-INF/jboos-service.xml才有效。這也與前面 TOP level UCL + TOP Devloper相對應。
        

        針對.sar,你可以在jboss-service.xml中,添加如下配置:
    <server>  
        
    <loader-repository> com.example:loader=unique-archive-name </loader-repository>  
    </server>

            
        針對.ear,你可以在jboss-app.xml添加如下配置:
        
    <jboss-app>  
      
    <loader-repository>com.example:loader=unique-archive-name</loader-repository>  
    </jboss-app>
        
        針對 .war,你可以在jboss-web.xml添加如下配置:
        
    <jboss-web>
    <class-loading java2ClassLoadingCompliance='true'>  
           
    <loader-repository>    
                 com.example:loader=unique-archive-name  
                 
    <loader-repository-config>  
                     java2ParentDelegaton=true  
                 
    </loader-repository-config>  
          
    </loader-repository>    
     
    </class-loading>
    </jboss-web>
       
       注意,在最新的4.2.1版本中,<class-loading>標簽已經不再使用,你可以直接配置:
    <jboss-web>    
        
    <loader-repository> com.example:loader=unique-archive-name </loader-repository>    
    </jboss-web>

        針對這兩種方式的配置,4.0.5版本都支持。  
          
        針對典型的ear+war應用,*.ear/META-INF/jboos-service.xml,用于調整war的加載方式。
     
    <!-- Get the flag indicating if the normal Java2 parent first class   
               loading model should be used over the servlet 2.3 web container first   
               model.   
          
    -->  
          
    <attribute name="Java2ClassLoadingCompliance">false</attribute>  
          
    <!-- A flag indicating if the JBoss Loader should be used. This loader   
               uses a unified class loader as the class loader rather than the tomcat   
               specific class loader.   
               The default is false to ensure that wars have isolated class loading   
               for duplicate jars and jsp files.   
          
    -->  
          
    <attribute name="UseJBossWebLoader">false</attribute>  
        配置java2ClassLoadingCompliance為true,則表明是選擇parent first。典型的classloader的雙親委托模型,否則是采用child first,先從自身加載,找不到再相父類請求。
        配置UseJBossWebLoader為false,則webapp的加載通過獨立于jboss的classloader進行加載。


    Blog : http://agapple.javaeye.com/  歡迎訪問
    posted on 2008-10-23 14:08 agapple 閱讀(4095) 評論(0)  編輯  收藏 所屬分類: java服務器
    主站蜘蛛池模板: 精品日韩亚洲AV无码| 亚洲第一极品精品无码久久| 亚洲国产成人99精品激情在线| 在线成人精品国产区免费| 狠狠综合久久综合88亚洲| eeuss影院免费直达入口| 精品亚洲视频在线观看| 黄床大片免费30分钟国产精品| 亚洲综合久久夜AV | 中国黄色免费网站| 亚洲av无码乱码国产精品fc2| 成人性生交大片免费看好| 国产AV无码专区亚洲Av| 99久久久国产精品免费蜜臀| 亚洲视频在线一区二区三区| aa级一级天堂片免费观看| 亚洲成年网站在线观看| 在线观看免费精品国产| 全部一级一级毛片免费看| 最新国产AV无码专区亚洲 | 丁香六月婷婷精品免费观看| 国产亚洲精品影视在线产品| 国产免费无码一区二区| 亚洲视屏在线观看| 成人毛片免费观看视频在线| 全黄A免费一级毛片| 亚洲乱亚洲乱妇无码麻豆| 午夜不卡久久精品无码免费 | 亚洲日韩v无码中文字幕| 四虎影视成人永久免费观看视频| 亚洲成a人片7777| 国产又黄又爽又猛的免费视频播放| www一区二区www免费| 日本亚洲视频在线 | 中文字幕在线亚洲精品| 100部毛片免费全部播放完整| 亚洲色欲啪啪久久WWW综合网| 亚洲男人的天堂在线va拉文| 99国产精品免费观看视频| 亚洲a∨无码一区二区| 亚洲精品tv久久久久久久久|