org.infinispan.hotrod.impl.protocol.HeaderParams 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.protocol;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import org.infinispan.hotrod.impl.ClientTopology;
import org.infinispan.hotrod.impl.DataFormat;
/**
* Hot Rod request header parameters
*
* @since 14.0
*/
public class HeaderParams {
final short opCode;
final short opRespCode;
byte[] cacheName;
final int flags;
final byte txMarker;
final AtomicReference clientTopology;
final long messageId;
int topologyAge;
final DataFormat dataFormat;
Map otherParams;
// sent client intelligence: to read the response
volatile byte clientIntelligence;
public HeaderParams(short requestCode, short responseCode, int flags, byte txMarker, long messageId, DataFormat dataFormat, AtomicReference clientTopology) {
opCode = requestCode;
opRespCode = responseCode;
this.flags = flags;
this.txMarker = txMarker;
this.messageId = messageId;
this.dataFormat = dataFormat;
this.clientTopology = clientTopology;
}
public HeaderParams cacheName(byte[] cacheName) {
this.cacheName = cacheName;
return this;
}
public long messageId() {
return messageId;
}
public HeaderParams topologyAge(int topologyAge) {
this.topologyAge = topologyAge;
return this;
}
public DataFormat dataFormat() {
return dataFormat;
}
public byte[] cacheName() {
return cacheName;
}
public void otherParam(String paramKey, byte[] paramValue) {
if (otherParams == null) {
otherParams = new HashMap<>(2);
}
otherParams.put(paramKey, paramValue);
}
public Map otherParams() {
return otherParams;
}
public int flags() {
return flags;
}
public AtomicReference getClientTopology() {
return clientTopology;
}
}