S
- individual messageT
- aggregated message (i.e. bucket)public class Aggregator<S,T> extends Object implements AutoCloseable, Runnable
AggregationPolicy
.
This class is designed to delegate dispatching to the calling threads as much
as possible (those which make calls to #aggregate(Message).
Modifier and Type | Class and Description |
---|---|
protected class |
Aggregator.Bucket |
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_NUM_STRIPE_LOCKS |
static String |
NUM_STRIPE_LOCKS_SYS_PROP
System property used to override the default number of stripe locks.
|
Constructor and Description |
---|
Aggregator(String id,
AggregationPolicy<S,T,?> policy,
AggregatingMessageProducer<S,T> messageProducer) |
Modifier and Type | Method and Description |
---|---|
T |
aggregate(S message)
Aggregates the given messages into a bucket and returns
the bucket if it is ready to be dispatched.
|
void |
close() |
void |
run() |
public static final String NUM_STRIPE_LOCKS_SYS_PROP
public static final int DEFAULT_NUM_STRIPE_LOCKS
public Aggregator(String id, AggregationPolicy<S,T,?> policy, AggregatingMessageProducer<S,T> messageProducer)
public T aggregate(S message)
message
- the message to aggregatednull
if nothing is ready to be dispatchedpublic void close() throws Exception
close
in interface AutoCloseable
Exception
Copyright © 2018. All rights reserved.