Search in sources :

Example 1 with TakeOfflineConfigurationBuilder

use of org.infinispan.configuration.cache.TakeOfflineConfigurationBuilder in project infinispan by infinispan.

the class OfflineStatusTest method createNew.

private static TestContext createNew(long minWait, int afterFailures) {
    ControlledTimeService t = new ControlledTimeService();
    ListenerImpl l = new ListenerImpl();
    TakeOfflineConfiguration c = new TakeOfflineConfigurationBuilder(null, null).afterFailures(afterFailures).minTimeToWait(minWait).create();
    return new TestContext(new OfflineStatus(c, t, l), t, l);
}
Also used : TakeOfflineConfiguration(org.infinispan.configuration.cache.TakeOfflineConfiguration) TakeOfflineConfigurationBuilder(org.infinispan.configuration.cache.TakeOfflineConfigurationBuilder) OfflineStatus(org.infinispan.xsite.OfflineStatus) ControlledTimeService(org.infinispan.util.ControlledTimeService)

Example 2 with TakeOfflineConfigurationBuilder

use of org.infinispan.configuration.cache.TakeOfflineConfigurationBuilder in project infinispan by infinispan.

the class XSiteAdminOperationsTest method amendTakeOffline.

public void amendTakeOffline() {
    assertEquals(admin(LON, 0).siteStatus(NYC), XSiteAdminOperations.ONLINE);
    assertEquals(admin(LON, 1).siteStatus(NYC), XSiteAdminOperations.ONLINE);
    TakeOfflineManager tom = takeOfflineManager(LON, 0);
    assertEquals(tom.getConfiguration(NYC), new TakeOfflineConfigurationBuilder(null, null).afterFailures(0).minTimeToWait(0).create());
    assertEquals(XSiteAdminOperations.SUCCESS, admin(LON, 1).amendTakeOffline(NYC, 7, 12));
    assertEquals(tom.getConfiguration(NYC), new TakeOfflineConfigurationBuilder(null, null).afterFailures(7).minTimeToWait(12).create());
    assertEquals(XSiteAdminOperations.SUCCESS, admin(LON, 1).setTakeOfflineAfterFailures(NYC, 8));
    assertEquals(tom.getConfiguration(NYC), new TakeOfflineConfigurationBuilder(null, null).afterFailures(8).minTimeToWait(12).create());
    assertEquals(XSiteAdminOperations.SUCCESS, admin(LON, 1).setTakeOfflineMinTimeToWait(NYC, 13));
    assertEquals(tom.getConfiguration(NYC), new TakeOfflineConfigurationBuilder(null, null).afterFailures(8).minTimeToWait(13).create());
    assertEquals(admin(LON, 0).getTakeOfflineAfterFailures(NYC), "8");
    assertEquals(admin(LON, 0).getTakeOfflineMinTimeToWait(NYC), "13");
    assertEquals(admin(LON, 1).getTakeOfflineAfterFailures(NYC), "8");
    assertEquals(admin(LON, 1).getTakeOfflineMinTimeToWait(NYC), "13");
}
Also used : TakeOfflineConfigurationBuilder(org.infinispan.configuration.cache.TakeOfflineConfigurationBuilder) TakeOfflineManager(org.infinispan.xsite.status.TakeOfflineManager)

Example 3 with TakeOfflineConfigurationBuilder

use of org.infinispan.configuration.cache.TakeOfflineConfigurationBuilder in project infinispan by infinispan.

the class OfflineStatus method amend.

public void amend(Integer afterFailures, Long minTimeToWait) {
    TakeOfflineConfigurationBuilder builder = new TakeOfflineConfigurationBuilder(null, null);
    builder.read(getTakeOffline());
    if (afterFailures != null) {
        builder.afterFailures(afterFailures);
    }
    if (minTimeToWait != null) {
        builder.minTimeToWait(minTimeToWait);
    }
    amend(builder.create());
}
Also used : TakeOfflineConfigurationBuilder(org.infinispan.configuration.cache.TakeOfflineConfigurationBuilder)

Aggregations

TakeOfflineConfigurationBuilder (org.infinispan.configuration.cache.TakeOfflineConfigurationBuilder)3 TakeOfflineConfiguration (org.infinispan.configuration.cache.TakeOfflineConfiguration)1 ControlledTimeService (org.infinispan.util.ControlledTimeService)1 OfflineStatus (org.infinispan.xsite.OfflineStatus)1 TakeOfflineManager (org.infinispan.xsite.status.TakeOfflineManager)1