Search in sources :

Example 26 with DistributedSystemDisconnectedException

use of org.apache.geode.distributed.DistributedSystemDisconnectedException in project geode by apache.

the class DestroyRegion method cmdExecute.

@Override
public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start) throws IOException, InterruptedException {
    Part regionNamePart = null, callbackArgPart = null;
    String regionName = null;
    Object callbackArg = null;
    Part eventPart = null;
    StringBuffer errMessage = new StringBuffer();
    CacheServerStats stats = serverConnection.getCacheServerStats();
    serverConnection.setAsTrue(REQUIRES_RESPONSE);
    {
        long oldStart = start;
        start = DistributionStats.getStatTime();
        stats.incReadDestroyRegionRequestTime(start - oldStart);
    }
    // Retrieve the data from the message parts
    regionNamePart = clientMessage.getPart(0);
    eventPart = clientMessage.getPart(1);
    // callbackArgPart = null; (redundant assignment)
    if (clientMessage.getNumberOfParts() > 2) {
        callbackArgPart = clientMessage.getPart(2);
        try {
            callbackArg = callbackArgPart.getObject();
        } catch (DistributedSystemDisconnectedException se) {
            // FIXME this can't happen
            if (logger.isDebugEnabled()) {
                logger.debug("{} ignoring message of type {} from client {} because shutdown occurred during message processing.", serverConnection.getName(), MessageType.getString(clientMessage.getMessageType()), serverConnection.getProxyID());
            }
            serverConnection.setFlagProcessMessagesAsFalse();
            serverConnection.setClientDisconnectedException(se);
            return;
        } catch (Exception e) {
            writeException(clientMessage, e, false, serverConnection);
            serverConnection.setAsTrue(RESPONDED);
            return;
        }
    }
    regionName = regionNamePart.getString();
    if (logger.isDebugEnabled()) {
        logger.debug("{}: Received destroy region request ({} bytes) from {} for region {}", serverConnection.getName(), clientMessage.getPayloadLength(), serverConnection.getSocketString(), regionName);
    }
    // Process the destroy region request
    if (regionName == null) {
        logger.warn(LocalizedMessage.create(LocalizedStrings.DestroyRegion_0_THE_INPUT_REGION_NAME_FOR_THE_DESTROY_REGION_REQUEST_IS_NULL, serverConnection.getName()));
        errMessage.append(LocalizedStrings.DestroyRegion__THE_INPUT_REGION_NAME_FOR_THE_DESTROY_REGION_REQUEST_IS_NULL.toLocalizedString());
        writeErrorResponse(clientMessage, MessageType.DESTROY_REGION_DATA_ERROR, errMessage.toString(), serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        return;
    }
    LocalRegion region = (LocalRegion) serverConnection.getCache().getRegion(regionName);
    if (region == null) {
        String reason = LocalizedStrings.DestroyRegion_REGION_WAS_NOT_FOUND_DURING_DESTROY_REGION_REQUEST.toLocalizedString();
        writeRegionDestroyedEx(clientMessage, regionName, reason, serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        return;
    }
    // Destroy the region
    ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(eventPart.getSerializedForm());
    long threadId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
    long sequenceId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
    EventID eventId = new EventID(serverConnection.getEventMemberIDByteArray(), threadId, sequenceId);
    try {
        // user needs to have data:manage on all regions in order to destory a particular region
        this.securityService.authorizeDataManage();
        AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
        if (authzRequest != null) {
            RegionDestroyOperationContext destroyContext = authzRequest.destroyRegionAuthorize(regionName, callbackArg);
            callbackArg = destroyContext.getCallbackArg();
        }
        // region.destroyRegion(callbackArg);
        region.basicBridgeDestroyRegion(callbackArg, serverConnection.getProxyID(), true, /* boolean from cache Client */
        eventId);
    } catch (DistributedSystemDisconnectedException e) {
        // FIXME better exception hierarchy would avoid this check
        if (serverConnection.getCachedRegionHelper().getCache().getCancelCriterion().cancelInProgress() != null) {
            if (logger.isDebugEnabled()) {
                logger.debug("{} ignoring message of type {} from client {} because shutdown occurred during message processing.", serverConnection.getName(), MessageType.getString(clientMessage.getMessageType()), serverConnection.getProxyID());
            }
            serverConnection.setFlagProcessMessagesAsFalse();
            serverConnection.setClientDisconnectedException(e);
        } else {
            writeException(clientMessage, e, false, serverConnection);
            serverConnection.setAsTrue(RESPONDED);
        }
        return;
    } catch (Exception e) {
        // If an interrupted exception is thrown , rethrow it
        checkForInterrupt(serverConnection, e);
        // Otherwise, write an exception message and continue
        writeException(clientMessage, e, false, serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        return;
    }
    // Update the statistics and write the reply
    {
        long oldStart = start;
        start = DistributionStats.getStatTime();
        stats.incProcessDestroyRegionTime(start - oldStart);
    }
    writeReply(clientMessage, serverConnection);
    serverConnection.setAsTrue(RESPONDED);
    if (logger.isDebugEnabled()) {
        logger.debug("{}: Sent destroy region response for region {}", serverConnection.getName(), regionName);
    }
    stats.incWriteDestroyRegionResponseTime(DistributionStats.getStatTime() - start);
}
Also used : DistributedSystemDisconnectedException(org.apache.geode.distributed.DistributedSystemDisconnectedException) AuthorizeRequest(org.apache.geode.internal.security.AuthorizeRequest) LocalRegion(org.apache.geode.internal.cache.LocalRegion) ByteBuffer(java.nio.ByteBuffer) IOException(java.io.IOException) DistributedSystemDisconnectedException(org.apache.geode.distributed.DistributedSystemDisconnectedException) RegionDestroyOperationContext(org.apache.geode.cache.operations.RegionDestroyOperationContext) CacheServerStats(org.apache.geode.internal.cache.tier.sockets.CacheServerStats) Part(org.apache.geode.internal.cache.tier.sockets.Part) EventID(org.apache.geode.internal.cache.EventID)

Example 27 with DistributedSystemDisconnectedException

use of org.apache.geode.distributed.DistributedSystemDisconnectedException in project geode by apache.

the class InternalDistributedSystemJUnitTest method testAccessingClosedDistributedSystem.

@Test
public void testAccessingClosedDistributedSystem() {
    Properties props = new Properties();
    // a loner is all this test needs
    props.setProperty(MCAST_PORT, "0");
    props.setProperty(LOCATORS, "");
    InternalDistributedSystem system = createSystem(props);
    system.disconnect();
    try {
        system.getDistributionManager();
        fail("Should have thrown an IllegalStateException");
    } catch (DistributedSystemDisconnectedException ex) {
    // pass...
    }
    try {
        system.getLogWriter();
    } catch (IllegalStateException ex) {
        fail("Shouldn't have thrown an IllegalStateException");
    }
}
Also used : DistributedSystemDisconnectedException(org.apache.geode.distributed.DistributedSystemDisconnectedException) ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties) Test(org.junit.Test) MembershipTest(org.apache.geode.test.junit.categories.MembershipTest) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 28 with DistributedSystemDisconnectedException

use of org.apache.geode.distributed.DistributedSystemDisconnectedException in project geode by apache.

the class InternalDistributedSystem method initialize.

/**
   * Initializes this connection to a distributed system with the current configuration state.
   */
private void initialize() {
    if (this.originalConfig.getLocators().equals("")) {
        if (this.originalConfig.getMcastPort() != 0) {
            throw new GemFireConfigException("The " + LOCATORS + " attribute can not be empty when the " + MCAST_PORT + " attribute is non-zero.");
        } else {
            // no distribution
            this.isLoner = true;
        }
    }
    this.config = new RuntimeDistributionConfigImpl(this);
    if (!this.isLoner) {
        this.attemptingToReconnect = (reconnectAttemptCounter > 0);
    }
    try {
        SocketCreatorFactory.setDistributionConfig(config);
        AlertAppender.getInstance().onConnect(this);
        // LOG: create LogWriterAppender(s) if log-file or security-log-file is specified
        final boolean hasLogFile = this.config.getLogFile() != null && !this.config.getLogFile().equals(new File(""));
        final boolean hasSecurityLogFile = this.config.getSecurityLogFile() != null && !this.config.getSecurityLogFile().equals(new File(""));
        LogService.configureLoggers(hasLogFile, hasSecurityLogFile);
        if (hasLogFile || hasSecurityLogFile) {
            // main log file
            if (hasLogFile) {
                // if log-file then create logWriterAppender
                this.logWriterAppender = LogWriterAppenders.getOrCreateAppender(LogWriterAppenders.Identifier.MAIN, this.isLoner, this.config, true);
            }
            // security log file
            if (hasSecurityLogFile) {
                // if security-log-file then create securityLogWriterAppender
                this.securityLogWriterAppender = LogWriterAppenders.getOrCreateAppender(LogWriterAppenders.Identifier.SECURITY, this.isLoner, this.config, false);
            } else {
            // let security route to regular log-file or stdout
            }
        }
        // getSecurityLogWriter
        if (this.logWriter == null) {
            this.logWriter = LogWriterFactory.createLogWriterLogger(this.isLoner, false, this.config, true);
            this.logWriter.fine("LogWriter is created.");
        }
        if (this.securityLogWriter == null) {
            // LOG: whole new LogWriterLogger instance for security
            this.securityLogWriter = LogWriterFactory.createLogWriterLogger(this.isLoner, true, this.config, false);
            this.securityLogWriter.fine("SecurityLogWriter is created.");
        }
        Services.setLogWriter(this.logWriter);
        Services.setSecurityLogWriter(this.securityLogWriter);
        this.clock = new DSClock(this.isLoner);
        if (this.attemptingToReconnect && logger.isDebugEnabled()) {
            logger.debug("This thread is initializing a new DistributedSystem in order to reconnect to other members");
        }
        // bridge server and will need to enforce the member limit
        if (Boolean.getBoolean(InternalLocator.FORCE_LOCATOR_DM_TYPE)) {
            this.locatorDMTypeForced = true;
        }
        // Initialize the Diffie-Hellman and public/private keys
        try {
            HandShake.initCertsMap(this.config.getSecurityProps());
            HandShake.initPrivateKey(this.config.getSecurityProps());
            HandShake.initDHKeys(this.config);
        } catch (Exception ex) {
            throw new GemFireSecurityException(LocalizedStrings.InternalDistributedSystem_PROBLEM_IN_INITIALIZING_KEYS_FOR_CLIENT_AUTHENTICATION.toLocalizedString(), ex);
        }
        final long offHeapMemorySize = OffHeapStorage.parseOffHeapMemorySize(getConfig().getOffHeapMemorySize());
        this.offHeapStore = OffHeapStorage.createOffHeapStorage(this, offHeapMemorySize, this);
        // Note: this can only happen on a linux system
        if (getConfig().getLockMemory()) {
            // This calculation is not exact, but seems fairly close. So far we have
            // not loaded much into the heap and the current RSS usage is already
            // included the available memory calculation.
            long avail = LinuxProcFsStatistics.getAvailableMemory(logger);
            long size = offHeapMemorySize + Runtime.getRuntime().totalMemory();
            if (avail < size) {
                if (ALLOW_MEMORY_LOCK_WHEN_OVERCOMMITTED) {
                    logger.warn(LocalizedMessage.create(LocalizedStrings.InternalDistributedSystem_MEMORY_OVERCOMMIT_WARN, size - avail));
                } else {
                    throw new IllegalStateException(LocalizedStrings.InternalDistributedSystem_MEMORY_OVERCOMMIT.toLocalizedString(avail, size));
                }
            }
            logger.info("Locking memory. This may take a while...");
            GemFireCacheImpl.lockMemory();
            logger.info("Finished locking memory.");
        }
        try {
            startInitLocator();
        } catch (InterruptedException e) {
            throw new SystemConnectException("Startup has been interrupted", e);
        }
        synchronized (this.isConnectedMutex) {
            this.isConnected = true;
        }
        if (!this.isLoner) {
            try {
                if (this.quorumChecker != null) {
                    this.quorumChecker.suspend();
                }
                this.dm = DistributionManager.create(this);
                // fix bug #46324
                if (InternalLocator.hasLocator()) {
                    InternalLocator locator = InternalLocator.getLocator();
                    getDistributionManager().addHostedLocators(getDistributedMember(), InternalLocator.getLocatorStrings(), locator.isSharedConfigurationEnabled());
                }
            } finally {
                if (this.dm == null && this.quorumChecker != null) {
                    this.quorumChecker.resume();
                }
                setDisconnected();
            }
        } else {
            this.dm = new LonerDistributionManager(this, this.logWriter);
        }
        Assert.assertTrue(this.dm != null);
        Assert.assertTrue(this.dm.getSystem() == this);
        try {
            this.id = this.dm.getChannelId();
        } catch (DistributedSystemDisconnectedException e) {
            // but during startup we should instead throw a SystemConnectException
            throw new SystemConnectException(LocalizedStrings.InternalDistributedSystem_DISTRIBUTED_SYSTEM_HAS_DISCONNECTED.toLocalizedString(), e);
        }
        synchronized (this.isConnectedMutex) {
            this.isConnected = true;
        }
        if (attemptingToReconnect && (this.startedLocator == null)) {
            try {
                startInitLocator();
            } catch (InterruptedException e) {
                throw new SystemConnectException("Startup has been interrupted", e);
            }
        }
        try {
            endInitLocator();
        } catch (IOException e) {
            throw new GemFireIOException("Problem finishing a locator service start", e);
        }
        if (!statsDisabled) {
            // to fix bug 42527 we need a sampler
            // even if sampling is not enabled.
            this.sampler = new GemFireStatSampler(this);
            this.sampler.start();
        }
        if (this.logWriterAppender != null) {
            LogWriterAppenders.startupComplete(LogWriterAppenders.Identifier.MAIN);
        }
        if (this.securityLogWriterAppender != null) {
            LogWriterAppenders.startupComplete(LogWriterAppenders.Identifier.SECURITY);
        }
        // this.logger.info("ds created", new RuntimeException("DEBUG: STACK"));
        // Log any instantiators that were registered before the log writer
        // was created
        InternalInstantiator.logInstantiators();
    } catch (RuntimeException ex) {
        this.config.close();
        throw ex;
    }
    resourceListeners = new CopyOnWriteArrayList<ResourceEventsListener>();
    this.reconnected = this.attemptingToReconnect;
    this.attemptingToReconnect = false;
}
Also used : DistributedSystemDisconnectedException(org.apache.geode.distributed.DistributedSystemDisconnectedException) GemFireIOException(org.apache.geode.GemFireIOException) IOException(java.io.IOException) DistributedSystemDisconnectedException(org.apache.geode.distributed.DistributedSystemDisconnectedException) CacheXmlException(org.apache.geode.cache.CacheXmlException) CancelException(org.apache.geode.CancelException) GemFireSecurityException(org.apache.geode.security.GemFireSecurityException) ManagementException(org.apache.geode.management.ManagementException) ForcedDisconnectException(org.apache.geode.ForcedDisconnectException) GemFireIOException(org.apache.geode.GemFireIOException) CacheClosedException(org.apache.geode.cache.CacheClosedException) SystemConnectException(org.apache.geode.SystemConnectException) GemFireConfigException(org.apache.geode.GemFireConfigException) IOException(java.io.IOException) GemFireStatSampler(org.apache.geode.internal.statistics.GemFireStatSampler) GemFireSecurityException(org.apache.geode.security.GemFireSecurityException) GemFireConfigException(org.apache.geode.GemFireConfigException) GemFireIOException(org.apache.geode.GemFireIOException) File(java.io.File) SystemConnectException(org.apache.geode.SystemConnectException)

Example 29 with DistributedSystemDisconnectedException

use of org.apache.geode.distributed.DistributedSystemDisconnectedException in project geode by apache.

the class DistributionManager method removeManager.

/**
   * Returns true if id was removed. Returns false if it was not in the list of managers.
   */
private boolean removeManager(InternalDistributedMember theId, boolean crashed, String p_reason) {
    String reason = p_reason;
    // initialization shouldn't be required, but...
    boolean result = false;
    // Note that it is always safe to _read_ {@link members} without locking
    if (isCurrentMember(theId)) {
        // Destroy underlying member's resources
        reason = prettifyReason(reason);
        synchronized (this.membersLock) {
            if (logger.isDebugEnabled()) {
                logger.debug("DistributionManager: removing member <{}>; crashed {}; reason = {}", theId, crashed, reason);
            }
            Map<InternalDistributedMember, InternalDistributedMember> tmp = new HashMap(this.members);
            if (tmp.remove(theId) != null) {
                // without locking.
                if (tmp.isEmpty()) {
                    tmp = Collections.EMPTY_MAP;
                } else {
                    tmp = Collections.unmodifiableMap(tmp);
                }
                this.members = tmp;
                result = true;
            } else {
                result = false;
            // Don't get upset since this can happen twice due to
            // an explicit remove followed by an implicit one caused
            // by a JavaGroup view change
            }
            Set tmp2 = new HashSet(this.membersAndAdmin);
            if (tmp2.remove(theId)) {
                if (tmp2.isEmpty()) {
                    tmp2 = Collections.EMPTY_SET;
                } else {
                    tmp2 = Collections.unmodifiableSet(tmp2);
                }
                this.membersAndAdmin = tmp2;
            }
            this.removeHostedLocators(theId);
        }
    // synchronized
    }
    // In any event, make sure that this member is no longer an elder.
    if (!theId.equals(myid) && theId.equals(elder)) {
        try {
            selectElder();
        } catch (DistributedSystemDisconnectedException e) {
        // ignore
        }
    }
    redundancyZones.remove(theId);
    return result;
}
Also used : DistributedSystemDisconnectedException(org.apache.geode.distributed.DistributedSystemDisconnectedException) Set(java.util.Set) HashSet(java.util.HashSet) InternalDistributedMember(org.apache.geode.distributed.internal.membership.InternalDistributedMember) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) HashSet(java.util.HashSet)

Example 30 with DistributedSystemDisconnectedException

use of org.apache.geode.distributed.DistributedSystemDisconnectedException in project geode by apache.

the class JGroupsMessenger method send.

private Set<InternalDistributedMember> send(DistributionMessage msg, boolean reliably) {
    // perform the same jgroups messaging as in 8.2's GMSMembershipManager.send() method
    // BUT: when marshalling messages we need to include the version of the product and
    // localAddress at the beginning of the message. These should be used in the receiver
    // code to create a versioned input stream, read the sender address, then read the message
    // and set its sender address
    DMStats theStats = services.getStatistics();
    NetView oldView = this.view;
    if (!myChannel.isConnected()) {
        logger.info("JGroupsMessenger channel is closed - messaging is not possible");
        throw new DistributedSystemDisconnectedException("Distributed System is shutting down");
    }
    filterOutgoingMessage(msg);
    // the message's processor if necessary
    if ((msg instanceof DirectReplyMessage) && msg.isDirectAck() && msg.getProcessorId() <= 0) {
        ((DirectReplyMessage) msg).registerProcessor();
    }
    InternalDistributedMember[] destinations = msg.getRecipients();
    boolean allDestinations = msg.forAll();
    boolean useMcast = false;
    if (services.getConfig().getTransport().isMcastEnabled()) {
        if (msg.getMulticast() || allDestinations) {
            useMcast = services.getManager().isMulticastAllowed();
        }
    }
    if (logger.isDebugEnabled() && reliably) {
        String recips = useMcast ? "multicast" : Arrays.toString(msg.getRecipients());
        logger.debug("sending via JGroups: [{}] recipients: {}", msg, recips);
    }
    JGAddress local = this.jgAddress;
    if (useMcast) {
        long startSer = theStats.startMsgSerialization();
        Message jmsg = createJGMessage(msg, local, Version.CURRENT_ORDINAL);
        theStats.endMsgSerialization(startSer);
        Exception problem;
        try {
            jmsg.setTransientFlag(TransientFlag.DONT_LOOPBACK);
            if (!reliably) {
                jmsg.setFlag(Message.Flag.NO_RELIABILITY);
            }
            theStats.incSentBytes(jmsg.getLength());
            logger.trace("Sending JGroups message: {}", jmsg);
            myChannel.send(jmsg);
        } catch (Exception e) {
            logger.debug("caught unexpected exception", e);
            Throwable cause = e.getCause();
            if (cause instanceof ForcedDisconnectException) {
                problem = (Exception) cause;
            } else {
                problem = e;
            }
            if (services.getShutdownCause() != null) {
                Throwable shutdownCause = services.getShutdownCause();
                // problem.
                if (shutdownCause instanceof ForcedDisconnectException) {
                    problem = (Exception) shutdownCause;
                } else {
                    Throwable ne = problem;
                    while (ne.getCause() != null) {
                        ne = ne.getCause();
                    }
                    ne.initCause(services.getShutdownCause());
                }
            }
            final String channelClosed = LocalizedStrings.GroupMembershipService_CHANNEL_CLOSED.toLocalizedString();
            // services.getManager().membershipFailure(channelClosed, problem);
            throw new DistributedSystemDisconnectedException(channelClosed, problem);
        }
    } else // useMcast
    {
        // ! useMcast
        int len = destinations.length;
        // explicit list of members
        List<GMSMember> calculatedMembers;
        // == calculatedMembers.len
        int calculatedLen;
        if (len == 1 && destinations[0] == DistributionMessage.ALL_RECIPIENTS) {
            // send to all
            // Grab a copy of the current membership
            NetView v = services.getJoinLeave().getView();
            // Construct the list
            calculatedLen = v.size();
            calculatedMembers = new LinkedList<GMSMember>();
            for (int i = 0; i < calculatedLen; i++) {
                InternalDistributedMember m = (InternalDistributedMember) v.get(i);
                calculatedMembers.add((GMSMember) m.getNetMember());
            }
        } else // send to all
        {
            // send to explicit list
            calculatedLen = len;
            calculatedMembers = new LinkedList<GMSMember>();
            for (int i = 0; i < calculatedLen; i++) {
                calculatedMembers.add((GMSMember) destinations[i].getNetMember());
            }
        }
        // send to explicit list
        Int2ObjectOpenHashMap<Message> messages = new Int2ObjectOpenHashMap<>();
        long startSer = theStats.startMsgSerialization();
        boolean firstMessage = true;
        for (GMSMember mbr : calculatedMembers) {
            short version = mbr.getVersionOrdinal();
            if (!messages.containsKey(version)) {
                Message jmsg = createJGMessage(msg, local, version);
                messages.put(version, jmsg);
                if (firstMessage) {
                    theStats.incSentBytes(jmsg.getLength());
                    firstMessage = false;
                }
            }
        }
        theStats.endMsgSerialization(startSer);
        Collections.shuffle(calculatedMembers);
        int i = 0;
        for (GMSMember mbr : calculatedMembers) {
            JGAddress to = new JGAddress(mbr);
            short version = mbr.getVersionOrdinal();
            Message jmsg = messages.get(version);
            Exception problem = null;
            try {
                Message tmp = (i < (calculatedLen - 1)) ? jmsg.copy(true) : jmsg;
                if (!reliably) {
                    jmsg.setFlag(Message.Flag.NO_RELIABILITY);
                }
                tmp.setDest(to);
                tmp.setSrc(this.jgAddress);
                logger.trace("Unicasting to {}", to);
                myChannel.send(tmp);
            } catch (Exception e) {
                problem = e;
            }
            if (problem != null) {
                Throwable cause = services.getShutdownCause();
                if (cause != null) {
                    // problem.
                    if (cause instanceof ForcedDisconnectException) {
                        problem = (Exception) cause;
                    } else {
                        Throwable ne = problem;
                        while (ne.getCause() != null) {
                            ne = ne.getCause();
                        }
                        ne.initCause(cause);
                    }
                }
                final String channelClosed = LocalizedStrings.GroupMembershipService_CHANNEL_CLOSED.toLocalizedString();
                // services.getManager().membershipFailure(channelClosed, problem);
                throw new DistributedSystemDisconnectedException(channelClosed, problem);
            }
        }
    // send individually
    }
    // (i.e., left the view), we signal it here.
    if (msg.forAll()) {
        return Collections.emptySet();
    }
    Set<InternalDistributedMember> result = new HashSet<>();
    NetView newView = this.view;
    if (newView != null && newView != oldView) {
        for (InternalDistributedMember d : destinations) {
            if (!newView.contains(d)) {
                logger.debug("messenger: member has left the view: {}  view is now {}", d, newView);
                result.add(d);
            }
        }
    }
    return result;
}
Also used : Int2ObjectOpenHashMap(it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap) DMStats(org.apache.geode.distributed.internal.DMStats) DistributedSystemDisconnectedException(org.apache.geode.distributed.DistributedSystemDisconnectedException) DistributionMessage(org.apache.geode.distributed.internal.DistributionMessage) JoinRequestMessage(org.apache.geode.distributed.internal.membership.gms.messages.JoinRequestMessage) DirectReplyMessage(org.apache.geode.internal.cache.DirectReplyMessage) JoinResponseMessage(org.apache.geode.distributed.internal.membership.gms.messages.JoinResponseMessage) LocalizedMessage(org.apache.geode.internal.logging.log4j.LocalizedMessage) Message(org.jgroups.Message) HighPriorityDistributionMessage(org.apache.geode.distributed.internal.HighPriorityDistributionMessage) ForcedDisconnectException(org.apache.geode.ForcedDisconnectException) GMSMember(org.apache.geode.distributed.internal.membership.gms.GMSMember) NetView(org.apache.geode.distributed.internal.membership.NetView) MemberShunnedException(org.apache.geode.internal.tcp.MemberShunnedException) DistributedSystemDisconnectedException(org.apache.geode.distributed.DistributedSystemDisconnectedException) InvocationTargetException(java.lang.reflect.InvocationTargetException) ForcedDisconnectException(org.apache.geode.ForcedDisconnectException) GemFireIOException(org.apache.geode.GemFireIOException) SystemConnectException(org.apache.geode.SystemConnectException) GemFireConfigException(org.apache.geode.GemFireConfigException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) DirectReplyMessage(org.apache.geode.internal.cache.DirectReplyMessage) InternalDistributedMember(org.apache.geode.distributed.internal.membership.InternalDistributedMember) HashSet(java.util.HashSet)

Aggregations

DistributedSystemDisconnectedException (org.apache.geode.distributed.DistributedSystemDisconnectedException)42 IOException (java.io.IOException)15 InternalDistributedMember (org.apache.geode.distributed.internal.membership.InternalDistributedMember)15 Test (org.junit.Test)9 CancelException (org.apache.geode.CancelException)7 ReplyException (org.apache.geode.distributed.internal.ReplyException)7 Iterator (java.util.Iterator)6 CacheClosedException (org.apache.geode.cache.CacheClosedException)6 DistributionMessage (org.apache.geode.distributed.internal.DistributionMessage)6 RegionDestroyedException (org.apache.geode.cache.RegionDestroyedException)5 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)4 Cache (org.apache.geode.cache.Cache)4 InternalDistributedSystem (org.apache.geode.distributed.internal.InternalDistributedSystem)4 InternalCache (org.apache.geode.internal.cache.InternalCache)4 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)4 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)4 MembershipTest (org.apache.geode.test.junit.categories.MembershipTest)4 InterruptedIOException (java.io.InterruptedIOException)3