Search in sources :

Example 1 with SharedConfigurationStatus

use of org.apache.geode.management.internal.configuration.domain.SharedConfigurationStatus in project geode by apache.

the class ClusterConfigurationService method getStatus.

/**
   * Gets the current status of the ClusterConfigurationService If the status is started , it
   * determines if the shared configuration is waiting for new configuration on other locators
   * 
   * @return {@link SharedConfigurationStatus}
   */
public SharedConfigurationStatus getStatus() {
    SharedConfigurationStatus scStatus = this.status.get();
    if (scStatus == SharedConfigurationStatus.STARTED) {
        PersistentMemberManager pmm = this.cache.getPersistentMemberManager();
        Map<String, Set<PersistentMemberID>> waitingRegions = pmm.getWaitingRegions();
        if (!waitingRegions.isEmpty()) {
            this.status.compareAndSet(SharedConfigurationStatus.STARTED, SharedConfigurationStatus.WAITING);
            Set<PersistentMemberID> persMemIds = waitingRegions.get(Region.SEPARATOR_CHAR + CONFIG_REGION_NAME);
            for (PersistentMemberID persMemId : persMemIds) {
                this.newerSharedConfigurationLocatorInfo.add(new PersistentMemberPattern(persMemId));
            }
        }
    }
    return this.status.get();
}
Also used : SharedConfigurationStatus(org.apache.geode.management.internal.configuration.domain.SharedConfigurationStatus) PersistentMemberManager(org.apache.geode.internal.cache.persistence.PersistentMemberManager) PersistentMemberPattern(org.apache.geode.internal.cache.persistence.PersistentMemberPattern) Set(java.util.Set) HashSet(java.util.HashSet) PersistentMemberID(org.apache.geode.internal.cache.persistence.PersistentMemberID)

Example 2 with SharedConfigurationStatus

use of org.apache.geode.management.internal.configuration.domain.SharedConfigurationStatus in project geode by apache.

the class FetchSharedConfigurationStatusFunction method execute.

@Override
public void execute(FunctionContext context) {
    InternalLocator locator = InternalLocator.getLocator();
    InternalCache cache = GemFireCacheImpl.getInstance();
    DistributedMember member = cache.getDistributedSystem().getDistributedMember();
    SharedConfigurationStatus status = locator.getSharedConfigurationStatus().getStatus();
    String memberId = member.getName();
    if (StringUtils.isBlank(memberId)) {
        memberId = member.getId();
    }
    CliFunctionResult result = new CliFunctionResult(memberId, new String[] { status.name() });
    context.getResultSender().lastResult(result);
}
Also used : SharedConfigurationStatus(org.apache.geode.management.internal.configuration.domain.SharedConfigurationStatus) InternalLocator(org.apache.geode.distributed.internal.InternalLocator) DistributedMember(org.apache.geode.distributed.DistributedMember) InternalCache(org.apache.geode.internal.cache.InternalCache)

Aggregations

SharedConfigurationStatus (org.apache.geode.management.internal.configuration.domain.SharedConfigurationStatus)2 HashSet (java.util.HashSet)1 Set (java.util.Set)1 DistributedMember (org.apache.geode.distributed.DistributedMember)1 InternalLocator (org.apache.geode.distributed.internal.InternalLocator)1 InternalCache (org.apache.geode.internal.cache.InternalCache)1 PersistentMemberID (org.apache.geode.internal.cache.persistence.PersistentMemberID)1 PersistentMemberManager (org.apache.geode.internal.cache.persistence.PersistentMemberManager)1 PersistentMemberPattern (org.apache.geode.internal.cache.persistence.PersistentMemberPattern)1