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

org.kairosdb.eventbus.Pipeline Maven / Gradle / Ivy

Go to download

KairosDB is a fast distributed scalable time series abstraction on top of Cassandra.

There is a newer version: 1.2.28
Show newest version
package org.kairosdb.eventbus;

import com.google.common.collect.ImmutableSortedSet;

import java.util.Collection;
import java.util.Iterator;

public class Pipeline implements Iterable
{
	private volatile ImmutableSortedSet m_pipeline;
	private final Object m_lock;

	public Pipeline()
	{
		m_lock = new Object();
		m_pipeline = ImmutableSortedSet.naturalOrder().build();
	}

	@Override
	public Iterator iterator()
	{
		return m_pipeline.iterator();
	}

	public void addAll(Collection subscribers)
	{
		synchronized (m_lock)
		{
			m_pipeline = ImmutableSortedSet.naturalOrder()
					.addAll(m_pipeline)
					.addAll(subscribers).build();
		}
	}

	public int size()
	{
		return m_pipeline.size();
	}

	public boolean isEmpty()
	{
		return m_pipeline.isEmpty();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy