FileDocCategorySizeDatePackage
DomainFilterInterceptor.javaAPI DocApache Tomcat 6.0.143443Fri Jul 20 04:20:34 BST 2007org.apache.catalina.tribes.group.interceptors

DomainFilterInterceptor

public class DomainFilterInterceptor extends org.apache.catalina.tribes.group.ChannelInterceptorBase

Title: Member domain filter interceptor

Description: Filters membership based on domain.

author
Filip Hanik
version
1.0

Fields Summary
private static org.apache.juli.logging.Log
log
protected org.apache.catalina.tribes.membership.Membership
membership
protected byte[]
domain
Constructors Summary
Methods Summary
public byte[]getDomain()

        return domain;
    
public org.apache.catalina.tribes.MembergetLocalMember(boolean incAlive)

        return super.getLocalMember(incAlive);
    
public org.apache.catalina.tribes.MembergetMember(org.apache.catalina.tribes.Member mbr)

        if ( membership == null ) setupMembership();
        return membership.getMember(mbr);
    
public org.apache.catalina.tribes.Member[]getMembers()

        if ( membership == null ) setupMembership();
        return membership.getMembers();
    
public booleanhasMembers()

        if ( membership == null ) setupMembership();
        return membership.hasMembers();
    
public voidmemberAdded(org.apache.catalina.tribes.Member member)

        if ( membership == null ) setupMembership();
        boolean notify = false;
        synchronized (membership) {
            notify = Arrays.equals(domain,member.getDomain());
            if ( notify ) notify = membership.memberAlive((MemberImpl)member);
        }
        if ( notify ) super.memberAdded(member);
    
public voidmemberDisappeared(org.apache.catalina.tribes.Member member)

        if ( membership == null ) setupMembership();
        boolean notify = false;
        synchronized (membership) {
            notify = Arrays.equals(domain,member.getDomain());
            membership.removeMember((MemberImpl)member);
        }
        if ( notify ) super.memberDisappeared(member);
    
public voidmessageReceived(org.apache.catalina.tribes.ChannelMessage msg)


        
        //should we filter incoming based on domain?
        super.messageReceived(msg);
    
public voidsetDomain(byte[] domain)

        this.domain = domain;
    
protected synchronized voidsetupMembership()

        if ( membership == null ) {
            membership = new Membership((MemberImpl)super.getLocalMember(true));
        }