public class LossyMultiCastSink
extends java.lang.Object
implements org.apache.excalibur.event.Sink
org.apache.excalibur.event.seda.event.Sink
implementation that multicasts enqueue operations to the
contained and concrete sink objects. Compared to the
regular org.apache.excalibur.event.seda.event.impl.MultiCastSink
this sink works in that it delivers zero, one or more sinks.
It can be configured to fail when less than one sink was
delivered to.| Modifier and Type | Class and Description |
|---|---|
private static class |
LossyMultiCastSink.DefaultPreparedEnqueue
A prepared enqueue object that holds other prepared
enqueue objects and allows to perform a commit / abort
on all of these objects.
|
| Modifier and Type | Field and Description |
|---|---|
private boolean |
m_oneSuccess
indicates if at least one enqueue operation must succeed.
|
private java.util.Collection |
m_sinks
A collection of sink arrays representing the
sinks to enqueue the element to.
|
private int |
m_size
The size of the sink.
|
| Constructor and Description |
|---|
LossyMultiCastSink(java.util.Collection sinks)
This constructor creates a failure tolerant sink
based on the collection of sink arrays.
|
LossyMultiCastSink(java.util.Collection sinks,
boolean oneSuccess)
This constructor creates a failure tolerant sink
based on the collection of sink arrays.
|
| Modifier and Type | Method and Description |
|---|---|
int |
canAccept() |
void |
enqueue(java.lang.Object element) |
void |
enqueue(java.lang.Object[] elements) |
boolean |
isFull() |
int |
maxSize() |
org.apache.excalibur.event.PreparedEnqueue |
prepareEnqueue(java.lang.Object[] elements) |
int |
size() |
boolean |
tryEnqueue(java.lang.Object element) |
private final java.util.Collection m_sinks
private final int m_size
private final boolean m_oneSuccess
public LossyMultiCastSink(java.util.Collection sinks)
sinks - A collection of sink arrays for each stage.public LossyMultiCastSink(java.util.Collection sinks,
boolean oneSuccess)
sinks - A collection of sink arrays for each stage.public int canAccept()
canAccept in interface org.apache.excalibur.event.SinkSink.canAccept()public boolean isFull()
isFull in interface org.apache.excalibur.event.SinkSink.isFull()public int maxSize()
maxSize in interface org.apache.excalibur.event.SinkSink.maxSize()public void enqueue(java.lang.Object element)
throws org.apache.excalibur.event.SinkException
enqueue in interface org.apache.excalibur.event.Sinkorg.apache.excalibur.event.SinkExceptionSink.enqueue(Object)public void enqueue(java.lang.Object[] elements)
throws org.apache.excalibur.event.SinkException
enqueue in interface org.apache.excalibur.event.Sinkorg.apache.excalibur.event.SinkExceptionSink.enqueue(Object[])public boolean tryEnqueue(java.lang.Object element)
tryEnqueue in interface org.apache.excalibur.event.SinkSink.tryEnqueue(Object)public org.apache.excalibur.event.PreparedEnqueue prepareEnqueue(java.lang.Object[] elements)
throws org.apache.excalibur.event.SinkException
prepareEnqueue in interface org.apache.excalibur.event.Sinkorg.apache.excalibur.event.SinkExceptionSink.prepareEnqueue(Object[])public int size()
size in interface org.apache.excalibur.event.SinkSink.size()