Search in sources :

Example 1 with PresenceListener

use of org.eclipse.leshan.server.queue.PresenceListener in project leshan by eclipse.

the class QueueModeIntegrationTestHelper method createServer.

public void createServer(int clientAwakeTime) {
    server = createServerBuilder(clientAwakeTime).build();
    awakeNotifications.set(0);
    server.getPresenceService().addListener(new PresenceListener() {

        @Override
        public void onAwake(Registration registration) {
            if (registration.getEndpoint().equals(currentEndpointIdentifier.get())) {
                awakeNotifications.addAndGet(1);
            }
        }

        @Override
        public void onSleeping(Registration registration) {
            awakeNotifications.set(0);
            awakeLatch.countDown();
        }
    });
    // monitor client registration
    setupRegistrationMonitoring();
}
Also used : PresenceListener(org.eclipse.leshan.server.queue.PresenceListener) Registration(org.eclipse.leshan.server.registration.Registration)

Aggregations

PresenceListener (org.eclipse.leshan.server.queue.PresenceListener)1 Registration (org.eclipse.leshan.server.registration.Registration)1