Coloc Feature

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:

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

Enabling coloc

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:

   <cxf:bus>
       <cxf:features>
             <coloc:enableColoc/>
       </cxf:features>
   </cxf:bus>

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:

   <jaxws:client name="{http://apache.org/hello_world_soap_http}SoapPort"
                   createdFromAPI="true">
         <jaxws:features>
             <coloc:enableColoc/>
         </jaxws:features>
    </jaxws:client>