alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Tomcat example source code file (cluster-interceptor.xml)

This example Tomcat source code file (cluster-interceptor.xml) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Tomcat tags/keywords

apache, asf, attributes, attributes, jdk, license, license, required, see, the, the, tribes, tribes, you

The Tomcat cluster-interceptor.xml source code

<?xml version="1.0"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!DOCTYPE document [
  <!ENTITY project SYSTEM "project.xml">
]>
<document url="cluster-interceptor.html">

  &project;

  <properties>
    <author email="fhanik@apache.org">Filip Hanik
    <title>The Channel Interceptor object
  </properties>

<body>


<section name="Introduction">
  <p>
  Apache Tribes supports an interceptor architecture to intercept both messages and membership notifications.
  This architecture allows decoupling of logic and opens the way for some very kewl feature add ons.
  </p>
</section>

<section name="Available Interceptors">
 <p>
   <ul>
    <li>org.apache.catalina.tribes.group.interceptors.TcpFailureDetector
    <li>org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor
    <li>org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor
    <li>org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor
    <li>org.apache.catalina.tribes.group.interceptors.NonBlockingCoordinator
    <li>org.apache.catalina.tribes.group.interceptors.OrderInterceptor
    <li>org.apache.catalina.tribes.group.interceptors.StaticMembershipInterceptor
    <li>org.apache.catalina.tribes.group.interceptors.TwoPhaseCommitInterceptor
    <li>org.apache.catalina.tribes.group.interceptors.DomainFilterInterceptor
    <li>org.apache.catalina.tribes.group.interceptors.FragmentationInterceptor
    <li>org.apache.catalina.tribes.group.interceptors.GzipInterceptor
   </ul>
 </p>
</section>

<section name="Static Membership">
  <p>
   In addition to dynamic discovery, Apache Tribes also supports static membership, with membership verification.
   To achieve this add the <code>org.apache.catalina.tribes.group.interceptors.StaticMembershipInterceptor
   underneath the <code>org.apache.catalina.tribes.group.interceptors.TcpFailureDetector interceptor.
   Inside the <code>StaticMembershipInterceptor you can add the static members you wish to have.
   The <code>TcpFailureDetector will do a health check on the static members,and also monitor them for crashes
   so they will have the same level of notification mechanism as the members that are automatically discovered.
   <source>
     <Interceptor className="org.apache.catalina.tribes.group.interceptors.StaticMembershipInterceptor">
       <Member className="org.apache.catalina.tribes.membership.StaticMember"
                  port="5678"
                  securePort="-1"
                  host="tomcat01.mydomain.com"
                  domain="staging-cluster"
                  uniqueId="{0,1,2,3,4,5,6,7,8,9}"/>
     </Interceptor>
   
   </source>
  </p>
</section>

<section name="Attributes">

  <subsection name="Common Attributes">
   <attributes>
     <attribute name="className" required="true">
       Required, as there is no default 
     </attribute>
     <attribute name="optionFlag" required="false">
       If you want the interceptor to trigger on certain message depending on the message's option flag,
       you can setup the interceptors flag here.
       The default value is <code>0, meaning this interceptor will trigger on all messages.
     </attribute>
   </attributes>
  </subsection>

  <subsection name="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor Attributes">
   <attributes>
     <attribute name="className" required="true">
       Required, This dispatcher uses JDK 1.5 java.util.concurrent package 
     </attribute>
     <attribute name="optionFlag" required="false">
       The default and hard coded value is <code>8 (org.apache.catalina.tribes.Channel.SEND_OPTIONS_ASYNCHRONOUS).
       The dispatcher will trigger on this value only, as it is predefined by Tribes.
     </attribute>
   </attributes>
  </subsection>
  <subsection name="org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor Attributes">
   <attributes>
     <attribute name="className" required="true">
       Required, Same implementation as <code>MessageDispatch15Interceptor, but with JDK 1.4 compliance.
     </attribute>
     <attribute name="optionFlag" required="false">
       The default and hard coded value is <code>8 (org.apache.catalina.tribes.Channel.SEND_OPTIONS_ASYNCHRONOUS).
       The dispatcher will trigger on this value only, as it is predefined by Tribes.
     </attribute>
   </attributes>
  </subsection>
  <subsection name="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector Attributes">
   <attributes>
   </attributes>
  </subsection>
  <subsection name="org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor Attributes">
   <attributes>
     <attribute name="interval" required="false">
       Defines the interval in number of messages when we are to report the throughput statistics.
       The report is logged to the <code>org.apache.juli.logging.LogFactory.getLog(ThroughputInterceptor.class)
       logger under the <code>INFO level.
       Default value is to report every <code>10000 messages.
     </attribute>
   </attributes>
  </subsection>
  
  <subsection name="Nested element StaticMember Attributes">
   <attributes>
     <attribute name="className" required="true">
       Only one implementation available:<code>org.apache.catalina.tribes.membership.StaticMember
     </attribute>
     <attribute name="port" required="true">
       The port that this static member listens to for cluster messages
     </attribute>
     <attribute name="securePort" required="false">
       The secure port this static member listens to for encrypted cluster messages
       default value is <code>-1, this value means the member is not listening on a secure port
     </attribute>
     <attribute name="host" required="true">
       The host (or network interface) that this static member listens for cluster messages.
       Three different type of values are possible:<br/>
       1. IP address in the form of "216.123.1.23"<br/>
       2. Hostnames like "tomcat01.mydomain.com" or "tomcat01" as long as they resolve correctly<br/>
       3. byte array in string form, for example {216,123,12,3}<br/>
     </attribute>
     <attribute name="domain" required="true">
       The logical cluster domain for this this static member listens for cluster messages.
       Two different type of values are possible:<br/>
       1. Regular string values like "staging-domain" or "tomcat-cluster" will be converted into bytes 
       using ISO-8859-1 encoding.
       2. byte array in string form, for example {216,123,12,3}<br/>
     </attribute>
     <attribute name="uniqueId" required="true">
       A universally uniqueId for this static member.
       The values must be 16 bytes in the following form:<br/>
       1. byte array in string form, for example {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}<br/>
     </attribute>
   </attributes>
  </subsection>
  <!--TODO Document all the interceptors-->
  
</section>


</body>

</document>

Other Tomcat examples (source code examples)

Here is a short list of links related to this Tomcat cluster-interceptor.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.