Search in sources :

Example 1 with BackOff

use of org.activityinfo.legacy.shared.util.BackOff in project activityinfo by bedatadriven.

the class RemoteDispatcherTest method setUp.

@Before
public void setUp() {
    service = createMock("remoteService", RemoteCommandServiceAsync.class);
    proxy = createMock("proxy", CommandCache.class);
    AuthenticatedUser auth = new AuthenticatedUser(AUTH_TOKEN, 1, "alex@alex.com");
    BackOff backOff = new ExponentialBackOff.Builder().setInitialIntervalMillis(MergingDispatcher.ADVISORY_GET_LOCK_TIMEOUT).setMultiplier(// increase in 2 times
    2).setNanoClock(new NanoClock() {

        @Override
        public long nanoTime() {
            return System.nanoTime();
        }
    }).build();
    dispatcher = new CachingDispatcher(proxyManager, new MergingDispatcher(new RemoteDispatcher(auth, service, "en"), scheduler, backOff));
}
Also used : RemoteCommandServiceAsync(org.activityinfo.legacy.shared.command.RemoteCommandServiceAsync) CommandCache(org.activityinfo.ui.client.dispatch.CommandCache) CachingDispatcher(org.activityinfo.ui.client.dispatch.remote.cache.CachingDispatcher) NanoClock(org.activityinfo.legacy.shared.util.NanoClock) AuthenticatedUser(org.activityinfo.legacy.shared.AuthenticatedUser) BackOff(org.activityinfo.legacy.shared.util.BackOff) ExponentialBackOff(org.activityinfo.legacy.shared.util.ExponentialBackOff) Before(org.junit.Before)

Aggregations

AuthenticatedUser (org.activityinfo.legacy.shared.AuthenticatedUser)1 RemoteCommandServiceAsync (org.activityinfo.legacy.shared.command.RemoteCommandServiceAsync)1 BackOff (org.activityinfo.legacy.shared.util.BackOff)1 ExponentialBackOff (org.activityinfo.legacy.shared.util.ExponentialBackOff)1 NanoClock (org.activityinfo.legacy.shared.util.NanoClock)1 CommandCache (org.activityinfo.ui.client.dispatch.CommandCache)1 CachingDispatcher (org.activityinfo.ui.client.dispatch.remote.cache.CachingDispatcher)1 Before (org.junit.Before)1