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

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

There is a newer version: 5.3.0
Show newest version
/*
 * ClearCommand.java
 *
 * Created on September 12, 2006, 12:04 PM
 *
 * Copyright 2005 Alachisoft, Inc. All rights reserved.
 * ALACHISOFT PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.alachisoft.ncache.client.internal.command;

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

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


/**
 * @author Administrator
 * @version 1.0
 */
public final class GetCountCommand extends Command {

    private final int _methodOverload;
    private com.alachisoft.ncache.common.protobuf.CountCommandProtocol.CountCommand _commandInstance;
    /**
     * Creates a new instance of ClearCommand
     *
     * @param isAsync
     */
    public GetCountCommand(int methodOverload) {
        super.name = "CountCommand";
        this._methodOverload = methodOverload;
    }

    protected void createCommand() throws CommandException {
        CountCommandProtocol.CountCommand.Builder
                builder = CountCommandProtocol.CountCommand.newBuilder()
                .setRequestId(super.getRequestId());
        _commandInstance = builder.build();
    }

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

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

    @Override
    public boolean getIsKeyBased()
    {
        return false;
    }

    @Override
    protected void serializeCommandInternal(ByteArrayOutputStream stream) throws IOException
    {
        _commandInstance.writeTo(stream);
    }

    @Override
    protected short getCommandHandle()
    {
        return (short)CommandProtocol.Command.Type.COUNT.getNumber();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy