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

net.anotheria.anoprise.eventservice.EventChannelPushConsumerProxy Maven / Gradle / Ivy

Go to download

Collection of utils for different enterprise class projects. Among other stuff contains Caches, Mocking, DualCrud, MetaFactory and SessionDistributorService. Visit https://opensource.anotheria.net for details.

There is a newer version: 4.0.0
Show newest version
package net.anotheria.anoprise.eventservice;

import java.util.ArrayList;
import java.util.List;

/**
 * Proxy implementation for Push Consumers.
 * @author lrosenberg
 * Created on 22.09.2004
 */
public class EventChannelPushConsumerProxy extends AbstractEventChannel implements EventChannelConsumerProxy{
	/**
	 * List of connected consumers.
	 */
	private List consumers;

	public EventChannelPushConsumerProxy(String name){
		super(name);
		
		consumers = new ArrayList(10);	
	}
	
	/**
	 * Adds a new consumer.
	 */
	public void addConsumer(EventServiceConsumer consumer) {
		if (! (consumer instanceof EventServicePushConsumer))
			throw new IllegalArgumentException("Only EventServicePushConsumer are supported.");
		consumers.add(consumer);
	}


	public void removeConsumer(EventServiceConsumer consumer) {
		consumers.remove(consumer);
	}

	public void pushEvent(Event e) {
		for (int i=0, n=consumers.size(); i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy