@PrivateApi public final class HazelcastInstanceProxy extends Object implements HazelcastInstance, SerializationServiceSupport
| Modifier and Type | Field and Description |
|---|---|
protected HazelcastInstanceImpl |
original |
| Modifier | Constructor and Description |
|---|---|
protected |
HazelcastInstanceProxy(HazelcastInstanceImpl original) |
| 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. |
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.
|
ICacheManager |
getCacheManager()
Obtain the
ICacheManager that provides access to JSR-107 (JCache) caches configured on a Hazelcast cluster. |
CardinalityEstimator |
getCardinalityEstimator(String name)
Obtain a
CardinalityEstimator with the given name. |
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.
|
FlakeIdGenerator |
getFlakeIdGenerator(String name)
Creates a cluster-wide unique ID generator.
|
IdGenerator |
getIdGenerator(String name)
Creates cluster-wide unique ID generator.
|
JobTracker |
getJobTracker(String name)
Returns the job tracker instance with the specified name.
|
LifecycleService |
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.
|
<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.
|
HazelcastInstanceImpl |
getOriginal() |
PartitionService |
getPartitionService()
Returns the partition service of this Hazelcast instance.
|
PNCounter |
getPNCounter(String name)
Obtain a
PNCounter with the given
name. |
<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.
|
IScheduledExecutorService |
getScheduledExecutorService(String name)
Returns the
IScheduledExecutorService scheduled executor service for the given 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() |
protected volatile HazelcastInstanceImpl original
protected HazelcastInstanceProxy(HazelcastInstanceImpl original)
public String getName()
HazelcastInstancegetName in interface HazelcastInstancepublic <K,V> IMap<K,V> getMap(String name)
HazelcastInstancegetMap in interface HazelcastInstancename - name of the distributed mappublic <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> ITopic<E> getReliableTopic(String name)
HazelcastInstancegetReliableTopic in interface HazelcastInstancename - name of the reliable ITopicpublic <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> MultiMap<K,V> getMultiMap(String name)
HazelcastInstancegetMultiMap in interface HazelcastInstancename - name of the distributed multimappublic JobTracker getJobTracker(String name)
HazelcastInstancegetJobTracker in interface HazelcastInstancename - name of the job trackerpublic <E> Ringbuffer<E> getRingbuffer(String name)
HazelcastInstancegetRingbuffer in interface HazelcastInstancename - 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 HazelcastInstancekey - key of the lock instancepublic IExecutorService getExecutorService(String name)
HazelcastInstance
Note: Note that it doesn't support invokeAll/Any
and doesn't have standard shutdown behavior
getExecutorService in interface HazelcastInstancename - name of the executor servicepublic DurableExecutorService getDurableExecutorService(String name)
HazelcastInstance
Note: Note that it doesn't support invokeAll/Any
and doesn't have standard shutdown behavior
getDurableExecutorService in interface HazelcastInstancename - name of the executor servicepublic <T> T executeTransaction(TransactionalTask<T> task) throws TransactionException
HazelcastInstanceexecuteTransaction in interface HazelcastInstanceT - 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
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)
HazelcastInstancelong primitive values
between 0 and Long.MAX_VALUE. ID generation occurs almost at the speed of
local AtomicLong.incrementAndGet(). Generated IDs are unique during the life
cycle of the cluster. If the entire cluster is restarted, IDs start from 0 again.getIdGenerator in interface HazelcastInstancename - name of the IdGeneratorpublic FlakeIdGenerator getFlakeIdGenerator(String name)
HazelcastInstancelong primitive values
and are k-ordered (roughly ordered). IDs are in the range from 0 to Long.MAX_VALUE.
The IDs contain timestamp component and a node ID component, which is assigned when the member
joins the cluster. This allows the IDs to be ordered and unique without any coordination between
members, which makes the generator safe even in split-brain scenario (for caveats,
see here).
For more details and caveats, see class documentation for FlakeIdGenerator.
Note: this implementation doesn't share namespace with HazelcastInstance.getIdGenerator(String).
That is, getIdGenerator("a") is distinct from getFlakeIdGenerator("a").
getFlakeIdGenerator in interface HazelcastInstancename - name of the FlakeIdGeneratorpublic IAtomicLong getAtomicLong(String name)
HazelcastInstanceIAtomicLong is distributed
implementation of java.util.concurrent.atomic.AtomicLong.getAtomicLong in interface HazelcastInstancename - name of the IAtomicLong proxypublic <K,V> ReplicatedMap<K,V> getReplicatedMap(String name)
HazelcastInstancegetReplicatedMap in interface HazelcastInstancename - name of the distributed mappublic <E> IAtomicReference<E> getAtomicReference(String name)
HazelcastInstanceIAtomicReference is distributed
implementation of java.util.concurrent.atomic.AtomicReference.getAtomicReference in interface HazelcastInstancename - name of the IAtomicReference proxyIAtomicReference proxy for the given namepublic ICountDownLatch getCountDownLatch(String name)
HazelcastInstanceICountDownLatch is distributed
implementation of java.util.concurrent.CountDownLatch.getCountDownLatch in interface HazelcastInstancename - name of the ICountDownLatch proxyICountDownLatch proxy for the given namepublic ISemaphore getSemaphore(String name)
HazelcastInstanceISemaphore is distributed
implementation of java.util.concurrent.Semaphore.getSemaphore in interface HazelcastInstancename - name of the ISemaphore proxyISemaphore proxy for the given namepublic ICacheManager getCacheManager()
HazelcastInstanceICacheManager 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 HazelcastInstanceICacheManagerICacheManagerpublic Cluster getCluster()
HazelcastInstancegetCluster in interface HazelcastInstancepublic Member getLocalEndpoint()
HazelcastInstance
Returned endpoint will be a Member instance for cluster nodes
and a Client instance for clients.
getLocalEndpoint in interface HazelcastInstanceEndpoint which this HazelcastInstance belongs toMember,
Clientpublic Collection<DistributedObject> getDistributedObjects()
HazelcastInstanceDistributedObject's such as; queue, map, set, list, topic, lock, multimap.getDistributedObjects in interface HazelcastInstancepublic Config getConfig()
HazelcastInstancegetConfig in interface HazelcastInstancepublic PartitionService getPartitionService()
HazelcastInstancegetPartitionService in interface HazelcastInstancepublic QuorumService getQuorumService()
HazelcastInstanceQuorum service can be used to retrieve quorum callbacks which let you to notify quorum results of your own to the cluster quorum service. IMPORTANT: The term "quorum" simply refers to the count of members in the cluster required for an operation to succeed. It does NOT refer to an implementation of Paxos or Raft protocols as used in many NoSQL and distributed systems. The mechanism it provides in Hazelcast protects the user in case the number of nodes in a cluster drops below the specified one.
getQuorumService in interface HazelcastInstancepublic ClientService getClientService()
HazelcastInstancegetClientService in interface HazelcastInstanceClientService of this Hazelcast instance.public LoggingService getLoggingService()
HazelcastInstanceLoggingService allows you to listen for LogEvents generated by Hazelcast runtime. You can log the events somewhere or take action based on the message.
getLoggingService in interface HazelcastInstancepublic LifecycleService getLifecycleService()
HazelcastInstanceLifecycleService allows you to shutdown this HazelcastInstance and listen for the lifecycle events.
getLifecycleService in interface HazelcastInstancepublic <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 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 registrationtrue if registration is removed, false otherwisepublic ConcurrentMap<String,Object> getUserContext()
HazelcastInstanceHazelcastInstanceAware 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 HazelcastInstancepublic HazelcastXAResource getXAResource()
HazelcastInstancegetXAResource in interface HazelcastInstancepublic CardinalityEstimator getCardinalityEstimator(String name)
HazelcastInstanceCardinalityEstimator with the given name.
The estimator can be used to efficiently estimate the cardinality of unique entities in big data sets, without the need of storing them.
The estimator is based on a HyperLogLog++ data-structure.
getCardinalityEstimator in interface HazelcastInstancename - the name of the estimatorCardinalityEstimatorpublic PNCounter getPNCounter(String name)
HazelcastInstancePNCounter with the given
name.
The PN counter can be used as a counter with strong eventual consistency guarantees - if operations to the counters stop, the counter values of all replicas that can communicate with each other should eventually converge to the same value.
getPNCounter in interface HazelcastInstancename - the name of the PN counterPNCounterpublic IScheduledExecutorService getScheduledExecutorService(String name)
HazelcastInstanceIScheduledExecutorService scheduled executor service for the given name.
ScheduledExecutor service enables you to schedule your Runnables and Callables
on the Hazelcast cluster.getScheduledExecutorService in interface HazelcastInstancename - name of the executor servicepublic void shutdown()
HazelcastInstanceLifecycleService.shutdown().shutdown in interface HazelcastInstancepublic InternalSerializationService getSerializationService()
getSerializationService in interface SerializationServiceSupportpublic HazelcastInstanceImpl getOriginal()
Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.