cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [CONF] Apache CXF Documentation > Coloc Feature
Date Mon, 28 Mar 2011 16:54:00 GMT
    <base href="">
            <link rel="stylesheet" href="/confluence/s/2042/9/1/_/styles/combined.css?spaceKey=CXF20DOC&amp;forWysiwyg=true"
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="">Coloc
    <h4>Page  <b>added</b> by             <a href="">Daniel
    <div class="notificationGreySide">
<h3><a name="ColocFeature-ColocFeature"></a>Coloc Feature</h3>

<p>While not technically a transport, use of  the Coloc feature in CXF can dramatically
speed up the interactions within the same JVM.   The Coloc feature works by detecting when
a client is calling a service that is registered on the same Bus instance and then bypasses
most of the interceptor processing.   The actual objects that the client sends are passed
directly to the service without any serialization or other processing.  Due to this, there
are a bunch of restrictions:</p>

	<li>The objects/parameters MUST be the exact same classes.  The easiest way is by having
the service and client implement the same interface.</li>
	<li>They MUST be in the same classloader.   This would be normal if on the same Bus.</li>
	<li>Because it is pass by reference instead of pass by value, the semantics are different
than a normal webservice call.   Modifications to the objects would be reflected back to the
	<li>Any extra processing at the soap or transport layers would be bypassed.   Thus,
things like security,  WS-RM, JAX-WS handlers, etc... would not be part of the interation.</li>

<p>If the above restrictions are acceptable, the Coloc feature is an easy way to boost
performance for clients/services within the same Bus.   </p>

<h4><a name="ColocFeature-Enablingcoloc"></a>Enabling coloc</h4>

<p>The easiest way to enable the coloc capabilities is to use the Coloc feature, either
via the feature class of org.apache.cxf.binding.coloc.feature.ColocFeature or using the coloc
namespace handler in spring.   You can enable the feature at the bus level like:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
   <span class="code-tag">&lt;cxf:bus&gt;</span>
       <span class="code-tag">&lt;cxf:features&gt;</span>
             <span class="code-tag">&lt;coloc:enableColoc/&gt;</span>
       <span class="code-tag">&lt;/cxf:features&gt;</span>
   <span class="code-tag">&lt;/cxf:bus&gt;</span>

<p>in which case all clients would check to see if the service is available locally
and use them if possible.   However, you can configure it on specific clients if you just
want it done in the particular cases where the restrictions above are acceptable:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
   &lt;jaxws:client name=<span class="code-quote">"{}SoapPort"</span>
                   createdFromAPI=<span class="code-quote">"true"</span>&gt;
         <span class="code-tag">&lt;jaxws:features&gt;</span>
             <span class="code-tag">&lt;coloc:enableColoc/&gt;</span>
         <span class="code-tag">&lt;/jaxws:features&gt;</span>
    <span class="code-tag">&lt;/jaxws:client&gt;</span>

    <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href=""
class="grey">Change Notification Preferences</a>
       <a href="">View
       <a href=";showCommentArea=true#addcomment">Add

View raw message