Search in sources :

Example 1 with AdminDistributedSystemImpl

use of org.apache.geode.admin.internal.AdminDistributedSystemImpl in project geode by apache.

the class ShutdownAllDUnitTest method shutDownAllMembers.

// TODO prpersist
// test move bucket
// test async put
// test create a new bucket by put async
private void shutDownAllMembers(VM vm, final int expnum) {
    vm.invoke(new SerializableRunnable("Shutdown all the members") {

        public void run() {
            DistributedSystemConfig config;
            AdminDistributedSystemImpl adminDS = null;
            try {
                config = AdminDistributedSystemFactory.defineDistributedSystem(getSystem(), "");
                adminDS = (AdminDistributedSystemImpl) AdminDistributedSystemFactory.getDistributedSystem(config);
                adminDS.connect();
                Set members = adminDS.shutDownAllMembers();
                int num = members == null ? 0 : members.size();
                assertEquals(expnum, num);
            } catch (AdminException e) {
                throw new RuntimeException(e);
            } finally {
                if (adminDS != null) {
                    adminDS.disconnect();
                }
            }
        }
    });
    // clean up for this vm
    System.setProperty("TestInternalGemFireError", "false");
}
Also used : AdminException(org.apache.geode.admin.AdminException) DistributedSystemConfig(org.apache.geode.admin.DistributedSystemConfig) TreeSet(java.util.TreeSet) Set(java.util.Set) SerializableRunnable(org.apache.geode.test.dunit.SerializableRunnable) AdminDistributedSystemImpl(org.apache.geode.admin.internal.AdminDistributedSystemImpl)

Example 2 with AdminDistributedSystemImpl

use of org.apache.geode.admin.internal.AdminDistributedSystemImpl in project geode by apache.

the class JUnit4DistributedTestCase method disconnectFromDS.

/**
   * Disconnects this VM from the distributed system
   */
public static final void disconnectFromDS() {
    // setTestMethodName(null);
    GemFireCacheImpl.testCacheXml = null;
    if (system != null) {
        system.disconnect();
        system = null;
    }
    for (; ; ) {
        DistributedSystem ds = InternalDistributedSystem.getConnectedInstance();
        if (ds == null) {
            break;
        }
        try {
            ds.disconnect();
        } catch (Exception e) {
        // ignore
        }
    }
    AdminDistributedSystemImpl ads = AdminDistributedSystemImpl.getConnectedInstance();
    if (ads != null) {
        // && ads.isConnected()) {
        ads.disconnect();
    }
}
Also used : AdminDistributedSystemImpl(org.apache.geode.admin.internal.AdminDistributedSystemImpl) InternalDistributedSystem(org.apache.geode.distributed.internal.InternalDistributedSystem) DistributedSystem(org.apache.geode.distributed.DistributedSystem) IgnoredException(org.apache.geode.test.dunit.IgnoredException)

Example 3 with AdminDistributedSystemImpl

use of org.apache.geode.admin.internal.AdminDistributedSystemImpl in project geode by apache.

the class AlertsNotificationMessage method process.

@Override
protected void process(DistributionManager dm) {
    // TODO add code to invoke process notification of agrregator
    // TODO: need to check whether it's a valid implimentation
    AdminDistributedSystemImpl ds = AdminDistributedSystemImpl.getConnectedInstance();
    if (ds instanceof StatAlertsAggregator) {
        StatAlertsAggregator aggregator = (StatAlertsAggregator) ds;
        RemoteGemFireVM remoteVM = dm.getAgent().getMemberById(getSender());
        aggregator.processNotifications(this._alerts, remoteVM);
    }
}
Also used : AdminDistributedSystemImpl(org.apache.geode.admin.internal.AdminDistributedSystemImpl) StatAlertsAggregator(org.apache.geode.admin.jmx.internal.StatAlertsAggregator)

Example 4 with AdminDistributedSystemImpl

use of org.apache.geode.admin.internal.AdminDistributedSystemImpl in project geode by apache.

the class ClientMembershipMessage method process.

/**
   * 
   * @see org.apache.geode.distributed.internal.DistributionMessage#process(org.apache.geode.distributed.internal.DistributionManager)
   */
@Override
protected void process(DistributionManager dm) {
    AdminDistributedSystemImpl adminDs = AdminDistributedSystemImpl.getConnectedInstance();
    /*
     * Disconnect can be called on AdminDistributedSystem from Agent and it is not synchronous with
     * processing of this message. Null check added to avoid null if disconnect has been called on
     * AdminDistributedSystem
     */
    if (adminDs != null) {
        String senderId = null;
        InternalDistributedMember msgSender = this.getSender();
        if (msgSender != null) {
            senderId = msgSender.getId();
        }
        adminDs.processClientMembership(senderId, clientId, clientHost, eventType);
    }
}
Also used : InternalDistributedMember(org.apache.geode.distributed.internal.membership.InternalDistributedMember) AdminDistributedSystemImpl(org.apache.geode.admin.internal.AdminDistributedSystemImpl)

Aggregations

AdminDistributedSystemImpl (org.apache.geode.admin.internal.AdminDistributedSystemImpl)4 Set (java.util.Set)1 TreeSet (java.util.TreeSet)1 AdminException (org.apache.geode.admin.AdminException)1 DistributedSystemConfig (org.apache.geode.admin.DistributedSystemConfig)1 StatAlertsAggregator (org.apache.geode.admin.jmx.internal.StatAlertsAggregator)1 DistributedSystem (org.apache.geode.distributed.DistributedSystem)1 InternalDistributedSystem (org.apache.geode.distributed.internal.InternalDistributedSystem)1 InternalDistributedMember (org.apache.geode.distributed.internal.membership.InternalDistributedMember)1 IgnoredException (org.apache.geode.test.dunit.IgnoredException)1 SerializableRunnable (org.apache.geode.test.dunit.SerializableRunnable)1