Package com.hazelcast.client
Class ClientOutOfMemoryHandler
java.lang.Object
com.hazelcast.core.OutOfMemoryHandler
com.hazelcast.client.ClientOutOfMemoryHandler
To clear resources of the client upon OutOfMemory
-
Field Summary
-
Constructor Summary
ConstructorDescriptionClientOutOfMemoryHandler
(double freeVersusMaxRatio) ClientOutOfMemoryHandler
(double freeVersusMaxRatio, com.hazelcast.internal.util.MemoryInfoAccessor memoryInfoAccessor) -
Method Summary
Modifier and TypeMethodDescriptionvoid
onOutOfMemory
(OutOfMemoryError oome, HazelcastInstance[] hazelcastInstances) When anOutOfMemoryError
is caught by Hazelcast threads, this method is called for ALLHazelcastInstance
s knows by current JVM (actually ClassLoader).boolean
shouldHandle
(OutOfMemoryError oome) Decides if the OutOfMemoryError thrown will be handled by this OutOfMemoryHandler or not.
-
Field Details
-
FREE_MAX_PERCENTAGE_PROP
- See Also:
-
GC_OVERHEAD_LIMIT_EXCEEDED
- See Also:
-
-
Constructor Details
-
ClientOutOfMemoryHandler
public ClientOutOfMemoryHandler() -
ClientOutOfMemoryHandler
public ClientOutOfMemoryHandler(double freeVersusMaxRatio) -
ClientOutOfMemoryHandler
public ClientOutOfMemoryHandler(double freeVersusMaxRatio, com.hazelcast.internal.util.MemoryInfoAccessor memoryInfoAccessor)
-
-
Method Details
-
onOutOfMemory
Description copied from class:OutOfMemoryHandler
When anOutOfMemoryError
is caught by Hazelcast threads, this method is called for ALLHazelcastInstance
s knows by current JVM (actually ClassLoader).User can shutdown the
HazelcastInstance
, callSystem.exit()
, just log the error, etc. The default handler tries to close socket connections to other nodes and shutdown theHazelcastInstance
.Warning:
OutOfMemoryHandler#tryCloseConnections(HazelcastInstance) OutOfMemoryHandler#tryShutdown(HazelcastInstance)OutOfMemoryHandler
may not be called even if JVM throwsOutOfMemoryError
because the error may be thrown from an external (user) thread and Hazelcast may not be informed aboutOutOfMemoryError
.- Specified by:
onOutOfMemory
in classOutOfMemoryHandler
- Parameters:
oome
- OutOfMemoryError thrown by JVMhazelcastInstances
- All HazelcastInstances known by JVM, can include inactive or NULL instances.
-
shouldHandle
Description copied from class:OutOfMemoryHandler
Decides if the OutOfMemoryError thrown will be handled by this OutOfMemoryHandler or not. Iftrue
is return,OutOfMemoryHandler.onOutOfMemory(OutOfMemoryError, HazelcastInstance[])
will be called to handle error, otherwise OutOfMemoryError will be ignored.- Overrides:
shouldHandle
in classOutOfMemoryHandler
- Parameters:
oome
- OutOfMemoryError thrown by JVM- Returns:
- true if OutOfMemoryError will be handled, false otherwise
-