com.hazelcast.client

## Class ClientOutOfMemoryHandler

- java.lang.Object
- - com.hazelcast.core.OutOfMemoryHandler
  - - com.hazelcast.instance.DefaultOutOfMemoryHandler
    - - com.hazelcast.client.ClientOutOfMemoryHandler

-     public class ClientOutOfMemoryHandler
      extends DefaultOutOfMemoryHandler

  To clear resources of the client upon OutOfMemory

- - ### Field Summary

    - ### Fields inherited from class com.hazelcast.instance.DefaultOutOfMemoryHandler

      `FREE_MAX_PERCENTAGE_PROP`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClientOutOfMemoryHandler()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `onOutOfMemory(OutOfMemoryError oome, HazelcastInstance[] hazelcastInstances)` When an `OutOfMemoryError` is caught by Hazelcast threads, this method is called for ALL `HazelcastInstance`s knows by current JVM (actually ClassLoader).

    - ### Methods inherited from class com.hazelcast.instance.DefaultOutOfMemoryHandler

      `shouldHandle`

    - ### Methods inherited from class com.hazelcast.core.OutOfMemoryHandler

      `tryCloseConnections, tryShutdown`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ClientOutOfMemoryHandler

          public ClientOutOfMemoryHandler()

  - ### Method Detail

    - #### onOutOfMemory

          public void onOutOfMemory(OutOfMemoryError oome,
                                    HazelcastInstance[] hazelcastInstances)

      Description copied from class: `OutOfMemoryHandler`
      When an `OutOfMemoryError` is caught by Hazelcast threads, this method is called for ALL `HazelcastInstance`s knows by current JVM (actually ClassLoader).

      User can shutdown the `HazelcastInstance`, call `System.exit()`, just log the error, etc. The default handler tries to close socket connections to other nodes and shutdown the `HazelcastInstance`.

      Warning: `OutOfMemoryHandler` may not be called even if JVM throws `OutOfMemoryError` because the error may be thrown from an external (user) thread and Hazelcast may not be informed about `OutOfMemoryError`.

      Overrides:
        `onOutOfMemory` in class `DefaultOutOfMemoryHandler`
      Parameters:
        `oome` - OutOfMemoryError thrown by JVM
        `hazelcastInstances` - All HazelcastInstances known by JVM, can include inactive or NULL instances.
      See Also:
        `OutOfMemoryHandler.tryCloseConnections(HazelcastInstance)`, `OutOfMemoryHandler.tryShutdown(HazelcastInstance)`

Copyright © 2018. All rights reserved.