cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache CXF Documentation > Coloc Feature
Date Mon, 28 Mar 2011 16:54:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2042/9/1/_/styles/combined.css?spaceKey=CXF20DOC&amp;forWysiwyg=true"
type="text/css">
    </head>
<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="https://cwiki.apache.org/confluence/display/CXF20DOC/Coloc+Feature">Coloc
Feature</a></h2>
    <h4>Page  <b>added</b> by             <a href="https://cwiki.apache.org/confluence/display/~dkulp">Daniel
Kulp</a>
    </h4>
         <br/>
    <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>

<ul>
	<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
caller.</li>
	<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>
</ul>


<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>
</pre>
</div></div>

<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">"{http://apache.org/hello_world_soap_http}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>
</pre>
</div></div>




    </div>
    <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>
       <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/Coloc+Feature">View
Online</a>
              |
       <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/Coloc+Feature?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
           </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message