Created
February 9, 2016 14:46
-
-
Save emrahkocaman/92755f326c186fbf2579 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hazelcast.internal.jmx; | |
import com.hazelcast.core.IAtomicLong; | |
import com.hazelcast.test.HazelcastParallelClassRunner; | |
import com.hazelcast.test.HazelcastTestSupport; | |
import com.hazelcast.test.TestHazelcastInstanceFactory; | |
import com.hazelcast.test.annotation.ParallelTest; | |
import com.hazelcast.test.annotation.QuickTest; | |
import org.junit.Before; | |
import org.junit.Test; | |
import org.junit.experimental.categories.Category; | |
import org.junit.runner.RunWith; | |
import java.util.concurrent.TimeUnit; | |
@RunWith(HazelcastParallelClassRunner.class) | |
@Category({QuickTest.class, ParallelTest.class}) | |
public class InstanceShutdownTest extends HazelcastTestSupport { | |
private MBeanDataHolder holder; | |
private MBeanDataHolder holder2; | |
@Before | |
public void setUp() throws Exception { | |
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2); | |
holder = new MBeanDataHolder(factory); | |
holder2 = new MBeanDataHolder(factory); | |
} | |
@Test | |
public void testInstanceShutdown() throws Exception { | |
IAtomicLong atomicLong = holder.getHz().getAtomicLong("atomiclong"); | |
atomicLong.incrementAndGet(); | |
holder.assertMBeanExistEventually("IAtomicLong", atomicLong.getName()); | |
holder.getHz().shutdown(); | |
holder2.assertMBeanExistEventually("IAtomicLong", atomicLong.getName()); | |
} | |
} |
@mirkosertic, but this happens only if INSTANCE_MAP
size is 0. All instances are needed to be shutdown for this to work, am I missing something?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey,
thank you for your feedback.
Your testcase does not cover my case. shutdownAll is indeed called by HazelcastInstanceFactory.remove() which is called as part of the shutdown process. See the following code snippet: