public final class HazelcastClient extends Object implements HazelcastInstance
| Modifier and Type | Method and Description |
|---|---|
String |
addDistributedObjectListener(DistributedObjectListener distributedObjectListener)
Adds a Distributed Object listener which will be notified when a
new
DistributedObject will be created or destroyed. |
<T> T |
executeTransaction(TransactionalTask<T> task)
Executes given transactional task in current thread using default options
and returns the result of the task.
|
<T> T |
executeTransaction(TransactionOptions options,
TransactionalTask<T> task)
Executes given transactional task in current thread using given options
and returns the result of the task.
|
static Collection<HazelcastInstance> |
getAllHazelcastClients() |
IAtomicLong |
getAtomicLong(String name)
Creates cluster-wide atomic long.
|
ClientClusterService |
getClientClusterService() |
ClientConfig |
getClientConfig() |
ClientExecutionService |
getClientExecutionService() |
ClientPartitionService |
getClientPartitionService() |
ClientService |
getClientService()
Returns the client service of this Hazelcast instance.
|
Cluster |
getCluster()
Returns the Cluster that this Hazelcast instance is part of.
|
Config |
getConfig()
Returns the configuration of this Hazelcast instance.
|
com.hazelcast.client.connection.ClientConnectionManager |
getConnectionManager() |
ICountDownLatch |
getCountDownLatch(String name)
Creates cluster-wide CountDownLatch.
|
<T extends DistributedObject> |
getDistributedObject(String serviceName,
Object id)
Deprecated.
|
<T extends DistributedObject> |
getDistributedObject(String serviceName,
String name) |
Collection<DistributedObject> |
getDistributedObjects()
Returns all
DistributedObject's such as; queue, map, set, list, topic, lock, multimap. |
IExecutorService |
getExecutorService(String name)
Returns the distributed executor service for the given
name.
|
IdGenerator |
getIdGenerator(String name)
Creates cluster-wide unique IDs.
|
ClientInvocationService |
getInvocationService() |
LifecycleService |
getLifecycleService()
Returns the lifecycle service for this instance.
|
<E> IList<E> |
getList(String name)
Returns the distributed list instance with the specified name.
|
ILock |
getLock(Object key)
Deprecated.
|
ILock |
getLock(String key)
Returns the distributed lock instance for the specified key object.
|
com.hazelcast.logging.LoggingService |
getLoggingService()
Returns the logging service of this Hazelcast instance.
|
<K,V> IMap<K,V> |
getMap(String name)
Returns the distributed map instance with the specified name.
|
<K,V> MultiMap<K,V> |
getMultiMap(String name)
Returns the distributed multimap instance with the specified name.
|
String |
getName()
Returns the name of this Hazelcast instance
|
PartitionService |
getPartitionService()
Returns the partition service of this Hazelcast instance.
|
<E> IQueue<E> |
getQueue(String name)
Returns the distributed queue instance with the specified name.
|
ISemaphore |
getSemaphore(String name)
Creates cluster-wide semaphore.
|
SerializationService |
getSerializationService() |
<E> ISet<E> |
getSet(String name)
Returns the distributed set instance with the specified name.
|
ThreadGroup |
getThreadGroup() |
<E> ITopic<E> |
getTopic(String name)
Returns the distributed topic instance with the specified name.
|
ConcurrentMap<String,Object> |
getUserContext()
Returns a ConcurrentMap that can be used to add user-context to the HazelcastInstance.
|
static HazelcastInstance |
newHazelcastClient() |
static HazelcastInstance |
newHazelcastClient(ClientConfig config) |
TransactionContext |
newTransactionContext()
Creates a new TransactionContext associated with the current thread using default options.
|
TransactionContext |
newTransactionContext(TransactionOptions options)
Creates a new TransactionContext associated with the current thread with given options.
|
boolean |
removeDistributedObjectListener(String registrationId)
Removes the specified Distributed Object listener.
|
void |
shutdown()
Shuts down this HazelcastInstance.
|
static void |
shutdownAll() |
public static HazelcastInstance newHazelcastClient()
public static HazelcastInstance newHazelcastClient(ClientConfig config)
public static Collection<HazelcastInstance> getAllHazelcastClients()
public static void shutdownAll()
public Config getConfig()
HazelcastInstancegetConfig in interface HazelcastInstancepublic String getName()
HazelcastInstancegetName in interface HazelcastInstancepublic <E> IQueue<E> getQueue(String name)
HazelcastInstancegetQueue in interface HazelcastInstancename - name of the distributed queuepublic <E> ITopic<E> getTopic(String name)
HazelcastInstancegetTopic in interface HazelcastInstancename - name of the distributed topicpublic <E> ISet<E> getSet(String name)
HazelcastInstancegetSet in interface HazelcastInstancename - name of the distributed setpublic <E> IList<E> getList(String name)
HazelcastInstancegetList in interface HazelcastInstancename - name of the distributed listpublic <K,V> IMap<K,V> getMap(String name)
HazelcastInstancegetMap in interface HazelcastInstancename - name of the distributed mappublic <K,V> MultiMap<K,V> getMultiMap(String name)
HazelcastInstancegetMultiMap in interface HazelcastInstancename - name of the distributed multimappublic ILock getLock(String key)
HazelcastInstance
Lock lock = hazelcastInstance.getLock("PROCESS_LOCK");
lock.lock();
try {
// process
} finally {
lock.unlock();
}
getLock in interface HazelcastInstancekey - key of the lock instance@Deprecated public ILock getLock(Object key)
getLock in interface HazelcastInstancepublic Cluster getCluster()
HazelcastInstancegetCluster in interface HazelcastInstancepublic IExecutorService getExecutorService(String name)
HazelcastInstanceNote: Note that it don't support invokeAll/Any and don't have standard shutdown behavior
getExecutorService in interface HazelcastInstancename - name of the executor servicepublic <T> T executeTransaction(TransactionalTask<T> task) throws TransactionException
HazelcastInstanceexecuteTransaction in interface HazelcastInstanceT - return type of tasktask - task to be executedTransactionException - if an error occurs during transaction.public <T> T executeTransaction(TransactionOptions options, TransactionalTask<T> task) throws TransactionException
HazelcastInstanceexecuteTransaction in interface HazelcastInstanceT - return type of taskoptions - options for this transactional tasktask - task to be executedTransactionException - if an error occurs during transaction.public TransactionContext newTransactionContext()
HazelcastInstancenewTransactionContext in interface HazelcastInstancepublic TransactionContext newTransactionContext(TransactionOptions options)
HazelcastInstancenewTransactionContext in interface HazelcastInstanceoptions - options for this transactionpublic IdGenerator getIdGenerator(String name)
HazelcastInstancegetIdGenerator in interface HazelcastInstancename - name of the IdGeneratorpublic IAtomicLong getAtomicLong(String name)
HazelcastInstancegetAtomicLong in interface HazelcastInstancename - name of the IAtomicLong proxypublic ICountDownLatch getCountDownLatch(String name)
HazelcastInstancegetCountDownLatch in interface HazelcastInstancename - name of the ICountDownLatch proxypublic ISemaphore getSemaphore(String name)
HazelcastInstancegetSemaphore in interface HazelcastInstancename - name of the ISemaphore proxypublic Collection<DistributedObject> getDistributedObjects()
HazelcastInstanceDistributedObject's such as; queue, map, set, list, topic, lock, multimap.getDistributedObjects in interface HazelcastInstancepublic String addDistributedObjectListener(DistributedObjectListener distributedObjectListener)
HazelcastInstanceDistributedObject will be created or destroyed.addDistributedObjectListener in interface HazelcastInstancedistributedObjectListener - instance listenerpublic boolean removeDistributedObjectListener(String registrationId)
HazelcastInstanceremoveDistributedObjectListener in interface HazelcastInstanceregistrationId - Id of listener registration.public PartitionService getPartitionService()
HazelcastInstancegetPartitionService in interface HazelcastInstancepublic ClientService getClientService()
HazelcastInstancegetClientService in interface HazelcastInstancepublic com.hazelcast.logging.LoggingService getLoggingService()
HazelcastInstancegetLoggingService in interface HazelcastInstancepublic LifecycleService getLifecycleService()
HazelcastInstancegetLifecycleService in interface HazelcastInstance@Deprecated public <T extends DistributedObject> T getDistributedObject(String serviceName, Object id)
getDistributedObject in interface HazelcastInstanceT - type of the DistributedObjectserviceName - name of the serviceid - identifier of the objectpublic <T extends DistributedObject> T getDistributedObject(String serviceName, String name)
getDistributedObject in interface HazelcastInstanceT - type of the DistributedObjectserviceName - name of the servicename - name of the objectpublic ConcurrentMap<String,Object> getUserContext()
HazelcastInstancegetUserContext in interface HazelcastInstancepublic ClientConfig getClientConfig()
public SerializationService getSerializationService()
public com.hazelcast.client.connection.ClientConnectionManager getConnectionManager()
public ClientClusterService getClientClusterService()
public ClientExecutionService getClientExecutionService()
public ClientPartitionService getClientPartitionService()
public ClientInvocationService getInvocationService()
public ThreadGroup getThreadGroup()
public void shutdown()
HazelcastInstanceLifecycleService.shutdown().shutdown in interface HazelcastInstanceCopyright © 2017 Hazelcast, Inc.. All Rights Reserved.