<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 閱讀(4086) 評論(0)  編輯  收藏 所屬分類: java服務器
    主站蜘蛛池模板: 亚洲国产午夜精品理论片在线播放| 亚洲伊人久久大香线蕉苏妲己| 亚洲日韩一区二区三区| 亚洲免费电影网站| 亚洲欧洲国产视频| 无码国产精品一区二区免费| 亚洲人成激情在线播放| 99久久99久久精品免费看蜜桃| 亚洲人成网站在线观看播放动漫| av无码久久久久不卡免费网站| 亚洲av专区无码观看精品天堂| 一个人免费高清在线观看| 最新国产成人亚洲精品影院| 大香人蕉免费视频75| 激情无码亚洲一区二区三区| 亚洲国产精品激情在线观看| 中国在线观看免费的www| 久久久久久亚洲AV无码专区| 久久精品免费全国观看国产| 中文字幕亚洲综合久久综合| 免费大黄网站在线观看| 四虎国产精品免费永久在线| 亚洲av乱码一区二区三区| 在线永久免费观看黄网站| a级毛片免费观看在线| 亚洲av无码潮喷在线观看| 无限动漫网在线观看免费| 美女视频黄频a免费| 国产亚洲精品xxx| 黄在线观看www免费看| 国产成人va亚洲电影| 亚洲阿v天堂在线| 女人18毛片a级毛片免费| 国产日韩久久免费影院| 亚洲人成电影青青在线播放| 亚洲国产一区二区三区| 91免费国产在线观看| 一级免费黄色毛片| 亚洲一级大黄大色毛片| 亚洲AⅤ视频一区二区三区| 特级无码毛片免费视频尤物|