public class MultiCastSink
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. The multi cast sink
will try to enqueue and only succeeds if no element was
rejected from any sink. The sink can be configured to
enqueue into one sink alone or all sinks.
If a sink array in the collection of sinks contains more
than one sink the multicast sink will try to enqueue the
element always to only one of these sinks.| Modifier and Type | Class and Description |
|---|---|
private static class |
MultiCastSink.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_single
Boolean value describing if one or all operations must succeed.
|
private java.util.Collection |
m_sinks
A collection of sink arrays representing the sinks to enqueue to.
|
private int |
m_size
The size of the sink.
|
| Constructor and Description |
|---|
MultiCastSink(java.util.Collection sinks)
This constructor creates a failure in-tolerant multicast
sink based on the collection of sink arrays.
|
MultiCastSink(java.util.Collection sinks,
boolean single)
This constructor creates a failure in-tolerant multicast
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_single
public MultiCastSink(java.util.Collection sinks)
sinks - A collection of sink arrays for each stage.public MultiCastSink(java.util.Collection sinks,
boolean single)
sinks - A collection of sink arrays for each stage.single - 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()