All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alachisoft.ncache.client.internal.command.DisposeReaderCommand Maven / Gradle / Ivy

package com.alachisoft.ncache.client.internal.command;

import com.alachisoft.ncache.common.protobuf.CommandProtocol;
import com.alachisoft.ncache.runtime.exceptions.CommandException;

import java.io.ByteArrayOutputStream;
import java.io.IOException;

public class DisposeReaderCommand extends Command {
    String _readerId;
    String _nodeIp;
    int _methodOverload;
    protected com.alachisoft.ncache.common.protobuf.DisposeReaderCommandProtocol.DisposeReaderCommand _commandInstance;

    public DisposeReaderCommand(String readerId, String nodeIp, int methodOverload)
    {
        super.name = "DisposeReaderCommand";
        this._readerId = readerId;
        this._nodeIp = nodeIp;
        this._methodOverload = methodOverload;
    }

    @Override
    public RequestType getCommandRequestType() {
        return RequestType.InternalCommand;
    }

    @Override
    public CommandType getCommandType() {
        return CommandType.DISPOSE_READER;
    }

    @Override
    protected  void serializeCommandInternal(ByteArrayOutputStream stream) throws IOException
    {
        _commandInstance.writeTo(stream);
    }
    @Override
    protected short getCommandHandle()
    {
        return (short) CommandProtocol.Command.Type.DISPOSE_READER.getNumber();
    }

    @Override
    protected void createCommand() throws CommandException {
        com.alachisoft.ncache.common.protobuf.DisposeReaderCommandProtocol.DisposeReaderCommand.Builder builder = com.alachisoft.ncache.common.protobuf.DisposeReaderCommandProtocol.DisposeReaderCommand.newBuilder();
        if(_readerId!=null){
            builder.setReaderId(_readerId);
        }
        if(_nodeIp!=null){
            builder.setReaderId(_nodeIp);
        }

        _commandInstance = builder.setRequestId(super.getRequestId())
                .setClientLastViewId(getClientLastViewId())
                .setMethodOverload(_methodOverload)
                .build();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy