All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.payneteasy.superfly.notification.strategy.InMemoryNotificationStorageStrategy Maven / Gradle / Ivy

package com.payneteasy.superfly.notification.strategy;

import java.util.ArrayList;
import java.util.List;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;

import com.payneteasy.superfly.notification.LogoutNotification;

/**
 * Stores notifications in memory.
 * 
 * @author Roman Puchkovskiy
 */
public class InMemoryNotificationStorageStrategy implements
        NotificationStorageStrategy {

    private Queue logoutNotifications = new ConcurrentLinkedQueue();

    public void enqueueLogoutNotifications(
            List notifications) {
        logoutNotifications.addAll(logoutNotifications);
    }

    public List dequeueLogoutNotifications() {
        List notifications = new ArrayList();
        while (!logoutNotifications.isEmpty()) {
            notifications.add(logoutNotifications.poll());
        }
        return notifications;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy