net.anotheria.anoprise.eventservice.EventChannelPushConsumerProxy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ano-prise Show documentation
Show all versions of ano-prise Show documentation
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.
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