org.d_haven.event.impl

Class MultiCastSink

public class MultiCastSink extends Object implements Sink

This is a 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.

Version: $Revision: 1.11 $

Author: schierma

Nested Class Summary
static classMultiCastSink.MultiCastPreparedEnqueue
A prepared enqueue object that holds other prepared enqueue objects and allows to perform a commit / abort on all of these objects.
Field Summary
booleanm_single
Boolean value describing if one or all operations must succeed.
Collectionm_sinks
A collection of sink arrays representing the sinks to enqueue to.
Constructor Summary
MultiCastSink(Collection sinks)
This constructor creates a failure in-tolerant multicast sink based on the collection of sink arrays.
MultiCastSink(Collection sinks, boolean single)
This constructor creates a failure in-tolerant multicast sink based on the collection of sink arrays.
Method Summary
voidenqueue(Object element)
voidenqueue(Object[] elements)
PreparedEnqueueprepareEnqueue(Object[] elements)
intsize()
StringtoString()
booleantryEnqueue(Object element)

Field Detail

m_single

private final boolean m_single
Boolean value describing if one or all operations must succeed.

m_sinks

private final Collection m_sinks
A collection of sink arrays representing the sinks to enqueue to.

Constructor Detail

MultiCastSink

public MultiCastSink(Collection sinks)
This constructor creates a failure in-tolerant multicast sink based on the collection of sink arrays. The delivery must succeed for all sinks in the collection or it will fail entirely.

Parameters: sinks A collection of sink arrays for each stage.

Since: May 16, 2002

MultiCastSink

public MultiCastSink(Collection sinks, boolean single)
This constructor creates a failure in-tolerant multicast sink based on the collection of sink arrays.

Parameters: sinks A collection of sink arrays for each stage. single true if just one operation must succeed. false if all operations must succeed.

Since: May 16, 2002

Method Detail

enqueue

public void enqueue(Object element)

enqueue

public void enqueue(Object[] elements)

prepareEnqueue

public PreparedEnqueue prepareEnqueue(Object[] elements)

size

public int size()

toString

public String toString()

tryEnqueue

public boolean tryEnqueue(Object element)