public final class HazelcastClient extends Object
Hazelcast
class and provides the ability
the create and manage Hazelcast clients. Hazelcast clients are HazelcastInstance
implementations, so
in most cases most of the code is unaware of talking to a cluster member or a client.
ClientNetworkConfig.setSmartRouting(boolean)
.
Modifier and Type | Method and Description |
---|---|
static Collection<HazelcastInstance> |
getAllHazelcastClients()
Gets an immutable collection of all client HazelcastInstances created in this JVM.
|
static HazelcastInstance |
getHazelcastClientByName(String instanceName)
Returns an existing HazelcastClient with instanceName.
|
static HazelcastInstance |
newHazelcastClient() |
static HazelcastInstance |
newHazelcastClient(ClientConfig config) |
static void |
setOutOfMemoryHandler(OutOfMemoryHandler outOfMemoryHandler)
Sets OutOfMemoryHandler to be used when an OutOfMemoryError
is caught by Hazelcast Client threads.
|
static void |
shutdown(HazelcastInstance instance)
Shutdown the provided client and remove it from the managed list
|
static void |
shutdown(String instanceName)
Shutdown the provided client and remove it from the managed list
|
static void |
shutdownAll()
Shuts down all the client HazelcastInstance created in this JVM.
|
public static HazelcastInstance newHazelcastClient()
public static HazelcastInstance newHazelcastClient(ClientConfig config)
public static HazelcastInstance getHazelcastClientByName(String instanceName)
instanceName
- Name of the HazelcastInstance (client) which can be retrieved by HazelcastInstance.getName()
public static Collection<HazelcastInstance> getAllHazelcastClients()
public static void shutdownAll()
getAllHazelcastClients()
public static void shutdown(HazelcastInstance instance)
instance
- the hazelcast client instancepublic static void shutdown(String instanceName)
instanceName
- the hazelcast client instance namepublic static void setOutOfMemoryHandler(OutOfMemoryHandler outOfMemoryHandler)
Warning: OutOfMemoryHandler may not be called although JVM throws OutOfMemoryError. Because error may be thrown from an external (user thread) thread and Hazelcast may not be informed about OutOfMemoryError.
outOfMemoryHandler
- set when an OutOfMemoryError is caught by HazelcastClient threadsOutOfMemoryError
,
OutOfMemoryHandler
Copyright © 2016 Hazelcast, Inc.. All Rights Reserved.