public class FactoryImpl extends Object implements HazelcastInstance
| Modifier and Type | Class and Description |
|---|---|
static class |
FactoryImpl.CreateOrDestroyInstanceProxy |
static class |
FactoryImpl.GetAllProxyKeysCallable |
static class |
FactoryImpl.HazelcastInstanceProxy |
static class |
FactoryImpl.InitializeMap |
static class |
FactoryImpl.ProxyKey |
| Constructor and Description |
|---|
FactoryImpl(String name,
Config config) |
| Modifier and Type | Method and Description |
|---|---|
void |
addInstanceListener(InstanceListener instanceListener)
Add a instance listener which will be notified when a
new instance such as map, queue, multimap, topic, lock is
added or removed.
|
Object |
createProxy(FactoryImpl.ProxyKey proxyKey) |
void |
destroyProxy(FactoryImpl.ProxyKey proxyKey) |
boolean |
equals(Object o) |
static Set<HazelcastInstance> |
getAllHazelcastInstanceProxies() |
AtomicNumber |
getAtomicNumber(String name)
Creates cluster-wide atomic long.
|
ClientService |
getClientService()
Returns the client service of this Hazelcast instance.
|
ClusterImpl |
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.
|
ExecutorService |
getExecutorService()
Returns the default distributed executor service.
|
ExecutorService |
getExecutorService(String name)
Returns the distributed executor service for the given
name.
|
FactoryImpl.HazelcastInstanceProxy |
getHazelcastInstanceProxy() |
static FactoryImpl.HazelcastInstanceProxy |
getHazelcastInstanceProxy(String instanceName) |
IdGenerator |
getIdGenerator(String name)
Creates cluster-wide unique IDs.
|
Collection<Instance> |
getInstances()
Returns all queue, map, set, list, topic, lock, multimap
instances created by Hazelcast.
|
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)
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
|
Object |
getOrCreateProxy(FactoryImpl.ProxyKey proxyKey) |
Object |
getOrCreateProxyByName(String name) |
PartitionService |
getPartitionService()
Returns the partition service of this Hazelcast instance.
|
Collection<HazelcastInstanceAwareInstance> |
getProxies() |
<E> IQueue<E> |
getQueue(String name)
Returns the distributed queue instance with the specified name.
|
ISemaphore |
getSemaphore(String name)
Creates cluster-wide semaphore.
|
<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.
|
Transaction |
getTransaction()
Returns the transaction instance associated with the current thread,
creates a new one if it wasn't already.
|
int |
hashCode() |
void |
initialChecks() |
static void |
kill(FactoryImpl factory) |
static FactoryImpl.HazelcastInstanceProxy |
newHazelcastInstanceProxy(Config config) |
static FactoryImpl.HazelcastInstanceProxy |
newHazelcastInstanceProxy(Config config,
Boolean liteMember) |
void |
removeInstanceListener(InstanceListener instanceListener)
Removes the specified instance listener.
|
void |
restart()
Detaches this member from the cluster first and then restarts it
as a new member.
|
void |
restartToMerge() |
void |
shutdown()
Detaches this member from the cluster.
|
static void |
shutdown(FactoryImpl factory) |
static void |
shutdownAll() |
String |
toString() |
public final Node node
public static Set<HazelcastInstance> getAllHazelcastInstanceProxies()
public static FactoryImpl.HazelcastInstanceProxy getHazelcastInstanceProxy(String instanceName)
public static FactoryImpl.HazelcastInstanceProxy newHazelcastInstanceProxy(Config config)
public static FactoryImpl.HazelcastInstanceProxy newHazelcastInstanceProxy(Config config, Boolean liteMember)
public FactoryImpl.HazelcastInstanceProxy getHazelcastInstanceProxy()
public String getName()
HazelcastInstancegetName in interface HazelcastInstancepublic static void shutdownAll()
public static void kill(FactoryImpl factory)
public static void shutdown(FactoryImpl factory)
public Config getConfig()
HazelcastInstancegetConfig in interface HazelcastInstancepublic Collection<Instance> getInstances()
HazelcastInstancegetInstances in interface HazelcastInstancepublic Collection<HazelcastInstanceAwareInstance> getProxies()
public ExecutorService getExecutorService()
HazelcastInstancegetExecutorService in interface HazelcastInstancepublic ExecutorService getExecutorService(String name)
HazelcastInstancegetExecutorService in interface HazelcastInstancename - name of the executor servicepublic ClusterImpl getCluster()
HazelcastInstancegetCluster in interface HazelcastInstancepublic IdGenerator getIdGenerator(String name)
HazelcastInstancegetIdGenerator in interface HazelcastInstancename - name of the IdGeneratorpublic AtomicNumber getAtomicNumber(String name)
HazelcastInstancegetAtomicNumber in interface HazelcastInstancename - name of the AtomicNumber 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 Transaction getTransaction()
HazelcastInstance
Map map = Hazelcast.getMap("mymap");
Transaction txn = Hazelcast.getTransaction();
txn.begin();
try {
map.put ("key", "value");
txn.commit();
}catch (Exception e) {
txn.rollback();
}
Isolation is always REPEATABLE_READ . If you are in
a transaction, you can read the data in your transaction and the data that
is already committed and if not in a transaction, you can only read the
committed data. Implementation is different for queue and map/set. For
queue operations (offer,poll), offered and/or polled objects are copied to
the next member in order to safely commit/rollback. For map/set, Hazelcast
first acquires the locks for the write operations (put, remove) and holds
the differences (what is added/removed/updated) locally for each transaction.
When transaction is set to commit, Hazelcast will release the locks and
apply the differences. When rolling back, Hazelcast will simply releases
the locks and discard the differences. Transaction instance is attached
to the current thread and each Hazelcast operation checks if the current
thread holds a transaction, if so, operation will be transaction aware.
When transaction is committed, rolled back or timed out, it will be detached
from the thread holding it.getTransaction in interface HazelcastInstancepublic PartitionService getPartitionService()
HazelcastInstancegetPartitionService in interface HazelcastInstancepublic ClientService getClientService()
HazelcastInstancegetClientService in interface HazelcastInstancepublic LoggingService getLoggingService()
HazelcastInstancegetLoggingService in interface HazelcastInstancepublic LifecycleService getLifecycleService()
HazelcastInstancegetLifecycleService in interface HazelcastInstancepublic void restart()
HazelcastInstancerestart in interface HazelcastInstanceHazelcastInstance.getLifecycleService()public void restartToMerge()
public void shutdown()
HazelcastInstanceshutdown in interface HazelcastInstanceHazelcastInstance.getLifecycleService()public <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> 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 ILock getLock(Object key)
HazelcastInstance
Lock lock = Hazelcast.getLock("PROCESS_LOCK");
lock.lock();
try {
// process
} finally {
lock.unlock();
}
getLock in interface HazelcastInstancekey - key of the lock instancepublic Object getOrCreateProxy(FactoryImpl.ProxyKey proxyKey)
public void initialChecks()
public void destroyProxy(FactoryImpl.ProxyKey proxyKey)
public Object createProxy(FactoryImpl.ProxyKey proxyKey)
public void addInstanceListener(InstanceListener instanceListener)
HazelcastInstanceaddInstanceListener in interface HazelcastInstanceinstanceListener - instance listenerpublic void removeInstanceListener(InstanceListener instanceListener)
HazelcastInstanceremoveInstanceListener in interface HazelcastInstanceinstanceListener - instance listener to removeCopyright © 2013 Hazelcast, Inc.. All rights reserved.