org.apache.catalina.tribes.MembershipListener Java Examples

The following examples show how to use org.apache.catalina.tribes.MembershipListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: McastService.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * Callback from the impl when a new member has been received
 * @param member The member
 */
@Override
public void memberDisappeared(Member member) {
    MembershipListener listener = this.listener;
    if (listener != null) {
        listener.memberDisappeared(member);
    }
}
 
Example #2
Source File: GroupChannel.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * memberDisappeared gets invoked by the interceptor below the channel
 * and the channel will broadcast it to the membership listeners
 * @param member Member - the member that left or crashed
 */
@Override
public void memberDisappeared(Member member) {
    //notify upwards
    for (int i=0; i<membershipListeners.size(); i++ ) {
        MembershipListener membershipListener = (MembershipListener)membershipListeners.get(i);
        if (membershipListener != null) membershipListener.memberDisappeared(member);
    }
}
 
Example #3
Source File: GroupChannel.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * memberAdded gets invoked by the interceptor below the channel
 * and the channel will broadcast it to the membership listeners
 * @param member Member - the new member
 */
@Override
public void memberAdded(Member member) {
    //notify upwards
    for (int i=0; i<membershipListeners.size(); i++ ) {
        MembershipListener membershipListener = (MembershipListener)membershipListeners.get(i);
        if (membershipListener != null) membershipListener.memberAdded(member);
    }
}
 
Example #4
Source File: McastServiceImpl.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * Create a new mcast service impl
 * @param member - the local member
 * @param sendFrequency - the time (ms) in between pings sent out
 * @param expireTime - the time (ms) for a member to expire
 * @param port - the mcast port
 * @param bind - the bind address (not sure this is used yet)
 * @param mcastAddress - the mcast address
 * @param service - the callback service
 * @param localLoopbackDisabled - disable loopbackMode
 * @throws IOException
 */
public McastServiceImpl(
    MemberImpl member,
    long sendFrequency,
    long expireTime,
    int port,
    InetAddress bind,
    InetAddress mcastAddress,
    int ttl,
    int soTimeout,
    MembershipListener service,
    MessageListener msgservice,
    boolean localLoopbackDisabled)
throws IOException {
    this.member = member;
    this.address = mcastAddress;
    this.port = port;
    this.mcastSoTimeout = soTimeout;
    this.mcastTTL = ttl;
    this.mcastBindAddress = bind;
    this.timeToExpiration = expireTime;
    this.service = service;
    this.msgservice = msgservice;
    this.sendFrequency = sendFrequency;
    this.localLoopbackDisabled = localLoopbackDisabled;
    init();
}
 
Example #5
Source File: GroupChannel.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * memberDisappeared gets invoked by the interceptor below the channel
 * and the channel will broadcast it to the membership listeners
 * @param member Member - the member that left or crashed
 */
@Override
public void memberDisappeared(Member member) {
    //notify upwards
    for (int i=0; i<membershipListeners.size(); i++ ) {
        MembershipListener membershipListener = (MembershipListener)membershipListeners.get(i);
        if (membershipListener != null) membershipListener.memberDisappeared(member);
    }
}
 
Example #6
Source File: GroupChannel.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * memberAdded gets invoked by the interceptor below the channel
 * and the channel will broadcast it to the membership listeners
 * @param member Member - the new member
 */
@Override
public void memberAdded(Member member) {
    //notify upwards
    for (int i=0; i<membershipListeners.size(); i++ ) {
        MembershipListener membershipListener = (MembershipListener)membershipListeners.get(i);
        if (membershipListener != null) membershipListener.memberAdded(member);
    }
}
 
Example #7
Source File: McastService.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Override
public void memberAdded(Member member) {
    MembershipListener listener = this.listener;
    if (listener != null) {
        listener.memberAdded(member);
    }
}
 
Example #8
Source File: McastServiceImpl.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * Create a new mcast service instance.
 * @param member - the local member
 * @param sendFrequency - the time (ms) in between pings sent out
 * @param expireTime - the time (ms) for a member to expire
 * @param port - the mcast port
 * @param bind - the bind address (not sure this is used yet)
 * @param mcastAddress - the mcast address
 * @param ttl multicast ttl that will be set on the socket
 * @param soTimeout Socket timeout
 * @param service - the callback service
 * @param msgservice Message listener
 * @param localLoopbackDisabled - disable loopbackMode
 * @throws IOException Init error
 */
public McastServiceImpl(
    MemberImpl member,
    long sendFrequency,
    long expireTime,
    int port,
    InetAddress bind,
    InetAddress mcastAddress,
    int ttl,
    int soTimeout,
    MembershipListener service,
    MessageListener msgservice,
    boolean localLoopbackDisabled)
throws IOException {
    this.member = member;
    this.address = mcastAddress;
    this.port = port;
    this.mcastSoTimeout = soTimeout;
    this.mcastTTL = ttl;
    this.mcastBindAddress = bind;
    this.timeToExpiration = expireTime;
    this.service = service;
    this.msgservice = msgservice;
    this.sendFrequency = sendFrequency;
    this.localLoopbackDisabled = localLoopbackDisabled;
    init();
}
 
Example #9
Source File: GroupChannel.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * memberDisappeared gets invoked by the interceptor below the channel
 * and the channel will broadcast it to the membership listeners
 * @param member Member - the member that left or crashed
 */
@Override
public void memberDisappeared(Member member) {
    //notify upwards
    for (int i=0; i<membershipListeners.size(); i++ ) {
        MembershipListener membershipListener = membershipListeners.get(i);
        if (membershipListener != null) membershipListener.memberDisappeared(member);
    }
}
 
Example #10
Source File: GroupChannel.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * memberAdded gets invoked by the interceptor below the channel
 * and the channel will broadcast it to the membership listeners
 * @param member Member - the new member
 */
@Override
public void memberAdded(Member member) {
    //notify upwards
    for (int i=0; i<membershipListeners.size(); i++ ) {
        MembershipListener membershipListener = membershipListeners.get(i);
        if (membershipListener != null) membershipListener.memberAdded(member);
    }
}
 
Example #11
Source File: McastServiceImpl.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * Create a new mcast service impl
 * @param member - the local member
 * @param sendFrequency - the time (ms) in between pings sent out
 * @param expireTime - the time (ms) for a member to expire
 * @param port - the mcast port
 * @param bind - the bind address (not sure this is used yet)
 * @param mcastAddress - the mcast address
 * @param service - the callback service
 * @param localLoopbackDisabled - disable loopbackMode
 * @throws IOException
 */
public McastServiceImpl(
    MemberImpl member,
    long sendFrequency,
    long expireTime,
    int port,
    InetAddress bind,
    InetAddress mcastAddress,
    int ttl,
    int soTimeout,
    MembershipListener service,
    MessageListener msgservice,
    boolean localLoopbackDisabled)
throws IOException {
    this.member = member;
    this.address = mcastAddress;
    this.port = port;
    this.mcastSoTimeout = soTimeout;
    this.mcastTTL = ttl;
    this.mcastBindAddress = bind;
    this.timeToExpiration = expireTime;
    this.service = service;
    this.msgservice = msgservice;
    this.sendFrequency = sendFrequency;
    this.localLoopbackDisabled = localLoopbackDisabled;
    init();
}
 
Example #12
Source File: GroupChannel.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
/**
 * Removes a membership listener from the channel.<br>
 * Membership listeners are uniquely identified using the equals(Object) method
 * @param membershipListener MembershipListener
 */

@Override
public void removeMembershipListener(MembershipListener membershipListener) {
    membershipListeners.remove(membershipListener);
}
 
Example #13
Source File: GroupChannel.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
/**
 * Removes a membership listener from the channel.<br>
 * Membership listeners are uniquely identified using the equals(Object) method
 * @param membershipListener MembershipListener
 */

@Override
public void removeMembershipListener(MembershipListener membershipListener) {
    membershipListeners.remove(membershipListener);
}
 
Example #14
Source File: GroupChannel.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
/**
 * Adds a membership listener to the channel.<br>
 * Membership listeners are uniquely identified using the equals(Object) method
 * @param membershipListener MembershipListener
 */
@Override
public void addMembershipListener(MembershipListener membershipListener) {
    if (!this.membershipListeners.contains(membershipListener) )
        this.membershipListeners.add(membershipListener);
}
 
Example #15
Source File: GroupChannel.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
/**
 * Adds a membership listener to the channel.<br>
 * Membership listeners are uniquely identified using the equals(Object) method
 * @param membershipListener MembershipListener
 */
@Override
public void addMembershipListener(MembershipListener membershipListener) {
    if (!this.membershipListeners.contains(membershipListener) )
        this.membershipListeners.add(membershipListener);
}
 
Example #16
Source File: GroupChannel.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
/**
 * Removes a membership listener from the channel.<br>
 * Membership listeners are uniquely identified using the equals(Object) method
 * @param membershipListener MembershipListener
 */

@Override
public void removeMembershipListener(MembershipListener membershipListener) {
    membershipListeners.remove(membershipListener);
}
 
Example #17
Source File: GroupChannel.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
/**
 * Adds a membership listener to the channel.<br>
 * Membership listeners are uniquely identified using the equals(Object) method
 * @param membershipListener MembershipListener
 */
@Override
public void addMembershipListener(MembershipListener membershipListener) {
    if (!this.membershipListeners.contains(membershipListener) )
        this.membershipListeners.add(membershipListener);
}
 
Example #18
Source File: McastService.java    From tomcatsrc with Apache License 2.0 2 votes vote down vote up
/**
 * Add a membership listener, this version only supports one listener per service,
 * so calling this method twice will result in only the second listener being active.
 * @param listener The listener
 */
@Override
public void setMembershipListener(MembershipListener listener) {
    this.listener = listener;
}
 
Example #19
Source File: McastService.java    From Tomcat7.0.67 with Apache License 2.0 2 votes vote down vote up
/**
 * Add a membership listener, this version only supports one listener per service,
 * so calling this method twice will result in only the second listener being active.
 * @param listener The listener
 */
@Override
public void setMembershipListener(MembershipListener listener) {
    this.listener = listener;
}
 
Example #20
Source File: McastService.java    From Tomcat8-Source-Read with MIT License 2 votes vote down vote up
/**
 * Add a membership listener, this version only supports one listener per service,
 * so calling this method twice will result in only the second listener being active.
 * @param listener The listener
 */
@Override
public void setMembershipListener(MembershipListener listener) {
    this.listener = listener;
}
 
Example #21
Source File: GroupChannelMBean.java    From Tomcat8-Source-Read with MIT License votes vote down vote up
public void removeMembershipListener(MembershipListener listener); 
Example #22
Source File: GroupChannelMBean.java    From Tomcat8-Source-Read with MIT License votes vote down vote up
public void addMembershipListener(MembershipListener listener);