/** * see {@link org.apache.geode.admin.AdminDistributedSystemFactory} * * @since GemFire 5.7 */ protected static void setEnableAdministrationOnly(boolean adminOnly) { synchronized (existingSystemsLock) { if (existingSystems != null && !existingSystems.isEmpty()) { throw new IllegalStateException( String.format("This VM already has one or more Distributed System connections %s", existingSystems)); } ClusterDistributionManager.setIsDedicatedAdminVM(adminOnly); } }
throw e; } finally { ClusterDistributionManager.setIsDedicatedAdminVM(false);
private Agent createAgent(final Properties props) throws IOException, AdminException { ClusterDistributionManager.setIsDedicatedAdminVM(true); SystemFailure.setExitOK(true); final AgentConfigImpl config = new AgentConfigImpl(props); // see bug 43760 if (config.getLogFile() == null || "".equals(config.getLogFile().trim())) { config.setLogFile(AgentConfigImpl.DEFAULT_LOG_FILE); } // LOG:TODO: redirectOutput called here OSProcess.redirectOutput(new File(config.getLogFile())); // redirect output to the configured // log file return AgentFactory.getAgent(config); }
ClusterDistributionManager.setIsDedicatedAdminVM(true);
public static void checkEnableAdministrationOnly(boolean v, boolean expectException) { boolean origIsDedicatedAdminVM = ClusterDistributionManager.isDedicatedAdminVM(); if (expectException) { try { AdminDistributedSystemFactory.setEnableAdministrationOnly(v); fail("expected IllegalStateException"); } catch (IllegalStateException expected) { assertEquals(origIsDedicatedAdminVM, ClusterDistributionManager.isDedicatedAdminVM()); } finally { ClusterDistributionManager.setIsDedicatedAdminVM(origIsDedicatedAdminVM); } } else { try { AdminDistributedSystemFactory.setEnableAdministrationOnly(v); assertEquals(v, ClusterDistributionManager.isDedicatedAdminVM()); } finally { ClusterDistributionManager.setIsDedicatedAdminVM(origIsDedicatedAdminVM); } } } }