@PrivateApi public class HazelcastInstanceImpl extends Object implements HazelcastInstance
Modifier | Constructor and Description |
---|---|
protected |
HazelcastInstanceImpl(String name,
Config config,
NodeContext nodeContext) |
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. |
protected Node |
createNode(Config config,
NodeContext nodeContext) |
boolean |
equals(Object o) |
<T> T |
executeTransaction(TransactionalTask<T> task)
Executes the 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 the given transactional task in current thread using given options
and returns the result of the task.
|
IAtomicLong |
getAtomicLong(String name)
Creates cluster-wide atomic long.
|
<E> IAtomicReference<E> |
getAtomicReference(String name)
Creates cluster-wide atomic reference.
|
HazelcastInstanceCacheManager |
getCacheManager()
Obtain the
ICacheManager that provides access to JSR-107 (JCache) caches configured on a Hazelcast cluster. |
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.
|
ICountDownLatch |
getCountDownLatch(String name)
Creates cluster-wide CountDownLatch.
|
<T extends DistributedObject> |
getDistributedObject(String serviceName,
String name) |
Collection<DistributedObject> |
getDistributedObjects()
Returns all
DistributedObject 's such as; queue, map, set, list, topic, lock, multimap. |
DurableExecutorService |
getDurableExecutorService(String name)
Returns the durable executor service for the given
name.
|
IExecutorService |
getExecutorService(String name)
Returns the distributed executor service for the given
name.
|
IdGenerator |
getIdGenerator(String name)
Creates cluster-wide unique IDs.
|
JobTracker |
getJobTracker(String name)
Returns the job tracker instance with the specified name.
|
LifecycleServiceImpl |
getLifecycleService()
Returns the lifecycle service for this instance.
|
<E> IList<E> |
getList(String name)
Returns the distributed list instance with the specified name.
|
Member |
getLocalEndpoint()
Returns the local Endpoint which this HazelcastInstance belongs to.
|
ILock |
getLock(String key)
Returns the distributed lock instance for the specified key object.
|
LoggingService |
getLoggingService()
Returns the logging service of this Hazelcast instance.
|
ManagementService |
getManagementService() |
<K,V> IMap<K,V> |
getMap(String name)
Returns the distributed map instance with the specified name.
|
MemoryStats |
getMemoryStats() |
<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.
|
QuorumService |
getQuorumService()
Returns the quorum service of this Hazelcast instance.
|
<E> ITopic<E> |
getReliableTopic(String name)
Returns the reliable ReliableTopic instance with the specified name.
|
<K,V> ReplicatedMap<K,V> |
getReplicatedMap(String name)
Returns the replicated map instance with the specified name.
|
<E> Ringbuffer<E> |
getRingbuffer(String name)
Returns the distributed Ringbuffer instance with the specified name.
|
ISemaphore |
getSemaphore(String name)
Creates cluster-wide semaphore.
|
InternalSerializationService |
getSerializationService() |
<E> ISet<E> |
getSet(String name)
Returns the distributed set instance with the specified name.
|
<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.
|
HazelcastXAResource |
getXAResource()
Gets xaResource which will participate in XATransaction.
|
int |
hashCode() |
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.
|
String |
toString() |
public final Node node
protected HazelcastInstanceImpl(String name, Config config, NodeContext nodeContext) throws Exception
Exception
protected Node createNode(Config config, NodeContext nodeContext)
public ManagementService getManagementService()
public String getName()
HazelcastInstance
getName
in interface HazelcastInstance
public <K,V> IMap<K,V> getMap(String name)
HazelcastInstance
getMap
in interface HazelcastInstance
name
- name of the distributed mappublic <E> IQueue<E> getQueue(String name)
HazelcastInstance
getQueue
in interface HazelcastInstance
name
- name of the distributed queuepublic <E> ITopic<E> getTopic(String name)
HazelcastInstance
getTopic
in interface HazelcastInstance
name
- name of the distributed topicpublic <E> ITopic<E> getReliableTopic(String name)
HazelcastInstance
getReliableTopic
in interface HazelcastInstance
name
- name of the reliable ITopicpublic <E> ISet<E> getSet(String name)
HazelcastInstance
getSet
in interface HazelcastInstance
name
- name of the distributed setpublic <E> IList<E> getList(String name)
HazelcastInstance
getList
in interface HazelcastInstance
name
- name of the distributed listpublic <K,V> MultiMap<K,V> getMultiMap(String name)
HazelcastInstance
getMultiMap
in interface HazelcastInstance
name
- name of the distributed multimappublic JobTracker getJobTracker(String name)
HazelcastInstance
getJobTracker
in interface HazelcastInstance
name
- name of the job trackerpublic <E> Ringbuffer<E> getRingbuffer(String name)
HazelcastInstance
getRingbuffer
in interface HazelcastInstance
name
- name of the distributed Ringbufferpublic ILock getLock(String key)
HazelcastInstance
Lock lock = hazelcastInstance.getLock("PROCESS_LOCK"); lock.lock(); try { // process } finally { lock.unlock(); }
getLock
in interface HazelcastInstance
key
- key of the lock instancepublic <T> T executeTransaction(TransactionalTask<T> task) throws TransactionException
HazelcastInstance
executeTransaction
in interface HazelcastInstance
T
- return type of tasktask
- the transactional task to be executedTransactionException
- if an error occurs during transaction.public <T> T executeTransaction(TransactionOptions options, TransactionalTask<T> task) throws TransactionException
HazelcastInstance
executeTransaction
in interface HazelcastInstance
T
- return type of taskoptions
- options for this transactional tasktask
- task to be executedTransactionException
- if an error occurs during transaction.public TransactionContext newTransactionContext()
HazelcastInstance
newTransactionContext
in interface HazelcastInstance
public TransactionContext newTransactionContext(TransactionOptions options)
HazelcastInstance
newTransactionContext
in interface HazelcastInstance
options
- options for this transactionpublic IExecutorService getExecutorService(String name)
HazelcastInstance
Note: Note that it don't support invokeAll/Any and don't have standard shutdown behavior
getExecutorService
in interface HazelcastInstance
name
- name of the executor servicepublic DurableExecutorService getDurableExecutorService(String name)
HazelcastInstance
Note: Note that it don't support invokeAll/Any and don't have standard shutdown behavior
getDurableExecutorService
in interface HazelcastInstance
name
- name of the executor servicepublic IdGenerator getIdGenerator(String name)
HazelcastInstance
getIdGenerator
in interface HazelcastInstance
name
- name of the IdGenerator
public IAtomicLong getAtomicLong(String name)
HazelcastInstance
IAtomicLong
is distributed
implementation of java.util.concurrent.atomic.AtomicLong.getAtomicLong
in interface HazelcastInstance
name
- name of the IAtomicLong
proxypublic <E> IAtomicReference<E> getAtomicReference(String name)
HazelcastInstance
IAtomicReference
is distributed
implementation of java.util.concurrent.atomic.AtomicReference.getAtomicReference
in interface HazelcastInstance
name
- name of the IAtomicReference
proxyIAtomicReference
proxy for the given namepublic ICountDownLatch getCountDownLatch(String name)
HazelcastInstance
ICountDownLatch
is distributed
implementation of java.util.concurrent.CountDownLatch.getCountDownLatch
in interface HazelcastInstance
name
- name of the ICountDownLatch
proxyICountDownLatch
proxy for the given namepublic ISemaphore getSemaphore(String name)
HazelcastInstance
ISemaphore
is distributed
implementation of java.util.concurrent.Semaphore.getSemaphore
in interface HazelcastInstance
name
- name of the ISemaphore
proxyISemaphore
proxy for the given namepublic <K,V> ReplicatedMap<K,V> getReplicatedMap(String name)
HazelcastInstance
getReplicatedMap
in interface HazelcastInstance
name
- name of the distributed mappublic HazelcastInstanceCacheManager getCacheManager()
HazelcastInstance
ICacheManager
that provides access to JSR-107 (JCache) caches configured on a Hazelcast cluster.
Note that this method does not return a JCache CacheManager
; to obtain a JCache
CacheManager
use JCache standard API.
getCacheManager
in interface HazelcastInstance
ICacheManager
ICacheManager
public Cluster getCluster()
HazelcastInstance
getCluster
in interface HazelcastInstance
public Member getLocalEndpoint()
HazelcastInstance
Member
instance for cluster nodes
and a Client
instance for clients.getLocalEndpoint
in interface HazelcastInstance
Endpoint
which this HazelcastInstance belongs toMember
,
Client
public Collection<DistributedObject> getDistributedObjects()
HazelcastInstance
DistributedObject
's such as; queue, map, set, list, topic, lock, multimap.getDistributedObjects
in interface HazelcastInstance
public Config getConfig()
HazelcastInstance
getConfig
in interface HazelcastInstance
public ConcurrentMap<String,Object> getUserContext()
HazelcastInstance
HazelcastInstanceAware
interface when submitting a Runnable/Callable to
Hazelcast ExecutorService. By storing the dependencies in the user-context, they can be retrieved as soon
as you have a reference to the HazelcastInstance.
This structure is purely local and Hazelcast remains agnostic abouts its content.getUserContext
in interface HazelcastInstance
public PartitionService getPartitionService()
HazelcastInstance
getPartitionService
in interface HazelcastInstance
public QuorumService getQuorumService()
HazelcastInstance
getQuorumService
in interface HazelcastInstance
public ClientService getClientService()
HazelcastInstance
getClientService
in interface HazelcastInstance
ClientService
of this Hazelcast instance.public LoggingService getLoggingService()
HazelcastInstance
getLoggingService
in interface HazelcastInstance
public LifecycleServiceImpl getLifecycleService()
HazelcastInstance
getLifecycleService
in interface HazelcastInstance
public void shutdown()
HazelcastInstance
LifecycleService.shutdown()
.shutdown
in interface HazelcastInstance
public <T extends DistributedObject> T getDistributedObject(String serviceName, String name)
getDistributedObject
in interface HazelcastInstance
T
- type of the DistributedObjectserviceName
- name of the servicename
- name of the objectpublic String addDistributedObjectListener(DistributedObjectListener distributedObjectListener)
HazelcastInstance
DistributedObject
will be created or destroyed.addDistributedObjectListener
in interface HazelcastInstance
distributedObjectListener
- instance listenerpublic boolean removeDistributedObjectListener(String registrationId)
HazelcastInstance
removeDistributedObjectListener
in interface HazelcastInstance
registrationId
- Id of listener registration.public InternalSerializationService getSerializationService()
public MemoryStats getMemoryStats()
public HazelcastXAResource getXAResource()
HazelcastInstance
getXAResource
in interface HazelcastInstance
Copyright © 2016 Hazelcast, Inc.. All Rights Reserved.