|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface HazelcastInstance
Hazelcast instance. Each Hazelcast instance is a member (node) in a cluster. Multiple Hazelcast instances can be created on a JVM. Each Hazelcast instance has its own socket, threads.
Hazelcast.newHazelcastInstance(Config config)
Method Summary | ||
---|---|---|
String |
addDistributedObjectListener(DistributedObjectListener distributedObjectListener)
Adds a Distributed Object listener which will be notified when a new DistributedObject will be created or destroyed. |
|
|
executeTransaction(TransactionalTask<T> task)
Executes the given transactional task in current thread using default options and returns the result of the task. |
|
|
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. |
|
|
getAtomicReference(String name)
Creates cluster-wide atomic reference. |
|
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. |
|
|
getDistributedObject(String serviceName,
Object id)
Deprecated. use getDistributedObject(String, String) instead. |
|
|
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. |
|
JobTracker |
getJobTracker(String name)
Returns the job tracker instance with the specified name. |
|
LifecycleService |
getLifecycleService()
Returns the lifecycle service for this instance. |
|
|
getList(String name)
Returns the distributed list instance with the specified name. |
|
Endpoint |
getLocalEndpoint()
Returns the local Endpoint which this HazelcastInstance belongs to. |
|
ILock |
getLock(Object key)
Deprecated. will be removed in Hazelcast 3.2. Use getLock(String) instead. |
|
ILock |
getLock(String key)
Returns the distributed lock instance for the specified key object. |
|
LoggingService |
getLoggingService()
Returns the logging service of this Hazelcast instance. |
|
|
getMap(String name)
Returns the distributed map instance with the specified name. |
|
|
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. |
|
|
getQueue(String name)
Returns the distributed queue instance with the specified name. |
|
|
getReplicatedMap(String name)
Returns the replicated map instance with the specified name. |
|
ISemaphore |
getSemaphore(String name)
Creates cluster-wide semaphore. |
|
|
getSet(String name)
Returns the distributed set instance with the specified name. |
|
|
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. |
|
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. |
Method Detail |
---|
String getName()
<E> IQueue<E> getQueue(String name)
name
- name of the distributed queue
<E> ITopic<E> getTopic(String name)
name
- name of the distributed topic
<E> ISet<E> getSet(String name)
name
- name of the distributed set
<E> IList<E> getList(String name)
name
- name of the distributed list
<K,V> IMap<K,V> getMap(String name)
name
- name of the distributed map
<K,V> ReplicatedMap<K,V> getReplicatedMap(String name)
name
- name of the distributed map
JobTracker getJobTracker(String name)
name
- name of the job tracker
<K,V> MultiMap<K,V> getMultiMap(String name)
name
- name of the distributed multimap
ILock getLock(String key)
Lock lock = hazelcastInstance.getLock("PROCESS_LOCK"); lock.lock(); try { // process } finally { lock.unlock(); }
key
- key of the lock instance
@Deprecated ILock getLock(Object key)
getLock(String)
instead.
Cluster getCluster()
Endpoint getLocalEndpoint()
Member
instance for cluster nodes
and a Client
instance for clients.
Endpoint
which this HazelcastInstance belongs toMember
,
Client
IExecutorService getExecutorService(String name)
Note: Note that it don't support invokeAll/Any and don't have standard shutdown behavior
name
- name of the executor service
<T> T executeTransaction(TransactionalTask<T> task) throws TransactionException
T
- return type of tasktask
- the transactional task to be executed
TransactionException
- if an error occurs during transaction.<T> T executeTransaction(TransactionOptions options, TransactionalTask<T> task) throws TransactionException
T
- return type of taskoptions
- options for this transactional tasktask
- task to be executed
TransactionException
- if an error occurs during transaction.TransactionContext newTransactionContext()
TransactionContext newTransactionContext(TransactionOptions options)
options
- options for this transaction
IdGenerator getIdGenerator(String name)
name
- name of the IdGenerator
IAtomicLong getAtomicLong(String name)
IAtomicLong
is distributed
implementation of java.util.concurrent.atomic.AtomicLong.
name
- name of the IAtomicLong
proxy
<E> IAtomicReference<E> getAtomicReference(String name)
IAtomicReference
is distributed
implementation of java.util.concurrent.atomic.AtomicReference.
name
- name of the IAtomicReference
proxy
IAtomicReference
proxy for the given nameICountDownLatch getCountDownLatch(String name)
ICountDownLatch
is distributed
implementation of java.util.concurrent.CountDownLatch.
name
- name of the ICountDownLatch
proxy
ICountDownLatch
proxy for the given nameISemaphore getSemaphore(String name)
ISemaphore
is distributed
implementation of java.util.concurrent.Semaphore.
name
- name of the ISemaphore
proxy
ISemaphore
proxy for the given nameCollection<DistributedObject> getDistributedObjects()
DistributedObject
's such as; queue, map, set, list, topic, lock, multimap.
String addDistributedObjectListener(DistributedObjectListener distributedObjectListener)
DistributedObject
will be created or destroyed.
distributedObjectListener
- instance listener
boolean removeDistributedObjectListener(String registrationId)
registrationId
- Id of listener registration.
Config getConfig()
PartitionService getPartitionService()
ClientService getClientService()
ClientService
of this Hazelcast instance.LoggingService getLoggingService()
LifecycleService getLifecycleService()
@Deprecated <T extends DistributedObject> T getDistributedObject(String serviceName, Object id)
getDistributedObject(String, String)
instead.
T
- type of the DistributedObjectserviceName
- name of the serviceid
- identifier of the object
<T extends DistributedObject> T getDistributedObject(String serviceName, String name)
T
- type of the DistributedObjectserviceName
- name of the servicename
- name of the object
ConcurrentMap<String,Object> getUserContext()
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.
void shutdown()
LifecycleService.shutdown()
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |