newlogic
newlogic

Reputation: 827

How does hazelcast deal with serialized lambdas?

According to Oracle its not advisable to serialize lamdbas, it's possible to use serialized lambdas with Hazelcast and I'm wondering how it deals with this, are there issues around duplication of lambda classes? e.g. the wrong code might be executed when generated classes for lambdas are duplicated. Im most interested in using the distributed executor and distributed map implementations.

Upvotes: 1

Views: 591

Answers (1)

noctarius
noctarius

Reputation: 6104

Serialized Lambdas are serialized according to the Java Lambda serialization specification. The only officially supported way is the standard way by doing the "double cast":

(Runnable & Serializable) (v) -> System.out.println(v);

That way it is serialized as with Java Serialization. However I would recommend not to capture any external content into the lambda.

Upvotes: 2

Related Questions