org.infinispan.hotrod.impl.operations.IterationEndOperation Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of infinispan-hotrod-jakarta Show documentation
Show all versions of infinispan-hotrod-jakarta Show documentation
Infinispan Hot Rod Client Jakarta EE
package org.infinispan.hotrod.impl.operations;
import static org.infinispan.hotrod.impl.logging.Log.HOTROD;
import java.util.concurrent.CompletableFuture;
import org.infinispan.api.common.CacheOptions;
import org.infinispan.hotrod.impl.transport.netty.HeaderDecoder;
import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
/**
* @since 14.0
*/
public class IterationEndOperation extends HotRodOperation {
private final byte[] iterationId;
private final Channel channel;
protected IterationEndOperation(OperationContext operationContext, CacheOptions options, byte[] iterationId, Channel channel) {
super(operationContext, ITERATION_END_REQUEST, ITERATION_END_RESPONSE, options);
this.iterationId = iterationId;
this.channel = channel;
}
@Override
public CompletableFuture execute() {
if (!channel.isActive()) {
throw HOTROD.channelInactive(channel.remoteAddress(), channel.remoteAddress());
}
scheduleRead(channel);
sendArrayOperation(channel, iterationId);
releaseChannel(channel);
return this;
}
@Override
public void acceptResponse(ByteBuf buf, short status, HeaderDecoder decoder) {
complete(new IterationEndResponse(status));
}
}