org.terracotta.api
Interface ClusteringToolkit

All Known Subinterfaces:
ClusteringToolkitExtension
All Known Implementing Classes:
TerracottaToolkit

public interface ClusteringToolkit


Method Summary
 ClusteredLock createLock(Object monitor, LockType type)
          Create a clustered lock around the supplied clustered monitor object.
 ClusteredAtomicLong getAtomicLong(String name)
          Get or create a clustered atomic long value.
 Barrier getBarrier(String name, int parties)
          Get or create a clustered barrier identified by the given name.
<E> BlockingQueue<E>
getBlockingQueue(String name)
          Get or create a clustered blocking queue with no capacity limit
<E> BlockingQueue<E>
getBlockingQueue(String name, int capacity)
          Get or create a clustered blocking queue with a capacity limit.
 ClusterInfo getClusterInfo()
          Retrieve a ClusterInfo object for the cluster this toolkit instance is related to.
<E> List<E>
getList(String name)
          Get or create a clustered list.
<K,V> ClusteredMap<K,V>
getMap(String name)
          Get or create a clustered map.
 ReadWriteLock getReadWriteLock(String name)
          Get or create a clustered read-write lock identified by the given name.
 ClusteredTextBucket getTextBucket(String name)
          Get or create a clustered text bucket identified by the given name.
 

Method Detail

getBarrier

Barrier getBarrier(String name,
                   int parties)
                   throws IllegalArgumentException
Get or create a clustered barrier identified by the given name.

If the named barrier already exists with the same number of parties then it is returned. If it doesn't exist it is created and registered. If the named barrier already exists but has a different number of parties then IllegalArgumentException is thrown.

Parameters:
name - identifier for the barrier
parties - number of parties
Returns:
a clustered barrier with the required number of parties
Throws:
IllegalArgumentException - if there is an existing barrier with a different number of parties

getReadWriteLock

ReadWriteLock getReadWriteLock(String name)
Get or create a clustered read-write lock identified by the given name.

If the named lock already exists then it is returned. If it doesn't exist it is created and registered.

Parameters:
name - identifier for the lock
Returns:
a clustered read-write lock

getTextBucket

ClusteredTextBucket getTextBucket(String name)
Get or create a clustered text bucket identified by the given name.

If the named bucket already exists then it is returned. If it doesn't exist it is created and registered.

Parameters:
name - identifier for the bucket
Returns:
a clustered text bucket

getBlockingQueue

<E> BlockingQueue<E> getBlockingQueue(String name)
                                  throws IllegalArgumentException
Get or create a clustered blocking queue with no capacity limit

If the named queue already exists and has no capacity limit then it is returned. If it doesn't exist then it is created and registered. If the named queue already exists but has a capacity limit then IllegalArgumentException is thrown.

Parameters:
name - identifier for the queue
Returns:
a clustered unbounded blocking queue
Throws:
IllegalArgumentException - if there is an existing queue with a capacity limit

getBlockingQueue

<E> BlockingQueue<E> getBlockingQueue(String name,
                                      int capacity)
                                  throws IllegalArgumentException
Get or create a clustered blocking queue with a capacity limit.

If the named queue already exists and it has the same capacity limit then it is returned. If it doesn't exist then it is created and registered. If the named queue already exists but has a different capacity limit then IllegalArgumentException is thrown.

Parameters:
name - identifier for the queue
capacity - the capacity limit for the queue
Returns:
a clustered capacity bounded blocking queue
Throws:
IllegalArgumentException - if there is an existing queue with a different capacity limit

getAtomicLong

ClusteredAtomicLong getAtomicLong(String name)
Get or create a clustered atomic long value.

If the named atomic long already exists then it is returned. If not it is created and registered.

Parameters:
name - identifier for the atomic long
Returns:
a clustered atomic long value

getMap

<K,V> ClusteredMap<K,V> getMap(String name)
Get or create a clustered map.

If the named map already exists then it is returned. If not it is created and registered.

Type Parameters:
K - key type
V - value type
Parameters:
name - identifier for the map
Returns:
a clustered map

getList

<E> List<E> getList(String name)
Get or create a clustered list.

If the named list already exists then it is returned. If not it is created and registered.

Type Parameters:
E - element type
Parameters:
name - identifier for the list
Returns:
a clustered list

createLock

ClusteredLock createLock(Object monitor,
                         LockType type)
                         throws IllegalArgumentException,
                                NullPointerException
Create a clustered lock around the supplied clustered monitor object.

The supplied lock type controls the lock hold acquired by the default Lock inherited methods.

If the supplied monitor object is null then NullPointerException is thrown. If it is not clustered then IllegalArgumentException is thrown.

Parameters:
monitor - clustered object
type - default lock hold type
Returns:
a clustered lock
Throws:
IllegalMonitorStateException - if monitor is not clustered
NullPointerException - if monitor is null
IllegalArgumentException

getClusterInfo

ClusterInfo getClusterInfo()
Retrieve a ClusterInfo object for the cluster this toolkit instance is related to.

Returns:
cluster info object


Copyright © 2015 Terracotta, Inc.. All Rights Reserved.