// Try to get space
final JavaSpace space = (JavaSpace) services[0];
logger.log(Level.INFO, "Got Space");
for (int i = 0; i < numRestarts; i++) {
addOutriggerLease(space.write(new UninterestingEntry(), null,
Lease.FOREVER), true);
logger.log(Level.INFO, "Wrote UninterestingEntry");
// Shutdown the space
logger.log(Level.INFO, "Trying shutDown()...");
shutdown(0);
// Trying to re-activate and read UninterestingEntry
logger.log(Level.INFO,
"trying to re-activate and read UninterestingEntry");
if (activatable) {
// try to read the entry we wrote
String msg = "Expected space to re-activate after shutdown.\n"
+ "Got : ";
Entry en = null;
en = space.takeIfExists(new UninterestingEntry(), null, 0);
// Check for read the entry we wrote
if (en == null) {
throw new TestException(
"Could not get entry we wrote before shutdown");
}
} else {
try {
space.takeIfExists(new UninterestingEntry(), null, 0);
throw new TestException("Space did not go away");
} catch (RemoteException e) {
// This is what we are looking for
}
}