com.hazelcast.client
Class HazelcastClient

java.lang.Object
  extended by com.hazelcast.client.HazelcastClient
All Implemented Interfaces:
HazelcastInstance

public class HazelcastClient
extends Object
implements HazelcastInstance

Hazelcast Client enables you to do all Hazelcast operations without being a member of the cluster. It connects to one of the cluster members and delegates all cluster wide operations to it. When the connected cluster member dies, client will automatically switch to another live member.


Method Summary
 void addInstanceListener(InstanceListener instanceListener)
           
protected  void destroy(String proxyName)
           
 AtomicNumber getAtomicNumber(String name)
           
<K,V,E> Object
getClientProxy(Object o)
           
 Cluster getCluster()
           
 Config getConfig()
           
 ConnectionManager getConnectionManager()
           
 ICountDownLatch getCountDownLatch(String name)
           
 ExecutorService getExecutorService()
           
 ExecutorService getExecutorService(String name)
           
 IdGenerator getIdGenerator(String name)
           
 InRunnable getInRunnable()
           
 Collection<Instance> getInstances()
           
 LifecycleService getLifecycleService()
           
<E> IList<E>
getList(String name)
           
 ILock getLock(Object obj)
           
 LoggingService getLoggingService()
           
<K,V> IMap<K,V>
getMap(String name)
           
<K,V> MultiMap<K,V>
getMultiMap(String name)
           
 String getName()
           
 OutRunnable getOutRunnable()
           
 PartitionService getPartitionService()
           
 ClientProperties getProperties()
           
<E> IQueue<E>
getQueue(String name)
           
 ISemaphore getSemaphore(String name)
           
<E> ISet<E>
getSet(String name)
           
<E> ITopic<E>
getTopic(String name)
           
 Transaction getTransaction()
           
 boolean isActive()
           
static HazelcastClient newHazelcastClient(ClientProperties clientProperties, boolean shuffle, InetSocketAddress... addresses)
          Returns a new HazelcastClient.
static HazelcastClient newHazelcastClient(ClientProperties properties, boolean shuffle, String... addresses)
          Returns a new HazelcastClient.
static HazelcastClient newHazelcastClient(ClientProperties properties, List<String> addresses)
          Returns a new HazelcastClient.
static HazelcastClient newHazelcastClient(ClientProperties properties, String... addresses)
          Returns a new HazelcastClient.
static HazelcastClient newHazelcastClient(ClientProperties clientProperties, String address)
          Giving address of one member is enough.
static HazelcastClient newHazelcastClient(String groupName, String groupPassword, boolean shuffle, InetSocketAddress... addresses)
          Returns a new HazelcastClient.
static HazelcastClient newHazelcastClient(String groupName, String groupPassword, boolean shuffle, String... addresses)
          Returns a new HazelcastClient.
static HazelcastClient newHazelcastClient(String groupName, String groupPassword, String... addresses)
          Returns a new HazelcastClient.
static HazelcastClient newHazelcastClient(String groupName, String groupPassword, String address)
          Giving address of one member is enough.
 void removeInstanceListener(InstanceListener instanceListener)
           
 void restart()
           
 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInRunnable

public InRunnable getInRunnable()

getOutRunnable

public OutRunnable getOutRunnable()

newHazelcastClient

public static HazelcastClient newHazelcastClient(String groupName,
                                                 String groupPassword,
                                                 String... addresses)
Returns a new HazelcastClient. It will shuffle the given address list and pick one address to connect. If the connected member will die, client will pick another from given addresses.

Parameters:
groupName - Group name of a cluster that client will connect
groupPassword - Group Password of a cluster that client will connect.
addresses - Addresses of Cluster Members that client will choose one to connect. If the connected member dies client will switch to the next one in the list. An address is in the form ip:port. If you will not specify the port, it will assume the default one, 5701. ex: "10.90.0.1", "10.90.0.2:5702"
Returns:
Returns a new Hazelcast Client instance.

newHazelcastClient

public static HazelcastClient newHazelcastClient(ClientProperties properties,
                                                 String... addresses)
Returns a new HazelcastClient. It will shuffle the given address list and pick one address to connect. If the connected member will die, client will pick another from given addresses.

Parameters:
properties - Client Properties
addresses - Addresses of Cluster Members that client will choose one to connect. If the connected member dies client will switch to the next one in the list. An address is in the form ip:port. If you will not specify the port, it will assume the default one, 5701. ex: "10.90.0.1", "10.90.0.2:5702"
Returns:
Returns a new Hazelcast Client instance.

newHazelcastClient

public static HazelcastClient newHazelcastClient(ClientProperties properties,
                                                 List<String> addresses)
Returns a new HazelcastClient. It will shuffle the given address list and pick one address to connect. If the connected member will die, client will pick another from given addresses.

Parameters:
properties - Client Properties
addresses - List of addresses of Cluster Members that client will choose one to connect. If the connected member dies client will switch to the next one in the list. An address is in the form ip:port. If you will not specify the port, it will assume the default one, 5701. ex: "10.90.0.1", "10.90.0.2:5702"
Returns:
Returns a new Hazelcast Client instance.

newHazelcastClient

public static HazelcastClient newHazelcastClient(String groupName,
                                                 String groupPassword,
                                                 boolean shuffle,
                                                 String... addresses)
Returns a new HazelcastClient. If the connected member will die, client will pick next live address from given addresses.

Parameters:
groupName - Group name of a cluster that client will connect
groupPassword - Group Password of a cluster that client will connect.
shuffle - Specifies whether to shuffle the list of addresses
addresses - Addresses of Cluster Members that client will choose one to connect. If the connected member dies client will switch to the next one in the list. An address is in the form ip:port. If you will not specify the port, it will assume the default one, 5701. ex: "10.90.0.1", "10.90.0.2:5702"
Returns:
Returns a new Hazelcast Client instance.

newHazelcastClient

public static HazelcastClient newHazelcastClient(ClientProperties properties,
                                                 boolean shuffle,
                                                 String... addresses)
Returns a new HazelcastClient. If the connected member will die, client will pick next live address from given addresses.

Parameters:
properties - Client Properties
shuffle - Specifies whether to shuffle the list of addresses
addresses - Addresses of Cluster Members that client will choose one to connect. If the connected member dies client will switch to the next one in the list. An address is in the form ip:port. If you will not specify the port, it will assume the default one, 5701. ex: "10.90.0.1", "10.90.0.2:5702"
Returns:
Returns a new Hazelcast Client instance.

newHazelcastClient

public static HazelcastClient newHazelcastClient(String groupName,
                                                 String groupPassword,
                                                 boolean shuffle,
                                                 InetSocketAddress... addresses)
Returns a new HazelcastClient. If the connected member will die, client will pick next live address from given addresses.

Parameters:
groupName - Group name of a cluster that client will connect
groupPassword - Group Password of a cluster that client will connect.
shuffle - Specifies whether to shuffle the list of addresses
addresses - InetSocketAddress of Cluster Members that client will choose one to connect. If the connected member dies client will switch to the next one in the list.
Returns:
Returns a new Hazelcast Client instance.

newHazelcastClient

public static HazelcastClient newHazelcastClient(ClientProperties clientProperties,
                                                 boolean shuffle,
                                                 InetSocketAddress... addresses)
Returns a new HazelcastClient. If the connected member will die, client will pick next live address from given addresses.

Parameters:
clientProperties - Client Properties
shuffle - Specifies whether to shuffle the list of addresses
addresses - InetSocketAddress of Cluster Members that client will choose one to connect. If the connected member dies client will switch to the next one in the list.
Returns:
Returns a new Hazelcast Client instance.

newHazelcastClient

public static HazelcastClient newHazelcastClient(String groupName,
                                                 String groupPassword,
                                                 String address)
Giving address of one member is enough. It will connect to that member and will get addresses of all members in the cluster. If the connected member will die or leave the cluster, client will automatically switch to another member in the cluster.

Parameters:
groupName - Group name of a cluster that client will connect
groupPassword - Group Password of a cluster that client will connect.
address - Address of one of the members
Returns:
Returns a new HazelcastClient.

newHazelcastClient

public static HazelcastClient newHazelcastClient(ClientProperties clientProperties,
                                                 String address)
Giving address of one member is enough. It will connect to that member and will get addresses of all members in the cluster. If the connected member will die or leave the cluster, client will automatically switch to another member in the cluster.

Parameters:
clientProperties - Client Properties
address - Address of one of the members
Returns:
Returns a new HazelcastClient.

getConfig

public Config getConfig()
Specified by:
getConfig in interface HazelcastInstance

getPartitionService

public PartitionService getPartitionService()
Specified by:
getPartitionService in interface HazelcastInstance

getLoggingService

public LoggingService getLoggingService()
Specified by:
getLoggingService in interface HazelcastInstance

getMap

public <K,V> IMap<K,V> getMap(String name)
Specified by:
getMap in interface HazelcastInstance

getClientProxy

public <K,V,E> Object getClientProxy(Object o)

getTransaction

public Transaction getTransaction()
Specified by:
getTransaction in interface HazelcastInstance

getConnectionManager

public ConnectionManager getConnectionManager()

addInstanceListener

public void addInstanceListener(InstanceListener instanceListener)
Specified by:
addInstanceListener in interface HazelcastInstance

getCluster

public Cluster getCluster()
Specified by:
getCluster in interface HazelcastInstance

getProperties

public ClientProperties getProperties()

getExecutorService

public ExecutorService getExecutorService()
Specified by:
getExecutorService in interface HazelcastInstance

getExecutorService

public ExecutorService getExecutorService(String name)
Specified by:
getExecutorService in interface HazelcastInstance

getIdGenerator

public IdGenerator getIdGenerator(String name)
Specified by:
getIdGenerator in interface HazelcastInstance

getAtomicNumber

public AtomicNumber getAtomicNumber(String name)
Specified by:
getAtomicNumber in interface HazelcastInstance

getCountDownLatch

public ICountDownLatch getCountDownLatch(String name)
Specified by:
getCountDownLatch in interface HazelcastInstance

getSemaphore

public ISemaphore getSemaphore(String name)
Specified by:
getSemaphore in interface HazelcastInstance

getInstances

public Collection<Instance> getInstances()
Specified by:
getInstances in interface HazelcastInstance

getList

public <E> IList<E> getList(String name)
Specified by:
getList in interface HazelcastInstance

getLock

public ILock getLock(Object obj)
Specified by:
getLock in interface HazelcastInstance

getMultiMap

public <K,V> MultiMap<K,V> getMultiMap(String name)
Specified by:
getMultiMap in interface HazelcastInstance

getName

public String getName()
Specified by:
getName in interface HazelcastInstance

getQueue

public <E> IQueue<E> getQueue(String name)
Specified by:
getQueue in interface HazelcastInstance

getSet

public <E> ISet<E> getSet(String name)
Specified by:
getSet in interface HazelcastInstance

getTopic

public <E> ITopic<E> getTopic(String name)
Specified by:
getTopic in interface HazelcastInstance

removeInstanceListener

public void removeInstanceListener(InstanceListener instanceListener)
Specified by:
removeInstanceListener in interface HazelcastInstance

shutdown

public void shutdown()
Specified by:
shutdown in interface HazelcastInstance

isActive

public boolean isActive()

destroy

protected void destroy(String proxyName)

restart

public void restart()
Specified by:
restart in interface HazelcastInstance

getLifecycleService

public LifecycleService getLifecycleService()
Specified by:
getLifecycleService in interface HazelcastInstance


Copyright © 2012 Hazel Bilisim Ltd.. All Rights Reserved.