com.alachisoft.ncache.client.internal.command.TouchCommand Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ncache-professional-client Show documentation
Show all versions of ncache-professional-client Show documentation
NCache Professional client for java.
package com.alachisoft.ncache.client.internal.command;
import com.alachisoft.ncache.client.internal.util.ConversionUtil;
import com.alachisoft.ncache.common.protobuf.AddAttributeProtocol;
import com.alachisoft.ncache.common.protobuf.CommandProtocol;
import com.alachisoft.ncache.common.protobuf.TouchCommandProtocol;
import com.alachisoft.ncache.runtime.exceptions.CommandException;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.List;
public class TouchCommand extends Command {
List _keys;
protected com.alachisoft.ncache.common.protobuf.TouchCommandProtocol.TouchCommand _commandInstance;
@Override
public CommandType getCommandType() {
return CommandType.TOUCH;
}
@Override
public RequestType getCommandRequestType() {
return RequestType.AtomicWrite;
}
public TouchCommand(List keys)
{
_keys=keys;
}
@Override
protected void serializeCommandInternal(ByteArrayOutputStream stream) throws IOException
{
_commandInstance.writeTo(stream);
}
@Override
protected short getCommandHandle()
{
return (short)CommandProtocol.Command.Type.ADD_ATTRIBUTE.getNumber();
}
@Override
protected void createCommand() throws CommandException {
TouchCommandProtocol.TouchCommand.Builder touchCommand= TouchCommandProtocol.TouchCommand.newBuilder();
touchCommand.addAllKeys(_keys);
touchCommand.setRequestId(getRequestId());
_commandInstance=touchCommand.build();
}
}