com.alachisoft.ncache.client.internal.command.GetCountCommand 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.
/*
* 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();
}
}