You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
3.4.11 ( Although I just checked the 4.x code and it has the same problem )
Description:
When implementing a RingbufferStore<byte[]> as in the example, when storeAll is invoked it will fail with a ClassCastException. This is because the RingbufferStoreWrapper converts the data into an Object array before trying to call the main RingBufferStore. An Object[] cannot be cast into an byte[][] so it fails to properly cast the data.
Example:
public class SimpleRingBufferStore implements RingbufferStore<byte[]>
{
public void store(final long sequence, final byte[] data) {}
public void storeAll(long firstItemSequence, byte[] [] items) {}
public byte[] load(long sequence) { return new byte[0]; }
public long getLargestSequence() { return 0L; }
}
var hazelcastInstance = ... // configure with ring buffer store and binary mode
var ringbuffer = hazelcastInstance .getRingbuffer("test_ringbuffer");
// This will fail internally
ringbuffer.addAllAsync(asList("A", "B", "C"), OverflowPolicy.FAIL)
.get();
// This will work
ringbuffer.add("A");
ringbuffer.add("B");
ringbuffer.add("C");
Solution:
The solution seems to be change it to RingBufferStore<Object> and then casting it internally.
The text was updated successfully, but these errors were encountered:
hazelcast-code-samples/distributed-collections/ringbufferstore/src/main/java/TheRingbufferBinaryStore.java
Line 11 in e640f3e
Version:
3.4.11
( Although I just checked the4.x
code and it has the same problem )Description:
When implementing a
RingbufferStore<byte[]>
as in the example, whenstoreAll
is invoked it will fail with aClassCastException
. This is because theRingbufferStoreWrapper
converts the data into anObject
array before trying to call the mainRingBufferStore
. AnObject[]
cannot be cast into anbyte[][]
so it fails to properly cast the data.Example:
Solution:
The solution seems to be change it to
RingBufferStore<Object>
and then casting it internally.The text was updated successfully, but these errors were encountered: