Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question

Best way to confirm the Lookup Service has closed

We have some integration tests that create a local cluster using a org.openspaces.pu.container.support.CompoundProcessingUnitContainer. We then close this after the test is done (in JUnits @AfterClass phase). Since the shutdown is asynchronous, the LUS may still be running when the next integration test is started so the test will use that one instead of starting a new one. However since that LUS is just about to shutdown the test fails.

Whats the best way to confirm that the LUS has shutdown before we proceed to the next test?

asked 2017-04-18 09:31:10 -0500

dmimnagh gravatar image
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

This question has come up before through support and there is a feature request for this.

Here is the workaround:

// JUnit is being used, the space is initialized once and a series of tests are run. There may be groups of tests, each with its own space and running in parallel. @BeforeClass public static void intialize() throws Exception { createRegistrar(); //other initialization done here ... }

// createRegistrar method definition public static com.sun.jini.reggie.Registrar createRegistrar() throws Exception { URL config = com.j_spaces.kernel.ResourceLoader.getServicesConfigUrl(); return new com.sun.jini.reggie.GigaRegistrar(new String[] {config.toExternalForm()}, null); }

Before each testSuite is run set the following: System.setProperty("com.gs.start-embedded-lus", false)

System.setProperty("com.gs.jini_lus.groups", groupName) // where groupName is random. This way each test will have access to it's own LUS and won't interfere with other tests that are multi-threaded.

answered 2017-04-27 16:35:51 -0500

Dixson Huie gravatar image
edit flag offensive delete link more

You can check via the Admin API if a lookup service is running. Make sure you use discoverUnmanagedSpaces() when constructing the admin object.

    Admin admin = new AdminFactory().discoverUnmanagedSpaces().create();
    LookupServices lookupServices = admin.getLookupServices();

answered 2017-04-27 16:04:04 -0500

shay hassidim gravatar image
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-04-18 09:31:10 -0500

Seen: 37 times

Last updated: Apr 27 '17