public String[] getGroups() { List<String> groups = cache.getDistributedSystem().getDistributedMember().getGroups(); String[] groupsArray = new String[groups.size()]; groupsArray = groups.toArray(groupsArray); return groupsArray; }
protected Properties getCredentials(DistributedMember member) { String authInitMethod = this.system.getProperties().getProperty(SECURITY_CLIENT_AUTH_INIT); return getCredentials(authInitMethod, this.system.getSecurityProperties(), member, false, (InternalLogWriter) this.system.getLogWriter(), (InternalLogWriter) this.system.getSecurityLogWriter()); }
protected InternalDistributedSystem connect(Properties props) { return (InternalDistributedSystem) DistributedSystem.connect(props); }
/** * Returns a connection to the distributed system that is appropriate for administration. This * method is for internal use only by the admin API. * * @since GemFire 4.0 */ protected static DistributedSystem connectForAdmin(Properties props) { DistributedSystem existing = getConnection(props); if (existing != null) { return existing; } else { // logger.info("creating new distributed system for admin"); // for (java.util.Enumeration en=props.propertyNames(); en.hasMoreElements(); ) { // String prop=(String)en.nextElement(); // logger.info(prop + "=" + props.getProperty(prop)); // } props.setProperty(CONSERVE_SOCKETS, "true"); // LOG: no longer using the LogWriter that was passed in return connect(props); } }
if (this.stoppedForReconnect) { logger.info("waiting for distributed system to disconnect..."); while (ds.isConnected()) { Thread.sleep(5000); restarted = ds.waitUntilReconnected(-1, TimeUnit.SECONDS); if (restarted) { logger.info("system restarted");
private void executeAlwaysException(FunctionContext context) { DistributedSystem ds = InternalDistributedSystem.getAnyInstance(); LogWriter logger = ds.getLogWriter(); logger.fine("Executing executeException in TestFunction on Member : " + ds.getDistributedMember() + "with Context : " + context); logger.fine("MyFunctionExecutionException Exception is intentionally thrown"); throw new MyFunctionExecutionException("I have been thrown from TestFunction"); }
private ClientProxyMembershipID(int id, byte[] clientSideIdentity) { boolean specialCase = Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "SPECIAL_DURABLE"); String durableID = this.system.getProperties().getProperty(DURABLE_CLIENT_ID); if (specialCase && durableID != null && (!durableID.equals(""))) { this.uniqueId = durable_synch_counter; } else { this.uniqueId = id; } this.identity = clientSideIdentity; this.memberId = systemMemberId; }
} else { DistributedSystem ds = InternalDistributedSystem.getAnyInstance(); LogWriter logger = ds.getLogWriter(); logger.info("Executing in TestFunction on Server : " + ds.getDistributedMember() + "with Context : " + context); while (ds.isConnected()) { logger.fine("Just executing function in infinite loop for Bug43513"); try {
public static void disconnect() { try { if (ds != null) { ds.disconnect(); } } finally { cache = null; ds = null; } }
@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); }
/** * Determines whether to continue waiting and keep the GemFire non-Server data member running. * * @param cache the Cache associated with this GemFire (non-Server) data member. * @return a boolean value indicating whether the GemFire data member should continue running, as * determined by the running flag and a connection to the distributed system (GemFire * cluster). */ boolean isWaiting(final Cache cache) { // return (isRunning() && !getCache().isClosed()); return isRunning() && (cache.getDistributedSystem().isConnected() || cache.isReconnecting()); }
cnx.getSocket().getPort(), false); DistributedSystem sys = InternalDistributedSystem.getConnectedInstance(); String authInitMethod = sys.getProperties().getProperty(SECURITY_CLIENT_AUTH_INIT); server, false, (InternalLogWriter) sys.getLogWriter(), (InternalLogWriter) sys.getSecurityLogWriter()); HeapDataOutputStream heapdos = new HeapDataOutputStream(Version.CURRENT); try {
public InternalConfigurationPersistenceService(InternalCache cache, Class<?>... xsdClasses) throws IOException { this.cache = cache; Properties properties = cache.getDistributedSystem().getProperties(); CLUSTER_CONFIG_DISK_DIR_PREFIX + cache.getDistributedSystem().getName();
private Function<Health.Builder, Health.Builder> withDistributedSystemDetails() { return healthBuilder -> getGemFireCache() .map(GemFireCache::getDistributedSystem) .map(distributedSystem -> healthBuilder .withDetail("geode.distributed-system.member-count", Optional.of(distributedSystem) .map(DistributedSystem::getAllOtherMembers) .map(Collection::size) .map(size -> size + 1) .orElse(1)) .withDetail("geode.distributed-system.connection", toConnectedNoConnectedString(distributedSystem.isConnected())) .withDetail("geode.distributed-system.reconnecting", toYesNoString(distributedSystem.isReconnecting())) .withDetail("geode.distributed-system.properties-location", Optional.ofNullable(DistributedSystem.getPropertiesFileURL()) .map(URL::toExternalForm) .filter(StringUtils::hasText) .orElse("")) .withDetail("geode.distributed-system.security-properties-location", Optional.ofNullable(DistributedSystem.getSecurityPropertiesFileURL()) .map(URL::toExternalForm) .filter(StringUtils::hasText) .orElse("")) ) .orElse(healthBuilder); }
Properties sysProps = system.getProperties(); String authenticator = sysProps.getProperty(SECURITY_CLIENT_AUTHENTICATOR); Handshake.verifyCredentials(authenticator, credentials, system.getSecurityProperties(), this.logWriter, this.securityLogWriter, member, this.cache.getSecurityService());
this.clientReadTimeout, null, this.credentials, member, false); String authInit = this.system.getProperties().getProperty(SECURITY_CLIENT_AUTH_INIT); if (!communicationMode.isWAN() && intermediateAcceptanceCode != REPLY_AUTH_NOT_REQUIRED CancelCriterion stopper = this.system.getCancelCriterion(); stopper.checkCancelInProgress(null); throw ex;
public static void crashDistributedSystem(final DistributedSystem msys) { msys.getLogWriter().info("crashing distributed system: " + msys); GMSMembershipManager mgr = ((GMSMembershipManager) getMembershipManager(msys)); mgr.saveCacheXmlForReconnect(false); MembershipManagerHelper.inhibitForcedDisconnectLogging(true); MembershipManagerHelper.beSickMember(msys); MembershipManagerHelper.playDead(msys); mgr.forceDisconnect("for testing"); // wait at most 10 seconds for system to be disconnected await().until(() -> !msys.isConnected()); MembershipManagerHelper.inhibitForcedDisconnectLogging(false); }
private ServerState stopInProcess() { if (isStoppable()) { if (this.cache.isReconnecting()) { this.cache.getDistributedSystem().stopReconnecting(); } // Another case of needing to use a non-daemon thread to keep the JVM alive until a clean // shutdown can be performed. If not, the JVM may exit too early causing the member to be // seen as having crashed and not cleanly departed. Thread t = new LoggingThread("ServerLauncherStopper", false, this::doStopInProcess); t.start(); try { t.join(); } catch (InterruptedException e) { // no matter, we're shutting down... } INSTANCE.compareAndSet(this, null); // note: other thread may return Status.NOT_RESPONDING now this.running.set(false); return new ServerState(this, Status.STOPPED); } else { return new ServerState(this, Status.NOT_RESPONDING); } }
public MXMemoryPoolListenerExample(DistributedSystem ds) { this.logger = ds.getLogWriter(); }
logInfo(() -> String.format("Connected to Distributed System [%1$s] as Member [%2$s]" .concat(" in Group(s) [%3$s] with Role(s) [%4$s] on Host [%5$s] having PID [%6$d]"), cache.getDistributedSystem().getName(), member.getId(), member.getGroups(), member.getRoles(), member.getHost(), member.getProcessId())));