public HighPriorityAckedMessage() { super(); InternalDistributedSystem ds = InternalDistributedSystem.getAnyInstance(); if (ds != null) { this.originDm = (ClusterDistributionManager) ds.getDistributionManager(); } if (this.originDm != null) { this.id = this.originDm.getDistributionManagerId(); } }
@Override public boolean isDurableClient() { boolean isDurable = false; DistributionConfig config = dsys.getConfig(); String durableClientId = config.getDurableClientId(); isDurable = durableClientId != null && durableClientId.length() > 0; return isDurable; }
@Override public String toString() { return "Set alerts refresh time interval in " + InternalDistributedSystem.getAnyInstance().getDistributedMember(); } }
private static LogWriter getLogger() { LogWriter result = null; InternalDistributedSystem ids = InternalDistributedSystem.unsafeGetConnectedInstance(); if (ids != null) { result = ids.getLogWriter(); } return result; } }
/** * 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; }
when(cache.getQueryMonitor()).thenReturn(queryMonitor); when(system.getDistributedMember()).thenReturn(member); when(system.getConfig()).thenReturn(config); when(system.getDistributionManager()).thenReturn(distributionManager); when(system.getCancelCriterion()).thenReturn(systemCancelCriterion); when(system.getClock()).thenReturn(clock); when(system.getLogWriter()).thenReturn(logger); when(system.getSecurityService()).thenReturn(mock(SecurityService.class)); when(system.createAtomicStatistics(any(), any(), anyLong())).thenReturn(stats); when(system.createAtomicStatistics(any(), any())).thenReturn(stats); when(system.getCache()).thenReturn(cache);
public ReliableCacheReplyProcessor(InternalDistributedSystem system, Collection initMembers, Set departedMembers) { super(system, initMembers); this.dm = system.getDistributionManager(); this.failedMembers = departedMembers; }
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 getCanonicalIDs() { if (this.versionTags != null) { DistributionManager dm = InternalDistributedSystem.getConnectedInstance().getDistributionManager(); if (dm != null) { for (VersionTag tag : this.versionTags) { if (tag != null) { tag.setCanonicalIDs(dm); } } } } }
/** * Returns the last created instance of GemFireCache * * @deprecated use DM.getCache instead */ @Deprecated public static GemFireCacheImpl getInstance() { InternalDistributedSystem system = InternalDistributedSystem.getAnyInstance(); if (system == null) { return null; } GemFireCacheImpl cache = (GemFireCacheImpl) system.getCache(); if (cache == null) { return null; } if (cache.isClosing) { return null; } return cache; }
@AfterClass public static void afterClass() { InternalDistributedSystem ids = InternalDistributedSystem.getAnyInstance(); if (ids != null) { ids.disconnect(); } }
public static InternalLogWriter getStaticInternalLogWriter() { InternalDistributedSystem sys = getAnyInstance(); if (sys != null) { return sys.logWriter; } return null; }
@Before public void setUp() throws Exception { when(ids.getLogWriter()).thenReturn(lw); when(ids.getDistributionManager()).thenReturn(dm); }
public static void backup(String targetDir) throws AdminException { InternalDistributedSystem ads = getAdminCnx(); // Baseline directory should be null if it was not provided on the command line BackupStatus status = new BackupOperation(ads.getDistributionManager(), ads.getCache()).backupAllMembers( targetDir, SystemAdmin.baselineDir); boolean incomplete = !status.getOfflineDiskStores().isEmpty(); System.out.println("The following disk stores were backed up:"); for (Set<PersistentID> memberStores : status.getBackedUpDiskStores().values()) { for (PersistentID store : memberStores) { System.out.println("\t" + store); } } if (incomplete) { System.err.println("The backup may be incomplete. The following disk stores are not online:"); for (PersistentID store : status.getOfflineDiskStores()) { System.err.println("\t" + store); } } else { System.out.println("Backup successful."); } }
/** * Returns the member id of my distributed system * * @since GemFire 5.0 */ @Override public InternalDistributedMember getMyId() { return this.system.getDistributedMember(); }
/** * 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()); }
doReturn(distributionConfig).when(internalDistributedSystem).getConfig(); doReturn(properties).when(internalDistributedSystem).getProperties(); doReturn(statistics).when(internalDistributedSystem).createAtomicStatistics(any(), anyString());
@Override public void releaseQuorumChecker(QuorumChecker checker) { checker.suspend(); InternalDistributedSystem system = InternalDistributedSystem.getAnyInstance(); if (system == null || !system.isConnected()) { checker.close(); } }
private static Object getSource() { Object source = SOURCE.get(); if (source == null) { source = InternalDistributedSystem.getAnyInstance().getMemberId(); } return source; }
/** * Checks various conditions which might arise due to race condition for lock of * GemFireCacheImpl.class which is obtained while GemFireCacheImpl constructor, cache.close(), * DistributedSystem.disconnect(). * * As ManagementService creation logic is called in cache.init() method it leaves a small window * of loosing the lock of GemFireCacheImpl.class * * These checks ensures that something unwanted has not happened during that small window * * @return true or false depending on the status of Cache and System */ boolean shouldProceed(ResourceEvent event) { InternalDistributedSystem.getConnectedInstance(); // CACHE_REMOVE is a special event. ForcedDisconnectException may raise this event. if (!system.isConnected() && !event.equals(ResourceEvent.CACHE_REMOVE)) { return false; } InternalCache currentCache = system.getCache(); if (currentCache == null) { return false; } return !currentCache.isClosed(); }