Search in sources :

Example 1 with MemberShunnedException

use of org.apache.geode.internal.tcp.MemberShunnedException in project geode by apache.

the class GMSMembershipManager method dispatchMessage.

/**
   * Logic for processing a distribution message.
   * <p>
   * It is possible to receive messages not consistent with our view. We handle this here, and
   * generate an uplevel event if necessary
   *
   * @param msg the message
   */
private void dispatchMessage(DistributionMessage msg) {
    InternalDistributedMember m = msg.getSender();
    boolean shunned = false;
    // synchronized (latestViewLock) {
    if (isShunnedOrNew(m)) {
        latestViewWriteLock.lock();
        try {
            if (isShunned(m)) {
                if (msg instanceof StartupMessage) {
                    endShun(m);
                } else {
                    // fix for bug 41538 - sick alert listener causes deadlock
                    // due to view latestViewReadWriteLock being held during messaging
                    shunned = true;
                }
            }
            if (!shunned) {
                // If it's a new sender, wait our turn, generate the event
                if (isNew(m)) {
                    shunned = !addSurpriseMember(m);
                }
            }
        } finally {
            latestViewWriteLock.unlock();
        }
    }
    if (shunned) {
        // bug #41538 - shun notification must be outside synchronization to avoid
        // hanging
        warnShun(m);
        if (logger.isTraceEnabled(LogMarker.DISTRIBUTION_VIEWS)) {
            logger.trace(LogMarker.DISTRIBUTION_VIEWS, "Membership: Ignoring message from shunned member <{}>:{}", m, msg);
        }
        throw new MemberShunnedException(m);
    }
    listener.messageReceived(msg);
}
Also used : InternalDistributedMember(org.apache.geode.distributed.internal.membership.InternalDistributedMember) StartupMessage(org.apache.geode.distributed.internal.StartupMessage) MemberShunnedException(org.apache.geode.internal.tcp.MemberShunnedException)

Aggregations

StartupMessage (org.apache.geode.distributed.internal.StartupMessage)1 InternalDistributedMember (org.apache.geode.distributed.internal.membership.InternalDistributedMember)1 MemberShunnedException (org.apache.geode.internal.tcp.MemberShunnedException)1