<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 閱讀(4084) 評論(0)  編輯  收藏 所屬分類: java服務器
    主站蜘蛛池模板: 亚洲videosbestsex日本| 久久久久久久久无码精品亚洲日韩| 久久精品一本到99热免费| 日韩亚洲国产高清免费视频| 国产精品99久久免费| 一级特黄录像免费播放肥| 亚洲一本之道高清乱码| 亚洲国产V高清在线观看| 午夜免费福利片观看| 亚洲爆乳无码专区www| 亚洲AV日韩AV天堂一区二区三区| 在线观看视频免费完整版| a色毛片免费视频| 亚洲午夜成人精品无码色欲| 国产亚洲精品看片在线观看| 九九九精品成人免费视频| 国产在线观看无码免费视频| 国产午夜亚洲精品国产| 国产v亚洲v天堂无码网站| 免费无码又爽又刺激高潮| 久久久久久久岛国免费播放| 国产精品亚洲精品日韩动图| 久久久久亚洲AV无码网站| 亚洲午夜精品第一区二区8050| 国产a视频精品免费观看| 黄色视频在线免费观看| 亚洲乱码国产乱码精华| 精品无码一区二区三区亚洲桃色| 亚洲国产成人VA在线观看| 无人在线直播免费观看| 日韩视频在线观看免费| 人与动性xxxxx免费| 亚洲暴爽av人人爽日日碰| 久久精品国产亚洲AV大全| 在线亚洲97se亚洲综合在线| 精品国产免费一区二区| 国产成人yy免费视频| 成全动漫视频在线观看免费高清版下载 | 亚洲精品成人av在线| 国产成人亚洲综合| 四虎AV永久在线精品免费观看|