RingbufferStore does not support byte[] as type parameter.

オープン
#417 コメント 1 件 リアクション 0 件 担当者 1 名 GitHub で見る

@mmedenjak がすでに取り組んでいます。

2020年5月4日 から。

評価

この issue はまだ評価されていません。

説明

https://github.com/hazelcast/hazelcast-code-samples/blob/e640f3ea1c3659e954e4dcfc91f55079675314a5/distributed-collections/ringbufferstore/src/main/java/TheRingbufferBinaryStore.java#L11

Version:

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.

主要言語
Java
スター
558
フォーク
599
PR マージ指標
30日以内にマージされた PR はありません

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

hazelcast/hazelcast-code-samples のほかの issue

hazelcast/hazelcast-code-samples の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。