|
|
|
@ -36,15 +36,15 @@ public class LocalCachedMessageCodec extends BaseCodec {
|
|
|
|
|
|
|
|
|
|
public static final LocalCachedMessageCodec INSTANCE = new LocalCachedMessageCodec();
|
|
|
|
|
|
|
|
|
|
private final Decoder<Object> decoder = new Decoder<Object>() {
|
|
|
|
|
@Override
|
|
|
|
|
public Object decode(ByteBuf buf, State state) throws IOException {
|
|
|
|
|
private final Decoder<Object> decoder = (buf, state) -> {
|
|
|
|
|
byte type = buf.readByte();
|
|
|
|
|
if (type == 0x0) {
|
|
|
|
|
byte[] excludedId = new byte[16];
|
|
|
|
|
buf.readBytes(excludedId);
|
|
|
|
|
byte[] id = new byte[16];
|
|
|
|
|
buf.readBytes(id);
|
|
|
|
|
boolean releaseSemaphore = buf.readBoolean();
|
|
|
|
|
return new LocalCachedMapClear(id, releaseSemaphore);
|
|
|
|
|
return new LocalCachedMapClear(excludedId, id, releaseSemaphore);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (type == 0x1) {
|
|
|
|
@ -112,17 +112,14 @@ public class LocalCachedMessageCodec extends BaseCodec {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
throw new IllegalArgumentException("Can't parse packet");
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private final Encoder encoder = new Encoder() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ByteBuf encode(Object in) throws IOException {
|
|
|
|
|
private final Encoder encoder = in -> {
|
|
|
|
|
if (in instanceof LocalCachedMapClear) {
|
|
|
|
|
LocalCachedMapClear li = (LocalCachedMapClear) in;
|
|
|
|
|
ByteBuf result = ByteBufAllocator.DEFAULT.buffer(1);
|
|
|
|
|
result.writeByte(0x0);
|
|
|
|
|
result.writeBytes(li.getExcludedId());
|
|
|
|
|
result.writeBytes(li.getRequestId());
|
|
|
|
|
result.writeBoolean(li.isReleaseSemaphore());
|
|
|
|
|
return result;
|
|
|
|
@ -191,7 +188,6 @@ public class LocalCachedMessageCodec extends BaseCodec {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
throw new IllegalArgumentException("Can't encode packet " + in);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|