/** * A simplistic policy that never allows stealing to occur. */ @InstrumentedClass public class NeverStealPolicy<I> implements StealPolicy<I> { public boolean shouldSteal(final ProcessingBucket<I> victim, final ProcessingBucket<I> thief) { return false; } }
@InstrumentedClass public class TerracottaToolkit implements ClusteringToolkit { @Root private final ConcurrentMap<String, Barrier> barriers = new ConcurrentDistributedMap<String, Barrier>(); @Root private final ConcurrentMap<String, ClusteredTextBucket> textBuckets = new ConcurrentDistributedMap<String, ClusteredTextBucket>(); @Root private final ConcurrentMap<String, ReadWriteLock> readWriteLocks = new ConcurrentDistributedMap<String, ReadWriteLock>(); @Root private final ConcurrentMap<String, ConcurrentBlockingQueue> blockingQueues = new ConcurrentDistributedMap<String, ConcurrentBlockingQueue>(); @Root private final ConcurrentMap<String, ClusteredMap> maps = new ConcurrentDistributedMap<String, ClusteredMap>(); @Root private final ConcurrentMap<String, List> lists = new ConcurrentDistributedMap<String, List>(); @Root private final ConcurrentMap<String, ClusteredAtomicLong> atomicLongs = new ConcurrentDistributedMap<String, ClusteredAtomicLong>();
@InstrumentedClass @HonorTransient class ProcessingBucketGroup<I> implements ClusterListener {
/** * A simplistic policy that never allows stealing to occur. */ @InstrumentedClass public class NeverStealPolicy<I> implements StealPolicy<I> { public boolean shouldSteal(final ProcessingBucket<I> victim, final ProcessingBucket<I> thief) { return false; } }
@InstrumentedClass public class TerracottaToolkit implements ClusteringToolkitExtension { @Root private final ConcurrentMap<String, Barrier> barriers = new ConcurrentDistributedMap<String, Barrier>(); @Root private final ConcurrentMap<String, ClusteredTextBucket> textBuckets = new ConcurrentDistributedMap<String, ClusteredTextBucket>(); @Root private final ConcurrentMap<String, ReadWriteLock> readWriteLocks = new ConcurrentDistributedMap<String, ReadWriteLock>(); @Root private final ConcurrentMap<String, ConcurrentBlockingQueue> blockingQueues = new ConcurrentDistributedMap<String, ConcurrentBlockingQueue>(); @Root private final ConcurrentMap<String, ClusteredMap> maps = new ConcurrentDistributedMap<String, ClusteredMap>(); @Root private final ConcurrentMap<String, List> lists = new ConcurrentDistributedMap<String, List>(); @Root private final ConcurrentMap<String, ClusteredAtomicLong> atomicLongs = new ConcurrentDistributedMap<String, ClusteredAtomicLong>();
/** * A simplistic policy that never allows stealing to occur. */ @InstrumentedClass public class NeverStealPolicy<I> implements StealPolicy<I> { public boolean shouldSteal(final ProcessingBucket<I> victim, final ProcessingBucket<I> thief) { return false; } }
@InstrumentedClass public class TerracottaToolkit implements ClusteringToolkitExtension { @Root private final ConcurrentMap<String, Barrier> barriers = new ConcurrentDistributedMap<String, Barrier>(); @Root private final ConcurrentMap<String, ClusteredTextBucket> textBuckets = new ConcurrentDistributedMap<String, ClusteredTextBucket>(); @Root private final ConcurrentMap<String, ReadWriteLock> readWriteLocks = new ConcurrentDistributedMap<String, ReadWriteLock>(); @Root private final ConcurrentMap<String, ConcurrentBlockingQueue> blockingQueues = new ConcurrentDistributedMap<String, ConcurrentBlockingQueue>(); @Root private final ConcurrentMap<String, ClusteredMap> maps = new ConcurrentDistributedMap<String, ClusteredMap>(); @Root private final ConcurrentMap<String, List> lists = new ConcurrentDistributedMap<String, List>(); @Root private final ConcurrentMap<String, ClusteredAtomicLong> atomicLongs = new ConcurrentDistributedMap<String, ClusteredAtomicLong>();
/** * A steal policy that will allow stealing once a bucket has fallen behind the thief by a certain amount of time. * <p> * In practical terms this means a bucket can be stolen from if its last processing time was more than * the threshold time before the thief's last processing time. */ @InstrumentedClass public class FallBehindStealPolicy<I> implements StealPolicy<I> { private final long maxAllowedFallBehind; /** * @param maxAllowedFallBehind the amount of milliseconds that the victim is allowed * to fall behind the thief before its work gets stolen */ public FallBehindStealPolicy(final long maxAllowedFallBehind) { this.maxAllowedFallBehind = maxAllowedFallBehind; } public boolean shouldSteal(final ProcessingBucket<I> victim, final ProcessingBucket<I> thief) { return thief.getLastProcessing() - victim.getLastProcessing() > maxAllowedFallBehind; } }
/** * A steal policy that will allow stealing once a bucket has fallen behind the thief by a certain amount of time. * <p> * In practical terms this means a bucket can be stolen from if its last processing time was more than * the threshold time before the thief's last processing time. */ @InstrumentedClass public class FallBehindStealPolicy<I> implements StealPolicy<I> { private final long maxAllowedFallBehind; /** * @param maxAllowedFallBehind the amount of milliseconds that the victim is allowed * to fall behind the thief before its work gets stolen */ public FallBehindStealPolicy(final long maxAllowedFallBehind) { this.maxAllowedFallBehind = maxAllowedFallBehind; } public boolean shouldSteal(final ProcessingBucket<I> victim, final ProcessingBucket<I> thief) { return thief.getLastProcessing() - victim.getLastProcessing() > maxAllowedFallBehind; } }
/** * A steal policy that will allow stealing once a bucket has fallen behind the thief by a certain amount of time. * <p> * In practical terms this means a bucket can be stolen from if its last processing time was more than * the threshold time before the thief's last processing time. */ @InstrumentedClass public class FallBehindStealPolicy<I> implements StealPolicy<I> { private final long maxAllowedFallBehind; /** * @param maxAllowedFallBehind the amount of milliseconds that the victim is allowed * to fall behind the thief before its work gets stolen */ public FallBehindStealPolicy(final long maxAllowedFallBehind) { this.maxAllowedFallBehind = maxAllowedFallBehind; } public boolean shouldSteal(final ProcessingBucket<I> victim, final ProcessingBucket<I> thief) { return thief.getLastProcessing() - victim.getLastProcessing() > maxAllowedFallBehind; } }
@InstrumentedClass public class TerracottaNode implements ClusterNode {
@InstrumentedClass public class TerracottaNode implements ClusterNode {
@InstrumentedClass public class TerracottaNode implements ClusterNode {
@InstrumentedClass public class TerracottaTextBucket implements ClusteredTextBucket { private final ReadWriteLock lock = new TerracottaReadWriteLock();
@InstrumentedClass public class TerracottaTextBucket implements ClusteredTextBucket { private final ReadWriteLock lock = new TerracottaReadWriteLock();
@InstrumentedClass public class TerracottaTextBucket implements ClusteredTextBucket { private final ReadWriteLock lock = new TerracottaReadWriteLock();
@InstrumentedClass public class DefaultAsyncConfig implements AsyncConfig2 { private final static AsyncConfig INSTANCE = new DefaultAsyncConfig();
@InstrumentedClass public class DefaultAsyncConfig implements AsyncConfig2 { private final static AsyncConfig INSTANCE = new DefaultAsyncConfig();
@InstrumentedClass public class DefaultAsyncConfig implements AsyncConfig { private final static AsyncConfig INSTANCE = new DefaultAsyncConfig();
@InstrumentedClass public class ProcessingBucketItems<E> implements List<E> { private E[] data;