![JAR search and dependency download from the Maven repository](/logo.png)
com.alachisoft.ncache.client.internal.command.DictionaryCommandBase Maven / Gradle / Ivy
package com.alachisoft.ncache.client.internal.command;
import com.alachisoft.ncache.common.protobuf.CommandProtocol;
import com.alachisoft.ncache.common.protobuf.DictionaryCommandProtocol;
import com.alachisoft.ncache.common.protobuf.LockInfoProtocol;
import com.alachisoft.ncache.runtime.caching.WriteThruOptions;
import com.alachisoft.ncache.runtime.exceptions.CommandException;
import com.alachisoft.ncache.runtime.util.TimeSpan;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
public abstract class DictionaryCommandBase extends Command {
protected String _lockId;
protected TimeSpan _lockTimeout;
protected WriteThruOptions _writeThruOption;
protected DictionaryCommandProtocol.DictionaryCommand.Builder _dictionaryCommandBuilder;
@Override
protected void createCommand() throws CommandException {
_dictionaryCommandBuilder = DictionaryCommandProtocol.DictionaryCommand.newBuilder();
_dictionaryCommandBuilder.setRequestId(super.getRequestId());
_dictionaryCommandBuilder.setName(key);
LockInfoProtocol.LockInfo.Builder lockInfoBuilder = LockInfoProtocol.LockInfo.newBuilder();
if(_lockId != null)
lockInfoBuilder.setLockId(_lockId);
if(_lockTimeout != null)
lockInfoBuilder.setLockTimeout(_lockTimeout.getTotalTicks());
if (_writeThruOption != null)
{
_dictionaryCommandBuilder.setDsWriteOption((int)_writeThruOption.getMode().getValue());
if(_writeThruOption.getProviderName()!=null) _dictionaryCommandBuilder.setProviderName(_writeThruOption.getProviderName());
}
_dictionaryCommandBuilder.setLockInfo(lockInfoBuilder);
}
@Override
protected void serializeCommandInternal(ByteArrayOutputStream stream) throws IOException {
_dictionaryCommandBuilder.build().writeTo(stream);
}
@Override
protected short getCommandHandle() {
return (short)CommandProtocol.Command.Type.DICTIONARY_COMMAND.getNumber();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy