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

com.netflix.eureka2.interests.InstanceInfoInitStateHolder Maven / Gradle / Ivy

The newest version!
package com.netflix.eureka2.interests;

import com.netflix.eureka2.registry.InstanceInfo;

import java.util.Iterator;
import java.util.concurrent.ConcurrentLinkedQueue;

/**
 * An {@link Index.InitStateHolder} implementation for {@link InstanceInfo}
 *
 * @author Nitesh Kant
 */
public class InstanceInfoInitStateHolder extends Index.InitStateHolder {

    // TODO: Implement compaction
    private final ConcurrentLinkedQueue> notifications;

    public InstanceInfoInitStateHolder(Iterator> initialRegistry) {
        super(NotificationsSubject.create());
        notifications = new ConcurrentLinkedQueue>();
        while (initialRegistry.hasNext()) {
            notifications.add(initialRegistry.next());
        }
    }

    @Override
    protected void addNotification(ChangeNotification notification) {
        notifications.add(notification);
    }

    @Override
    protected void clearAllNotifications() {
        notifications.clear();
    }

    @Override
    protected Iterator> _newIterator() {
        return notifications.iterator();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy