同じマシンで 3 つの Hazelcast ノードを実行しています。各ノードは AtomicReference を変更しようとします。1 番目と 2 番目のノードは問題なく実行されており、3 番目のノードは HazelcastSerializationException をスローしています。
Hazelcast バージョン: Hazelcast 3.4.2 (20150326 - f6349a4)
何が起こっているか知っている人はいますか?
スレッド「メイン」での例外 com.hazelcast.nio.serialization.HazelcastSerializationException: Data インスタンスを書き込めません! 代わりに #writeData(ObjectDataOutput out, Data data) を使用してください。 com.hazelcast.nio.serialization.SerializationServiceImpl.writeObject (SerializationServiceImpl.java:272) で com.hazelcast.nio.serialization.ByteArrayObjectDataOutput.writeObject (ByteArrayObjectDataOutput.java:262) で com.hazelcast.concurrent.atomicreference.operations.AbstractAlterOperation.writeInternal (AbstractAlterOperation.java:61) で com.hazelcast.spi.Operation.writeData (Operation.java:281) で com.hazelcast.nio.serialization.DataSerializer.write (DataSerializer.java:140) で com.hazelcast.nio.serialization.DataSerializer.write(DataSerializer.java:39) で com.hazelcast.nio.serialization.StreamSerializerAdapter.toData (StreamSerializerAdapter.java:51) で com.hazelcast.nio.serialization.SerializationServiceImpl.toData (SerializationServiceImpl.java:222) で com.hazelcast.nio.serialization.SerializationServiceImpl.toData (SerializationServiceImpl.java:203) で com.hazelcast.spi.impl.NodeEngineImpl.toData (NodeEngineImpl.java:180) で com.hazelcast.spi.impl.BasicOperationService.send (BasicOperationService.java:348) で com.hazelcast.spi.impl.BasicInvocation.doInvokeRemote (BasicInvocation.java:288) で com.hazelcast.spi.impl.BasicInvocation.doInvoke (BasicInvocation.java:260) で com.hazelcast.spi.impl.BasicInvocation.invoke (BasicInvocation.java:229) で com.hazelcast.spi.impl.BasicOperationService.invokeOnPartition (BasicOperationService.java:272) で com.hazelcast.concurrent.atomicreference.AtomicReferenceProxy.asyncInvoke (AtomicReferenceProxy.java:56) で com.hazelcast.concurrent.atomicreference.AtomicReferenceProxy.asyncAlterAndGet (AtomicReferenceProxy.java:87) で com.hazelcast.concurrent.atomicreference.AtomicReferenceProxy.alterAndGet (AtomicReferenceProxy.java:78) で com.senior.seguranca.csm.datamart.hazelcast.HazelcastTest.(HazelcastTest.java:18) で com.senior.seguranca.csm.datamart.hazelcast.HazelcastTest.main (HazelcastTest.java:22) で
私のコード:
package com.senior.seguranca.csm.datamart.hazelcast;
import com.hazelcast.config.Config;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.IAtomicReference;
import com.hazelcast.core.IFunction;
public class HazelcastTest {
public HazelcastTest() {
Config config = new Config();
config.setInstanceName("HAZELCAST_INSTANCE");
HazelcastInstance hazelcastInstance = Hazelcast.getOrCreateHazelcastInstance(config);
IAtomicReference<String> atomicReference = hazelcastInstance.getAtomicReference("TEST");
String item = "A";
System.out.println("Item: " + atomicReference.alterAndGet(new MyFunction(item)));
}
public static void main(String[] args) {
new HazelcastTest();
}
}
class MyFunction implements IFunction<String, String> {
private String newItem;
public MyFunction(String newItem) {
this.newItem = newItem;
}
@Override
public String apply(String item) {
return newItem;
}
}