Skip to content

Commit

Permalink
GEODE-5310: Modified to check for initialized RegionAdvisor
Browse files Browse the repository at this point in the history
* GEODE-5310: Modified to check for initialized RegionAdvisor

* Fix a failing unit test.

[GEODE-5310]

Signed-off-by: Jianxia Chen <[email protected]>
  • Loading branch information
boglesby authored Jun 12, 2018
1 parent ca1f3bf commit 1e69c19
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ public void process(final ClusterDistributionManager dm) {
return;
}
pr = getPartitionedRegion();
if (pr == null && failIfRegionMissing()) {
if ((pr == null || !pr.getDistributionAdvisor().isInitialized()) && failIfRegionMissing()) {
// if the distributed system is disconnecting, don't send a reply saying
// the partitioned region can't be found (bug 36585)
thr = new ForceReattemptException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.junit.experimental.categories.Category;

import org.apache.geode.distributed.internal.ClusterDistributionManager;
import org.apache.geode.distributed.internal.DistributionAdvisor;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.cache.PartitionedRegion;
Expand All @@ -46,6 +47,7 @@ public class PartitionMessageTest {
private TXManagerImpl txMgr;
private long startTime = 1;
private TXStateProxy tx;
private DistributionAdvisor advisor;

@Before
public void setUp() throws Exception {
Expand All @@ -55,13 +57,16 @@ public void setUp() throws Exception {
pr = mock(PartitionedRegion.class);
txMgr = mock(TXManagerImpl.class);
tx = mock(TXStateProxyImpl.class);
advisor = mock(DistributionAdvisor.class);

when(msg.checkCacheClosing(dm)).thenReturn(false);
when(msg.checkDSClosing(dm)).thenReturn(false);
when(msg.getPartitionedRegion()).thenReturn(pr);
when(msg.getStartPartitionMessageProcessingTime(pr)).thenReturn(startTime);
when(msg.getTXManagerImpl(cache)).thenReturn(txMgr);
when(dm.getCache()).thenReturn(cache);
when(pr.getDistributionAdvisor()).thenReturn(advisor);
when(advisor.isInitialized()).thenReturn(true);

doAnswer(CALLS_REAL_METHODS).when(msg).process(dm);
}
Expand Down

0 comments on commit 1e69c19

Please sign in to comment.