Skip to content

Commit

Permalink
GEODE-7556e - catch and translate exceptions into geode-core exceptio…
Browse files Browse the repository at this point in the history
…ns (apache#4519)

added a few more translation points.  These changes are for
non-opensource legacy tests that are looking for
ForcedDisconnectException as a cause for a cache disconnecting.  There
is nothing in Geode that expects this so I have not added tests that
require it.
  • Loading branch information
bschuchardt authored Dec 23, 2019
1 parent 6c87735 commit 9581406
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import org.apache.geode.distributed.internal.locks.ElderState;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.distributed.internal.membership.gms.api.MemberData;
import org.apache.geode.distributed.internal.membership.gms.api.MemberDisconnectedException;
import org.apache.geode.distributed.internal.membership.gms.api.MemberIdentifier;
import org.apache.geode.distributed.internal.membership.gms.api.MemberIdentifierFactory;
import org.apache.geode.distributed.internal.membership.gms.api.Membership;
Expand Down Expand Up @@ -2868,6 +2869,9 @@ public RuntimeException generateCancelledException(Throwable e) {
}

if (e == null) {
if (rc instanceof MemberDisconnectedException) {
rc = new ForcedDisconnectException(rc.getMessage());
}
// Caller did not specify any root cause, so just use our own.
return new DistributedSystemDisconnectedException(reason, rc);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,10 @@ public Set<InternalDistributedMember> directChannelSend(
checkCancelled();
}
} catch (MembershipClosedException e) {
checkCancelled();
throw new DistributedSystemDisconnectedException(e.getMessage(), e.getCause());
} catch (DistributedSystemDisconnectedException ex) {
checkCancelled();
throw ex;
} catch (ConnectExceptions ex) {
// Check if the connect exception is due to system shutting down.
Expand Down Expand Up @@ -426,12 +428,14 @@ public Set<InternalDistributedMember> directChannelSend(
return new HashSet<>(members);
} // catch ConnectionExceptions
catch (ToDataException | CancelException e) {
checkCancelled();
throw e;
} catch (NotSerializableException | RuntimeException | Error e) {
if (logger.isDebugEnabled()) {
logger.debug("Membership: directChannelSend caught exception: {}",
e.getMessage(), e);
}
checkCancelled();
throw e;
}
return null;
Expand Down

0 comments on commit 9581406

Please sign in to comment.