use of org.apache.geode.internal.admin.GfManagerAgentConfig in project geode by apache.
the class ConsoleDistributionManagerDUnitTest method postSetUp.
@Override
public final void postSetUp() throws Exception {
boolean finishedSetup = false;
IgnoredException.addIgnoredException("Error occurred while reading system log");
try {
if (firstTime) {
// make sure there's no ldm lying around
disconnectFromDS();
try {
Thread.sleep(5 * 1000);
} catch (InterruptedException ie) {
fail("interrupted");
}
firstTime = false;
}
DistributionManager.isDedicatedAdminVM = true;
populateCache();
RemoteTransportConfig transport = null;
{
boolean created = !isConnectedToDS();
InternalDistributedSystem ds = getSystem();
transport = new RemoteTransportConfig(ds.getConfig(), DistributionManager.ADMIN_ONLY_DM_TYPE);
if (created) {
disconnectFromDS();
}
}
// create a GfManagerAgent in the master vm.
this.agent = GfManagerAgentFactory.getManagerAgent(new GfManagerAgentConfig(null, transport, LogWriterUtils.getLogWriter(), Alert.SEVERE, this, null));
if (!agent.isConnected()) {
WaitCriterion ev = new WaitCriterion() {
public boolean done() {
return agent.isConnected();
}
public String description() {
return null;
}
};
Wait.waitForCriterion(ev, 60 * 1000, 200, true);
}
finishedSetup = true;
} finally {
if (!finishedSetup) {
try {
this.agent.disconnect();
} catch (VirtualMachineError e) {
SystemFailure.initiateFailure(e);
throw e;
} catch (Throwable ignore) {
}
try {
super.preTearDown();
} catch (VirtualMachineError e) {
SystemFailure.initiateFailure(e);
throw e;
} catch (Throwable ignore) {
}
try {
disconnectFromDS();
} catch (VirtualMachineError e) {
SystemFailure.initiateFailure(e);
throw e;
} catch (Throwable ignore) {
}
DistributionManager.isDedicatedAdminVM = false;
}
}
}
Aggregations