Want to try Hazelcast 5.0?

We’ve combined the in-memory storage of IMDG with the stream processing power of Jet to bring you an all new Hazelcast platform.

Serialization

Hazelcast needs to serialize the Java objects that you put into Hazelcast because Hazelcast is a distributed system. The data and its replicas are stored in different partitions on multiple cluster members. The data you need may not be present on the local member, and in that case, Hazelcast retrieves that data from another member. This requires serialization.

Serialization is used in the following cases:

  • Adding key/value objects to a map

  • Putting items in a queue/set/list

  • Sending a runnable using an executor service

  • Processing an entry within a map

  • Locking an object

  • Sending a message to a topic

Hazelcast optimizes the serialization for the basic types and their array types with its built-in serializers. By default, you cannot override this behavior; however, Hazelcast offers a way to override them using a configuration option, see the Overriding the Default Serializers section.

Hazelcast’s built-in serializers can handle the following types:

  • Byte, Boolean, Character, Short, Integer, Long, Float, Double, String, UUID

  • byte[], boolean[], char[], short[], int[], long[], float[], double[], String[]

  • Class, Optional, Date, BigInteger, BigDecimal, ArrayList, LinkedList, CopyOnWriteArrayList/Set, HashMap/Set, ConcurrentSkipListMap/Set, ConcurrentHashMap, LinkedHashMap/Set, TreeMap/Set, ArrayDeque, LinkedBlockingQueue, ArrayBlockingQueue, PriorityBlockingQueue, PriorityQueue, DelayQueue, SynchronousQueue, LinkedTransferQueue

Hazelcast optimizes all of the above object types. You do not need to worry about their (de)serializations.