public static void disconnectDSIfAny() { DistributedSystem ds = InternalDistributedSystem.getConnectedInstance(); if (ds != null) { ds.disconnect(); } }
/** * Gets the ID of the member in the GemFire distributed system as determined and assigned by * GemFire when the member process joins the distributed system. Note, this call only works if the * API is used in-process. * * @return a String value indicating the ID of the member in the GemFire distributed system. */ public String getMemberId() { final InternalDistributedSystem distributedSystem = InternalDistributedSystem.getConnectedInstance(); return distributedSystem != null ? distributedSystem.getMemberId() : null; }
private static DistributedSystem getDistributedSystem() { DistributedSystem system = InternalDistributedSystem.getConnectedInstance(); if (system == null) { throw new DistributedSystemDisconnectedException( "This connection to a distributed system has been disconnected."); } return system; } }
public void forceDisconnectMember() { MembershipManagerHelper .crashDistributedSystem(InternalDistributedSystem.getConnectedInstance()); }
/** * Gets the name of the member in the GemFire distributed system as determined by the 'name' * GemFire property. Note, this call only works if the API is used in-process. * * @return a String value indicating the name of the member in the GemFire distributed system. */ public String getMemberName() { final InternalDistributedSystem distributedSystem = InternalDistributedSystem.getConnectedInstance(); return distributedSystem != null ? distributedSystem.getConfig().getName() : null; }
private void getCanonicalIDs() { if (this.versionTags != null) { DistributionManager dm = InternalDistributedSystem.getConnectedInstance().getDistributionManager(); if (dm != null) { for (VersionTag tag : this.versionTags) { if (tag != null) { tag.setCanonicalIDs(dm); } } } } }
@Override public void setStatisticSampleRate(int value) { if (value < DEFAULT_STATISTIC_SAMPLE_RATE) { // fix 48228 InternalDistributedSystem ids = InternalDistributedSystem.getConnectedInstance(); if (ids != null) { ids.getLogWriter() .info("Setting statistic-sample-rate to " + DEFAULT_STATISTIC_SAMPLE_RATE + " instead of the requested " + value + " because VSD does not work with sub-second sampling."); } value = DEFAULT_STATISTIC_SAMPLE_RATE; } statisticSampleRate = value; }
public static ObjectName getManagerName() { String member = getMemberNameOrUniqueId( InternalDistributedSystem.getConnectedInstance().getDistributedMember()); return getObjectName((MessageFormat.format(OBJECTNAME__MANAGER_MXBEAN, member))); }
/** * public constructor * * @param repo Resource repo for this member */ public NotificationHub(ManagementResourceRepo repo) { this.repo = repo; logger = InternalDistributedSystem.getLogger(); this.listenerObjectMap = new HashMap<ObjectName, NotificationHubListener>(); memberSource = MBeanJMXAdapter .getMemberNameOrUniqueId( InternalDistributedSystem.getConnectedInstance().getDistributedMember()); }
/** * If we are connected to a distributed system, send a message to other members telling them about * a newly-registered serializer. */ private static void sendRegistrationMessage(DataSerializer s) { InternalDistributedSystem system = InternalDistributedSystem.getConnectedInstance(); if (system != null) { RegistrationMessage m = new RegistrationMessage(s); system.getDistributionManager().putOutgoing(m); } }
public void waitTilServerFullyReconnected() { vm.invoke(() -> { try { await().until(() -> { InternalDistributedSystem internalDistributedSystem = InternalDistributedSystem.getConnectedInstance(); return internalDistributedSystem != null && internalDistributedSystem.getCache() != null && !internalDistributedSystem.getCache().getCacheServers().isEmpty(); }); } catch (Exception e) { // provide more information when condition is not satisfied after awaitility timeout InternalDistributedSystem ids = InternalDistributedSystem.getConnectedInstance(); logger.info("ds is: " + (ids != null ? "not null" : "null")); logger.info("cache is: " + (ids.getCache() != null ? "not null" : "null")); logger.info("has cache server: " + (!ids.getCache().getCacheServers().isEmpty())); throw e; } }); }
protected void closeCache(final VM vm) { vm.invoke("Close Cache", () -> { InternalCache existingInstance = GemFireCacheImpl.getInstance(); if (existingInstance != null) { existingInstance.close(); } InternalDistributedSystem ds = InternalDistributedSystem.getConnectedInstance(); if (ds != null) { ds.disconnect(); } }); }
@Override public void execute(FunctionContext context) { try { final InternalDistributedSystem system = InternalDistributedSystem.getConnectedInstance(); if (system == null) { return; } String memberName = system.getDistributedMember().getId(); logger.info("Received GFSH shutdown. Shutting down member " + memberName); disconnectInNonDaemonThread(system); context.getResultSender().lastResult("SUCCESS: succeeded in shutting down " + memberName); } catch (Exception ex) { logger.warn("Error during shutdown", ex); context.getResultSender().lastResult("FAILURE: failed in shutting down " + ex.getMessage()); } }
/** * Disconnects this VM from the distributed system */ public static void disconnectFromDS() { GemFireCacheImpl.testCacheXml = null; for (;;) { DistributedSystem ds = InternalDistributedSystem.getConnectedInstance(); if (ds == null) { break; } try { ds.disconnect(); } catch (Exception ignore) { } } AdminDistributedSystemImpl ads = AdminDistributedSystemImpl.getConnectedInstance(); if (ads != null) { ads.disconnect(); } } }
DistributedMember getCoordinator() { InternalDistributedSystem ids = InternalDistributedSystem.getConnectedInstance(); if (ids == null || !ids.isConnected()) { return null; } MembershipManager mmgr = ids.getDistributionManager().getMembershipManager(); if (mmgr == null) { return null; } return mmgr.getCoordinator(); } }
private void executeWithNoLastResult(FunctionContext context) { // add expected exception InternalDistributedSystem.getConnectedInstance().getLogWriter() .info("<ExpectedException action=add>did not send last result" + "</ExpectedException>"); context.getResultSender().sendResult(context.getArguments()); }
public static void main(String[] args) { try { final SystemAdmin admin = new SystemAdmin(); admin.initHelpMap(); admin.initUsageMap(); admin.invoke(args); } finally { InternalDistributedSystem sys = InternalDistributedSystem.getConnectedInstance(); if (sys != null) { sys.disconnect(); } } }
@Before public void before() { DistributedSystem.removeSystem(InternalDistributedSystem.getConnectedInstance()); }
@Override public void execute(final FunctionContext context) { DistributedSystem ds = InternalDistributedSystem.getConnectedInstance(); if (ds == null || !ds.isConnected()) { return; } String host = ds.getDistributedMember().getHost(); NetstatFunctionArgument args = (NetstatFunctionArgument) context.getArguments(); boolean withlsof = args.isWithlsof(); String lineSeparator = args.getLineSeparator(); String netstatOutput = executeCommand(lineSeparator, withlsof); StringBuilder netstatInfo = new StringBuilder(); // {0} will be replaced on Manager addMemberHostHeader(netstatInfo, "{0}", host, lineSeparator); NetstatFunctionResult result = new NetstatFunctionResult(host, netstatInfo.toString(), CliUtil.compressBytes(netstatOutput.getBytes())); context.getResultSender().lastResult(result); }
public MemberMBeanBridge() { this.monitor = new MBeanStatsMonitor("MemberMXBeanMonitor"); this.diskMonitor = new MemberLevelDiskMonitor(MEMBER_LEVEL_DISK_MONITOR); this.regionMonitor = new AggregateRegionStatsMonitor(MEMBER_LEVEL_REGION_MONITOR); this.gcMonitor = new GCStatsMonitor("GCStatsMonitor"); this.vmStatsMonitor = new VMStatsMonitor("VMStatsMonitor"); this.systemStatsMonitor = new MBeanStatsMonitor("SystemStatsManager"); this.system = InternalDistributedSystem.getConnectedInstance(); initializeStats(); }