diff --git a/protobuf/memcached.proto b/protobuf/memcached.proto deleted file mode 100644 index 6a99565..0000000 --- a/protobuf/memcached.proto +++ /dev/null @@ -1,79 +0,0 @@ -option java_package = "messageBody"; -option java_outer_classname="memcachedmsg"; - -message Test1 -{ - optional string key=1;//string delegate String -} -message messageTest//内部类名 -{ - //optional int32 a = 1; 中1这样的序列号在一个类不能重复 - optional int32 a = 1;//optional代表可选 一般写这个 int32代表java的int - optional int64 b = 2;//int64代表java的Long - optional string key=3;//string 代表String - optional bool d = 4;//bool代表boolean - repeated int32 e=5;//代表 List - optional Test1 f=6;// 嵌套对象 -} - -message nm_Connected -{ - optional int32 num = 1; -} - -message nm_Connected_mem_back -{ - optional int32 num = 1; -} - -message nm_Connected_web_back -{ - optional int32 num = 1; -} - - -message nm_read -{ - optional string key=1; - optional string value=2; - optional int64 time=3; -} - -message nm_read_recovery -{ - optional string key=1; - optional string value=2; - optional int64 time=3; -} - -message nm_write_1 -{ - optional string key=1; - optional string value=2; - optional int64 time=3; - optional int32 memID=4; -} - -message nm_write_1_res -{ - optional string key=1; - optional string value=2; - optional int64 time=3; - optional int32 memID=4; -} - -message nm_write_2 -{ - optional string key=1; - optional string value=2; - optional int64 time=3; - optional int32 memID=4; -} - -message nm_write_2_res -{ - optional string key=1; - optional string value=2; - optional int64 time=3; - optional int32 memID=4; -} diff --git a/protobuf/requestMsg.proto b/protobuf/requestMsg.proto deleted file mode 100644 index 1129beb..0000000 --- a/protobuf/requestMsg.proto +++ /dev/null @@ -1,42 +0,0 @@ -option java_package = "messageBody";//包名 -option java_outer_classname="requestMsg"; //类命 - -// 连接memcached server -message nr_Connected_mem -{ - -} - -message nr_Connected_mem_back -{ - optional int32 memID=1; -} - -message nr_Read -{ - optional string key=1; - optional int32 clientid=2; - optional int64 time=3; -} - -message nr_Read_res -{ - optional string key=1; - optional string value=2; - optional int64 time=3; -} - -message nr_write -{ - optional string key=1; - optional string value=2; - optional int64 time=3; -} - -message nr_write_res -{ - optional string key=1; - optional string value=2; - optional int64 time=3; -} - diff --git a/src/client.xml b/src/client.xml deleted file mode 100644 index 79e2449..0000000 --- a/src/client.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - 0000 - 127.0.0.1 - 30000 - 127.0.0.1:20000 - - - 0001 - 127.0.0.1 - 30001 - 127.0.0.1:20001 - - - 0002 - 127.0.0.1 - 30002 - 127.0.0.1:20002 - - - 0003 - 127.0.0.1 - 30003 - 127.0.0.1:20003 - - \ No newline at end of file diff --git a/src/client/Client.java b/src/client/Client.java deleted file mode 100644 index 123694c..0000000 --- a/src/client/Client.java +++ /dev/null @@ -1,39 +0,0 @@ -package client; -import java.net.InetSocketAddress; -import java.util.concurrent.Executors; -import org.jboss.netty.bootstrap.ClientBootstrap; -import org.jboss.netty.channel.ChannelFuture; -import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory; - -public class Client -{ - ClientBootstrap bootstrap; - ChannelFuture channelFuture; - String host; - int port; - int id; - - public boolean init(String host, int port) - { - bootstrap = new ClientBootstrap( - new NioClientSocketChannelFactory( - Executors.newCachedThreadPool(), - Executors.newCachedThreadPool())); - // Set up the event pipeline factory. - bootstrap.setPipelineFactory(new MClientPipelineFactory()); - // Start the connection attempt. - channelFuture = bootstrap.connect(new InetSocketAddress(host, port)); - return channelFuture.isSuccess(); - } - - public void stop() - { - channelFuture.awaitUninterruptibly(); - if (!channelFuture.isSuccess()) - { - channelFuture.getCause().printStackTrace(); - } - channelFuture.getChannel().getCloseFuture().awaitUninterruptibly(); - bootstrap.releaseExternalResources(); - } -} \ No newline at end of file diff --git a/src/client/ClientMgr.java b/src/client/ClientMgr.java deleted file mode 100644 index d05661a..0000000 --- a/src/client/ClientMgr.java +++ /dev/null @@ -1,120 +0,0 @@ -package client; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map.Entry; - -import server.ClientConfig; - -public class ClientMgr -{ - public HashMap m_mapLocalClients; - static ClientMgr clientMgr; - public int mClientNumber; - public static int nCopyNode; - public static int protocol; - public static final Integer twoPhaseCommit = 0; - public static final Integer paxos = (nCopyNode-1)-((nCopyNode-1)/2+1); - public static final Integer weak = nCopyNode-2; - - public static ClientMgr getInstance() - { - if (clientMgr == null) - { - clientMgr = new ClientMgr(); - } - return clientMgr; - } - - public Integer getSize() { - return m_mapLocalClients.size()+1; - } - - // num 为hash第一个节点 - public boolean isCopyNode(Integer hash) - { - if ((mClientNumber-hash + m_mapLocalClients.size()+1) - %(m_mapLocalClients.size()+1) hm) - { - m_mapLocalClients = new HashMap(); - mClientNumber = num; - - Iterator iter = hm.entrySet().iterator(); - while (iter.hasNext()) - { - Entry entry = (Entry) iter.next(); - ClientConfig cc = (ClientConfig)entry.getValue(); - if (cc.id != mClientNumber) - { - Client lc = new Client(); - lc.host = cc.host; - lc.port = cc.client_port; - lc.id = cc.id; - m_mapLocalClients.put(lc.id, lc); - if(lc.init(lc.host, lc.port)) - { - System.out.println("client connected successful"); - } - } - } - } - - - public String getCopyHost(Integer number, Integer index) - { - Client client =m_mapLocalClients.get((number+index)%getSize()); - if (client==null) { - return null; - } - return client.host+client.port; - } - - public String getCurCoyhost(Integer number) - { - Client client =m_mapLocalClients.get((number+mClientNumber)%m_mapLocalClients.size()); - if (client==null) { - return null; - } - return client.host+client.port; - } - - @SuppressWarnings("rawtypes") - public Integer getClientNum(String host) - { - Iterator iter = m_mapLocalClients.entrySet().iterator(); - while (iter.hasNext()) - { - Entry entry = (Entry) iter.next(); - Client client = (Client)entry.getValue(); - if (host.compareTo("/"+client.host+":"+client.port) == 0) - { - return client.id; - } - } - return -1; - } - - @SuppressWarnings("rawtypes") - public void connect(String host) - { - Iterator iter = m_mapLocalClients.entrySet().iterator(); - while (iter.hasNext()) - { - Entry entry = (Entry) iter.next(); - Client client = (Client)entry.getValue(); - if (client.host == host) - { - client.init(client.host, client.port); - break; - } - } - } -} diff --git a/src/client/MClientHandler.java b/src/client/MClientHandler.java deleted file mode 100644 index ea0da5f..0000000 --- a/src/client/MClientHandler.java +++ /dev/null @@ -1,44 +0,0 @@ -package client; - -import messageBody.memcachedmsg.nm_Connected; -import org.jboss.netty.channel.ChannelHandlerContext; -import org.jboss.netty.channel.ChannelStateEvent; -import org.jboss.netty.channel.ExceptionEvent; -import org.jboss.netty.channel.MessageEvent; -import org.jboss.netty.channel.SimpleChannelUpstreamHandler; - -import server.NetMsg; -import common.EMSGID; - - -public class MClientHandler extends SimpleChannelUpstreamHandler -{ - @Override - public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) - { - nm_Connected.Builder builder = nm_Connected.newBuilder(); - builder.setNum(ClientMgr.getInstance().mClientNumber); - - NetMsg sendMsg = NetMsg.newMessage(); - sendMsg.setMsgID(EMSGID.nm_connected); - sendMsg.setMessageLite(builder); - e.getChannel().write(sendMsg); - } - - @Override - public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) - { - if (!(e.getMessage() instanceof NetMsg)) - { - return;//(1) - } - } - - @Override - public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) - { - if (e.getChannel().getLocalAddress() == null) { - return; - } - } -} \ No newline at end of file diff --git a/src/client/MClientPipelineFactory.java b/src/client/MClientPipelineFactory.java deleted file mode 100644 index 2d4591e..0000000 --- a/src/client/MClientPipelineFactory.java +++ /dev/null @@ -1,21 +0,0 @@ -package client; - -import org.jboss.netty.channel.ChannelPipeline; -import org.jboss.netty.channel.ChannelPipelineFactory; -import org.jboss.netty.channel.Channels; - -import server.MDecoder; -import server.MEncoder; - -public class MClientPipelineFactory implements ChannelPipelineFactory -{ - - public ChannelPipeline getPipeline() throws Exception - { - ChannelPipeline pipeline = Channels.pipeline(); - - pipeline.addLast("decoder", new MDecoder()); - pipeline.addLast("encoder", new MEncoder()); - return pipeline; - } -} \ No newline at end of file diff --git a/src/common/EMSGID.java b/src/common/EMSGID.java deleted file mode 100644 index 36598a9..0000000 --- a/src/common/EMSGID.java +++ /dev/null @@ -1,20 +0,0 @@ -package common; -public enum EMSGID -{ - nr_read, //WebApp send read request to R-Memcached - nr_read_res, //R-Memcached respond read request from WebServer - nr_write, //WebApp send write request to R-Memcached - nr_write_copy, - nr_write_res, //R-Memcached respond write request from WebServer - nr_connected_mem, //Init connection channel between WebApp and R-Memcached - nr_connected_mem_back, - - nm_connected, //Init connection channel between R-Memcached and R-Memcached - nm_connected_mem_back, - nm_connected_web_back, - nm_read, //R-Memcached send read request to another R-Memcached - nm_read_recovery, //data recovery - nm_write_1, //write phase 1 - nm_write_1_res, - nm_write_2 //write phase 2 -} diff --git a/src/common/MessageManager.java b/src/common/MessageManager.java deleted file mode 100644 index bf66b4b..0000000 --- a/src/common/MessageManager.java +++ /dev/null @@ -1,41 +0,0 @@ -package common; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Map; - -import com.google.protobuf.GeneratedMessage; -import com.google.protobuf.InvalidProtocolBufferException; -import com.google.protobuf.MessageLite; - -/** - * - * @author Yanran Lu - * - */ -public class MessageManager { //create messageMap to manage all messages - private static Map messageMap = new HashMap(); - - public static void addMessageCla(int id, //add message to map - Class msgCla) - throws NoSuchMethodException, SecurityException, - IllegalAccessException, IllegalArgumentException, - InvocationTargetException { - if (msgCla == null) - return; - Method method = msgCla.getMethod("getDefaultInstance"); - MessageLite lite = (MessageLite) method.invoke(null, null); - messageMap.put(id, lite); - } - - public static MessageLite getMessage(int id, byte[] body) //get message from map - throws InvalidProtocolBufferException { - MessageLite list = messageMap.get(id); - if (list == null) { - System.err.printf("msg %d no register", id); - return null; - } - return list.newBuilderForType().mergeFrom(body).build(); - } -} diff --git a/src/common/RegisterHandler.java b/src/common/RegisterHandler.java deleted file mode 100644 index 4eb695e..0000000 --- a/src/common/RegisterHandler.java +++ /dev/null @@ -1,56 +0,0 @@ -package common; - -import java.lang.reflect.InvocationTargetException; - -import messageBody.memcachedmsg.nm_Connected; -import messageBody.memcachedmsg.nm_Connected_mem_back; -import messageBody.memcachedmsg.nm_read; -import messageBody.memcachedmsg.nm_read_recovery; -import messageBody.memcachedmsg.nm_write_1; -import messageBody.memcachedmsg.nm_write_1_res; -import messageBody.memcachedmsg.nm_write_2; -import messageBody.requestMsg.nr_Connected_mem; -import messageBody.requestMsg.nr_Read; -import messageBody.requestMsg.nr_write; - -import com.google.protobuf.GeneratedMessage; - -public class RegisterHandler { - public static void initHandler() // register all messages created by - // protobuf and will be handled by R-Memcached - { - initHandler(EMSGID.nm_connected.ordinal(), nm_Connected.class); - initHandler(EMSGID.nm_connected_mem_back.ordinal(), - nm_Connected_mem_back.class); - initHandler(EMSGID.nr_connected_mem.ordinal(), nr_Connected_mem.class); - initHandler(EMSGID.nr_read.ordinal(), nr_Read.class); - initHandler(EMSGID.nm_read.ordinal(), nm_read.class); - initHandler(EMSGID.nm_read_recovery.ordinal(), nm_read_recovery.class); - initHandler(EMSGID.nr_write.ordinal(), nr_write.class); - initHandler(EMSGID.nm_write_1.ordinal(), nm_write_1.class); - initHandler(EMSGID.nm_write_1_res.ordinal(), nm_write_1_res.class); - initHandler(EMSGID.nm_write_2.ordinal(), nm_write_2.class); - } - - private static void initHandler(int id, - Class msgCla) { - try { - MessageManager.addMessageCla(id, msgCla); - } catch (NoSuchMethodException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SecurityException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalArgumentException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (InvocationTargetException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } -} diff --git a/src/config.properties b/src/config.properties deleted file mode 100644 index 0c206f5..0000000 --- a/src/config.properties +++ /dev/null @@ -1,3 +0,0 @@ -webServerHost = 192.168.3.222 -replicasNum = 4 -consistencyProtocol =twoPhaseCommit \ No newline at end of file diff --git a/src/log4j.properties b/src/log4j.properties deleted file mode 100644 index bf10475..0000000 --- a/src/log4j.properties +++ /dev/null @@ -1,4 +0,0 @@ -log4j.rootLogger=ERROR, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n \ No newline at end of file diff --git a/src/memcached/ByteBufArrayInputStream.java b/src/memcached/ByteBufArrayInputStream.java deleted file mode 100644 index a1c1070..0000000 --- a/src/memcached/ByteBufArrayInputStream.java +++ /dev/null @@ -1,117 +0,0 @@ -package cn.edu.buaa.act.memcachedClient; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.nio.ByteBuffer; -import java.util.List; - -public final class ByteBufArrayInputStream extends InputStream implements - LineInputStream { - private ByteBuffer[] bufs; - private int currentBuf = 0; - - public ByteBufArrayInputStream(List bufs) throws Exception { - this(bufs.toArray(new ByteBuffer[] {})); - } - - public ByteBufArrayInputStream(ByteBuffer[] bufs) throws Exception { - if (bufs == null || bufs.length == 0) - throw new Exception("buffer is empty"); - - this.bufs = bufs; - for (ByteBuffer b : bufs) - b.flip(); - } - - public int read() { - do { - if (bufs[currentBuf].hasRemaining()) - return bufs[currentBuf].get(); - currentBuf++; - } while (currentBuf < bufs.length); - - currentBuf--; - return -1; - } - - public int read(byte[] buf) { - int len = buf.length; - int bufPos = 0; - do { - if (bufs[currentBuf].hasRemaining()) { - int n = Math.min(bufs[currentBuf].remaining(), len - bufPos); - bufs[currentBuf].get(buf, bufPos, n); - bufPos += n; - } - currentBuf++; - } while (currentBuf < bufs.length && bufPos < len); - - currentBuf--; - - if (bufPos > 0 || (bufPos == 0 && len == 0)) - return bufPos; - else - return -1; - } - - public String readLine() throws IOException { - byte[] b = new byte[1]; - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - boolean eol = false; - - while (read(b, 0, 1) != -1) { - if (b[0] == 13) { - eol = true; - } else { - if (eol) { - if (b[0] == 10) - break; - eol = false; - } - } - - // cast byte into char array - bos.write(b, 0, 1); - } - - if (bos == null || bos.size() <= 0) { - throw new IOException( - "++++ Stream appears to be dead, so closing it down"); - } - - // else return the string - return bos.toString().trim(); - } - - public void clearEOL() throws IOException { - byte[] b = new byte[1]; - boolean eol = false; - while (read(b, 0, 1) != -1) { - - // only stop when we see - // \r (13) followed by \n (10) - if (b[0] == 13) { - eol = true; - continue; - } - - if (eol) { - if (b[0] == 10) - break; - eol = false; - } - } - } - - public String toString() { - StringBuilder sb = new StringBuilder("ByteBufArrayIS: "); - sb.append(bufs.length).append(" bufs of sizes: \n"); - - for (int i = 0; i < bufs.length; i++) { - sb.append(" ").append(i) - .append(": ").append(bufs[i]).append("\n"); - } - return sb.toString(); - } -} diff --git a/src/memcached/ContextObjectInputStream.java b/src/memcached/ContextObjectInputStream.java deleted file mode 100644 index b38db42..0000000 --- a/src/memcached/ContextObjectInputStream.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.edu.buaa.act.memcachedClient; - -import java.io.*; - -public class ContextObjectInputStream extends ObjectInputStream { - - ClassLoader mLoader; - - public ContextObjectInputStream(InputStream in, ClassLoader loader) - throws IOException, SecurityException { - super(in); - mLoader = loader; - } - - protected Class resolveClass(ObjectStreamClass v) throws IOException, - ClassNotFoundException { - if (mLoader == null) - return super.resolveClass(v); - else - return Class.forName(v.getName(), true, mLoader); - } -} diff --git a/src/memcached/ErrorHandler.java b/src/memcached/ErrorHandler.java deleted file mode 100644 index 5b2889f..0000000 --- a/src/memcached/ErrorHandler.java +++ /dev/null @@ -1,51 +0,0 @@ -package cn.edu.buaa.act.memcachedClient; - -public interface ErrorHandler { - - /** - * Called for errors thrown during initialization. - */ - public void handleErrorOnInit( final MemcachedClient client , - final Throwable error ); - - /** - * Called for errors thrown during {@link MemcachedClient#get(String)} and related methods. - */ - public void handleErrorOnGet( final MemcachedClient client , - final Throwable error , - final String cacheKey ); - - /** - * Called for errors thrown during {@link MemcachedClient#getMulti(String)} and related methods. - */ - public void handleErrorOnGet( final MemcachedClient client , - final Throwable error , - final String[] cacheKeys ); - - /** - * Called for errors thrown during {@link MemcachedClient#set(String,Object)} and related methods. - */ - public void handleErrorOnSet( final MemcachedClient client , - final Throwable error , - final String cacheKey ); - - /** - * Called for errors thrown during {@link MemcachedClient#delete(String)} and related methods. - */ - public void handleErrorOnDelete( final MemcachedClient client , - final Throwable error , - final String cacheKey ); - - /** - * Called for errors thrown during {@link MemcachedClient#flushAll()} and related methods. - */ - public void handleErrorOnFlush( final MemcachedClient client , - final Throwable error ); - - /** - * Called for errors thrown during {@link MemcachedClient#stats()} and related methods. - */ - public void handleErrorOnStats( final MemcachedClient client , - final Throwable error); - -} // interface diff --git a/src/memcached/LineInputStream.java b/src/memcached/LineInputStream.java deleted file mode 100644 index 7f7ff02..0000000 --- a/src/memcached/LineInputStream.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.edu.buaa.act.memcachedClient; - -import java.io.IOException; - -public interface LineInputStream { - - /** - * Read everything up to the next end-of-line. Does not include the end of - * line, though it is consumed from the input. - * - * @return All next up to the next end of line. - */ - public String readLine() throws IOException; - - /** - * Read everything up to and including the end of line. - */ - public void clearEOL() throws IOException; - - /** - * Read some bytes. - * - * @param buf - * The buffer into which read. - * @return The number of bytes actually read, or -1 if none could be read. - */ - public int read(byte[] buf) throws IOException; -} diff --git a/src/memcached/MemcachedClient.java b/src/memcached/MemcachedClient.java deleted file mode 100644 index 7a099b8..0000000 --- a/src/memcached/MemcachedClient.java +++ /dev/null @@ -1,1781 +0,0 @@ -package memcached; - -import java.util.*; -import java.util.zip.*; -import java.io.*; -import java.net.URLEncoder; -import java.net.UnknownHostException; - -import org.apache.log4j.Logger; - -public class MemcachedClient { - - // logger - private static Logger log = Logger.getLogger(MemcachedClient.class - .getName()); - - // return codes - private static final String VALUE = "VALUE"; // start of value line from - // server - private static final String STATS = "STAT"; // start of stats line from - // server - private static final String ITEM = "ITEM"; // start of item line from server - private static final String DELETED = "DELETED"; // successful deletion - private static final String NOTFOUND = "NOT_FOUND"; // record not found for - // delete or incr/decr - private static final String STORED = "STORED"; // successful store of data - private static final String NOTSTORED = "NOT_STORED"; // data not stored - private static final String OK = "OK"; // success - private static final String END = "END"; // end of data from server - - private static final String ERROR = "ERROR"; // invalid command name from - // client - private static final String CLIENT_ERROR = "CLIENT_ERROR"; // client error - // in input line - // - invalid - // protocol - private static final String SERVER_ERROR = "SERVER_ERROR"; // server error - - // default compression threshold - private static final int COMPRESS_THRESH = 30720; - - // values for cache flags - public static final int MARKER_BYTE = 1; - public static final int MARKER_BOOLEAN = 8192; - public static final int MARKER_INTEGER = 4; - public static final int MARKER_LONG = 16384; - public static final int MARKER_CHARACTER = 16; - public static final int MARKER_STRING = 32; - public static final int MARKER_STRINGBUFFER = 64; - public static final int MARKER_FLOAT = 128; - public static final int MARKER_SHORT = 256; - public static final int MARKER_DOUBLE = 512; - public static final int MARKER_DATE = 1024; - public static final int MARKER_STRINGBUILDER = 2048; - public static final int MARKER_BYTEARR = 4096; - public static final int F_COMPRESSED = 2; - public static final int F_SERIALIZED = 8; - - private int socketTO = 1000 * 3; // default timeout of socket reads - private int socketConnectTO = 1000 * 3; // default timeout of socket - // connections - private boolean nagle = false; // enable/disable Nagle's algorithm - - // flags - private boolean sanitizeKeys; - private boolean primitiveAsString; - private boolean compressEnable; - private long compressThreshold; - private String defaultEncoding; - - public static SockIO sock; - - // which pool to use - private String HostName; - - // optional passed in classloader - private ClassLoader classLoader; - - // optional error handler - private ErrorHandler errorHandler; - - /** - * Creates a new instance of MemCachedClient accepting a passed in pool - * name. - * - * @param poolName - * name of SockIOPool - */ - public MemcachedClient(String HostName) { - this.HostName = HostName; - try { - sock = new SockIO(HostName, socketTO, socketConnectTO, nagle); - if (!sock.isConnected()) { - log.error("++++ failed to get SockIO obj for: " + HostName - + " -- new socket is not connected"); - sock = null; - } - } catch (UnknownHostException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - init(); - } - - /** - * Creates a new instance of MemCacheClient but acceptes a passed in - * ClassLoader. - * - * @param classLoader - * ClassLoader object. - */ - public MemcachedClient(ClassLoader classLoader) { - this.classLoader = classLoader; - init(); - } - - /** - * Creates a new instance of MemCacheClient but acceptes a passed in - * ClassLoader and a passed in ErrorHandler. - * - * @param classLoader - * ClassLoader object. - * @param errorHandler - * ErrorHandler object. - */ - public MemcachedClient(ClassLoader classLoader, ErrorHandler errorHandler) { - this.classLoader = classLoader; - this.errorHandler = errorHandler; - init(); - } - - /** - * Creates a new instance of MemCacheClient but acceptes a passed in - * ClassLoader, ErrorHandler, and SockIOPool name. - * - * @param classLoader - * ClassLoader object. - * @param errorHandler - * ErrorHandler object. - * @param poolName - * SockIOPool name - */ - public MemcachedClient(ClassLoader classLoader, ErrorHandler errorHandler, - String HostName) { - this.classLoader = classLoader; - this.errorHandler = errorHandler; - this.HostName = HostName; - init(); - } - - /** - * Initializes client object to defaults. - * - * This enables compression and sets compression threshhold to 15 KB. - */ - private void init() { - this.sanitizeKeys = true; - this.primitiveAsString = false; - this.compressEnable = true; - this.compressThreshold = COMPRESS_THRESH; - this.defaultEncoding = "UTF-8"; - } - - /** - * Sets an optional ClassLoader to be used for serialization. - * - * @param classLoader - */ - public void setClassLoader(ClassLoader classLoader) { - this.classLoader = classLoader; - } - - /** - * Sets an optional ErrorHandler. - * - * @param errorHandler - */ - public void setErrorHandler(ErrorHandler errorHandler) { - this.errorHandler = errorHandler; - } - - /** - * Enables/disables sanitizing keys by URLEncoding. - * - * @param sanitizeKeys - * if true, then URLEncode all keys - */ - public void setSanitizeKeys(boolean sanitizeKeys) { - this.sanitizeKeys = sanitizeKeys; - } - - /** - * Enables storing primitive types as their String values. - * - * @param primitiveAsString - * if true, then store all primitives as their string value. - */ - public void setPrimitiveAsString(boolean primitiveAsString) { - this.primitiveAsString = primitiveAsString; - } - - /** - * Sets default String encoding when storing primitives as Strings. Default - * is UTF-8. - * - * @param defaultEncoding - */ - public void setDefaultEncoding(String defaultEncoding) { - this.defaultEncoding = defaultEncoding; - } - - /** - * Enable storing compressed data, provided it meets the threshold - * requirements. - * - * If enabled, data will be stored in compressed form if it is
- * longer than the threshold length set with setCompressThreshold(int)
- *
- * The default is that compression is enabled.
- *
- * Even if compression is disabled, compressed data will be automatically
- * decompressed. - * - * @param compressEnable - * true to enable compression, false to - * disable compression - */ - public void setCompressEnable(boolean compressEnable) { - this.compressEnable = compressEnable; - } - - /** - * Sets the required length for data to be considered for compression. - * - * If the length of the data to be stored is not equal or larger than this - * value, it will not be compressed. - * - * This defaults to 15 KB. - * - * @param compressThreshold - * required length of data to consider compression - */ - public void setCompressThreshold(long compressThreshold) { - this.compressThreshold = compressThreshold; - } - - /** - * Checks to see if key exists in cache. - * - * @param key - * the key to look for - * @return true if key found in cache, false if not (or if cache is down) - */ - public boolean keyExists(String key) { - return (this.get(key, null, true) != null); - } - - /** - * Deletes an object from cache given cache key. - * - * @param key - * the key to be removed - * @return true, if the data was deleted successfully - */ - public boolean delete(String key) { - return delete(key, null, null); - } - - /** - * Deletes an object from cache given cache key and expiration date. - * - * @param key - * the key to be removed - * @param expiry - * when to expire the record. - * @return true, if the data was deleted successfully - */ - public boolean delete(String key, Date expiry) { - return delete(key, null, expiry); - } - - /** - * Deletes an object from cache given cache key, a delete time, and an - * optional hashcode. - * - * The item is immediately made non retrievable.
- * Keep in mind {@link #add(String, Object) add} and - * {@link #replace(String, Object) replace}
- * will fail when used with the same key will fail, until the server reaches - * the
- * specified time. However, {@link #set(String, Object) set} will succeed,
- * and the new value will not be deleted. - * - * @param key - * the key to be removed - * @param hashCode - * if not null, then the int hashcode to use - * @param expiry - * when to expire the record. - * @return true, if the data was deleted successfully - */ - public boolean delete(String key, Integer hashCode, Date expiry) { - - if (key == null) { - log.error("null value for key passed to delete()"); - return false; - } - - try { - key = sanitizeKey(key); - } catch (UnsupportedEncodingException e) { - - // if we have an errorHandler, use its hook - if (errorHandler != null) - errorHandler.handleErrorOnDelete(this, e, key); - - log.error("failed to sanitize your key!", e); - return false; - } - - // return false if unable to get SockIO obj - if (sock == null) { - if (errorHandler != null) - errorHandler.handleErrorOnDelete(this, new IOException( - "no socket to server available"), key); - return false; - } - - // build command - StringBuilder command = new StringBuilder("delete ").append(key); - if (expiry != null) - command.append(" " + expiry.getTime() / 1000); - - command.append("\r\n"); - - try { - sock.write(command.toString().getBytes()); - sock.flush(); - - // if we get appropriate response back, then we return true - String line = sock.readLine(); - if (DELETED.equals(line)) { - if (log.isInfoEnabled()) - log.info("++++ deletion of key: " + key - + " from cache was a success"); - - // return sock to pool and bail here - sock.close(); - sock = null; - return true; - } else if (NOTFOUND.equals(line)) { - if (log.isInfoEnabled()) - log.info("++++ deletion of key: " + key - + " from cache failed as the key was not found"); - } else { - log.error("++++ error deleting key: " + key); - log.error("++++ server response: " + line); - } - } catch (IOException e) { - - // if we have an errorHandler, use its hook - if (errorHandler != null) - errorHandler.handleErrorOnDelete(this, e, key); - - // exception thrown - log.error("++++ exception thrown while writing bytes to server on delete"); - log.error(e.getMessage(), e); - - try { - sock.trueClose(); - } catch (IOException ioe) { - log.error("++++ failed to close socket : " + sock.toString()); - } - - sock = null; - } - - if (sock != null) { - sock.close(); - sock = null; - } - - return false; - } - - /** - * Stores data on the server; only the key and the value are specified. - * - * @param key - * key to store data under - * @param value - * value to store - * @return true, if the data was successfully stored - */ - public boolean set(String key, Object value) { - return set("set", key, value, null, null, primitiveAsString); - } - - /** - * Stores data on the server; only the key and the value are specified. - * - * @param key - * key to store data under - * @param value - * value to store - * @param hashCode - * if not null, then the int hashcode to use - * @return true, if the data was successfully stored - */ - public boolean set(String key, Object value, Integer hashCode) { - return set("set", key, value, null, hashCode, primitiveAsString); - } - - /** - * Stores data on the server; the key, value, and an expiration time are - * specified. - * - * @param key - * key to store data under - * @param value - * value to store - * @param expiry - * when to expire the record - * @return true, if the data was successfully stored - */ - public boolean set(String key, Object value, Date expiry) { - return set("set", key, value, expiry, null, primitiveAsString); - } - - /** - * Stores data on the server; the key, value, and an expiration time are - * specified. - * - * @param key - * key to store data under - * @param value - * value to store - * @param expiry - * when to expire the record - * @param hashCode - * if not null, then the int hashcode to use - * @return true, if the data was successfully stored - */ - public boolean set(String key, Object value, Date expiry, Integer hashCode) { - return set("set", key, value, expiry, hashCode, primitiveAsString); - } - - /** - * Adds data to the server; only the key and the value are specified. - * - * @param key - * key to store data under - * @param value - * value to store - * @return true, if the data was successfully stored - */ - public boolean add(String key, Object value) { - return set("add", key, value, null, null, primitiveAsString); - } - - /** - * Adds data to the server; the key, value, and an optional hashcode are - * passed in. - * - * @param key - * key to store data under - * @param value - * value to store - * @param hashCode - * if not null, then the int hashcode to use - * @return true, if the data was successfully stored - */ - public boolean add(String key, Object value, Integer hashCode) { - return set("add", key, value, null, hashCode, primitiveAsString); - } - - /** - * Adds data to the server; the key, value, and an expiration time are - * specified. - * - * @param key - * key to store data under - * @param value - * value to store - * @param expiry - * when to expire the record - * @return true, if the data was successfully stored - */ - public boolean add(String key, Object value, Date expiry) { - return set("add", key, value, expiry, null, primitiveAsString); - } - - /** - * Adds data to the server; the key, value, and an expiration time are - * specified. - * - * @param key - * key to store data under - * @param value - * value to store - * @param expiry - * when to expire the record - * @param hashCode - * if not null, then the int hashcode to use - * @return true, if the data was successfully stored - */ - public boolean add(String key, Object value, Date expiry, Integer hashCode) { - return set("add", key, value, expiry, hashCode, primitiveAsString); - } - - /** - * Updates data on the server; only the key and the value are specified. - * - * @param key - * key to store data under - * @param value - * value to store - * @return true, if the data was successfully stored - */ - public boolean replace(String key, Object value) { - return set("replace", key, value, null, null, primitiveAsString); - } - - /** - * Updates data on the server; only the key and the value and an optional - * hash are specified. - * - * @param key - * key to store data under - * @param value - * value to store - * @param hashCode - * if not null, then the int hashcode to use - * @return true, if the data was successfully stored - */ - public boolean replace(String key, Object value, Integer hashCode) { - return set("replace", key, value, null, hashCode, primitiveAsString); - } - - /** - * Updates data on the server; the key, value, and an expiration time are - * specified. - * - * @param key - * key to store data under - * @param value - * value to store - * @param expiry - * when to expire the record - * @return true, if the data was successfully stored - */ - public boolean replace(String key, Object value, Date expiry) { - return set("replace", key, value, expiry, null, primitiveAsString); - } - - /** - * Updates data on the server; the key, value, and an expiration time are - * specified. - * - * @param key - * key to store data under - * @param value - * value to store - * @param expiry - * when to expire the record - * @param hashCode - * if not null, then the int hashcode to use - * @return true, if the data was successfully stored - */ - public boolean replace(String key, Object value, Date expiry, - Integer hashCode) { - return set("replace", key, value, expiry, hashCode, primitiveAsString); - } - - /** - * Stores data to cache. - * - * If data does not already exist for this key on the server, or if the key - * is being
- * deleted, the specified value will not be stored.
- * The server will automatically delete the value when the expiration time - * has been reached.
- *
- * If compression is enabled, and the data is longer than the compression - * threshold
- * the data will be stored in compressed form.
- *
- * As of the current release, all objects stored will use java - * serialization. - * - * @param cmdname - * action to take (set, add, replace) - * @param key - * key to store cache under - * @param value - * object to cache - * @param expiry - * expiration - * @param hashCode - * if not null, then the int hashcode to use - * @param asString - * store this object as a string? - * @return true/false indicating success - */ - private boolean set(String cmdname, String key, Object value, Date expiry, - Integer hashCode, boolean asString) { - - if (cmdname == null || cmdname.trim().equals("") || key == null) { - log.error("key is null or cmd is null/empty for set()"); - return false; - } - - try { - key = sanitizeKey(key); - } catch (UnsupportedEncodingException e) { - - // if we have an errorHandler, use its hook - if (errorHandler != null) - errorHandler.handleErrorOnSet(this, e, key); - - log.error("failed to sanitize your key!", e); - return false; - } - - if (value == null) { - log.error("trying to store a null value to cache"); - return false; - } - - if (sock == null) { - if (errorHandler != null) - errorHandler.handleErrorOnSet(this, new IOException( - "no socket to server available"), key); - return false; - } - - if (expiry == null) - expiry = new Date(0); - - // store flags - int flags = 0; - - // byte array to hold data - byte[] val; - - if (NativeHandler.isHandled(value)) { - - if (asString) { - // useful for sharing data between java and non-java - // and also for storing ints for the increment method - try { - if (log.isInfoEnabled()) - log.info("++++ storing data as a string for key: " - + key + " for class: " - + value.getClass().getName()); - val = value.toString().getBytes(defaultEncoding); - } catch (UnsupportedEncodingException ue) { - - // if we have an errorHandler, use its hook - if (errorHandler != null) - errorHandler.handleErrorOnSet(this, ue, key); - - log.error("invalid encoding type used: " + defaultEncoding, - ue); - sock.close(); - sock = null; - return false; - } - } else { - try { - if (log.isInfoEnabled()) - log.info("Storing with native handler..."); - flags |= NativeHandler.getMarkerFlag(value); - val = NativeHandler.encode(value); - } catch (Exception e) { - - // if we have an errorHandler, use its hook - if (errorHandler != null) - errorHandler.handleErrorOnSet(this, e, key); - - log.error("Failed to native handle obj", e); - - sock.close(); - sock = null; - return false; - } - } - } else { - // always serialize for non-primitive types - try { - if (log.isInfoEnabled()) - log.info("++++ serializing for key: " + key - + " for class: " + value.getClass().getName()); - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - (new ObjectOutputStream(bos)).writeObject(value); - val = bos.toByteArray(); - flags |= F_SERIALIZED; - } catch (IOException e) { - - // if we have an errorHandler, use its hook - if (errorHandler != null) - errorHandler.handleErrorOnSet(this, e, key); - - // if we fail to serialize, then - // we bail - log.error("failed to serialize obj", e); - log.error(value.toString()); - - // return socket to pool and bail - sock.close(); - sock = null; - return false; - } - } - - // now try to compress if we want to - // and if the length is over the threshold - if (compressEnable && val.length > compressThreshold) { - - try { - if (log.isInfoEnabled()) { - log.info("++++ trying to compress data"); - log.info("++++ size prior to compression: " + val.length); - } - ByteArrayOutputStream bos = new ByteArrayOutputStream( - val.length); - GZIPOutputStream gos = new GZIPOutputStream(bos); - gos.write(val, 0, val.length); - gos.finish(); - gos.close(); - - // store it and set compression flag - val = bos.toByteArray(); - flags |= F_COMPRESSED; - - if (log.isInfoEnabled()) - log.info("++++ compression succeeded, size after: " - + val.length); - } catch (IOException e) { - - // if we have an errorHandler, use its hook - if (errorHandler != null) - errorHandler.handleErrorOnSet(this, e, key); - - log.error("IOException while compressing stream: " - + e.getMessage()); - log.error("storing data uncompressed"); - } - } - - // now write the data to the cache server - try { - String cmd = String.format("%s %s %d %d %d\r\n", cmdname, key, - flags, (expiry.getTime() / 1000), val.length); - sock.write(cmd.getBytes()); - sock.write(val); - sock.write("\r\n".getBytes()); - sock.flush(); - - // get result code - String line = sock.readLine(); - if (log.isInfoEnabled()) - log.info("++++ memcache cmd (result code): " + cmd + " (" - + line + ")"); - - if (STORED.equals(line)) { - if (log.isInfoEnabled()) - log.info("++++ data successfully stored for key: " + key); - // sock.close(); - // sock = null; - return true; - } else if (NOTSTORED.equals(line)) { - if (log.isInfoEnabled()) - log.info("++++ data not stored in cache for key: " + key); - } else { - log.error("++++ error storing data in cache for key: " + key - + " -- length: " + val.length); - log.error("++++ server response: " + line); - } - } catch (IOException e) { - - // if we have an errorHandler, use its hook - if (errorHandler != null) - errorHandler.handleErrorOnSet(this, e, key); - - // exception thrown - log.error("++++ exception thrown while writing bytes to server on set"); - log.error(e.getMessage(), e); - - try { - sock.trueClose(); - } catch (IOException ioe) { - log.error("++++ failed to close socket : " + sock.toString()); - } - - sock = null; - } - - if (sock != null) { - sock.close(); - sock = null; - } - - return false; - } - - /** - * Store a counter to memcached given a key - * - * @param key - * cache key - * @param counter - * number to store - * @return true/false indicating success - */ - public boolean storeCounter(String key, long counter) { - return set("set", key, new Long(counter), null, null, true); - } - - /** - * Store a counter to memcached given a key - * - * @param key - * cache key - * @param counter - * number to store - * @return true/false indicating success - */ - public boolean storeCounter(String key, Long counter) { - return set("set", key, counter, null, null, true); - } - - /** - * Store a counter to memcached given a key - * - * @param key - * cache key - * @param counter - * number to store - * @param hashCode - * if not null, then the int hashcode to use - * @return true/false indicating success - */ - public boolean storeCounter(String key, Long counter, Integer hashCode) { - return set("set", key, counter, null, hashCode, true); - } - - /** - * Returns value in counter at given key as long. - * - * @param key - * cache ket - * @return counter value or -1 if not found - */ - public long getCounter(String key) { - return getCounter(key, null); - } - - /** - * Returns value in counter at given key as long. - * - * @param key - * cache ket - * @param hashCode - * if not null, then the int hashcode to use - * @return counter value or -1 if not found - */ - public long getCounter(String key, Integer hashCode) { - - if (key == null) { - log.error("null key for getCounter()"); - return -1; - } - - long counter = -1; - try { - counter = Long.parseLong((String) get(key, hashCode, true)); - } catch (Exception ex) { - - // if we have an errorHandler, use its hook - if (errorHandler != null) - errorHandler.handleErrorOnGet(this, ex, key); - - // not found or error getting out - if (log.isInfoEnabled()) - log.info(String.format( - "Failed to parse Long value for key: %s", key)); - } - - return counter; - } - - /** - * Thread safe way to initialize and increment a counter. - * - * @param key - * key where the data is stored - * @return value of incrementer - */ - public long addOrIncr(String key) { - return addOrIncr(key, 0, null); - } - - /** - * Thread safe way to initialize and increment a counter. - * - * @param key - * key where the data is stored - * @param inc - * value to set or increment by - * @return value of incrementer - */ - public long addOrIncr(String key, long inc) { - return addOrIncr(key, inc, null); - } - - /** - * Thread safe way to initialize and increment a counter. - * - * @param key - * key where the data is stored - * @param inc - * value to set or increment by - * @param hashCode - * if not null, then the int hashcode to use - * @return value of incrementer - */ - public long addOrIncr(String key, long inc, Integer hashCode) { - boolean ret = set("add", key, new Long(inc), null, hashCode, true); - - if (ret) { - return inc; - } else { - return incrdecr("incr", key, inc, hashCode); - } - } - - /** - * Thread safe way to initialize and decrement a counter. - * - * @param key - * key where the data is stored - * @return value of incrementer - */ - public long addOrDecr(String key) { - return addOrDecr(key, 0, null); - } - - /** - * Thread safe way to initialize and decrement a counter. - * - * @param key - * key where the data is stored - * @param inc - * value to set or increment by - * @return value of incrementer - */ - public long addOrDecr(String key, long inc) { - return addOrDecr(key, inc, null); - } - - /** - * Thread safe way to initialize and decrement a counter. - * - * @param key - * key where the data is stored - * @param inc - * value to set or increment by - * @param hashCode - * if not null, then the int hashcode to use - * @return value of incrementer - */ - public long addOrDecr(String key, long inc, Integer hashCode) { - boolean ret = set("add", key, new Long(inc), null, hashCode, true); - - if (ret) { - return inc; - } else { - return incrdecr("decr", key, inc, hashCode); - } - } - - /** - * Increment the value at the specified key by 1, and then return it. - * - * @param key - * key where the data is stored - * @return -1, if the key is not found, the value after incrementing - * otherwise - */ - public long incr(String key) { - return incrdecr("incr", key, 1, null); - } - - /** - * Increment the value at the specified key by passed in val. - * - * @param key - * key where the data is stored - * @param inc - * how much to increment by - * @return -1, if the key is not found, the value after incrementing - * otherwise - */ - public long incr(String key, long inc) { - return incrdecr("incr", key, inc, null); - } - - /** - * Increment the value at the specified key by the specified increment, and - * then return it. - * - * @param key - * key where the data is stored - * @param inc - * how much to increment by - * @param hashCode - * if not null, then the int hashcode to use - * @return -1, if the key is not found, the value after incrementing - * otherwise - */ - public long incr(String key, long inc, Integer hashCode) { - return incrdecr("incr", key, inc, hashCode); - } - - /** - * Decrement the value at the specified key by 1, and then return it. - * - * @param key - * key where the data is stored - * @return -1, if the key is not found, the value after incrementing - * otherwise - */ - public long decr(String key) { - return incrdecr("decr", key, 1, null); - } - - /** - * Decrement the value at the specified key by passed in value, and then - * return it. - * - * @param key - * key where the data is stored - * @param inc - * how much to increment by - * @return -1, if the key is not found, the value after incrementing - * otherwise - */ - public long decr(String key, long inc) { - return incrdecr("decr", key, inc, null); - } - - /** - * Decrement the value at the specified key by the specified increment, and - * then return it. - * - * @param key - * key where the data is stored - * @param inc - * how much to increment by - * @param hashCode - * if not null, then the int hashcode to use - * @return -1, if the key is not found, the value after incrementing - * otherwise - */ - public long decr(String key, long inc, Integer hashCode) { - return incrdecr("decr", key, inc, hashCode); - } - - /** - * Increments/decrements the value at the specified key by inc. - * - * Note that the server uses a 32-bit unsigned integer, and checks for
- * underflow. In the event of underflow, the result will be zero. Because
- * Java lacks unsigned types, the value is returned as a 64-bit integer.
- * The server will only decrement a value if it already exists;
- * if a value is not found, -1 will be returned. - * - * @param cmdname - * increment/decrement - * @param key - * cache key - * @param inc - * amount to incr or decr - * @param hashCode - * if not null, then the int hashcode to use - * @return new value or -1 if not exist - */ - private long incrdecr(String cmdname, String key, long inc, Integer hashCode) { - - if (key == null) { - log.error("null key for incrdecr()"); - return -1; - } - - try { - key = sanitizeKey(key); - } catch (UnsupportedEncodingException e) { - - // if we have an errorHandler, use its hook - if (errorHandler != null) - errorHandler.handleErrorOnGet(this, e, key); - - log.error("failed to sanitize your key!", e); - return -1; - } - - if (sock == null) { - if (errorHandler != null) - errorHandler.handleErrorOnSet(this, new IOException( - "no socket to server available"), key); - return -1; - } - - try { - String cmd = String.format("%s %s %d\r\n", cmdname, key, inc); - if (log.isDebugEnabled()) - log.debug("++++ memcache incr/decr command: " + cmd); - - sock.write(cmd.getBytes()); - sock.flush(); - - // get result back - String line = sock.readLine(); - - if (line.matches("\\d+")) { - - // return sock to pool and return result - sock.close(); - try { - return Long.parseLong(line); - } catch (Exception ex) { - - // if we have an errorHandler, use its hook - if (errorHandler != null) - errorHandler.handleErrorOnGet(this, ex, key); - - log.error(String.format( - "Failed to parse Long value for key: %s", key)); - } - } else if (NOTFOUND.equals(line)) { - if (log.isInfoEnabled()) - log.info("++++ key not found to incr/decr for key: " + key); - } else { - log.error("++++ error incr/decr key: " + key); - log.error("++++ server response: " + line); - } - } catch (IOException e) { - - // if we have an errorHandler, use its hook - if (errorHandler != null) - errorHandler.handleErrorOnGet(this, e, key); - - // exception thrown - log.error("++++ exception thrown while writing bytes to server on incr/decr"); - log.error(e.getMessage(), e); - - try { - sock.trueClose(); - } catch (IOException ioe) { - log.error("++++ failed to close socket : " + sock.toString()); - } - - sock = null; - } - - if (sock != null) { - sock.close(); - sock = null; - } - - return -1; - } - - /** - * Retrieve a key from the server, using a specific hash. - * - * If the data was compressed or serialized when compressed, it will - * automatically
- * be decompressed or serialized, as appropriate. (Inclusive or)
- *
- * Non-serialized data will be returned as a string, so explicit conversion - * to
- * numeric types will be necessary, if desired
- * - * @param key - * key where data is stored - * @return the object that was previously stored, or null if it was not - * previously stored - */ - public Object get(String key) { - return get(key, null, false); - } - - /** - * Retrieve a key from the server, using a specific hash. - * - * If the data was compressed or serialized when compressed, it will - * automatically
- * be decompressed or serialized, as appropriate. (Inclusive or)
- *
- * Non-serialized data will be returned as a string, so explicit conversion - * to
- * numeric types will be necessary, if desired
- * - * @param key - * key where data is stored - * @param hashCode - * if not null, then the int hashcode to use - * @return the object that was previously stored, or null if it was not - * previously stored - */ - public Object get(String key, Integer hashCode) { - return get(key, hashCode, false); - } - - /** - * Retrieve a key from the server, using a specific hash. - * - * If the data was compressed or serialized when compressed, it will - * automatically
- * be decompressed or serialized, as appropriate. (Inclusive or)
- *
- * Non-serialized data will be returned as a string, so explicit conversion - * to
- * numeric types will be necessary, if desired
- * - * @param key - * key where data is stored - * @param hashCode - * if not null, then the int hashcode to use - * @param asString - * if true, then return string val - * @return the object that was previously stored, or null if it was not - * previously stored - */ - public Object get(String key, Integer hashCode, boolean asString) { - - if (key == null) { - log.error("key is null for get()"); - return null; - } - - try { - key = sanitizeKey(key); - } catch (UnsupportedEncodingException e) { - - // if we have an errorHandler, use its hook - if (errorHandler != null) - errorHandler.handleErrorOnGet(this, e, key); - - log.error("failed to sanitize your key!", e); - return null; - } - - if (sock == null) { - if (errorHandler != null) - errorHandler.handleErrorOnGet(this, new IOException( - "no socket to server available"), key); - return null; - } - - try { - String cmd = "get " + key + "\r\n"; - - if (log.isDebugEnabled()) - log.debug("++++ memcache get command: " + cmd); - - sock.write(cmd.getBytes()); - sock.flush(); - - // ready object - Object o = null; - - while (true) { - String line = sock.readLine(); - - if (log.isDebugEnabled()) - log.debug("++++ line: " + line); - - if (line.startsWith(VALUE)) { - String[] info = line.split(" "); - int flag = Integer.parseInt(info[2]); - int length = Integer.parseInt(info[3]); - - if (log.isDebugEnabled()) { - log.debug("++++ key: " + key); - log.debug("++++ flags: " + flag); - log.debug("++++ length: " + length); - } - - // read obj into buffer - byte[] buf = new byte[length]; - sock.read(buf); - sock.clearEOL(); - - if ((flag & F_COMPRESSED) == F_COMPRESSED) { - try { - // read the input stream, and write to a byte array - // output stream since - // we have to read into a byte array, but we don't - // know how large it - // will need to be, and we don't want to resize it a - // bunch - GZIPInputStream gzi = new GZIPInputStream( - new ByteArrayInputStream(buf)); - ByteArrayOutputStream bos = new ByteArrayOutputStream( - buf.length); - - int count; - byte[] tmp = new byte[2048]; - while ((count = gzi.read(tmp)) != -1) { - bos.write(tmp, 0, count); - } - - // store uncompressed back to buffer - buf = bos.toByteArray(); - gzi.close(); - } catch (IOException e) { - - // if we have an errorHandler, use its hook - if (errorHandler != null) - errorHandler.handleErrorOnGet(this, e, key); - - log.error("++++ IOException thrown while trying to uncompress input stream for key: " - + key + " -- " + e.getMessage()); - throw new NestedIOException( - "++++ IOException thrown while trying to uncompress input stream for key: " - + key, e); - } - } - - // we can only take out serialized objects - if ((flag & F_SERIALIZED) != F_SERIALIZED) { - if (primitiveAsString || asString) { - // pulling out string value - if (log.isInfoEnabled()) - log.info("++++ retrieving object and stuffing into a string."); - o = new String(buf, defaultEncoding); - } else { - // decoding object - try { - o = NativeHandler.decode(buf, flag); - } catch (Exception e) { - - // if we have an errorHandler, use its hook - if (errorHandler != null) - errorHandler.handleErrorOnGet(this, e, key); - - log.error( - "++++ Exception thrown while trying to deserialize for key: " - + key, e); - throw new NestedIOException(e); - } - } - } else { - // deserialize if the data is serialized - ContextObjectInputStream ois = new ContextObjectInputStream( - new ByteArrayInputStream(buf), classLoader); - try { - o = ois.readObject(); - if (log.isInfoEnabled()) - log.info("++++ deserializing " + o.getClass()); - } catch (Exception e) { - if (errorHandler != null) - errorHandler.handleErrorOnGet(this, e, key); - - o = null; - log.error("++++ Exception thrown while trying to deserialize for key: " - + key + " -- " + e.getMessage()); - } - } - } else if (END.equals(line)) { - if (log.isDebugEnabled()) - log.debug("++++ finished reading from cache server"); - break; - } - } - - // sock.close(); - // sock = null; - return o; - } catch (IOException e) { - - // if we have an errorHandler, use its hook - if (errorHandler != null) - errorHandler.handleErrorOnGet(this, e, key); - - // exception thrown - log.error("++++ exception thrown while trying to get object from cache for key: " - + key + " -- " + e.getMessage()); - - try { - sock.trueClose(); - } catch (IOException ioe) { - log.error("++++ failed to close socket : " + sock.toString()); - } - sock = null; - } - - if (sock != null) - sock.close(); - - return null; - } - - /** - * Retrieve multiple objects from the memcache. - * - * This is recommended over repeated calls to {@link #get(String) get()}, - * since it
- * is more efficient.
- * - * @param keys - * String array of keys to retrieve - * @param hashCodes - * if not null, then the Integer array of hashCodes - * @param asString - * if true, retrieve string vals - * @return Object array ordered in same order as key array containing - * results - */ - - /** - * Retrieve multiple objects from the memcache. - * - * This is recommended over repeated calls to {@link #get(String) get()}, - * since it
- * is more efficient.
- * - * @param keys - * String array of keys to retrieve - * @return a hashmap with entries for each key is found by the server, keys - * that are not found are not entered into the hashmap, but - * attempting to retrieve them from the hashmap gives you null. - */ - - /** - * This method loads the data from cache into a Map. - * - * Pass a SockIO object which is ready to receive data and a HashMap
- * to store the results. - * - * @param sock - * socket waiting to pass back data - * @param hm - * hashmap to store data into - * @param asString - * if true, and if we are using NativehHandler, return string val - * @throws IOException - * if io exception happens while reading from socket - */ - private void loadMulti(LineInputStream input, Map hm, - boolean asString) throws IOException { - - while (true) { - String line = input.readLine(); - if (log.isDebugEnabled()) - log.debug("++++ line: " + line); - - if (line.startsWith(VALUE)) { - String[] info = line.split(" "); - String key = info[1]; - int flag = Integer.parseInt(info[2]); - int length = Integer.parseInt(info[3]); - - if (log.isDebugEnabled()) { - log.debug("++++ key: " + key); - log.debug("++++ flags: " + flag); - log.debug("++++ length: " + length); - } - - // read obj into buffer - byte[] buf = new byte[length]; - input.read(buf); - input.clearEOL(); - - // ready object - Object o; - - // check for compression - if ((flag & F_COMPRESSED) == F_COMPRESSED) { - try { - // read the input stream, and write to a byte array - // output stream since - // we have to read into a byte array, but we don't know - // how large it - // will need to be, and we don't want to resize it a - // bunch - GZIPInputStream gzi = new GZIPInputStream( - new ByteArrayInputStream(buf)); - ByteArrayOutputStream bos = new ByteArrayOutputStream( - buf.length); - - int count; - byte[] tmp = new byte[2048]; - while ((count = gzi.read(tmp)) != -1) { - bos.write(tmp, 0, count); - } - - // store uncompressed back to buffer - buf = bos.toByteArray(); - gzi.close(); - } catch (IOException e) { - - // if we have an errorHandler, use its hook - if (errorHandler != null) - errorHandler.handleErrorOnGet(this, e, key); - - log.error("++++ IOException thrown while trying to uncompress input stream for key: " - + key + " -- " + e.getMessage()); - throw new NestedIOException( - "++++ IOException thrown while trying to uncompress input stream for key: " - + key, e); - } - } - - // we can only take out serialized objects - if ((flag & F_SERIALIZED) != F_SERIALIZED) { - if (primitiveAsString || asString) { - // pulling out string value - if (log.isInfoEnabled()) - log.info("++++ retrieving object and stuffing into a string."); - o = new String(buf, defaultEncoding); - } else { - // decoding object - try { - o = NativeHandler.decode(buf, flag); - } catch (Exception e) { - - // if we have an errorHandler, use its hook - if (errorHandler != null) - errorHandler.handleErrorOnGet(this, e, key); - - log.error("++++ Exception thrown while trying to deserialize for key: " - + key + " -- " + e.getMessage()); - throw new NestedIOException(e); - } - } - } else { - // deserialize if the data is serialized - ContextObjectInputStream ois = new ContextObjectInputStream( - new ByteArrayInputStream(buf), classLoader); - try { - o = ois.readObject(); - if (log.isInfoEnabled()) - log.info("++++ deserializing " + o.getClass()); - } catch (InvalidClassException e) { - /* - * Errors de-serializing are to be expected in the case - * of a long running server that spans client restarts - * with updated classes. - */ - // if we have an errorHandler, use its hook - if (errorHandler != null) - errorHandler.handleErrorOnGet(this, e, key); - - o = null; - log.error("++++ InvalidClassException thrown while trying to deserialize for key: " - + key + " -- " + e.getMessage()); - } catch (ClassNotFoundException e) { - - // if we have an errorHandler, use its hook - if (errorHandler != null) - errorHandler.handleErrorOnGet(this, e, key); - - o = null; - log.error("++++ ClassNotFoundException thrown while trying to deserialize for key: " - + key + " -- " + e.getMessage()); - } - } - - // store the object into the cache - if (o != null) - hm.put(key, o); - } else if (END.equals(line)) { - if (log.isDebugEnabled()) - log.debug("++++ finished reading from cache server"); - break; - } - } - } - - private String sanitizeKey(String key) throws UnsupportedEncodingException { - return (sanitizeKeys) ? URLEncoder.encode(key, "UTF-8") : key; - } - - /** - * Invalidates the entire cache. - * - * Will return true only if succeeds in clearing all servers. - * - * @return success true/false - */ - public boolean flushAll() { - return flushAll(null); - } - - /** - * Invalidates the entire cache. - * - * Will return true only if succeeds in clearing all servers. If pass in - * null, then will try to flush all servers. - * - * @param servers - * optional array of host(s) to flush (host:port) - * @return success true/false - */ - public boolean flushAll(String[] servers) { - boolean success = true; - if (sock == null) { - log.error("++++ unable to get connection to : " + HostName); - success = false; - if (errorHandler != null) - errorHandler.handleErrorOnFlush(this, new IOException( - "no socket to server available")); - - // build command - String command = "flush_all\r\n"; - - try { - sock.write(command.getBytes()); - sock.flush(); - - // if we get appropriate response back, then we return true - String line = sock.readLine(); - success = (OK.equals(line)) ? success && true : false; - } catch (IOException e) { - - // if we have an errorHandler, use its hook - if (errorHandler != null) - errorHandler.handleErrorOnFlush(this, e); - - // exception thrown - log.error("++++ exception thrown while writing bytes to server on flushAll"); - log.error(e.getMessage(), e); - - try { - sock.trueClose(); - } catch (IOException ioe) { - log.error("++++ failed to close socket : " - + sock.toString()); - } - - success = false; - sock = null; - } - - if (sock != null) { - sock.close(); - sock = null; - } - } - - return success; - } - - public Map stats() { - return stats("stats\r\n", STATS); - } - - public Map statsItems() { - return stats("stats items\r\n", STATS); - } - - /** - * Retrieves stats for passed in servers (or all servers). - * - * Returns a map keyed on the servername. The value is another map which - * contains slabs stats with slabnumber:field as key and value as value. - * - * @param servers - * string array of servers to retrieve stats from, or all if this - * is null - * @return Stats map - */ - public Map statsSlabs() { - return stats("stats slabs\r\n", STATS); - } - - /** - * Retrieves stats for passed in servers (or all servers). - * - * Returns a map keyed on the servername. The value is another map which - * contains cachedump stats with the cachekey as key and byte size and unix - * timestamp as value. - * - * @param servers - * string array of servers to retrieve stats from, or all if this - * is null - * @param slabNumber - * the item number of the cache dump - * @return Stats map - */ - public Map statsCacheDump(int slabNumber, int limit) { - return stats( - String.format("stats cachedump %d %d\r\n", slabNumber, limit), - ITEM); - } - - private Map stats(String command, String lineStart) { - - if (command == null || command.trim().equals("")) { - log.error("++++ invalid / missing command for stats()"); - return null; - } - - if (sock == null) { - log.error("++++ unable to get connection to : " + HostName); - if (errorHandler != null) - errorHandler.handleErrorOnStats(this, new IOException( - "no socket to server available")); - return null; - } - // map to hold key value pairs - Map stats = new HashMap(); - // build command - try { - sock.write(command.getBytes()); - sock.flush(); - - // loop over results - while (true) { - String line = sock.readLine(); - if (log.isDebugEnabled()) - log.debug("++++ line: " + line); - - if (line.startsWith(lineStart)) { - String[] info = line.split(" ", 3); - String key = info[1]; - String value = info[2]; - - if (log.isDebugEnabled()) { - log.debug("++++ key : " + key); - log.debug("++++ value: " + value); - } - - stats.put(key, value); - } else if (END.equals(line)) { - // finish when we get end from server - if (log.isDebugEnabled()) - log.debug("++++ finished reading from cache server"); - break; - } else if (line.startsWith(ERROR) - || line.startsWith(CLIENT_ERROR) - || line.startsWith(SERVER_ERROR)) { - log.error("++++ failed to query stats"); - log.error("++++ server response: " + line); - break; - } - } - } catch (IOException e) { - - // if we have an errorHandler, use its hook - if (errorHandler != null) - errorHandler.handleErrorOnStats(this, e); - - // exception thrown - log.error("++++ exception thrown while writing bytes to server on stats"); - log.error(e.getMessage(), e); - - try { - sock.trueClose(); - } catch (IOException ioe) { - log.error("++++ failed to close socket : " + sock.toString()); - } - - sock = null; - } - - if (sock != null) { - sock.close(); - sock = null; - } - - return stats; - } -} diff --git a/src/memcached/NativeHandler.java b/src/memcached/NativeHandler.java deleted file mode 100644 index c3d414b..0000000 --- a/src/memcached/NativeHandler.java +++ /dev/null @@ -1,412 +0,0 @@ -package cn.edu.buaa.act.memcachedClient; - -import java.util.Date; -import org.apache.log4j.Logger; - -/** - * Handle encoding standard Java types directly which can result in significant - * memory savings: - * - * Currently the Memcached driver for Java supports the setSerialize() option. - * This can increase performance in some situations but has a few issues: - * - * Code that performs class casting will throw ClassCastExceptions when - * setSerialize is enabled. For example: - * - * mc.set( "foo", new Integer( 1 ) ); Integer output = (Integer)mc.get("foo"); - * - * Will work just file when setSerialize is true but when its false will just - * throw a ClassCastException. - * - * Also internally it doesn't support Boolean and since toString is called - * wastes a lot of memory and causes additional performance issue. For example - * an Integer can take anywhere from 1 byte to 10 bytes. - * - * Due to the way the memcached slab allocator works it seems like a LOT of - * wasted memory to store primitive types as serialized objects (from a - * performance and memory perspective). In our applications we have millions of - * small objects and wasted memory would become a big problem. - * - * For example a Serialized Boolean takes 47 bytes which means it will fit into - * the 64byte LRU. Using 1 byte means it will fit into the 8 byte LRU thus - * saving 8x the memory. This also saves the CPU performance since we don't have - * to serialize bytes back and forth and we can compute the byte[] value - * directly. - * - * One problem would be when the user calls get() because doing so would require - * the app to know the type of the object stored as a bytearray inside memcached - * (since the user will probably cast). - * - * If we assume the basic types are interned we could use the first byte as the - * type with the remaining bytes as the value. Then on get() we could read the - * first byte to determine the type and then construct the correct object for - * it. This would prevent the ClassCastException I talked about above. - * - * We could remove the setSerialize() option and just assume that standard VM - * types are always internd in this manner. - * - * mc.set( "foo", new Boolean.TRUE ); Boolean b = (Boolean)mc.get( "foo" ); - * - * And the type casts would work because internally we would create a new - * Boolean to return back to the client. - * - * This would reduce memory footprint and allow for a virtual implementation of - * the Externalizable interface which is much faster than Serialzation. - * - * Currently the memory improvements would be: - * - * java.lang.Boolean - 8x performance improvement (now just two bytes) - * java.lang.Integer - 16x performance improvement (now just 5 bytes) - * - * Most of the other primitive types would benefit from this optimization. - * java.lang.Character being another obvious example. - * - * I know it seems like I'm being really picky here but for our application I'd - * save 1G of memory right off the bat. We'd go down from 1.152G of memory used - * down to 144M of memory used which is much better IMO. - * - */ -public class NativeHandler { - - // logger - private static Logger log = Logger.getLogger(NativeHandler.class.getName()); - - /** - * Detemine of object can be natively serialized by this class. - * - * @param value - * Object to test. - * @return true/false - */ - public static boolean isHandled(Object value) { - - return (value instanceof Byte || value instanceof Boolean - || value instanceof Integer || value instanceof Long - || value instanceof Character || value instanceof String - || value instanceof StringBuffer || value instanceof Float - || value instanceof Short || value instanceof Double - || value instanceof Date || value instanceof StringBuilder || value instanceof byte[]) ? true - : false; - } - - /** - * Returns the flag for marking the type of the byte array. - * - * @param value - * Object we are storing. - * @return int marker - */ - public static int getMarkerFlag(Object value) { - - if (value instanceof Byte) - return MemcachedClient.MARKER_BYTE; - - if (value instanceof Boolean) - return MemcachedClient.MARKER_BOOLEAN; - - if (value instanceof Integer) - return MemcachedClient.MARKER_INTEGER; - - if (value instanceof Long) - return MemcachedClient.MARKER_LONG; - - if (value instanceof Character) - return MemcachedClient.MARKER_CHARACTER; - - if (value instanceof String) - return MemcachedClient.MARKER_STRING; - - if (value instanceof StringBuffer) - return MemcachedClient.MARKER_STRINGBUFFER; - - if (value instanceof Float) - return MemcachedClient.MARKER_FLOAT; - - if (value instanceof Short) - return MemcachedClient.MARKER_SHORT; - - if (value instanceof Double) - return MemcachedClient.MARKER_DOUBLE; - - if (value instanceof Date) - return MemcachedClient.MARKER_DATE; - - if (value instanceof StringBuilder) - return MemcachedClient.MARKER_STRINGBUILDER; - - if (value instanceof byte[]) - return MemcachedClient.MARKER_BYTEARR; - - return -1; - } - - /** - * Encodes supported types - * - * @param value - * Object to encode. - * @return byte array - * - * @throws Exception - * If fail to encode. - */ - public static byte[] encode(Object value) throws Exception { - - if (value instanceof Byte) - return encode((Byte) value); - - if (value instanceof Boolean) - return encode((Boolean) value); - - if (value instanceof Integer) - return encode(((Integer) value).intValue()); - - if (value instanceof Long) - return encode(((Long) value).longValue()); - - if (value instanceof Character) - return encode((Character) value); - - if (value instanceof String) - return encode((String) value); - - if (value instanceof StringBuffer) - return encode((StringBuffer) value); - - if (value instanceof Float) - return encode(((Float) value).floatValue()); - - if (value instanceof Short) - return encode((Short) value); - - if (value instanceof Double) - return encode(((Double) value).doubleValue()); - - if (value instanceof Date) - return encode((Date) value); - - if (value instanceof StringBuilder) - return encode((StringBuilder) value); - - if (value instanceof byte[]) - return encode((byte[]) value); - - return null; - } - - protected static byte[] encode(Byte value) { - byte[] b = new byte[1]; - b[0] = value.byteValue(); - return b; - } - - protected static byte[] encode(Boolean value) { - byte[] b = new byte[1]; - - if (value.booleanValue()) - b[0] = 1; - else - b[0] = 0; - - return b; - } - - protected static byte[] encode(int value) { - return getBytes(value); - } - - protected static byte[] encode(long value) throws Exception { - return getBytes(value); - } - - protected static byte[] encode(Date value) { - return getBytes(value.getTime()); - } - - protected static byte[] encode(Character value) { - return encode(value.charValue()); - } - - protected static byte[] encode(String value) throws Exception { - return value.getBytes("UTF-8"); - } - - protected static byte[] encode(StringBuffer value) throws Exception { - return encode(value.toString()); - } - - protected static byte[] encode(float value) throws Exception { - return encode((int) Float.floatToIntBits(value)); - } - - protected static byte[] encode(Short value) throws Exception { - return encode((int) value.shortValue()); - } - - protected static byte[] encode(double value) throws Exception { - return encode((long) Double.doubleToLongBits(value)); - } - - protected static byte[] encode(StringBuilder value) throws Exception { - return encode(value.toString()); - } - - protected static byte[] encode(byte[] value) { - return value; - } - - protected static byte[] getBytes(long value) { - byte[] b = new byte[8]; - b[0] = (byte) ((value >> 56) & 0xFF); - b[1] = (byte) ((value >> 48) & 0xFF); - b[2] = (byte) ((value >> 40) & 0xFF); - b[3] = (byte) ((value >> 32) & 0xFF); - b[4] = (byte) ((value >> 24) & 0xFF); - b[5] = (byte) ((value >> 16) & 0xFF); - b[6] = (byte) ((value >> 8) & 0xFF); - b[7] = (byte) ((value >> 0) & 0xFF); - return b; - } - - protected static byte[] getBytes(int value) { - byte[] b = new byte[4]; - b[0] = (byte) ((value >> 24) & 0xFF); - b[1] = (byte) ((value >> 16) & 0xFF); - b[2] = (byte) ((value >> 8) & 0xFF); - b[3] = (byte) ((value >> 0) & 0xFF); - return b; - } - - /** - * Decodes byte array using memcache flag to determine type. - * - * @param b - * @param marker - * @return - * @throws Exception - */ - public static Object decode(byte[] b, int flag) throws Exception { - - if (b.length < 1) - return null; - - if ((flag & MemcachedClient.MARKER_BYTE) == MemcachedClient.MARKER_BYTE) - return decodeByte(b); - - if ((flag & MemcachedClient.MARKER_BOOLEAN) == MemcachedClient.MARKER_BOOLEAN) - return decodeBoolean(b); - - if ((flag & MemcachedClient.MARKER_INTEGER) == MemcachedClient.MARKER_INTEGER) - return decodeInteger(b); - - if ((flag & MemcachedClient.MARKER_LONG) == MemcachedClient.MARKER_LONG) - return decodeLong(b); - - if ((flag & MemcachedClient.MARKER_CHARACTER) == MemcachedClient.MARKER_CHARACTER) - return decodeCharacter(b); - - if ((flag & MemcachedClient.MARKER_STRING) == MemcachedClient.MARKER_STRING) - return decodeString(b); - - if ((flag & MemcachedClient.MARKER_STRINGBUFFER) == MemcachedClient.MARKER_STRINGBUFFER) - return decodeStringBuffer(b); - - if ((flag & MemcachedClient.MARKER_FLOAT) == MemcachedClient.MARKER_FLOAT) - return decodeFloat(b); - - if ((flag & MemcachedClient.MARKER_SHORT) == MemcachedClient.MARKER_SHORT) - return decodeShort(b); - - if ((flag & MemcachedClient.MARKER_DOUBLE) == MemcachedClient.MARKER_DOUBLE) - return decodeDouble(b); - - if ((flag & MemcachedClient.MARKER_DATE) == MemcachedClient.MARKER_DATE) - return decodeDate(b); - - if ((flag & MemcachedClient.MARKER_STRINGBUILDER) == MemcachedClient.MARKER_STRINGBUILDER) - return decodeStringBuilder(b); - - if ((flag & MemcachedClient.MARKER_BYTEARR) == MemcachedClient.MARKER_BYTEARR) - return decodeByteArr(b); - - return null; - } - - // decode methods - protected static Byte decodeByte(byte[] b) { - return new Byte(b[0]); - } - - protected static Boolean decodeBoolean(byte[] b) { - boolean value = b[0] == 1; - return (value) ? Boolean.TRUE : Boolean.FALSE; - } - - protected static Integer decodeInteger(byte[] b) { - return new Integer(toInt(b)); - } - - protected static Long decodeLong(byte[] b) throws Exception { - return new Long(toLong(b)); - } - - protected static Character decodeCharacter(byte[] b) { - return new Character((char) decodeInteger(b).intValue()); - } - - protected static String decodeString(byte[] b) throws Exception { - return new String(b, "UTF-8"); - } - - protected static StringBuffer decodeStringBuffer(byte[] b) throws Exception { - return new StringBuffer(decodeString(b)); - } - - protected static Float decodeFloat(byte[] b) throws Exception { - Integer l = decodeInteger(b); - return new Float(Float.intBitsToFloat(l.intValue())); - } - - protected static Short decodeShort(byte[] b) throws Exception { - return new Short((short) decodeInteger(b).intValue()); - } - - protected static Double decodeDouble(byte[] b) throws Exception { - Long l = decodeLong(b); - return new Double(Double.longBitsToDouble(l.longValue())); - } - - protected static Date decodeDate(byte[] b) { - return new Date(toLong(b)); - } - - protected static StringBuilder decodeStringBuilder(byte[] b) - throws Exception { - return new StringBuilder(decodeString(b)); - } - - protected static byte[] decodeByteArr(byte[] b) { - return b; - } - - /** - * This works by taking each of the bit patterns and converting them to ints - * taking into account 2s complement and then adding them.. - * - * @param b - * @return - */ - protected static int toInt(byte[] b) { - return (((((int) b[3]) & 0xFF) << 32) + ((((int) b[2]) & 0xFF) << 40) - + ((((int) b[1]) & 0xFF) << 48) + ((((int) b[0]) & 0xFF) << 56)); - } - - protected static long toLong(byte[] b) { - return ((((long) b[7]) & 0xFF) + ((((long) b[6]) & 0xFF) << 8) - + ((((long) b[5]) & 0xFF) << 16) - + ((((long) b[4]) & 0xFF) << 24) - + ((((long) b[3]) & 0xFF) << 32) - + ((((long) b[2]) & 0xFF) << 40) - + ((((long) b[1]) & 0xFF) << 48) + ((((long) b[0]) & 0xFF) << 56)); - } -} diff --git a/src/memcached/NestedIOException.java b/src/memcached/NestedIOException.java deleted file mode 100644 index 4d811ce..0000000 --- a/src/memcached/NestedIOException.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.edu.buaa.act.memcachedClient; - -import java.io.*; - -/** - * Bridge class to provide nested Exceptions with IOException which has - * constructors that don't take Throwables. - * - */ -public class NestedIOException extends IOException { - - /** - * Create a new NestedIOException instance. - * - * @param cause - * object of type throwable - */ - public NestedIOException(Throwable cause) { - super(cause.getMessage()); - super.initCause(cause); - } - - public NestedIOException(String message, Throwable cause) { - super(message); - initCause(cause); - } -} diff --git a/src/memcached/SockIO.java b/src/memcached/SockIO.java deleted file mode 100644 index 620116f..0000000 --- a/src/memcached/SockIO.java +++ /dev/null @@ -1,432 +0,0 @@ -package memcached; - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.IOException; -import java.net.InetSocketAddress; -import java.net.Socket; -import java.net.UnknownHostException; -import java.nio.channels.SocketChannel; - -import org.apache.log4j.Logger; - -/** - * MemCached client for Java, utility class for Socket IO. - * - * This class is a wrapper around a Socket and its streams. - * - */ -public class SockIO implements LineInputStream { - // logger - private static Logger log = Logger.getLogger(SockIO.class.getName()); - - // data - private String host; - private Socket sock; - - private DataInputStream in; - private BufferedOutputStream out; - - /** - * creates a new SockIO object wrapping a socket connection to host:port, - * and its input and output streams - * - * @param pool - * Pool this object is tied to - * @param host - * host to connect to - * @param port - * port to connect to - * @param timeout - * int ms to block on data for read - * @param connectTimeout - * timeout (in ms) for initial connection - * @param noDelay - * TCP NODELAY option? - * @throws IOException - * if an io error occurrs when creating socket - * @throws UnknownHostException - * if hostname is invalid - */ - public SockIO(String host, int port, int timeout, int connectTimeout, - boolean noDelay) throws IOException, UnknownHostException { - // get a socket channel - sock = getSocket(host, port, connectTimeout); - - if (timeout >= 0) - sock.setSoTimeout(timeout); - - // testing only - sock.setTcpNoDelay(noDelay); - - // wrap streams - in = new DataInputStream(new BufferedInputStream(sock.getInputStream())); - out = new BufferedOutputStream(sock.getOutputStream()); - - this.host = host + ":" + port; - } - - /** - * creates a new SockIO object wrapping a socket connection to host:port, - * and its input and output streams - * - * @param host - * hostname:port - * @param timeout - * read timeout value for connected socket - * @param connectTimeout - * timeout for initial connections - * @param noDelay - * TCP NODELAY option? - * @throws IOException - * if an io error occurrs when creating socket - * @throws UnknownHostException - * if hostname is invalid - */ - public SockIO(String host, int timeout, int connectTimeout, boolean noDelay) - throws IOException, UnknownHostException { - String[] ip = host.split(":"); - - // get socket: default is to use non-blocking connect - sock = getSocket(ip[0], Integer.parseInt(ip[1]), connectTimeout); - - if (timeout >= 0) - this.sock.setSoTimeout(timeout); - - // testing only - sock.setTcpNoDelay(noDelay); - - // wrap streams - in = new DataInputStream(new BufferedInputStream(sock.getInputStream())); - out = new BufferedOutputStream(sock.getOutputStream()); - - this.host = host; - } - - /** - * Method which gets a connection from SocketChannel. - * - * @param host - * host to establish connection to - * @param port - * port on that host - * @param timeout - * connection timeout in ms - * - * @return connected socket - * @throws IOException - * if errors connecting or if connection times out - */ - protected static Socket getSocket(String host, int port, int timeout) - throws IOException { - SocketChannel sock = SocketChannel.open(); - sock.socket().connect(new InetSocketAddress(host, port), timeout); - return sock.socket(); - } - - /** - * Lets caller get access to underlying channel. - * - * @return the backing SocketChannel - */ - public SocketChannel getChannel() { - return sock.getChannel(); - } - - /** - * returns the host this socket is connected to - * - * @return String representation of host (hostname:port) - */ - public String getHost() { - return this.host; - } - - /** - * closes socket and all streams connected to it - * - * @throws IOException - * if fails to close streams or socket - */ - public void trueClose() throws IOException { - trueClose(true); - } - - /** - * closes socket and all streams connected to it - * - * @throws IOException - * if fails to close streams or socket - */ - public void trueClose(boolean addToDeadPool) throws IOException { - if (log.isDebugEnabled()) - log.debug("++++ Closing socket for real: " + toString()); - - boolean err = false; - StringBuilder errMsg = new StringBuilder(); - - if (in != null) { - try { - in.close(); - } catch (IOException ioe) { - log.error("++++ error closing input stream for socket: " - + toString() + " for host: " + getHost()); - log.error(ioe.getMessage(), ioe); - errMsg.append("++++ error closing input stream for socket: " - + toString() + " for host: " + getHost() + "\n"); - errMsg.append(ioe.getMessage()); - err = true; - } - } - - if (out != null) { - try { - out.close(); - } catch (IOException ioe) { - log.error("++++ error closing output stream for socket: " - + toString() + " for host: " + getHost()); - log.error(ioe.getMessage(), ioe); - errMsg.append("++++ error closing output stream for socket: " - + toString() + " for host: " + getHost() + "\n"); - errMsg.append(ioe.getMessage()); - err = true; - } - } - - if (sock != null) { - try { - sock.close(); - } catch (IOException ioe) { - log.error("++++ error closing socket: " + toString() - + " for host: " + getHost()); - log.error(ioe.getMessage(), ioe); - errMsg.append("++++ error closing socket: " + toString() - + " for host: " + getHost() + "\n"); - errMsg.append(ioe.getMessage()); - err = true; - } - } - - // check in to pool - if (addToDeadPool && sock != null) { - // check in to pool pool.checkIn( this, false ); - System.out.println("check in to pool "); - } - - in = null; - out = null; - sock = null; - - if (err) - throw new IOException(errMsg.toString()); - } - - /** - * sets closed flag and checks in to connection pool but does not close - * connections - */ - void close() { - // check in to pool - if (log.isDebugEnabled()) - log.debug("++++ marking socket (" + this.toString() - + ") as closed and available to return to avail pool"); - // pool.checkIn( this ); - } - - /** - * checks if the connection is open - * - * @return true if connected - */ - boolean isConnected() { - return (sock != null && sock.isConnected()); - } - - /* - * checks to see that the connection is still working - * - * @return true if still alive - */ - boolean isAlive() { - - if (!isConnected()) - return false; - - // try to talk to the server w/ a dumb query to ask its version - try { - this.write("version\r\n".getBytes()); - this.flush(); - this.readLine(); - } catch (IOException ex) { - return false; - } - - return true; - } - - /** - * reads a line intentionally not using the deprecated readLine method from - * DataInputStream - * - * @return String that was read in - * @throws IOException - * if io problems during read - */ - public String readLine() throws IOException { - if (sock == null || !sock.isConnected()) { - log.error("++++ attempting to read from closed socket"); - throw new IOException("++++ attempting to read from closed socket"); - } - - byte[] b = new byte[1]; - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - boolean eol = false; - - while (in.read(b, 0, 1) != -1) { - - if (b[0] == 13) { - eol = true; - } else { - if (eol) { - if (b[0] == 10) - break; - - eol = false; - } - } - - // cast byte into char array - bos.write(b, 0, 1); - } - - if (bos == null || bos.size() <= 0) { - throw new IOException( - "++++ Stream appears to be dead, so closing it down"); - } - - // else return the string - return bos.toString().trim(); - } - - /** - * reads up to end of line and returns nothing - * - * @throws IOException - * if io problems during read - */ - public void clearEOL() throws IOException { - if (sock == null || !sock.isConnected()) { - log.error("++++ attempting to read from closed socket"); - throw new IOException("++++ attempting to read from closed socket"); - } - - byte[] b = new byte[1]; - boolean eol = false; - while (in.read(b, 0, 1) != -1) { - - // only stop when we see - // \r (13) followed by \n (10) - if (b[0] == 13) { - eol = true; - continue; - } - - if (eol) { - if (b[0] == 10) - break; - - eol = false; - } - } - } - - /** - * reads length bytes into the passed in byte array from dtream - * - * @param b - * byte array - * @throws IOException - * if io problems during read - */ - public int read(byte[] b) throws IOException { - if (sock == null || !sock.isConnected()) { - log.error("++++ attempting to read from closed socket"); - throw new IOException("++++ attempting to read from closed socket"); - } - - int count = 0; - while (count < b.length) { - int cnt = in.read(b, count, (b.length - count)); - count += cnt; - } - - return count; - } - - /** - * flushes output stream - * - * @throws IOException - * if io problems during read - */ - void flush() throws IOException { - if (sock == null || !sock.isConnected()) { - log.error("++++ attempting to write to closed socket"); - throw new IOException("++++ attempting to write to closed socket"); - } - out.flush(); - } - - /** - * writes a byte array to the output stream - * - * @param b - * byte array to write - * @throws IOException - * if an io error happens - */ - void write(byte[] b) throws IOException { - if (sock == null || !sock.isConnected()) { - log.error("++++ attempting to write to closed socket"); - throw new IOException("++++ attempting to write to closed socket"); - } - out.write(b); - } - - /** - * use the sockets hashcode for this object so we can key off of SockIOs - * - * @return int hashcode - */ - public int hashCode() { - return (sock == null) ? 0 : sock.hashCode(); - } - - /** - * returns the string representation of this socket - * - * @return string - */ - public String toString() { - return (sock == null) ? "" : sock.toString(); - } - - /** - * Hack to reap any leaking children. - */ - protected void finalize() throws Throwable { - try { - if (sock != null) { - log.error("++++ closing potentially leaked socket in finalize"); - sock.close(); - sock = null; - } - } catch (Throwable t) { - log.error(t.getMessage(), t); - } finally { - super.finalize(); - } - } -} \ No newline at end of file diff --git a/src/messageBody/memcachedmsg.java b/src/messageBody/memcachedmsg.java deleted file mode 100644 index 83231f4..0000000 --- a/src/messageBody/memcachedmsg.java +++ /dev/null @@ -1,5766 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: memcached.proto - -package messageBody; - -public final class memcachedmsg { - private memcachedmsg() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - } - public interface Test1OrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional string key = 1; - boolean hasKey(); - String getKey(); - } - public static final class Test1 extends - com.google.protobuf.GeneratedMessage - implements Test1OrBuilder { - // Use Test1.newBuilder() to construct. - private Test1(Builder builder) { - super(builder); - } - private Test1(boolean noInit) {} - - private static final Test1 defaultInstance; - public static Test1 getDefaultInstance() { - return defaultInstance; - } - - public Test1 getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.memcachedmsg.internal_static_Test1_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.memcachedmsg.internal_static_Test1_fieldAccessorTable; - } - - private int bitField0_; - // optional string key = 1; - public static final int KEY_FIELD_NUMBER = 1; - private java.lang.Object key_; - public boolean hasKey() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getKey() { - java.lang.Object ref = key_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - key_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getKeyBytes() { - java.lang.Object ref = key_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - key_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private void initFields() { - key_ = ""; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getKeyBytes()); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getKeyBytes()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static messageBody.memcachedmsg.Test1 parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.memcachedmsg.Test1 parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.Test1 parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.memcachedmsg.Test1 parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.Test1 parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.memcachedmsg.Test1 parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.Test1 parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.memcachedmsg.Test1 parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.memcachedmsg.Test1 parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.memcachedmsg.Test1 parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(messageBody.memcachedmsg.Test1 prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements messageBody.memcachedmsg.Test1OrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.memcachedmsg.internal_static_Test1_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.memcachedmsg.internal_static_Test1_fieldAccessorTable; - } - - // Construct using messageBody.memcachedmsg.Test1.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - key_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return messageBody.memcachedmsg.Test1.getDescriptor(); - } - - public messageBody.memcachedmsg.Test1 getDefaultInstanceForType() { - return messageBody.memcachedmsg.Test1.getDefaultInstance(); - } - - public messageBody.memcachedmsg.Test1 build() { - messageBody.memcachedmsg.Test1 result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private messageBody.memcachedmsg.Test1 buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - messageBody.memcachedmsg.Test1 result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public messageBody.memcachedmsg.Test1 buildPartial() { - messageBody.memcachedmsg.Test1 result = new messageBody.memcachedmsg.Test1(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.key_ = key_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof messageBody.memcachedmsg.Test1) { - return mergeFrom((messageBody.memcachedmsg.Test1)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(messageBody.memcachedmsg.Test1 other) { - if (other == messageBody.memcachedmsg.Test1.getDefaultInstance()) return this; - if (other.hasKey()) { - setKey(other.getKey()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - key_ = input.readBytes(); - break; - } - } - } - } - - private int bitField0_; - - // optional string key = 1; - private java.lang.Object key_ = ""; - public boolean hasKey() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getKey() { - java.lang.Object ref = key_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - key_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setKey(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - key_ = value; - onChanged(); - return this; - } - public Builder clearKey() { - bitField0_ = (bitField0_ & ~0x00000001); - key_ = getDefaultInstance().getKey(); - onChanged(); - return this; - } - void setKey(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - key_ = value; - onChanged(); - } - - // @@protoc_insertion_point(builder_scope:Test1) - } - - static { - defaultInstance = new Test1(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:Test1) - } - - public interface messageTestOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional int32 a = 1; - boolean hasA(); - int getA(); - - // optional int64 b = 2; - boolean hasB(); - long getB(); - - // optional string key = 3; - boolean hasKey(); - String getKey(); - - // optional bool d = 4; - boolean hasD(); - boolean getD(); - - // repeated int32 e = 5; - java.util.List getEList(); - int getECount(); - int getE(int index); - - // optional .Test1 f = 6; - boolean hasF(); - messageBody.memcachedmsg.Test1 getF(); - messageBody.memcachedmsg.Test1OrBuilder getFOrBuilder(); - } - public static final class messageTest extends - com.google.protobuf.GeneratedMessage - implements messageTestOrBuilder { - // Use messageTest.newBuilder() to construct. - private messageTest(Builder builder) { - super(builder); - } - private messageTest(boolean noInit) {} - - private static final messageTest defaultInstance; - public static messageTest getDefaultInstance() { - return defaultInstance; - } - - public messageTest getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.memcachedmsg.internal_static_messageTest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.memcachedmsg.internal_static_messageTest_fieldAccessorTable; - } - - private int bitField0_; - // optional int32 a = 1; - public static final int A_FIELD_NUMBER = 1; - private int a_; - public boolean hasA() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public int getA() { - return a_; - } - - // optional int64 b = 2; - public static final int B_FIELD_NUMBER = 2; - private long b_; - public boolean hasB() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public long getB() { - return b_; - } - - // optional string key = 3; - public static final int KEY_FIELD_NUMBER = 3; - private java.lang.Object key_; - public boolean hasKey() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public String getKey() { - java.lang.Object ref = key_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - key_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getKeyBytes() { - java.lang.Object ref = key_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - key_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional bool d = 4; - public static final int D_FIELD_NUMBER = 4; - private boolean d_; - public boolean hasD() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public boolean getD() { - return d_; - } - - // repeated int32 e = 5; - public static final int E_FIELD_NUMBER = 5; - private java.util.List e_; - public java.util.List - getEList() { - return e_; - } - public int getECount() { - return e_.size(); - } - public int getE(int index) { - return e_.get(index); - } - - // optional .Test1 f = 6; - public static final int F_FIELD_NUMBER = 6; - private messageBody.memcachedmsg.Test1 f_; - public boolean hasF() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - public messageBody.memcachedmsg.Test1 getF() { - return f_; - } - public messageBody.memcachedmsg.Test1OrBuilder getFOrBuilder() { - return f_; - } - - private void initFields() { - a_ = 0; - b_ = 0L; - key_ = ""; - d_ = false; - e_ = java.util.Collections.emptyList();; - f_ = messageBody.memcachedmsg.Test1.getDefaultInstance(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeInt32(1, a_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeInt64(2, b_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeBytes(3, getKeyBytes()); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeBool(4, d_); - } - for (int i = 0; i < e_.size(); i++) { - output.writeInt32(5, e_.get(i)); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - output.writeMessage(6, f_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(1, a_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(2, b_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(3, getKeyBytes()); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeBoolSize(4, d_); - } - { - int dataSize = 0; - for (int i = 0; i < e_.size(); i++) { - dataSize += com.google.protobuf.CodedOutputStream - .computeInt32SizeNoTag(e_.get(i)); - } - size += dataSize; - size += 1 * getEList().size(); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(6, f_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static messageBody.memcachedmsg.messageTest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.memcachedmsg.messageTest parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.messageTest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.memcachedmsg.messageTest parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.messageTest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.memcachedmsg.messageTest parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.messageTest parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.memcachedmsg.messageTest parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.memcachedmsg.messageTest parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.memcachedmsg.messageTest parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(messageBody.memcachedmsg.messageTest prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements messageBody.memcachedmsg.messageTestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.memcachedmsg.internal_static_messageTest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.memcachedmsg.internal_static_messageTest_fieldAccessorTable; - } - - // Construct using messageBody.memcachedmsg.messageTest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getFFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - a_ = 0; - bitField0_ = (bitField0_ & ~0x00000001); - b_ = 0L; - bitField0_ = (bitField0_ & ~0x00000002); - key_ = ""; - bitField0_ = (bitField0_ & ~0x00000004); - d_ = false; - bitField0_ = (bitField0_ & ~0x00000008); - e_ = java.util.Collections.emptyList();; - bitField0_ = (bitField0_ & ~0x00000010); - if (fBuilder_ == null) { - f_ = messageBody.memcachedmsg.Test1.getDefaultInstance(); - } else { - fBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000020); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return messageBody.memcachedmsg.messageTest.getDescriptor(); - } - - public messageBody.memcachedmsg.messageTest getDefaultInstanceForType() { - return messageBody.memcachedmsg.messageTest.getDefaultInstance(); - } - - public messageBody.memcachedmsg.messageTest build() { - messageBody.memcachedmsg.messageTest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private messageBody.memcachedmsg.messageTest buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - messageBody.memcachedmsg.messageTest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public messageBody.memcachedmsg.messageTest buildPartial() { - messageBody.memcachedmsg.messageTest result = new messageBody.memcachedmsg.messageTest(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.a_ = a_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.b_ = b_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.key_ = key_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.d_ = d_; - if (((bitField0_ & 0x00000010) == 0x00000010)) { - e_ = java.util.Collections.unmodifiableList(e_); - bitField0_ = (bitField0_ & ~0x00000010); - } - result.e_ = e_; - if (((from_bitField0_ & 0x00000020) == 0x00000020)) { - to_bitField0_ |= 0x00000010; - } - if (fBuilder_ == null) { - result.f_ = f_; - } else { - result.f_ = fBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof messageBody.memcachedmsg.messageTest) { - return mergeFrom((messageBody.memcachedmsg.messageTest)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(messageBody.memcachedmsg.messageTest other) { - if (other == messageBody.memcachedmsg.messageTest.getDefaultInstance()) return this; - if (other.hasA()) { - setA(other.getA()); - } - if (other.hasB()) { - setB(other.getB()); - } - if (other.hasKey()) { - setKey(other.getKey()); - } - if (other.hasD()) { - setD(other.getD()); - } - if (!other.e_.isEmpty()) { - if (e_.isEmpty()) { - e_ = other.e_; - bitField0_ = (bitField0_ & ~0x00000010); - } else { - ensureEIsMutable(); - e_.addAll(other.e_); - } - onChanged(); - } - if (other.hasF()) { - mergeF(other.getF()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - a_ = input.readInt32(); - break; - } - case 16: { - bitField0_ |= 0x00000002; - b_ = input.readInt64(); - break; - } - case 26: { - bitField0_ |= 0x00000004; - key_ = input.readBytes(); - break; - } - case 32: { - bitField0_ |= 0x00000008; - d_ = input.readBool(); - break; - } - case 40: { - ensureEIsMutable(); - e_.add(input.readInt32()); - break; - } - case 42: { - int length = input.readRawVarint32(); - int limit = input.pushLimit(length); - while (input.getBytesUntilLimit() > 0) { - addE(input.readInt32()); - } - input.popLimit(limit); - break; - } - case 50: { - messageBody.memcachedmsg.Test1.Builder subBuilder = messageBody.memcachedmsg.Test1.newBuilder(); - if (hasF()) { - subBuilder.mergeFrom(getF()); - } - input.readMessage(subBuilder, extensionRegistry); - setF(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // optional int32 a = 1; - private int a_ ; - public boolean hasA() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public int getA() { - return a_; - } - public Builder setA(int value) { - bitField0_ |= 0x00000001; - a_ = value; - onChanged(); - return this; - } - public Builder clearA() { - bitField0_ = (bitField0_ & ~0x00000001); - a_ = 0; - onChanged(); - return this; - } - - // optional int64 b = 2; - private long b_ ; - public boolean hasB() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public long getB() { - return b_; - } - public Builder setB(long value) { - bitField0_ |= 0x00000002; - b_ = value; - onChanged(); - return this; - } - public Builder clearB() { - bitField0_ = (bitField0_ & ~0x00000002); - b_ = 0L; - onChanged(); - return this; - } - - // optional string key = 3; - private java.lang.Object key_ = ""; - public boolean hasKey() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public String getKey() { - java.lang.Object ref = key_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - key_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setKey(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; - key_ = value; - onChanged(); - return this; - } - public Builder clearKey() { - bitField0_ = (bitField0_ & ~0x00000004); - key_ = getDefaultInstance().getKey(); - onChanged(); - return this; - } - void setKey(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000004; - key_ = value; - onChanged(); - } - - // optional bool d = 4; - private boolean d_ ; - public boolean hasD() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public boolean getD() { - return d_; - } - public Builder setD(boolean value) { - bitField0_ |= 0x00000008; - d_ = value; - onChanged(); - return this; - } - public Builder clearD() { - bitField0_ = (bitField0_ & ~0x00000008); - d_ = false; - onChanged(); - return this; - } - - // repeated int32 e = 5; - private java.util.List e_ = java.util.Collections.emptyList();; - private void ensureEIsMutable() { - if (!((bitField0_ & 0x00000010) == 0x00000010)) { - e_ = new java.util.ArrayList(e_); - bitField0_ |= 0x00000010; - } - } - public java.util.List - getEList() { - return java.util.Collections.unmodifiableList(e_); - } - public int getECount() { - return e_.size(); - } - public int getE(int index) { - return e_.get(index); - } - public Builder setE( - int index, int value) { - ensureEIsMutable(); - e_.set(index, value); - onChanged(); - return this; - } - public Builder addE(int value) { - ensureEIsMutable(); - e_.add(value); - onChanged(); - return this; - } - public Builder addAllE( - java.lang.Iterable values) { - ensureEIsMutable(); - super.addAll(values, e_); - onChanged(); - return this; - } - public Builder clearE() { - e_ = java.util.Collections.emptyList();; - bitField0_ = (bitField0_ & ~0x00000010); - onChanged(); - return this; - } - - // optional .Test1 f = 6; - private messageBody.memcachedmsg.Test1 f_ = messageBody.memcachedmsg.Test1.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - messageBody.memcachedmsg.Test1, messageBody.memcachedmsg.Test1.Builder, messageBody.memcachedmsg.Test1OrBuilder> fBuilder_; - public boolean hasF() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - public messageBody.memcachedmsg.Test1 getF() { - if (fBuilder_ == null) { - return f_; - } else { - return fBuilder_.getMessage(); - } - } - public Builder setF(messageBody.memcachedmsg.Test1 value) { - if (fBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - f_ = value; - onChanged(); - } else { - fBuilder_.setMessage(value); - } - bitField0_ |= 0x00000020; - return this; - } - public Builder setF( - messageBody.memcachedmsg.Test1.Builder builderForValue) { - if (fBuilder_ == null) { - f_ = builderForValue.build(); - onChanged(); - } else { - fBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000020; - return this; - } - public Builder mergeF(messageBody.memcachedmsg.Test1 value) { - if (fBuilder_ == null) { - if (((bitField0_ & 0x00000020) == 0x00000020) && - f_ != messageBody.memcachedmsg.Test1.getDefaultInstance()) { - f_ = - messageBody.memcachedmsg.Test1.newBuilder(f_).mergeFrom(value).buildPartial(); - } else { - f_ = value; - } - onChanged(); - } else { - fBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000020; - return this; - } - public Builder clearF() { - if (fBuilder_ == null) { - f_ = messageBody.memcachedmsg.Test1.getDefaultInstance(); - onChanged(); - } else { - fBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000020); - return this; - } - public messageBody.memcachedmsg.Test1.Builder getFBuilder() { - bitField0_ |= 0x00000020; - onChanged(); - return getFFieldBuilder().getBuilder(); - } - public messageBody.memcachedmsg.Test1OrBuilder getFOrBuilder() { - if (fBuilder_ != null) { - return fBuilder_.getMessageOrBuilder(); - } else { - return f_; - } - } - private com.google.protobuf.SingleFieldBuilder< - messageBody.memcachedmsg.Test1, messageBody.memcachedmsg.Test1.Builder, messageBody.memcachedmsg.Test1OrBuilder> - getFFieldBuilder() { - if (fBuilder_ == null) { - fBuilder_ = new com.google.protobuf.SingleFieldBuilder< - messageBody.memcachedmsg.Test1, messageBody.memcachedmsg.Test1.Builder, messageBody.memcachedmsg.Test1OrBuilder>( - f_, - getParentForChildren(), - isClean()); - f_ = null; - } - return fBuilder_; - } - - // @@protoc_insertion_point(builder_scope:messageTest) - } - - static { - defaultInstance = new messageTest(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:messageTest) - } - - public interface nm_ConnectedOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional int32 num = 1; - boolean hasNum(); - int getNum(); - } - public static final class nm_Connected extends - com.google.protobuf.GeneratedMessage - implements nm_ConnectedOrBuilder { - // Use nm_Connected.newBuilder() to construct. - private nm_Connected(Builder builder) { - super(builder); - } - private nm_Connected(boolean noInit) {} - - private static final nm_Connected defaultInstance; - public static nm_Connected getDefaultInstance() { - return defaultInstance; - } - - public nm_Connected getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.memcachedmsg.internal_static_nm_Connected_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.memcachedmsg.internal_static_nm_Connected_fieldAccessorTable; - } - - private int bitField0_; - // optional int32 num = 1; - public static final int NUM_FIELD_NUMBER = 1; - private int num_; - public boolean hasNum() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public int getNum() { - return num_; - } - - private void initFields() { - num_ = 0; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeInt32(1, num_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(1, num_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static messageBody.memcachedmsg.nm_Connected parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.memcachedmsg.nm_Connected parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.nm_Connected parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.memcachedmsg.nm_Connected parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.nm_Connected parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.memcachedmsg.nm_Connected parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.nm_Connected parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.memcachedmsg.nm_Connected parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.memcachedmsg.nm_Connected parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.memcachedmsg.nm_Connected parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(messageBody.memcachedmsg.nm_Connected prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements messageBody.memcachedmsg.nm_ConnectedOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.memcachedmsg.internal_static_nm_Connected_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.memcachedmsg.internal_static_nm_Connected_fieldAccessorTable; - } - - // Construct using messageBody.memcachedmsg.nm_Connected.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - num_ = 0; - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return messageBody.memcachedmsg.nm_Connected.getDescriptor(); - } - - public messageBody.memcachedmsg.nm_Connected getDefaultInstanceForType() { - return messageBody.memcachedmsg.nm_Connected.getDefaultInstance(); - } - - public messageBody.memcachedmsg.nm_Connected build() { - messageBody.memcachedmsg.nm_Connected result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private messageBody.memcachedmsg.nm_Connected buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - messageBody.memcachedmsg.nm_Connected result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public messageBody.memcachedmsg.nm_Connected buildPartial() { - messageBody.memcachedmsg.nm_Connected result = new messageBody.memcachedmsg.nm_Connected(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.num_ = num_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof messageBody.memcachedmsg.nm_Connected) { - return mergeFrom((messageBody.memcachedmsg.nm_Connected)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(messageBody.memcachedmsg.nm_Connected other) { - if (other == messageBody.memcachedmsg.nm_Connected.getDefaultInstance()) return this; - if (other.hasNum()) { - setNum(other.getNum()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - num_ = input.readInt32(); - break; - } - } - } - } - - private int bitField0_; - - // optional int32 num = 1; - private int num_ ; - public boolean hasNum() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public int getNum() { - return num_; - } - public Builder setNum(int value) { - bitField0_ |= 0x00000001; - num_ = value; - onChanged(); - return this; - } - public Builder clearNum() { - bitField0_ = (bitField0_ & ~0x00000001); - num_ = 0; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:nm_Connected) - } - - static { - defaultInstance = new nm_Connected(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:nm_Connected) - } - - public interface nm_Connected_mem_backOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional int32 num = 1; - boolean hasNum(); - int getNum(); - } - public static final class nm_Connected_mem_back extends - com.google.protobuf.GeneratedMessage - implements nm_Connected_mem_backOrBuilder { - // Use nm_Connected_mem_back.newBuilder() to construct. - private nm_Connected_mem_back(Builder builder) { - super(builder); - } - private nm_Connected_mem_back(boolean noInit) {} - - private static final nm_Connected_mem_back defaultInstance; - public static nm_Connected_mem_back getDefaultInstance() { - return defaultInstance; - } - - public nm_Connected_mem_back getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.memcachedmsg.internal_static_nm_Connected_mem_back_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.memcachedmsg.internal_static_nm_Connected_mem_back_fieldAccessorTable; - } - - private int bitField0_; - // optional int32 num = 1; - public static final int NUM_FIELD_NUMBER = 1; - private int num_; - public boolean hasNum() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public int getNum() { - return num_; - } - - private void initFields() { - num_ = 0; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeInt32(1, num_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(1, num_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static messageBody.memcachedmsg.nm_Connected_mem_back parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.memcachedmsg.nm_Connected_mem_back parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.nm_Connected_mem_back parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.memcachedmsg.nm_Connected_mem_back parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.nm_Connected_mem_back parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.memcachedmsg.nm_Connected_mem_back parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.nm_Connected_mem_back parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.memcachedmsg.nm_Connected_mem_back parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.memcachedmsg.nm_Connected_mem_back parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.memcachedmsg.nm_Connected_mem_back parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(messageBody.memcachedmsg.nm_Connected_mem_back prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements messageBody.memcachedmsg.nm_Connected_mem_backOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.memcachedmsg.internal_static_nm_Connected_mem_back_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.memcachedmsg.internal_static_nm_Connected_mem_back_fieldAccessorTable; - } - - // Construct using messageBody.memcachedmsg.nm_Connected_mem_back.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - num_ = 0; - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return messageBody.memcachedmsg.nm_Connected_mem_back.getDescriptor(); - } - - public messageBody.memcachedmsg.nm_Connected_mem_back getDefaultInstanceForType() { - return messageBody.memcachedmsg.nm_Connected_mem_back.getDefaultInstance(); - } - - public messageBody.memcachedmsg.nm_Connected_mem_back build() { - messageBody.memcachedmsg.nm_Connected_mem_back result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private messageBody.memcachedmsg.nm_Connected_mem_back buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - messageBody.memcachedmsg.nm_Connected_mem_back result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public messageBody.memcachedmsg.nm_Connected_mem_back buildPartial() { - messageBody.memcachedmsg.nm_Connected_mem_back result = new messageBody.memcachedmsg.nm_Connected_mem_back(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.num_ = num_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof messageBody.memcachedmsg.nm_Connected_mem_back) { - return mergeFrom((messageBody.memcachedmsg.nm_Connected_mem_back)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(messageBody.memcachedmsg.nm_Connected_mem_back other) { - if (other == messageBody.memcachedmsg.nm_Connected_mem_back.getDefaultInstance()) return this; - if (other.hasNum()) { - setNum(other.getNum()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - num_ = input.readInt32(); - break; - } - } - } - } - - private int bitField0_; - - // optional int32 num = 1; - private int num_ ; - public boolean hasNum() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public int getNum() { - return num_; - } - public Builder setNum(int value) { - bitField0_ |= 0x00000001; - num_ = value; - onChanged(); - return this; - } - public Builder clearNum() { - bitField0_ = (bitField0_ & ~0x00000001); - num_ = 0; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:nm_Connected_mem_back) - } - - static { - defaultInstance = new nm_Connected_mem_back(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:nm_Connected_mem_back) - } - - public interface nm_Connected_web_backOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional int32 num = 1; - boolean hasNum(); - int getNum(); - } - public static final class nm_Connected_web_back extends - com.google.protobuf.GeneratedMessage - implements nm_Connected_web_backOrBuilder { - // Use nm_Connected_web_back.newBuilder() to construct. - private nm_Connected_web_back(Builder builder) { - super(builder); - } - private nm_Connected_web_back(boolean noInit) {} - - private static final nm_Connected_web_back defaultInstance; - public static nm_Connected_web_back getDefaultInstance() { - return defaultInstance; - } - - public nm_Connected_web_back getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.memcachedmsg.internal_static_nm_Connected_web_back_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.memcachedmsg.internal_static_nm_Connected_web_back_fieldAccessorTable; - } - - private int bitField0_; - // optional int32 num = 1; - public static final int NUM_FIELD_NUMBER = 1; - private int num_; - public boolean hasNum() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public int getNum() { - return num_; - } - - private void initFields() { - num_ = 0; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeInt32(1, num_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(1, num_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static messageBody.memcachedmsg.nm_Connected_web_back parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.memcachedmsg.nm_Connected_web_back parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.nm_Connected_web_back parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.memcachedmsg.nm_Connected_web_back parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.nm_Connected_web_back parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.memcachedmsg.nm_Connected_web_back parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.nm_Connected_web_back parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.memcachedmsg.nm_Connected_web_back parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.memcachedmsg.nm_Connected_web_back parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.memcachedmsg.nm_Connected_web_back parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(messageBody.memcachedmsg.nm_Connected_web_back prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements messageBody.memcachedmsg.nm_Connected_web_backOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.memcachedmsg.internal_static_nm_Connected_web_back_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.memcachedmsg.internal_static_nm_Connected_web_back_fieldAccessorTable; - } - - // Construct using messageBody.memcachedmsg.nm_Connected_web_back.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - num_ = 0; - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return messageBody.memcachedmsg.nm_Connected_web_back.getDescriptor(); - } - - public messageBody.memcachedmsg.nm_Connected_web_back getDefaultInstanceForType() { - return messageBody.memcachedmsg.nm_Connected_web_back.getDefaultInstance(); - } - - public messageBody.memcachedmsg.nm_Connected_web_back build() { - messageBody.memcachedmsg.nm_Connected_web_back result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private messageBody.memcachedmsg.nm_Connected_web_back buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - messageBody.memcachedmsg.nm_Connected_web_back result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public messageBody.memcachedmsg.nm_Connected_web_back buildPartial() { - messageBody.memcachedmsg.nm_Connected_web_back result = new messageBody.memcachedmsg.nm_Connected_web_back(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.num_ = num_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof messageBody.memcachedmsg.nm_Connected_web_back) { - return mergeFrom((messageBody.memcachedmsg.nm_Connected_web_back)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(messageBody.memcachedmsg.nm_Connected_web_back other) { - if (other == messageBody.memcachedmsg.nm_Connected_web_back.getDefaultInstance()) return this; - if (other.hasNum()) { - setNum(other.getNum()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - num_ = input.readInt32(); - break; - } - } - } - } - - private int bitField0_; - - // optional int32 num = 1; - private int num_ ; - public boolean hasNum() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public int getNum() { - return num_; - } - public Builder setNum(int value) { - bitField0_ |= 0x00000001; - num_ = value; - onChanged(); - return this; - } - public Builder clearNum() { - bitField0_ = (bitField0_ & ~0x00000001); - num_ = 0; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:nm_Connected_web_back) - } - - static { - defaultInstance = new nm_Connected_web_back(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:nm_Connected_web_back) - } - - public interface nm_readOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional string key = 1; - boolean hasKey(); - String getKey(); - - // optional string value = 2; - boolean hasValue(); - String getValue(); - - // optional int64 time = 3; - boolean hasTime(); - long getTime(); - } - public static final class nm_read extends - com.google.protobuf.GeneratedMessage - implements nm_readOrBuilder { - // Use nm_read.newBuilder() to construct. - private nm_read(Builder builder) { - super(builder); - } - private nm_read(boolean noInit) {} - - private static final nm_read defaultInstance; - public static nm_read getDefaultInstance() { - return defaultInstance; - } - - public nm_read getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.memcachedmsg.internal_static_nm_read_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.memcachedmsg.internal_static_nm_read_fieldAccessorTable; - } - - private int bitField0_; - // optional string key = 1; - public static final int KEY_FIELD_NUMBER = 1; - private java.lang.Object key_; - public boolean hasKey() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getKey() { - java.lang.Object ref = key_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - key_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getKeyBytes() { - java.lang.Object ref = key_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - key_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional string value = 2; - public static final int VALUE_FIELD_NUMBER = 2; - private java.lang.Object value_; - public boolean hasValue() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public String getValue() { - java.lang.Object ref = value_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - value_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getValueBytes() { - java.lang.Object ref = value_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - value_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional int64 time = 3; - public static final int TIME_FIELD_NUMBER = 3; - private long time_; - public boolean hasTime() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public long getTime() { - return time_; - } - - private void initFields() { - key_ = ""; - value_ = ""; - time_ = 0L; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getKeyBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getValueBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeInt64(3, time_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getKeyBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, getValueBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(3, time_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static messageBody.memcachedmsg.nm_read parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.memcachedmsg.nm_read parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.nm_read parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.memcachedmsg.nm_read parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.nm_read parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.memcachedmsg.nm_read parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.nm_read parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.memcachedmsg.nm_read parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.memcachedmsg.nm_read parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.memcachedmsg.nm_read parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(messageBody.memcachedmsg.nm_read prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements messageBody.memcachedmsg.nm_readOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.memcachedmsg.internal_static_nm_read_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.memcachedmsg.internal_static_nm_read_fieldAccessorTable; - } - - // Construct using messageBody.memcachedmsg.nm_read.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - key_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - value_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - time_ = 0L; - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return messageBody.memcachedmsg.nm_read.getDescriptor(); - } - - public messageBody.memcachedmsg.nm_read getDefaultInstanceForType() { - return messageBody.memcachedmsg.nm_read.getDefaultInstance(); - } - - public messageBody.memcachedmsg.nm_read build() { - messageBody.memcachedmsg.nm_read result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private messageBody.memcachedmsg.nm_read buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - messageBody.memcachedmsg.nm_read result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public messageBody.memcachedmsg.nm_read buildPartial() { - messageBody.memcachedmsg.nm_read result = new messageBody.memcachedmsg.nm_read(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.key_ = key_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.value_ = value_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.time_ = time_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof messageBody.memcachedmsg.nm_read) { - return mergeFrom((messageBody.memcachedmsg.nm_read)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(messageBody.memcachedmsg.nm_read other) { - if (other == messageBody.memcachedmsg.nm_read.getDefaultInstance()) return this; - if (other.hasKey()) { - setKey(other.getKey()); - } - if (other.hasValue()) { - setValue(other.getValue()); - } - if (other.hasTime()) { - setTime(other.getTime()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - key_ = input.readBytes(); - break; - } - case 18: { - bitField0_ |= 0x00000002; - value_ = input.readBytes(); - break; - } - case 24: { - bitField0_ |= 0x00000004; - time_ = input.readInt64(); - break; - } - } - } - } - - private int bitField0_; - - // optional string key = 1; - private java.lang.Object key_ = ""; - public boolean hasKey() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getKey() { - java.lang.Object ref = key_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - key_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setKey(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - key_ = value; - onChanged(); - return this; - } - public Builder clearKey() { - bitField0_ = (bitField0_ & ~0x00000001); - key_ = getDefaultInstance().getKey(); - onChanged(); - return this; - } - void setKey(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - key_ = value; - onChanged(); - } - - // optional string value = 2; - private java.lang.Object value_ = ""; - public boolean hasValue() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public String getValue() { - java.lang.Object ref = value_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - value_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setValue(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - value_ = value; - onChanged(); - return this; - } - public Builder clearValue() { - bitField0_ = (bitField0_ & ~0x00000002); - value_ = getDefaultInstance().getValue(); - onChanged(); - return this; - } - void setValue(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000002; - value_ = value; - onChanged(); - } - - // optional int64 time = 3; - private long time_ ; - public boolean hasTime() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public long getTime() { - return time_; - } - public Builder setTime(long value) { - bitField0_ |= 0x00000004; - time_ = value; - onChanged(); - return this; - } - public Builder clearTime() { - bitField0_ = (bitField0_ & ~0x00000004); - time_ = 0L; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:nm_read) - } - - static { - defaultInstance = new nm_read(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:nm_read) - } - - public interface nm_read_recoveryOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional string key = 1; - boolean hasKey(); - String getKey(); - - // optional string value = 2; - boolean hasValue(); - String getValue(); - - // optional int64 time = 3; - boolean hasTime(); - long getTime(); - } - public static final class nm_read_recovery extends - com.google.protobuf.GeneratedMessage - implements nm_read_recoveryOrBuilder { - // Use nm_read_recovery.newBuilder() to construct. - private nm_read_recovery(Builder builder) { - super(builder); - } - private nm_read_recovery(boolean noInit) {} - - private static final nm_read_recovery defaultInstance; - public static nm_read_recovery getDefaultInstance() { - return defaultInstance; - } - - public nm_read_recovery getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.memcachedmsg.internal_static_nm_read_recovery_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.memcachedmsg.internal_static_nm_read_recovery_fieldAccessorTable; - } - - private int bitField0_; - // optional string key = 1; - public static final int KEY_FIELD_NUMBER = 1; - private java.lang.Object key_; - public boolean hasKey() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getKey() { - java.lang.Object ref = key_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - key_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getKeyBytes() { - java.lang.Object ref = key_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - key_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional string value = 2; - public static final int VALUE_FIELD_NUMBER = 2; - private java.lang.Object value_; - public boolean hasValue() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public String getValue() { - java.lang.Object ref = value_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - value_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getValueBytes() { - java.lang.Object ref = value_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - value_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional int64 time = 3; - public static final int TIME_FIELD_NUMBER = 3; - private long time_; - public boolean hasTime() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public long getTime() { - return time_; - } - - private void initFields() { - key_ = ""; - value_ = ""; - time_ = 0L; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getKeyBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getValueBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeInt64(3, time_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getKeyBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, getValueBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(3, time_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static messageBody.memcachedmsg.nm_read_recovery parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.memcachedmsg.nm_read_recovery parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.nm_read_recovery parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.memcachedmsg.nm_read_recovery parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.nm_read_recovery parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.memcachedmsg.nm_read_recovery parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.nm_read_recovery parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.memcachedmsg.nm_read_recovery parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.memcachedmsg.nm_read_recovery parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.memcachedmsg.nm_read_recovery parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(messageBody.memcachedmsg.nm_read_recovery prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements messageBody.memcachedmsg.nm_read_recoveryOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.memcachedmsg.internal_static_nm_read_recovery_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.memcachedmsg.internal_static_nm_read_recovery_fieldAccessorTable; - } - - // Construct using messageBody.memcachedmsg.nm_read_recovery.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - key_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - value_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - time_ = 0L; - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return messageBody.memcachedmsg.nm_read_recovery.getDescriptor(); - } - - public messageBody.memcachedmsg.nm_read_recovery getDefaultInstanceForType() { - return messageBody.memcachedmsg.nm_read_recovery.getDefaultInstance(); - } - - public messageBody.memcachedmsg.nm_read_recovery build() { - messageBody.memcachedmsg.nm_read_recovery result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private messageBody.memcachedmsg.nm_read_recovery buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - messageBody.memcachedmsg.nm_read_recovery result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public messageBody.memcachedmsg.nm_read_recovery buildPartial() { - messageBody.memcachedmsg.nm_read_recovery result = new messageBody.memcachedmsg.nm_read_recovery(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.key_ = key_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.value_ = value_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.time_ = time_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof messageBody.memcachedmsg.nm_read_recovery) { - return mergeFrom((messageBody.memcachedmsg.nm_read_recovery)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(messageBody.memcachedmsg.nm_read_recovery other) { - if (other == messageBody.memcachedmsg.nm_read_recovery.getDefaultInstance()) return this; - if (other.hasKey()) { - setKey(other.getKey()); - } - if (other.hasValue()) { - setValue(other.getValue()); - } - if (other.hasTime()) { - setTime(other.getTime()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - key_ = input.readBytes(); - break; - } - case 18: { - bitField0_ |= 0x00000002; - value_ = input.readBytes(); - break; - } - case 24: { - bitField0_ |= 0x00000004; - time_ = input.readInt64(); - break; - } - } - } - } - - private int bitField0_; - - // optional string key = 1; - private java.lang.Object key_ = ""; - public boolean hasKey() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getKey() { - java.lang.Object ref = key_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - key_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setKey(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - key_ = value; - onChanged(); - return this; - } - public Builder clearKey() { - bitField0_ = (bitField0_ & ~0x00000001); - key_ = getDefaultInstance().getKey(); - onChanged(); - return this; - } - void setKey(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - key_ = value; - onChanged(); - } - - // optional string value = 2; - private java.lang.Object value_ = ""; - public boolean hasValue() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public String getValue() { - java.lang.Object ref = value_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - value_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setValue(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - value_ = value; - onChanged(); - return this; - } - public Builder clearValue() { - bitField0_ = (bitField0_ & ~0x00000002); - value_ = getDefaultInstance().getValue(); - onChanged(); - return this; - } - void setValue(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000002; - value_ = value; - onChanged(); - } - - // optional int64 time = 3; - private long time_ ; - public boolean hasTime() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public long getTime() { - return time_; - } - public Builder setTime(long value) { - bitField0_ |= 0x00000004; - time_ = value; - onChanged(); - return this; - } - public Builder clearTime() { - bitField0_ = (bitField0_ & ~0x00000004); - time_ = 0L; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:nm_read_recovery) - } - - static { - defaultInstance = new nm_read_recovery(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:nm_read_recovery) - } - - public interface nm_write_1OrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional string key = 1; - boolean hasKey(); - String getKey(); - - // optional string value = 2; - boolean hasValue(); - String getValue(); - - // optional int64 time = 3; - boolean hasTime(); - long getTime(); - - // optional int32 memID = 4; - boolean hasMemID(); - int getMemID(); - } - public static final class nm_write_1 extends - com.google.protobuf.GeneratedMessage - implements nm_write_1OrBuilder { - // Use nm_write_1.newBuilder() to construct. - private nm_write_1(Builder builder) { - super(builder); - } - private nm_write_1(boolean noInit) {} - - private static final nm_write_1 defaultInstance; - public static nm_write_1 getDefaultInstance() { - return defaultInstance; - } - - public nm_write_1 getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.memcachedmsg.internal_static_nm_write_1_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.memcachedmsg.internal_static_nm_write_1_fieldAccessorTable; - } - - private int bitField0_; - // optional string key = 1; - public static final int KEY_FIELD_NUMBER = 1; - private java.lang.Object key_; - public boolean hasKey() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getKey() { - java.lang.Object ref = key_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - key_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getKeyBytes() { - java.lang.Object ref = key_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - key_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional string value = 2; - public static final int VALUE_FIELD_NUMBER = 2; - private java.lang.Object value_; - public boolean hasValue() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public String getValue() { - java.lang.Object ref = value_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - value_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getValueBytes() { - java.lang.Object ref = value_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - value_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional int64 time = 3; - public static final int TIME_FIELD_NUMBER = 3; - private long time_; - public boolean hasTime() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public long getTime() { - return time_; - } - - // optional int32 memID = 4; - public static final int MEMID_FIELD_NUMBER = 4; - private int memID_; - public boolean hasMemID() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public int getMemID() { - return memID_; - } - - private void initFields() { - key_ = ""; - value_ = ""; - time_ = 0L; - memID_ = 0; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getKeyBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getValueBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeInt64(3, time_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeInt32(4, memID_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getKeyBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, getValueBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(3, time_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(4, memID_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static messageBody.memcachedmsg.nm_write_1 parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_1 parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_1 parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_1 parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_1 parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_1 parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_1 parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.memcachedmsg.nm_write_1 parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.memcachedmsg.nm_write_1 parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_1 parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(messageBody.memcachedmsg.nm_write_1 prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements messageBody.memcachedmsg.nm_write_1OrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.memcachedmsg.internal_static_nm_write_1_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.memcachedmsg.internal_static_nm_write_1_fieldAccessorTable; - } - - // Construct using messageBody.memcachedmsg.nm_write_1.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - key_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - value_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - time_ = 0L; - bitField0_ = (bitField0_ & ~0x00000004); - memID_ = 0; - bitField0_ = (bitField0_ & ~0x00000008); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return messageBody.memcachedmsg.nm_write_1.getDescriptor(); - } - - public messageBody.memcachedmsg.nm_write_1 getDefaultInstanceForType() { - return messageBody.memcachedmsg.nm_write_1.getDefaultInstance(); - } - - public messageBody.memcachedmsg.nm_write_1 build() { - messageBody.memcachedmsg.nm_write_1 result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private messageBody.memcachedmsg.nm_write_1 buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - messageBody.memcachedmsg.nm_write_1 result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public messageBody.memcachedmsg.nm_write_1 buildPartial() { - messageBody.memcachedmsg.nm_write_1 result = new messageBody.memcachedmsg.nm_write_1(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.key_ = key_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.value_ = value_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.time_ = time_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.memID_ = memID_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof messageBody.memcachedmsg.nm_write_1) { - return mergeFrom((messageBody.memcachedmsg.nm_write_1)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(messageBody.memcachedmsg.nm_write_1 other) { - if (other == messageBody.memcachedmsg.nm_write_1.getDefaultInstance()) return this; - if (other.hasKey()) { - setKey(other.getKey()); - } - if (other.hasValue()) { - setValue(other.getValue()); - } - if (other.hasTime()) { - setTime(other.getTime()); - } - if (other.hasMemID()) { - setMemID(other.getMemID()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - key_ = input.readBytes(); - break; - } - case 18: { - bitField0_ |= 0x00000002; - value_ = input.readBytes(); - break; - } - case 24: { - bitField0_ |= 0x00000004; - time_ = input.readInt64(); - break; - } - case 32: { - bitField0_ |= 0x00000008; - memID_ = input.readInt32(); - break; - } - } - } - } - - private int bitField0_; - - // optional string key = 1; - private java.lang.Object key_ = ""; - public boolean hasKey() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getKey() { - java.lang.Object ref = key_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - key_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setKey(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - key_ = value; - onChanged(); - return this; - } - public Builder clearKey() { - bitField0_ = (bitField0_ & ~0x00000001); - key_ = getDefaultInstance().getKey(); - onChanged(); - return this; - } - void setKey(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - key_ = value; - onChanged(); - } - - // optional string value = 2; - private java.lang.Object value_ = ""; - public boolean hasValue() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public String getValue() { - java.lang.Object ref = value_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - value_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setValue(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - value_ = value; - onChanged(); - return this; - } - public Builder clearValue() { - bitField0_ = (bitField0_ & ~0x00000002); - value_ = getDefaultInstance().getValue(); - onChanged(); - return this; - } - void setValue(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000002; - value_ = value; - onChanged(); - } - - // optional int64 time = 3; - private long time_ ; - public boolean hasTime() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public long getTime() { - return time_; - } - public Builder setTime(long value) { - bitField0_ |= 0x00000004; - time_ = value; - onChanged(); - return this; - } - public Builder clearTime() { - bitField0_ = (bitField0_ & ~0x00000004); - time_ = 0L; - onChanged(); - return this; - } - - // optional int32 memID = 4; - private int memID_ ; - public boolean hasMemID() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public int getMemID() { - return memID_; - } - public Builder setMemID(int value) { - bitField0_ |= 0x00000008; - memID_ = value; - onChanged(); - return this; - } - public Builder clearMemID() { - bitField0_ = (bitField0_ & ~0x00000008); - memID_ = 0; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:nm_write_1) - } - - static { - defaultInstance = new nm_write_1(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:nm_write_1) - } - - public interface nm_write_1_resOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional string key = 1; - boolean hasKey(); - String getKey(); - - // optional string value = 2; - boolean hasValue(); - String getValue(); - - // optional int64 time = 3; - boolean hasTime(); - long getTime(); - - // optional int32 memID = 4; - boolean hasMemID(); - int getMemID(); - } - public static final class nm_write_1_res extends - com.google.protobuf.GeneratedMessage - implements nm_write_1_resOrBuilder { - // Use nm_write_1_res.newBuilder() to construct. - private nm_write_1_res(Builder builder) { - super(builder); - } - private nm_write_1_res(boolean noInit) {} - - private static final nm_write_1_res defaultInstance; - public static nm_write_1_res getDefaultInstance() { - return defaultInstance; - } - - public nm_write_1_res getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.memcachedmsg.internal_static_nm_write_1_res_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.memcachedmsg.internal_static_nm_write_1_res_fieldAccessorTable; - } - - private int bitField0_; - // optional string key = 1; - public static final int KEY_FIELD_NUMBER = 1; - private java.lang.Object key_; - public boolean hasKey() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getKey() { - java.lang.Object ref = key_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - key_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getKeyBytes() { - java.lang.Object ref = key_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - key_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional string value = 2; - public static final int VALUE_FIELD_NUMBER = 2; - private java.lang.Object value_; - public boolean hasValue() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public String getValue() { - java.lang.Object ref = value_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - value_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getValueBytes() { - java.lang.Object ref = value_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - value_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional int64 time = 3; - public static final int TIME_FIELD_NUMBER = 3; - private long time_; - public boolean hasTime() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public long getTime() { - return time_; - } - - // optional int32 memID = 4; - public static final int MEMID_FIELD_NUMBER = 4; - private int memID_; - public boolean hasMemID() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public int getMemID() { - return memID_; - } - - private void initFields() { - key_ = ""; - value_ = ""; - time_ = 0L; - memID_ = 0; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getKeyBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getValueBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeInt64(3, time_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeInt32(4, memID_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getKeyBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, getValueBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(3, time_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(4, memID_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static messageBody.memcachedmsg.nm_write_1_res parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_1_res parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_1_res parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_1_res parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_1_res parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_1_res parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_1_res parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.memcachedmsg.nm_write_1_res parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.memcachedmsg.nm_write_1_res parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_1_res parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(messageBody.memcachedmsg.nm_write_1_res prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements messageBody.memcachedmsg.nm_write_1_resOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.memcachedmsg.internal_static_nm_write_1_res_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.memcachedmsg.internal_static_nm_write_1_res_fieldAccessorTable; - } - - // Construct using messageBody.memcachedmsg.nm_write_1_res.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - key_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - value_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - time_ = 0L; - bitField0_ = (bitField0_ & ~0x00000004); - memID_ = 0; - bitField0_ = (bitField0_ & ~0x00000008); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return messageBody.memcachedmsg.nm_write_1_res.getDescriptor(); - } - - public messageBody.memcachedmsg.nm_write_1_res getDefaultInstanceForType() { - return messageBody.memcachedmsg.nm_write_1_res.getDefaultInstance(); - } - - public messageBody.memcachedmsg.nm_write_1_res build() { - messageBody.memcachedmsg.nm_write_1_res result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private messageBody.memcachedmsg.nm_write_1_res buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - messageBody.memcachedmsg.nm_write_1_res result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public messageBody.memcachedmsg.nm_write_1_res buildPartial() { - messageBody.memcachedmsg.nm_write_1_res result = new messageBody.memcachedmsg.nm_write_1_res(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.key_ = key_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.value_ = value_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.time_ = time_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.memID_ = memID_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof messageBody.memcachedmsg.nm_write_1_res) { - return mergeFrom((messageBody.memcachedmsg.nm_write_1_res)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(messageBody.memcachedmsg.nm_write_1_res other) { - if (other == messageBody.memcachedmsg.nm_write_1_res.getDefaultInstance()) return this; - if (other.hasKey()) { - setKey(other.getKey()); - } - if (other.hasValue()) { - setValue(other.getValue()); - } - if (other.hasTime()) { - setTime(other.getTime()); - } - if (other.hasMemID()) { - setMemID(other.getMemID()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - key_ = input.readBytes(); - break; - } - case 18: { - bitField0_ |= 0x00000002; - value_ = input.readBytes(); - break; - } - case 24: { - bitField0_ |= 0x00000004; - time_ = input.readInt64(); - break; - } - case 32: { - bitField0_ |= 0x00000008; - memID_ = input.readInt32(); - break; - } - } - } - } - - private int bitField0_; - - // optional string key = 1; - private java.lang.Object key_ = ""; - public boolean hasKey() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getKey() { - java.lang.Object ref = key_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - key_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setKey(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - key_ = value; - onChanged(); - return this; - } - public Builder clearKey() { - bitField0_ = (bitField0_ & ~0x00000001); - key_ = getDefaultInstance().getKey(); - onChanged(); - return this; - } - void setKey(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - key_ = value; - onChanged(); - } - - // optional string value = 2; - private java.lang.Object value_ = ""; - public boolean hasValue() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public String getValue() { - java.lang.Object ref = value_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - value_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setValue(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - value_ = value; - onChanged(); - return this; - } - public Builder clearValue() { - bitField0_ = (bitField0_ & ~0x00000002); - value_ = getDefaultInstance().getValue(); - onChanged(); - return this; - } - void setValue(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000002; - value_ = value; - onChanged(); - } - - // optional int64 time = 3; - private long time_ ; - public boolean hasTime() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public long getTime() { - return time_; - } - public Builder setTime(long value) { - bitField0_ |= 0x00000004; - time_ = value; - onChanged(); - return this; - } - public Builder clearTime() { - bitField0_ = (bitField0_ & ~0x00000004); - time_ = 0L; - onChanged(); - return this; - } - - // optional int32 memID = 4; - private int memID_ ; - public boolean hasMemID() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public int getMemID() { - return memID_; - } - public Builder setMemID(int value) { - bitField0_ |= 0x00000008; - memID_ = value; - onChanged(); - return this; - } - public Builder clearMemID() { - bitField0_ = (bitField0_ & ~0x00000008); - memID_ = 0; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:nm_write_1_res) - } - - static { - defaultInstance = new nm_write_1_res(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:nm_write_1_res) - } - - public interface nm_write_2OrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional string key = 1; - boolean hasKey(); - String getKey(); - - // optional string value = 2; - boolean hasValue(); - String getValue(); - - // optional int64 time = 3; - boolean hasTime(); - long getTime(); - - // optional int32 memID = 4; - boolean hasMemID(); - int getMemID(); - } - public static final class nm_write_2 extends - com.google.protobuf.GeneratedMessage - implements nm_write_2OrBuilder { - // Use nm_write_2.newBuilder() to construct. - private nm_write_2(Builder builder) { - super(builder); - } - private nm_write_2(boolean noInit) {} - - private static final nm_write_2 defaultInstance; - public static nm_write_2 getDefaultInstance() { - return defaultInstance; - } - - public nm_write_2 getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.memcachedmsg.internal_static_nm_write_2_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.memcachedmsg.internal_static_nm_write_2_fieldAccessorTable; - } - - private int bitField0_; - // optional string key = 1; - public static final int KEY_FIELD_NUMBER = 1; - private java.lang.Object key_; - public boolean hasKey() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getKey() { - java.lang.Object ref = key_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - key_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getKeyBytes() { - java.lang.Object ref = key_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - key_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional string value = 2; - public static final int VALUE_FIELD_NUMBER = 2; - private java.lang.Object value_; - public boolean hasValue() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public String getValue() { - java.lang.Object ref = value_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - value_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getValueBytes() { - java.lang.Object ref = value_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - value_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional int64 time = 3; - public static final int TIME_FIELD_NUMBER = 3; - private long time_; - public boolean hasTime() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public long getTime() { - return time_; - } - - // optional int32 memID = 4; - public static final int MEMID_FIELD_NUMBER = 4; - private int memID_; - public boolean hasMemID() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public int getMemID() { - return memID_; - } - - private void initFields() { - key_ = ""; - value_ = ""; - time_ = 0L; - memID_ = 0; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getKeyBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getValueBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeInt64(3, time_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeInt32(4, memID_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getKeyBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, getValueBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(3, time_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(4, memID_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static messageBody.memcachedmsg.nm_write_2 parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_2 parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_2 parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_2 parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_2 parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_2 parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_2 parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.memcachedmsg.nm_write_2 parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.memcachedmsg.nm_write_2 parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_2 parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(messageBody.memcachedmsg.nm_write_2 prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements messageBody.memcachedmsg.nm_write_2OrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.memcachedmsg.internal_static_nm_write_2_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.memcachedmsg.internal_static_nm_write_2_fieldAccessorTable; - } - - // Construct using messageBody.memcachedmsg.nm_write_2.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - key_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - value_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - time_ = 0L; - bitField0_ = (bitField0_ & ~0x00000004); - memID_ = 0; - bitField0_ = (bitField0_ & ~0x00000008); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return messageBody.memcachedmsg.nm_write_2.getDescriptor(); - } - - public messageBody.memcachedmsg.nm_write_2 getDefaultInstanceForType() { - return messageBody.memcachedmsg.nm_write_2.getDefaultInstance(); - } - - public messageBody.memcachedmsg.nm_write_2 build() { - messageBody.memcachedmsg.nm_write_2 result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private messageBody.memcachedmsg.nm_write_2 buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - messageBody.memcachedmsg.nm_write_2 result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public messageBody.memcachedmsg.nm_write_2 buildPartial() { - messageBody.memcachedmsg.nm_write_2 result = new messageBody.memcachedmsg.nm_write_2(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.key_ = key_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.value_ = value_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.time_ = time_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.memID_ = memID_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof messageBody.memcachedmsg.nm_write_2) { - return mergeFrom((messageBody.memcachedmsg.nm_write_2)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(messageBody.memcachedmsg.nm_write_2 other) { - if (other == messageBody.memcachedmsg.nm_write_2.getDefaultInstance()) return this; - if (other.hasKey()) { - setKey(other.getKey()); - } - if (other.hasValue()) { - setValue(other.getValue()); - } - if (other.hasTime()) { - setTime(other.getTime()); - } - if (other.hasMemID()) { - setMemID(other.getMemID()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - key_ = input.readBytes(); - break; - } - case 18: { - bitField0_ |= 0x00000002; - value_ = input.readBytes(); - break; - } - case 24: { - bitField0_ |= 0x00000004; - time_ = input.readInt64(); - break; - } - case 32: { - bitField0_ |= 0x00000008; - memID_ = input.readInt32(); - break; - } - } - } - } - - private int bitField0_; - - // optional string key = 1; - private java.lang.Object key_ = ""; - public boolean hasKey() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getKey() { - java.lang.Object ref = key_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - key_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setKey(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - key_ = value; - onChanged(); - return this; - } - public Builder clearKey() { - bitField0_ = (bitField0_ & ~0x00000001); - key_ = getDefaultInstance().getKey(); - onChanged(); - return this; - } - void setKey(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - key_ = value; - onChanged(); - } - - // optional string value = 2; - private java.lang.Object value_ = ""; - public boolean hasValue() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public String getValue() { - java.lang.Object ref = value_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - value_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setValue(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - value_ = value; - onChanged(); - return this; - } - public Builder clearValue() { - bitField0_ = (bitField0_ & ~0x00000002); - value_ = getDefaultInstance().getValue(); - onChanged(); - return this; - } - void setValue(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000002; - value_ = value; - onChanged(); - } - - // optional int64 time = 3; - private long time_ ; - public boolean hasTime() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public long getTime() { - return time_; - } - public Builder setTime(long value) { - bitField0_ |= 0x00000004; - time_ = value; - onChanged(); - return this; - } - public Builder clearTime() { - bitField0_ = (bitField0_ & ~0x00000004); - time_ = 0L; - onChanged(); - return this; - } - - // optional int32 memID = 4; - private int memID_ ; - public boolean hasMemID() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public int getMemID() { - return memID_; - } - public Builder setMemID(int value) { - bitField0_ |= 0x00000008; - memID_ = value; - onChanged(); - return this; - } - public Builder clearMemID() { - bitField0_ = (bitField0_ & ~0x00000008); - memID_ = 0; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:nm_write_2) - } - - static { - defaultInstance = new nm_write_2(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:nm_write_2) - } - - public interface nm_write_2_resOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional string key = 1; - boolean hasKey(); - String getKey(); - - // optional string value = 2; - boolean hasValue(); - String getValue(); - - // optional int64 time = 3; - boolean hasTime(); - long getTime(); - - // optional int32 memID = 4; - boolean hasMemID(); - int getMemID(); - } - public static final class nm_write_2_res extends - com.google.protobuf.GeneratedMessage - implements nm_write_2_resOrBuilder { - // Use nm_write_2_res.newBuilder() to construct. - private nm_write_2_res(Builder builder) { - super(builder); - } - private nm_write_2_res(boolean noInit) {} - - private static final nm_write_2_res defaultInstance; - public static nm_write_2_res getDefaultInstance() { - return defaultInstance; - } - - public nm_write_2_res getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.memcachedmsg.internal_static_nm_write_2_res_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.memcachedmsg.internal_static_nm_write_2_res_fieldAccessorTable; - } - - private int bitField0_; - // optional string key = 1; - public static final int KEY_FIELD_NUMBER = 1; - private java.lang.Object key_; - public boolean hasKey() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getKey() { - java.lang.Object ref = key_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - key_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getKeyBytes() { - java.lang.Object ref = key_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - key_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional string value = 2; - public static final int VALUE_FIELD_NUMBER = 2; - private java.lang.Object value_; - public boolean hasValue() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public String getValue() { - java.lang.Object ref = value_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - value_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getValueBytes() { - java.lang.Object ref = value_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - value_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional int64 time = 3; - public static final int TIME_FIELD_NUMBER = 3; - private long time_; - public boolean hasTime() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public long getTime() { - return time_; - } - - // optional int32 memID = 4; - public static final int MEMID_FIELD_NUMBER = 4; - private int memID_; - public boolean hasMemID() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public int getMemID() { - return memID_; - } - - private void initFields() { - key_ = ""; - value_ = ""; - time_ = 0L; - memID_ = 0; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getKeyBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getValueBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeInt64(3, time_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeInt32(4, memID_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getKeyBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, getValueBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(3, time_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(4, memID_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static messageBody.memcachedmsg.nm_write_2_res parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_2_res parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_2_res parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_2_res parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_2_res parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_2_res parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_2_res parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.memcachedmsg.nm_write_2_res parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.memcachedmsg.nm_write_2_res parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.memcachedmsg.nm_write_2_res parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(messageBody.memcachedmsg.nm_write_2_res prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements messageBody.memcachedmsg.nm_write_2_resOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.memcachedmsg.internal_static_nm_write_2_res_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.memcachedmsg.internal_static_nm_write_2_res_fieldAccessorTable; - } - - // Construct using messageBody.memcachedmsg.nm_write_2_res.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - key_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - value_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - time_ = 0L; - bitField0_ = (bitField0_ & ~0x00000004); - memID_ = 0; - bitField0_ = (bitField0_ & ~0x00000008); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return messageBody.memcachedmsg.nm_write_2_res.getDescriptor(); - } - - public messageBody.memcachedmsg.nm_write_2_res getDefaultInstanceForType() { - return messageBody.memcachedmsg.nm_write_2_res.getDefaultInstance(); - } - - public messageBody.memcachedmsg.nm_write_2_res build() { - messageBody.memcachedmsg.nm_write_2_res result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private messageBody.memcachedmsg.nm_write_2_res buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - messageBody.memcachedmsg.nm_write_2_res result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public messageBody.memcachedmsg.nm_write_2_res buildPartial() { - messageBody.memcachedmsg.nm_write_2_res result = new messageBody.memcachedmsg.nm_write_2_res(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.key_ = key_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.value_ = value_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.time_ = time_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.memID_ = memID_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof messageBody.memcachedmsg.nm_write_2_res) { - return mergeFrom((messageBody.memcachedmsg.nm_write_2_res)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(messageBody.memcachedmsg.nm_write_2_res other) { - if (other == messageBody.memcachedmsg.nm_write_2_res.getDefaultInstance()) return this; - if (other.hasKey()) { - setKey(other.getKey()); - } - if (other.hasValue()) { - setValue(other.getValue()); - } - if (other.hasTime()) { - setTime(other.getTime()); - } - if (other.hasMemID()) { - setMemID(other.getMemID()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - key_ = input.readBytes(); - break; - } - case 18: { - bitField0_ |= 0x00000002; - value_ = input.readBytes(); - break; - } - case 24: { - bitField0_ |= 0x00000004; - time_ = input.readInt64(); - break; - } - case 32: { - bitField0_ |= 0x00000008; - memID_ = input.readInt32(); - break; - } - } - } - } - - private int bitField0_; - - // optional string key = 1; - private java.lang.Object key_ = ""; - public boolean hasKey() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getKey() { - java.lang.Object ref = key_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - key_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setKey(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - key_ = value; - onChanged(); - return this; - } - public Builder clearKey() { - bitField0_ = (bitField0_ & ~0x00000001); - key_ = getDefaultInstance().getKey(); - onChanged(); - return this; - } - void setKey(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - key_ = value; - onChanged(); - } - - // optional string value = 2; - private java.lang.Object value_ = ""; - public boolean hasValue() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public String getValue() { - java.lang.Object ref = value_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - value_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setValue(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - value_ = value; - onChanged(); - return this; - } - public Builder clearValue() { - bitField0_ = (bitField0_ & ~0x00000002); - value_ = getDefaultInstance().getValue(); - onChanged(); - return this; - } - void setValue(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000002; - value_ = value; - onChanged(); - } - - // optional int64 time = 3; - private long time_ ; - public boolean hasTime() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public long getTime() { - return time_; - } - public Builder setTime(long value) { - bitField0_ |= 0x00000004; - time_ = value; - onChanged(); - return this; - } - public Builder clearTime() { - bitField0_ = (bitField0_ & ~0x00000004); - time_ = 0L; - onChanged(); - return this; - } - - // optional int32 memID = 4; - private int memID_ ; - public boolean hasMemID() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public int getMemID() { - return memID_; - } - public Builder setMemID(int value) { - bitField0_ |= 0x00000008; - memID_ = value; - onChanged(); - return this; - } - public Builder clearMemID() { - bitField0_ = (bitField0_ & ~0x00000008); - memID_ = 0; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:nm_write_2_res) - } - - static { - defaultInstance = new nm_write_2_res(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:nm_write_2_res) - } - - private static com.google.protobuf.Descriptors.Descriptor - internal_static_Test1_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_Test1_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_messageTest_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_messageTest_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_nm_Connected_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_nm_Connected_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_nm_Connected_mem_back_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_nm_Connected_mem_back_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_nm_Connected_web_back_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_nm_Connected_web_back_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_nm_read_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_nm_read_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_nm_read_recovery_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_nm_read_recovery_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_nm_write_1_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_nm_write_1_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_nm_write_1_res_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_nm_write_1_res_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_nm_write_2_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_nm_write_2_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_nm_write_2_res_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_nm_write_2_res_fieldAccessorTable; - - public static com.google.protobuf.Descriptors.FileDescriptor - getDescriptor() { - return descriptor; - } - private static com.google.protobuf.Descriptors.FileDescriptor - descriptor; - static { - java.lang.String[] descriptorData = { - "\n\017memcached.proto\"\024\n\005Test1\022\013\n\003key\030\001 \001(\t\"" + - "Y\n\013messageTest\022\t\n\001a\030\001 \001(\005\022\t\n\001b\030\002 \001(\003\022\013\n\003" + - "key\030\003 \001(\t\022\t\n\001d\030\004 \001(\010\022\t\n\001e\030\005 \003(\005\022\021\n\001f\030\006 \001" + - "(\0132\006.Test1\"\033\n\014nm_Connected\022\013\n\003num\030\001 \001(\005\"" + - "$\n\025nm_Connected_mem_back\022\013\n\003num\030\001 \001(\005\"$\n" + - "\025nm_Connected_web_back\022\013\n\003num\030\001 \001(\005\"3\n\007n" + - "m_read\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t\022\014\n\004ti" + - "me\030\003 \001(\003\"<\n\020nm_read_recovery\022\013\n\003key\030\001 \001(" + - "\t\022\r\n\005value\030\002 \001(\t\022\014\n\004time\030\003 \001(\003\"E\n\nnm_wri" + - "te_1\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t\022\014\n\004time", - "\030\003 \001(\003\022\r\n\005memID\030\004 \001(\005\"I\n\016nm_write_1_res\022" + - "\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t\022\014\n\004time\030\003 \001(" + - "\003\022\r\n\005memID\030\004 \001(\005\"E\n\nnm_write_2\022\013\n\003key\030\001 " + - "\001(\t\022\r\n\005value\030\002 \001(\t\022\014\n\004time\030\003 \001(\003\022\r\n\005memI" + - "D\030\004 \001(\005\"I\n\016nm_write_2_res\022\013\n\003key\030\001 \001(\t\022\r" + - "\n\005value\030\002 \001(\t\022\014\n\004time\030\003 \001(\003\022\r\n\005memID\030\004 \001" + - "(\005B\033\n\013messageBodyB\014memcachedmsg" - }; - com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = - new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { - public com.google.protobuf.ExtensionRegistry assignDescriptors( - com.google.protobuf.Descriptors.FileDescriptor root) { - descriptor = root; - internal_static_Test1_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_Test1_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_Test1_descriptor, - new java.lang.String[] { "Key", }, - messageBody.memcachedmsg.Test1.class, - messageBody.memcachedmsg.Test1.Builder.class); - internal_static_messageTest_descriptor = - getDescriptor().getMessageTypes().get(1); - internal_static_messageTest_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_messageTest_descriptor, - new java.lang.String[] { "A", "B", "Key", "D", "E", "F", }, - messageBody.memcachedmsg.messageTest.class, - messageBody.memcachedmsg.messageTest.Builder.class); - internal_static_nm_Connected_descriptor = - getDescriptor().getMessageTypes().get(2); - internal_static_nm_Connected_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_nm_Connected_descriptor, - new java.lang.String[] { "Num", }, - messageBody.memcachedmsg.nm_Connected.class, - messageBody.memcachedmsg.nm_Connected.Builder.class); - internal_static_nm_Connected_mem_back_descriptor = - getDescriptor().getMessageTypes().get(3); - internal_static_nm_Connected_mem_back_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_nm_Connected_mem_back_descriptor, - new java.lang.String[] { "Num", }, - messageBody.memcachedmsg.nm_Connected_mem_back.class, - messageBody.memcachedmsg.nm_Connected_mem_back.Builder.class); - internal_static_nm_Connected_web_back_descriptor = - getDescriptor().getMessageTypes().get(4); - internal_static_nm_Connected_web_back_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_nm_Connected_web_back_descriptor, - new java.lang.String[] { "Num", }, - messageBody.memcachedmsg.nm_Connected_web_back.class, - messageBody.memcachedmsg.nm_Connected_web_back.Builder.class); - internal_static_nm_read_descriptor = - getDescriptor().getMessageTypes().get(5); - internal_static_nm_read_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_nm_read_descriptor, - new java.lang.String[] { "Key", "Value", "Time", }, - messageBody.memcachedmsg.nm_read.class, - messageBody.memcachedmsg.nm_read.Builder.class); - internal_static_nm_read_recovery_descriptor = - getDescriptor().getMessageTypes().get(6); - internal_static_nm_read_recovery_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_nm_read_recovery_descriptor, - new java.lang.String[] { "Key", "Value", "Time", }, - messageBody.memcachedmsg.nm_read_recovery.class, - messageBody.memcachedmsg.nm_read_recovery.Builder.class); - internal_static_nm_write_1_descriptor = - getDescriptor().getMessageTypes().get(7); - internal_static_nm_write_1_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_nm_write_1_descriptor, - new java.lang.String[] { "Key", "Value", "Time", "MemID", }, - messageBody.memcachedmsg.nm_write_1.class, - messageBody.memcachedmsg.nm_write_1.Builder.class); - internal_static_nm_write_1_res_descriptor = - getDescriptor().getMessageTypes().get(8); - internal_static_nm_write_1_res_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_nm_write_1_res_descriptor, - new java.lang.String[] { "Key", "Value", "Time", "MemID", }, - messageBody.memcachedmsg.nm_write_1_res.class, - messageBody.memcachedmsg.nm_write_1_res.Builder.class); - internal_static_nm_write_2_descriptor = - getDescriptor().getMessageTypes().get(9); - internal_static_nm_write_2_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_nm_write_2_descriptor, - new java.lang.String[] { "Key", "Value", "Time", "MemID", }, - messageBody.memcachedmsg.nm_write_2.class, - messageBody.memcachedmsg.nm_write_2.Builder.class); - internal_static_nm_write_2_res_descriptor = - getDescriptor().getMessageTypes().get(10); - internal_static_nm_write_2_res_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_nm_write_2_res_descriptor, - new java.lang.String[] { "Key", "Value", "Time", "MemID", }, - messageBody.memcachedmsg.nm_write_2_res.class, - messageBody.memcachedmsg.nm_write_2_res.Builder.class); - return null; - } - }; - com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - }, assigner); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/src/messageBody/requestMsg.java b/src/messageBody/requestMsg.java deleted file mode 100644 index 6fe9727..0000000 --- a/src/messageBody/requestMsg.java +++ /dev/null @@ -1,2804 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: requestMsg.proto - -package messageBody; - -public final class requestMsg { - private requestMsg() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - } - public interface nr_Connected_memOrBuilder - extends com.google.protobuf.MessageOrBuilder { - } - public static final class nr_Connected_mem extends - com.google.protobuf.GeneratedMessage - implements nr_Connected_memOrBuilder { - // Use nr_Connected_mem.newBuilder() to construct. - private nr_Connected_mem(Builder builder) { - super(builder); - } - private nr_Connected_mem(boolean noInit) {} - - private static final nr_Connected_mem defaultInstance; - public static nr_Connected_mem getDefaultInstance() { - return defaultInstance; - } - - public nr_Connected_mem getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.requestMsg.internal_static_nr_Connected_mem_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.requestMsg.internal_static_nr_Connected_mem_fieldAccessorTable; - } - - private void initFields() { - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static messageBody.requestMsg.nr_Connected_mem parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.requestMsg.nr_Connected_mem parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.requestMsg.nr_Connected_mem parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.requestMsg.nr_Connected_mem parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.requestMsg.nr_Connected_mem parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.requestMsg.nr_Connected_mem parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static messageBody.requestMsg.nr_Connected_mem parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.requestMsg.nr_Connected_mem parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.requestMsg.nr_Connected_mem parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.requestMsg.nr_Connected_mem parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(messageBody.requestMsg.nr_Connected_mem prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements messageBody.requestMsg.nr_Connected_memOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.requestMsg.internal_static_nr_Connected_mem_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.requestMsg.internal_static_nr_Connected_mem_fieldAccessorTable; - } - - // Construct using messageBody.requestMsg.nr_Connected_mem.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return messageBody.requestMsg.nr_Connected_mem.getDescriptor(); - } - - public messageBody.requestMsg.nr_Connected_mem getDefaultInstanceForType() { - return messageBody.requestMsg.nr_Connected_mem.getDefaultInstance(); - } - - public messageBody.requestMsg.nr_Connected_mem build() { - messageBody.requestMsg.nr_Connected_mem result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private messageBody.requestMsg.nr_Connected_mem buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - messageBody.requestMsg.nr_Connected_mem result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public messageBody.requestMsg.nr_Connected_mem buildPartial() { - messageBody.requestMsg.nr_Connected_mem result = new messageBody.requestMsg.nr_Connected_mem(this); - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof messageBody.requestMsg.nr_Connected_mem) { - return mergeFrom((messageBody.requestMsg.nr_Connected_mem)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(messageBody.requestMsg.nr_Connected_mem other) { - if (other == messageBody.requestMsg.nr_Connected_mem.getDefaultInstance()) return this; - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - } - } - } - - - // @@protoc_insertion_point(builder_scope:nr_Connected_mem) - } - - static { - defaultInstance = new nr_Connected_mem(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:nr_Connected_mem) - } - - public interface nr_Connected_mem_backOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional int32 memID = 1; - boolean hasMemID(); - int getMemID(); - } - public static final class nr_Connected_mem_back extends - com.google.protobuf.GeneratedMessage - implements nr_Connected_mem_backOrBuilder { - // Use nr_Connected_mem_back.newBuilder() to construct. - private nr_Connected_mem_back(Builder builder) { - super(builder); - } - private nr_Connected_mem_back(boolean noInit) {} - - private static final nr_Connected_mem_back defaultInstance; - public static nr_Connected_mem_back getDefaultInstance() { - return defaultInstance; - } - - public nr_Connected_mem_back getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.requestMsg.internal_static_nr_Connected_mem_back_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.requestMsg.internal_static_nr_Connected_mem_back_fieldAccessorTable; - } - - private int bitField0_; - // optional int32 memID = 1; - public static final int MEMID_FIELD_NUMBER = 1; - private int memID_; - public boolean hasMemID() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public int getMemID() { - return memID_; - } - - private void initFields() { - memID_ = 0; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeInt32(1, memID_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(1, memID_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static messageBody.requestMsg.nr_Connected_mem_back parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.requestMsg.nr_Connected_mem_back parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.requestMsg.nr_Connected_mem_back parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.requestMsg.nr_Connected_mem_back parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.requestMsg.nr_Connected_mem_back parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.requestMsg.nr_Connected_mem_back parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static messageBody.requestMsg.nr_Connected_mem_back parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.requestMsg.nr_Connected_mem_back parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.requestMsg.nr_Connected_mem_back parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.requestMsg.nr_Connected_mem_back parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(messageBody.requestMsg.nr_Connected_mem_back prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements messageBody.requestMsg.nr_Connected_mem_backOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.requestMsg.internal_static_nr_Connected_mem_back_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.requestMsg.internal_static_nr_Connected_mem_back_fieldAccessorTable; - } - - // Construct using messageBody.requestMsg.nr_Connected_mem_back.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - memID_ = 0; - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return messageBody.requestMsg.nr_Connected_mem_back.getDescriptor(); - } - - public messageBody.requestMsg.nr_Connected_mem_back getDefaultInstanceForType() { - return messageBody.requestMsg.nr_Connected_mem_back.getDefaultInstance(); - } - - public messageBody.requestMsg.nr_Connected_mem_back build() { - messageBody.requestMsg.nr_Connected_mem_back result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private messageBody.requestMsg.nr_Connected_mem_back buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - messageBody.requestMsg.nr_Connected_mem_back result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public messageBody.requestMsg.nr_Connected_mem_back buildPartial() { - messageBody.requestMsg.nr_Connected_mem_back result = new messageBody.requestMsg.nr_Connected_mem_back(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.memID_ = memID_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof messageBody.requestMsg.nr_Connected_mem_back) { - return mergeFrom((messageBody.requestMsg.nr_Connected_mem_back)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(messageBody.requestMsg.nr_Connected_mem_back other) { - if (other == messageBody.requestMsg.nr_Connected_mem_back.getDefaultInstance()) return this; - if (other.hasMemID()) { - setMemID(other.getMemID()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - memID_ = input.readInt32(); - break; - } - } - } - } - - private int bitField0_; - - // optional int32 memID = 1; - private int memID_ ; - public boolean hasMemID() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public int getMemID() { - return memID_; - } - public Builder setMemID(int value) { - bitField0_ |= 0x00000001; - memID_ = value; - onChanged(); - return this; - } - public Builder clearMemID() { - bitField0_ = (bitField0_ & ~0x00000001); - memID_ = 0; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:nr_Connected_mem_back) - } - - static { - defaultInstance = new nr_Connected_mem_back(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:nr_Connected_mem_back) - } - - public interface nr_ReadOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional string key = 1; - boolean hasKey(); - String getKey(); - - // optional int32 clientid = 2; - boolean hasClientid(); - int getClientid(); - - // optional int64 time = 3; - boolean hasTime(); - long getTime(); - } - public static final class nr_Read extends - com.google.protobuf.GeneratedMessage - implements nr_ReadOrBuilder { - // Use nr_Read.newBuilder() to construct. - private nr_Read(Builder builder) { - super(builder); - } - private nr_Read(boolean noInit) {} - - private static final nr_Read defaultInstance; - public static nr_Read getDefaultInstance() { - return defaultInstance; - } - - public nr_Read getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.requestMsg.internal_static_nr_Read_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.requestMsg.internal_static_nr_Read_fieldAccessorTable; - } - - private int bitField0_; - // optional string key = 1; - public static final int KEY_FIELD_NUMBER = 1; - private java.lang.Object key_; - public boolean hasKey() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getKey() { - java.lang.Object ref = key_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - key_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getKeyBytes() { - java.lang.Object ref = key_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - key_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional int32 clientid = 2; - public static final int CLIENTID_FIELD_NUMBER = 2; - private int clientid_; - public boolean hasClientid() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public int getClientid() { - return clientid_; - } - - // optional int64 time = 3; - public static final int TIME_FIELD_NUMBER = 3; - private long time_; - public boolean hasTime() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public long getTime() { - return time_; - } - - private void initFields() { - key_ = ""; - clientid_ = 0; - time_ = 0L; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getKeyBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeInt32(2, clientid_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeInt64(3, time_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getKeyBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(2, clientid_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(3, time_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static messageBody.requestMsg.nr_Read parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.requestMsg.nr_Read parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.requestMsg.nr_Read parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.requestMsg.nr_Read parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.requestMsg.nr_Read parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.requestMsg.nr_Read parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static messageBody.requestMsg.nr_Read parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.requestMsg.nr_Read parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.requestMsg.nr_Read parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.requestMsg.nr_Read parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(messageBody.requestMsg.nr_Read prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements messageBody.requestMsg.nr_ReadOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.requestMsg.internal_static_nr_Read_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.requestMsg.internal_static_nr_Read_fieldAccessorTable; - } - - // Construct using messageBody.requestMsg.nr_Read.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - key_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - clientid_ = 0; - bitField0_ = (bitField0_ & ~0x00000002); - time_ = 0L; - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return messageBody.requestMsg.nr_Read.getDescriptor(); - } - - public messageBody.requestMsg.nr_Read getDefaultInstanceForType() { - return messageBody.requestMsg.nr_Read.getDefaultInstance(); - } - - public messageBody.requestMsg.nr_Read build() { - messageBody.requestMsg.nr_Read result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private messageBody.requestMsg.nr_Read buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - messageBody.requestMsg.nr_Read result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public messageBody.requestMsg.nr_Read buildPartial() { - messageBody.requestMsg.nr_Read result = new messageBody.requestMsg.nr_Read(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.key_ = key_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.clientid_ = clientid_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.time_ = time_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof messageBody.requestMsg.nr_Read) { - return mergeFrom((messageBody.requestMsg.nr_Read)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(messageBody.requestMsg.nr_Read other) { - if (other == messageBody.requestMsg.nr_Read.getDefaultInstance()) return this; - if (other.hasKey()) { - setKey(other.getKey()); - } - if (other.hasClientid()) { - setClientid(other.getClientid()); - } - if (other.hasTime()) { - setTime(other.getTime()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - key_ = input.readBytes(); - break; - } - case 16: { - bitField0_ |= 0x00000002; - clientid_ = input.readInt32(); - break; - } - case 24: { - bitField0_ |= 0x00000004; - time_ = input.readInt64(); - break; - } - } - } - } - - private int bitField0_; - - // optional string key = 1; - private java.lang.Object key_ = ""; - public boolean hasKey() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getKey() { - java.lang.Object ref = key_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - key_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setKey(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - key_ = value; - onChanged(); - return this; - } - public Builder clearKey() { - bitField0_ = (bitField0_ & ~0x00000001); - key_ = getDefaultInstance().getKey(); - onChanged(); - return this; - } - void setKey(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - key_ = value; - onChanged(); - } - - // optional int32 clientid = 2; - private int clientid_ ; - public boolean hasClientid() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public int getClientid() { - return clientid_; - } - public Builder setClientid(int value) { - bitField0_ |= 0x00000002; - clientid_ = value; - onChanged(); - return this; - } - public Builder clearClientid() { - bitField0_ = (bitField0_ & ~0x00000002); - clientid_ = 0; - onChanged(); - return this; - } - - // optional int64 time = 3; - private long time_ ; - public boolean hasTime() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public long getTime() { - return time_; - } - public Builder setTime(long value) { - bitField0_ |= 0x00000004; - time_ = value; - onChanged(); - return this; - } - public Builder clearTime() { - bitField0_ = (bitField0_ & ~0x00000004); - time_ = 0L; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:nr_Read) - } - - static { - defaultInstance = new nr_Read(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:nr_Read) - } - - public interface nr_Read_resOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional string key = 1; - boolean hasKey(); - String getKey(); - - // optional string value = 2; - boolean hasValue(); - String getValue(); - - // optional int64 time = 3; - boolean hasTime(); - long getTime(); - } - public static final class nr_Read_res extends - com.google.protobuf.GeneratedMessage - implements nr_Read_resOrBuilder { - // Use nr_Read_res.newBuilder() to construct. - private nr_Read_res(Builder builder) { - super(builder); - } - private nr_Read_res(boolean noInit) {} - - private static final nr_Read_res defaultInstance; - public static nr_Read_res getDefaultInstance() { - return defaultInstance; - } - - public nr_Read_res getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.requestMsg.internal_static_nr_Read_res_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.requestMsg.internal_static_nr_Read_res_fieldAccessorTable; - } - - private int bitField0_; - // optional string key = 1; - public static final int KEY_FIELD_NUMBER = 1; - private java.lang.Object key_; - public boolean hasKey() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getKey() { - java.lang.Object ref = key_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - key_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getKeyBytes() { - java.lang.Object ref = key_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - key_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional string value = 2; - public static final int VALUE_FIELD_NUMBER = 2; - private java.lang.Object value_; - public boolean hasValue() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public String getValue() { - java.lang.Object ref = value_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - value_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getValueBytes() { - java.lang.Object ref = value_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - value_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional int64 time = 3; - public static final int TIME_FIELD_NUMBER = 3; - private long time_; - public boolean hasTime() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public long getTime() { - return time_; - } - - private void initFields() { - key_ = ""; - value_ = ""; - time_ = 0L; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getKeyBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getValueBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeInt64(3, time_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getKeyBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, getValueBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(3, time_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static messageBody.requestMsg.nr_Read_res parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.requestMsg.nr_Read_res parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.requestMsg.nr_Read_res parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.requestMsg.nr_Read_res parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.requestMsg.nr_Read_res parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.requestMsg.nr_Read_res parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static messageBody.requestMsg.nr_Read_res parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.requestMsg.nr_Read_res parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.requestMsg.nr_Read_res parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.requestMsg.nr_Read_res parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(messageBody.requestMsg.nr_Read_res prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements messageBody.requestMsg.nr_Read_resOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.requestMsg.internal_static_nr_Read_res_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.requestMsg.internal_static_nr_Read_res_fieldAccessorTable; - } - - // Construct using messageBody.requestMsg.nr_Read_res.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - key_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - value_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - time_ = 0L; - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return messageBody.requestMsg.nr_Read_res.getDescriptor(); - } - - public messageBody.requestMsg.nr_Read_res getDefaultInstanceForType() { - return messageBody.requestMsg.nr_Read_res.getDefaultInstance(); - } - - public messageBody.requestMsg.nr_Read_res build() { - messageBody.requestMsg.nr_Read_res result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private messageBody.requestMsg.nr_Read_res buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - messageBody.requestMsg.nr_Read_res result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public messageBody.requestMsg.nr_Read_res buildPartial() { - messageBody.requestMsg.nr_Read_res result = new messageBody.requestMsg.nr_Read_res(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.key_ = key_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.value_ = value_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.time_ = time_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof messageBody.requestMsg.nr_Read_res) { - return mergeFrom((messageBody.requestMsg.nr_Read_res)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(messageBody.requestMsg.nr_Read_res other) { - if (other == messageBody.requestMsg.nr_Read_res.getDefaultInstance()) return this; - if (other.hasKey()) { - setKey(other.getKey()); - } - if (other.hasValue()) { - setValue(other.getValue()); - } - if (other.hasTime()) { - setTime(other.getTime()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - key_ = input.readBytes(); - break; - } - case 18: { - bitField0_ |= 0x00000002; - value_ = input.readBytes(); - break; - } - case 24: { - bitField0_ |= 0x00000004; - time_ = input.readInt64(); - break; - } - } - } - } - - private int bitField0_; - - // optional string key = 1; - private java.lang.Object key_ = ""; - public boolean hasKey() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getKey() { - java.lang.Object ref = key_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - key_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setKey(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - key_ = value; - onChanged(); - return this; - } - public Builder clearKey() { - bitField0_ = (bitField0_ & ~0x00000001); - key_ = getDefaultInstance().getKey(); - onChanged(); - return this; - } - void setKey(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - key_ = value; - onChanged(); - } - - // optional string value = 2; - private java.lang.Object value_ = ""; - public boolean hasValue() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public String getValue() { - java.lang.Object ref = value_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - value_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setValue(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - value_ = value; - onChanged(); - return this; - } - public Builder clearValue() { - bitField0_ = (bitField0_ & ~0x00000002); - value_ = getDefaultInstance().getValue(); - onChanged(); - return this; - } - void setValue(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000002; - value_ = value; - onChanged(); - } - - // optional int64 time = 3; - private long time_ ; - public boolean hasTime() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public long getTime() { - return time_; - } - public Builder setTime(long value) { - bitField0_ |= 0x00000004; - time_ = value; - onChanged(); - return this; - } - public Builder clearTime() { - bitField0_ = (bitField0_ & ~0x00000004); - time_ = 0L; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:nr_Read_res) - } - - static { - defaultInstance = new nr_Read_res(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:nr_Read_res) - } - - public interface nr_writeOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional string key = 1; - boolean hasKey(); - String getKey(); - - // optional string value = 2; - boolean hasValue(); - String getValue(); - - // optional int64 time = 3; - boolean hasTime(); - long getTime(); - } - public static final class nr_write extends - com.google.protobuf.GeneratedMessage - implements nr_writeOrBuilder { - // Use nr_write.newBuilder() to construct. - private nr_write(Builder builder) { - super(builder); - } - private nr_write(boolean noInit) {} - - private static final nr_write defaultInstance; - public static nr_write getDefaultInstance() { - return defaultInstance; - } - - public nr_write getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.requestMsg.internal_static_nr_write_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.requestMsg.internal_static_nr_write_fieldAccessorTable; - } - - private int bitField0_; - // optional string key = 1; - public static final int KEY_FIELD_NUMBER = 1; - private java.lang.Object key_; - public boolean hasKey() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getKey() { - java.lang.Object ref = key_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - key_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getKeyBytes() { - java.lang.Object ref = key_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - key_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional string value = 2; - public static final int VALUE_FIELD_NUMBER = 2; - private java.lang.Object value_; - public boolean hasValue() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public String getValue() { - java.lang.Object ref = value_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - value_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getValueBytes() { - java.lang.Object ref = value_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - value_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional int64 time = 3; - public static final int TIME_FIELD_NUMBER = 3; - private long time_; - public boolean hasTime() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public long getTime() { - return time_; - } - - private void initFields() { - key_ = ""; - value_ = ""; - time_ = 0L; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getKeyBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getValueBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeInt64(3, time_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getKeyBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, getValueBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(3, time_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static messageBody.requestMsg.nr_write parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.requestMsg.nr_write parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.requestMsg.nr_write parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.requestMsg.nr_write parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.requestMsg.nr_write parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.requestMsg.nr_write parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static messageBody.requestMsg.nr_write parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.requestMsg.nr_write parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.requestMsg.nr_write parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.requestMsg.nr_write parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(messageBody.requestMsg.nr_write prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements messageBody.requestMsg.nr_writeOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.requestMsg.internal_static_nr_write_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.requestMsg.internal_static_nr_write_fieldAccessorTable; - } - - // Construct using messageBody.requestMsg.nr_write.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - key_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - value_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - time_ = 0L; - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return messageBody.requestMsg.nr_write.getDescriptor(); - } - - public messageBody.requestMsg.nr_write getDefaultInstanceForType() { - return messageBody.requestMsg.nr_write.getDefaultInstance(); - } - - public messageBody.requestMsg.nr_write build() { - messageBody.requestMsg.nr_write result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private messageBody.requestMsg.nr_write buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - messageBody.requestMsg.nr_write result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public messageBody.requestMsg.nr_write buildPartial() { - messageBody.requestMsg.nr_write result = new messageBody.requestMsg.nr_write(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.key_ = key_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.value_ = value_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.time_ = time_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof messageBody.requestMsg.nr_write) { - return mergeFrom((messageBody.requestMsg.nr_write)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(messageBody.requestMsg.nr_write other) { - if (other == messageBody.requestMsg.nr_write.getDefaultInstance()) return this; - if (other.hasKey()) { - setKey(other.getKey()); - } - if (other.hasValue()) { - setValue(other.getValue()); - } - if (other.hasTime()) { - setTime(other.getTime()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - key_ = input.readBytes(); - break; - } - case 18: { - bitField0_ |= 0x00000002; - value_ = input.readBytes(); - break; - } - case 24: { - bitField0_ |= 0x00000004; - time_ = input.readInt64(); - break; - } - } - } - } - - private int bitField0_; - - // optional string key = 1; - private java.lang.Object key_ = ""; - public boolean hasKey() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getKey() { - java.lang.Object ref = key_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - key_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setKey(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - key_ = value; - onChanged(); - return this; - } - public Builder clearKey() { - bitField0_ = (bitField0_ & ~0x00000001); - key_ = getDefaultInstance().getKey(); - onChanged(); - return this; - } - void setKey(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - key_ = value; - onChanged(); - } - - // optional string value = 2; - private java.lang.Object value_ = ""; - public boolean hasValue() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public String getValue() { - java.lang.Object ref = value_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - value_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setValue(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - value_ = value; - onChanged(); - return this; - } - public Builder clearValue() { - bitField0_ = (bitField0_ & ~0x00000002); - value_ = getDefaultInstance().getValue(); - onChanged(); - return this; - } - void setValue(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000002; - value_ = value; - onChanged(); - } - - // optional int64 time = 3; - private long time_ ; - public boolean hasTime() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public long getTime() { - return time_; - } - public Builder setTime(long value) { - bitField0_ |= 0x00000004; - time_ = value; - onChanged(); - return this; - } - public Builder clearTime() { - bitField0_ = (bitField0_ & ~0x00000004); - time_ = 0L; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:nr_write) - } - - static { - defaultInstance = new nr_write(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:nr_write) - } - - public interface nr_write_resOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional string key = 1; - boolean hasKey(); - String getKey(); - - // optional string value = 2; - boolean hasValue(); - String getValue(); - - // optional int64 time = 3; - boolean hasTime(); - long getTime(); - } - public static final class nr_write_res extends - com.google.protobuf.GeneratedMessage - implements nr_write_resOrBuilder { - // Use nr_write_res.newBuilder() to construct. - private nr_write_res(Builder builder) { - super(builder); - } - private nr_write_res(boolean noInit) {} - - private static final nr_write_res defaultInstance; - public static nr_write_res getDefaultInstance() { - return defaultInstance; - } - - public nr_write_res getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.requestMsg.internal_static_nr_write_res_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.requestMsg.internal_static_nr_write_res_fieldAccessorTable; - } - - private int bitField0_; - // optional string key = 1; - public static final int KEY_FIELD_NUMBER = 1; - private java.lang.Object key_; - public boolean hasKey() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getKey() { - java.lang.Object ref = key_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - key_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getKeyBytes() { - java.lang.Object ref = key_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - key_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional string value = 2; - public static final int VALUE_FIELD_NUMBER = 2; - private java.lang.Object value_; - public boolean hasValue() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public String getValue() { - java.lang.Object ref = value_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - value_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getValueBytes() { - java.lang.Object ref = value_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - value_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional int64 time = 3; - public static final int TIME_FIELD_NUMBER = 3; - private long time_; - public boolean hasTime() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public long getTime() { - return time_; - } - - private void initFields() { - key_ = ""; - value_ = ""; - time_ = 0L; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getKeyBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getValueBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeInt64(3, time_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getKeyBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, getValueBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(3, time_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static messageBody.requestMsg.nr_write_res parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.requestMsg.nr_write_res parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.requestMsg.nr_write_res parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static messageBody.requestMsg.nr_write_res parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static messageBody.requestMsg.nr_write_res parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.requestMsg.nr_write_res parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static messageBody.requestMsg.nr_write_res parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.requestMsg.nr_write_res parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static messageBody.requestMsg.nr_write_res parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static messageBody.requestMsg.nr_write_res parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(messageBody.requestMsg.nr_write_res prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements messageBody.requestMsg.nr_write_resOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return messageBody.requestMsg.internal_static_nr_write_res_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return messageBody.requestMsg.internal_static_nr_write_res_fieldAccessorTable; - } - - // Construct using messageBody.requestMsg.nr_write_res.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - key_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - value_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - time_ = 0L; - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return messageBody.requestMsg.nr_write_res.getDescriptor(); - } - - public messageBody.requestMsg.nr_write_res getDefaultInstanceForType() { - return messageBody.requestMsg.nr_write_res.getDefaultInstance(); - } - - public messageBody.requestMsg.nr_write_res build() { - messageBody.requestMsg.nr_write_res result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private messageBody.requestMsg.nr_write_res buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - messageBody.requestMsg.nr_write_res result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public messageBody.requestMsg.nr_write_res buildPartial() { - messageBody.requestMsg.nr_write_res result = new messageBody.requestMsg.nr_write_res(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.key_ = key_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.value_ = value_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.time_ = time_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof messageBody.requestMsg.nr_write_res) { - return mergeFrom((messageBody.requestMsg.nr_write_res)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(messageBody.requestMsg.nr_write_res other) { - if (other == messageBody.requestMsg.nr_write_res.getDefaultInstance()) return this; - if (other.hasKey()) { - setKey(other.getKey()); - } - if (other.hasValue()) { - setValue(other.getValue()); - } - if (other.hasTime()) { - setTime(other.getTime()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - key_ = input.readBytes(); - break; - } - case 18: { - bitField0_ |= 0x00000002; - value_ = input.readBytes(); - break; - } - case 24: { - bitField0_ |= 0x00000004; - time_ = input.readInt64(); - break; - } - } - } - } - - private int bitField0_; - - // optional string key = 1; - private java.lang.Object key_ = ""; - public boolean hasKey() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getKey() { - java.lang.Object ref = key_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - key_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setKey(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - key_ = value; - onChanged(); - return this; - } - public Builder clearKey() { - bitField0_ = (bitField0_ & ~0x00000001); - key_ = getDefaultInstance().getKey(); - onChanged(); - return this; - } - void setKey(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - key_ = value; - onChanged(); - } - - // optional string value = 2; - private java.lang.Object value_ = ""; - public boolean hasValue() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public String getValue() { - java.lang.Object ref = value_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - value_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setValue(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - value_ = value; - onChanged(); - return this; - } - public Builder clearValue() { - bitField0_ = (bitField0_ & ~0x00000002); - value_ = getDefaultInstance().getValue(); - onChanged(); - return this; - } - void setValue(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000002; - value_ = value; - onChanged(); - } - - // optional int64 time = 3; - private long time_ ; - public boolean hasTime() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public long getTime() { - return time_; - } - public Builder setTime(long value) { - bitField0_ |= 0x00000004; - time_ = value; - onChanged(); - return this; - } - public Builder clearTime() { - bitField0_ = (bitField0_ & ~0x00000004); - time_ = 0L; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:nr_write_res) - } - - static { - defaultInstance = new nr_write_res(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:nr_write_res) - } - - private static com.google.protobuf.Descriptors.Descriptor - internal_static_nr_Connected_mem_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_nr_Connected_mem_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_nr_Connected_mem_back_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_nr_Connected_mem_back_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_nr_Read_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_nr_Read_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_nr_Read_res_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_nr_Read_res_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_nr_write_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_nr_write_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_nr_write_res_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_nr_write_res_fieldAccessorTable; - - public static com.google.protobuf.Descriptors.FileDescriptor - getDescriptor() { - return descriptor; - } - private static com.google.protobuf.Descriptors.FileDescriptor - descriptor; - static { - java.lang.String[] descriptorData = { - "\n\020requestMsg.proto\"\022\n\020nr_Connected_mem\"&" + - "\n\025nr_Connected_mem_back\022\r\n\005memID\030\001 \001(\005\"6" + - "\n\007nr_Read\022\013\n\003key\030\001 \001(\t\022\020\n\010clientid\030\002 \001(\005" + - "\022\014\n\004time\030\003 \001(\003\"7\n\013nr_Read_res\022\013\n\003key\030\001 \001" + - "(\t\022\r\n\005value\030\002 \001(\t\022\014\n\004time\030\003 \001(\003\"4\n\010nr_wr" + - "ite\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t\022\014\n\004time\030" + - "\003 \001(\003\"8\n\014nr_write_res\022\013\n\003key\030\001 \001(\t\022\r\n\005va" + - "lue\030\002 \001(\t\022\014\n\004time\030\003 \001(\003B\031\n\013messageBodyB\n" + - "requestMsg" - }; - com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = - new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { - public com.google.protobuf.ExtensionRegistry assignDescriptors( - com.google.protobuf.Descriptors.FileDescriptor root) { - descriptor = root; - internal_static_nr_Connected_mem_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_nr_Connected_mem_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_nr_Connected_mem_descriptor, - new java.lang.String[] { }, - messageBody.requestMsg.nr_Connected_mem.class, - messageBody.requestMsg.nr_Connected_mem.Builder.class); - internal_static_nr_Connected_mem_back_descriptor = - getDescriptor().getMessageTypes().get(1); - internal_static_nr_Connected_mem_back_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_nr_Connected_mem_back_descriptor, - new java.lang.String[] { "MemID", }, - messageBody.requestMsg.nr_Connected_mem_back.class, - messageBody.requestMsg.nr_Connected_mem_back.Builder.class); - internal_static_nr_Read_descriptor = - getDescriptor().getMessageTypes().get(2); - internal_static_nr_Read_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_nr_Read_descriptor, - new java.lang.String[] { "Key", "Clientid", "Time", }, - messageBody.requestMsg.nr_Read.class, - messageBody.requestMsg.nr_Read.Builder.class); - internal_static_nr_Read_res_descriptor = - getDescriptor().getMessageTypes().get(3); - internal_static_nr_Read_res_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_nr_Read_res_descriptor, - new java.lang.String[] { "Key", "Value", "Time", }, - messageBody.requestMsg.nr_Read_res.class, - messageBody.requestMsg.nr_Read_res.Builder.class); - internal_static_nr_write_descriptor = - getDescriptor().getMessageTypes().get(4); - internal_static_nr_write_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_nr_write_descriptor, - new java.lang.String[] { "Key", "Value", "Time", }, - messageBody.requestMsg.nr_write.class, - messageBody.requestMsg.nr_write.Builder.class); - internal_static_nr_write_res_descriptor = - getDescriptor().getMessageTypes().get(5); - internal_static_nr_write_res_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_nr_write_res_descriptor, - new java.lang.String[] { "Key", "Value", "Time", }, - messageBody.requestMsg.nr_write_res.class, - messageBody.requestMsg.nr_write_res.Builder.class); - return null; - } - }; - com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - }, assigner); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/src/server/ClientConfig.java b/src/server/ClientConfig.java deleted file mode 100644 index d2a5f24..0000000 --- a/src/server/ClientConfig.java +++ /dev/null @@ -1,9 +0,0 @@ -package server; - -public class ClientConfig -{ - public int id; - public String host; - public int client_port; - public String memcached; -} diff --git a/src/server/LockKey.java b/src/server/LockKey.java deleted file mode 100644 index 2ef798d..0000000 --- a/src/server/LockKey.java +++ /dev/null @@ -1,19 +0,0 @@ -package server; - -public class LockKey { - public Integer memNumber = 0; - public Integer ncount = 0; - public Integer state = unLock; - public long time; - - LockKey(Integer num, Integer count, long t, Integer s) { - memNumber = num; - ncount = count; - time = t; - state = s; - } - - public final static Integer unLock = 0; - public final static Integer badLock = 1; - public final static Integer waitLock = 2; -} diff --git a/src/server/MDecoder.java b/src/server/MDecoder.java deleted file mode 100644 index c03c09a..0000000 --- a/src/server/MDecoder.java +++ /dev/null @@ -1,33 +0,0 @@ -package server; - -import org.jboss.netty.buffer.ChannelBuffer; -import org.jboss.netty.channel.Channel; -import org.jboss.netty.channel.ChannelHandlerContext; -import org.jboss.netty.handler.codec.frame.FrameDecoder; - -import common.EMSGID; - -public class MDecoder extends FrameDecoder -{ - @Override - protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception { - if (buffer.readableBytes() < 4) - { - return null;//(1) - } - int dataLength = buffer.getInt(buffer.readerIndex()); - if (buffer.readableBytes() < dataLength + 4) - { - return null;//(2) - } - - buffer.skipBytes(4);//(3) - int id = buffer.readInt(); - byte[] decoded = new byte[dataLength-4]; - - buffer.readBytes(decoded); - NetMsg msg = new NetMsg(decoded, id);//(4) - msg.setMsgID(EMSGID.values()[id]); - return msg; - } -} \ No newline at end of file diff --git a/src/server/MEncoder.java b/src/server/MEncoder.java deleted file mode 100644 index 3d75d1b..0000000 --- a/src/server/MEncoder.java +++ /dev/null @@ -1,27 +0,0 @@ -package server; - -import org.jboss.netty.buffer.ChannelBuffer; -import org.jboss.netty.buffer.ChannelBuffers; -import org.jboss.netty.channel.Channel; -import org.jboss.netty.channel.ChannelHandlerContext; -import org.jboss.netty.handler.codec.oneone.OneToOneEncoder; - -public class MEncoder extends OneToOneEncoder -{ - @Override - protected Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception - { - if (!(msg instanceof NetMsg)) - { - return msg;//(1) - } - NetMsg res = (NetMsg)msg; - byte[] data = res.getBytes(); - int dataLength = data.length+4; - ChannelBuffer buf = ChannelBuffers.dynamicBuffer();//(2) - buf.writeInt(dataLength); - buf.writeInt(res.msgID.ordinal()); - buf.writeBytes(data); - return buf;//(3) - } -} \ No newline at end of file diff --git a/src/server/MServerHandler.java b/src/server/MServerHandler.java deleted file mode 100644 index fc8e958..0000000 --- a/src/server/MServerHandler.java +++ /dev/null @@ -1,35 +0,0 @@ -package server; - -import org.jboss.netty.channel.Channel; -import org.jboss.netty.channel.ChannelHandlerContext; -import org.jboss.netty.channel.ChannelStateEvent; -import org.jboss.netty.channel.ExceptionEvent; -import org.jboss.netty.channel.MessageEvent; -import org.jboss.netty.channel.SimpleChannelUpstreamHandler; - - -public class MServerHandler extends SimpleChannelUpstreamHandler -{ - @Override - public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) - { - if (!(e.getMessage() instanceof NetMsg)) - { - return; - } - memSession.getInstance().addSession(e); - } - - @Override - public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) - { - Channel channel = e.getChannel(); - channel.close(); - } - - @Override - public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e)throws Exception - { - - } -} \ No newline at end of file diff --git a/src/server/MServerPipelineFactory.java b/src/server/MServerPipelineFactory.java deleted file mode 100644 index d03ab92..0000000 --- a/src/server/MServerPipelineFactory.java +++ /dev/null @@ -1,18 +0,0 @@ -package server; - -import org.jboss.netty.channel.ChannelPipeline; -import org.jboss.netty.channel.ChannelPipelineFactory; -import org.jboss.netty.channel.Channels; - -public class MServerPipelineFactory implements ChannelPipelineFactory -{ - public ChannelPipeline getPipeline() throws Exception - { - ChannelPipeline pipeline = Channels.pipeline(); - - pipeline.addLast("decoder", new MDecoder()); - pipeline.addLast("encoder", new MEncoder()); - pipeline.addLast("handler", new MServerHandler()); - return pipeline; - } -} \ No newline at end of file diff --git a/src/server/MemcachedMain.java b/src/server/MemcachedMain.java deleted file mode 100644 index 8024468..0000000 --- a/src/server/MemcachedMain.java +++ /dev/null @@ -1,143 +0,0 @@ -package server; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.HashMap; -import java.util.Properties; -import java.util.Scanner; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; - -import client.Client; -import client.ClientMgr; - -import common.RegisterHandler; - -public class MemcachedMain { - HashMap m_mapMemcachedClient; - String webServerHost; - String protocolName; - - public boolean initConfig() { - m_mapMemcachedClient = new HashMap(); - - File f = new File(System.getProperty("user.dir")); - String path = f.getPath() + File.separator + "bin" + File.separator; - readClientsXML(path + "client.xml"); - try { - Properties properties = new Properties(); - properties.load(new FileInputStream(path+"config.properties")); - webServerHost = properties.getProperty("webServerHost").toString(); - ClientMgr.nCopyNode = Integer.parseInt(properties.getProperty("replicasNum")); - protocolName = properties.getProperty("consistencyProtocol").toString(); - if(protocolName.equals("twoPhaseCommit")){ - ClientMgr.protocol = ClientMgr.twoPhaseCommit; - }else if(protocolName.equals("paxos")){ - ClientMgr.protocol = ClientMgr.paxos; - }else if(protocolName.equals("weak")){ - ClientMgr.protocol = ClientMgr.weak; - }else{ - System.err.print("consistency protocol input error"); - return false; - } - } catch (FileNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return true; - } - - public int getMemcachedNumber() { - System.out.print("Please in put R-Memcached ID:"); - @SuppressWarnings("resource") - Scanner scanner = new Scanner(System.in); - return Integer.decode(scanner.next()); - } - - public void start() { - initConfig(); - int num = getMemcachedNumber(); - - RegisterHandler.initHandler(); - memSession.getInstance().start(m_mapMemcachedClient.get(num).memcached); - - ClientMgr clientMgr = ClientMgr.getInstance(); - Server server = Server.getInstance(); - server.init(m_mapMemcachedClient.get(num).client_port); - clientMgr.init(num, m_mapMemcachedClient); - - Client webClient = new Client(); - webClient.init(webServerHost, 8888); - } - - public static void main(String[] args) { - MemcachedMain entrance = new MemcachedMain(); - entrance.start(); - } - - // 读取memcached client配置 - public boolean readClientsXML(String str) { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - try { - factory.setIgnoringElementContentWhitespace(true); - - DocumentBuilder db = factory.newDocumentBuilder(); - Document xmldoc = db.parse(new File(str)); - Element elmtInfo = xmldoc.getDocumentElement(); - NodeList nodes = elmtInfo.getChildNodes(); - for (int i = 0; i < nodes.getLength(); i++) { - Node result = nodes.item(i); - if (result.getNodeType() == Node.ELEMENT_NODE - && result.getNodeName().equals("client")) { - NodeList ns = result.getChildNodes(); - ClientConfig localClient = new ClientConfig(); - int m = 0; - for (int j = 0; j < ns.getLength(); j++) { - Node record = ns.item(j); - if (record.getNodeType() == Node.ELEMENT_NODE) { - if (record.getNodeName().equals("id")) { - m++; - localClient.id = Integer.decode(record - .getTextContent()); - } else if (record.getNodeName().equals("host")) { - m++; - localClient.host = record.getTextContent(); - } else if (record.getNodeName().equals( - "client_port")) { - m++; - localClient.client_port = Integer.decode(record - .getTextContent()); - } else if (record.getNodeName().equals("memcached")) { - m++; - localClient.memcached = record.getTextContent(); - } - } - } - if (m == 4) { - m_mapMemcachedClient.put(localClient.id, localClient); - } - } - } - } catch (ParserConfigurationException e) { - e.printStackTrace(); - } catch (SAXException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - return true; - } -} diff --git a/src/server/NetMsg.java b/src/server/NetMsg.java deleted file mode 100644 index b363b39..0000000 --- a/src/server/NetMsg.java +++ /dev/null @@ -1,51 +0,0 @@ -package server; -import com.google.protobuf.GeneratedMessage; -import com.google.protobuf.MessageLite; - -import common.EMSGID; -import common.MessageManager; - -public class NetMsg // package different messages -{ - EMSGID msgID; - MessageLite messageLite; - - private NetMsg(){}; - public static NetMsg newMessage() - { - return new NetMsg(); - } - - NetMsg(byte[] decoded, int id) throws Exception - { - messageLite = MessageManager.getMessage(id, decoded); - } - - public byte[] getBytes() //get data in messageLite - { - return messageLite.toByteArray(); - } - - public EMSGID getMsgID() //get message catagory - { - return msgID; - } - - public void setMsgID(EMSGID id) { //according EMSGID.java set the message ID - this.msgID = id; - - } - - @SuppressWarnings("unchecked") - public T getMessageLite() //get messageLite - { - return (T)messageLite; - } - - @SuppressWarnings("rawtypes") - public void setMessageLite(GeneratedMessage.Builder builder) - { - this.messageLite = builder.build(); - } - -} diff --git a/src/server/Server.java b/src/server/Server.java deleted file mode 100644 index 6acf071..0000000 --- a/src/server/Server.java +++ /dev/null @@ -1,45 +0,0 @@ -package server; - -import java.net.InetSocketAddress; -import java.util.concurrent.Executors; - -import org.jboss.netty.bootstrap.ServerBootstrap; -import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; - -public class Server -{ - static Server server; - ServerBootstrap bootstrap; - - public void init(int port) - { - bootstrap = new ServerBootstrap( - new NioServerSocketChannelFactory( - Executors.newCachedThreadPool(), - Executors.newCachedThreadPool())); - - // Set up the default event pipeline. - bootstrap.setPipelineFactory(new MServerPipelineFactory()); - bootstrap.setOption("child.tcpNoDelay", true); - bootstrap.setOption("child.keepAlive", true); - bootstrap.setOption("reuseAddress", true); - // Bind and start to accept incoming connections. - bootstrap.bind(new InetSocketAddress(port)); - - System.out.println("server init complete"); - } - - public void stop() - { - bootstrap.releaseExternalResources(); - } - - public static Server getInstance() - { - if (server == null) - { - server = new Server(); - } - return server; - } -} \ No newline at end of file diff --git a/src/server/memSession.java b/src/server/memSession.java deleted file mode 100644 index 3956060..0000000 --- a/src/server/memSession.java +++ /dev/null @@ -1,507 +0,0 @@ -package server; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map.Entry; -import java.util.concurrent.ConcurrentLinkedQueue; - -import messageBody.memcachedmsg.nm_Connected; -import messageBody.memcachedmsg.nm_Connected_mem_back; -import messageBody.memcachedmsg.nm_read; -import messageBody.memcachedmsg.nm_read_recovery; -import messageBody.memcachedmsg.nm_write_1; -import messageBody.memcachedmsg.nm_write_1_res; -import messageBody.memcachedmsg.nm_write_2; -import messageBody.requestMsg.nr_Connected_mem_back; -import messageBody.requestMsg.nr_Read; -import messageBody.requestMsg.nr_Read_res; -import messageBody.requestMsg.nr_write; -import messageBody.requestMsg.nr_write_res; - -import org.jboss.netty.channel.Channel; -import org.jboss.netty.channel.MessageEvent; -import org.jboss.netty.util.internal.ConcurrentHashMap; - -import memcached.MemcachedClient; -import client.ClientMgr; - -import common.EMSGID; - -public class memSession implements Runnable { - ConcurrentLinkedQueue recvQueue = new ConcurrentLinkedQueue(); - ConcurrentHashMap ClientChannelMap = new ConcurrentHashMap(); - ConcurrentHashMap LockKeyMap = new ConcurrentHashMap(); - public MemcachedClient client; - static memSession session = null; - - Channel webServeChannel = null; - - public static memSession getInstance() { - if (session == null) { - session = new memSession(); - } - return session; - } - - public void start(String host) { - client = new MemcachedClient(host); - new Thread(session).start(); - System.out.println("session start"); - } - - // 增加client连接 - public void addClientChannel(Integer num, Channel ch) { - ClientChannelMap.put(num, ch); - } - - public Channel getClientChannel(Integer id) { - return ClientChannelMap.get(id); - } - - // 删掉client连接 - @SuppressWarnings("rawtypes") - public void removeClientChannel(Channel ch) { - Iterator iter = ClientChannelMap.entrySet().iterator(); - while (iter.hasNext()) { - Entry entry = (Entry) iter.next(); - if ((Channel) entry.getValue() == ch) { - ClientChannelMap.remove((Integer) entry.getKey()); - break; - } - } - } - - // //////////////////////////////////////////////////////// - public void run() { - long curTime = System.currentTimeMillis(); - while (true) { - MessageEvent event = recvQueue.poll(); - while (event != null) { - handle(event); - event = recvQueue.poll(); - if (System.currentTimeMillis() - curTime > 20000) { - curTime = System.currentTimeMillis(); - HandleBadLock(curTime); - } - } - try { - Thread.sleep((long) 0.00001); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - - @SuppressWarnings("rawtypes") - public void HandleBadLock(long curTime) { - Iterator it = LockKeyMap.keySet().iterator(); - while(it.hasNext()){ - String key = (String) it.next(); - LockKey value = LockKeyMap.get(key); - if (value.state == LockKey.waitLock) { - if (curTime - value.time > 20000) { - value.state = LockKey.badLock; - LockKeyMap.remove(key); - LockKeyMap.put(key, value); - } - } - } - } - - public int getLockState(String key) { - LockKey lock = LockKeyMap.get(key); - if (lock == null) { - return LockKey.unLock; - } - return lock.state; - } - - public void setLockState(String key, Integer state) { - LockKey lock = LockKeyMap.get(key); - if (lock != null) { - lock.state = state; - LockKeyMap.put(key, lock); - } else { - System.out.println("set Lock state error"); - return; - } - } - - public boolean lockKey(String key, LockKey lock) { - LockKey lockKey = LockKeyMap.put(key, lock); - if (lockKey != null && (lockKey.state == 0 || lockKey.state == 1)) { - return true; - } - return lockKey == null; - } - - public int desLockKeyCount(String key) { - LockKey lock = LockKeyMap.get(key); - if (lock != null) { - lock.ncount--; - LockKeyMap.put(key, lock); - return lock.ncount; - } - return 0; - } - - public boolean removeLock(String key) { - return LockKeyMap.remove(key) != null; - } - - public void handle(MessageEvent e) { - NetMsg msg = (NetMsg) e.getMessage(); - - switch (msg.getMsgID()) { - case nm_connected: { - nm_Connected msgLite = msg.getMessageLite(); - addClientChannel(msgLite.getNum(), e.getChannel()); - - nm_Connected_mem_back.Builder builder = nm_Connected_mem_back - .newBuilder(); - builder.setNum(ClientMgr.getInstance().mClientNumber); - - NetMsg send = NetMsg.newMessage(); - send.setMessageLite(builder); - send.setMsgID(EMSGID.nm_connected_mem_back); - - e.getChannel().write(send); - } - break; - case nm_connected_mem_back: { - nm_Connected_mem_back msgLite = msg.getMessageLite(); - addClientChannel(msgLite.getNum(), e.getChannel()); - } - break; - case nr_connected_mem: { - webServeChannel = e.getChannel(); - - nr_Connected_mem_back.Builder builder = nr_Connected_mem_back - .newBuilder(); - builder.setMemID(ClientMgr.getInstance().mClientNumber); - - NetMsg send = NetMsg.newMessage(); - send.setMessageLite(builder); - send.setMsgID(EMSGID.nr_connected_mem_back); - - e.getChannel().write(send); - } - break; - case nm_connected_web_back: { - webServeChannel = e.getChannel(); - } - break; - case nr_read: { - nr_Read msgLite = msg.getMessageLite(); - - Integer state = getLockState(msgLite.getKey()); - if (state == LockKey.waitLock) { - nr_Read_res.Builder builder = nr_Read_res.newBuilder(); - builder.setKey(msgLite.getKey()); - builder.setValue(""); - builder.setTime(msgLite.getTime()); - - NetMsg send = NetMsg.newMessage(); - send.setMessageLite(builder); - send.setMsgID(EMSGID.nr_read_res); - - webServeChannel.write(send); - return; - } else if (state == LockKey.unLock) { - String value = (String) client.get(msgLite.getKey()); - if (value != null) { - nr_Read_res.Builder builder = nr_Read_res.newBuilder(); - builder.setKey(msgLite.getKey()); - builder.setValue(value); - builder.setTime(msgLite.getTime()); - - NetMsg send = NetMsg.newMessage(); - send.setMessageLite(builder); - send.setMsgID(EMSGID.nr_read_res); - webServeChannel.write(send); - - return; - } - } - // Can't get data in local Memcached server, try to ask for data from another cache node - nm_read.Builder builder = nm_read.newBuilder(); - builder.setKey(msgLite.getKey()); - builder.setTime(msgLite.getTime()); - - NetMsg send = NetMsg.newMessage(); - send.setMessageLite(builder); - send.setMsgID(EMSGID.nm_read); - - if (sendOtherCopyMsg(gethashMem(msgLite.getKey()), send) == false) { - nr_Read_res.Builder builder1 = nr_Read_res.newBuilder(); - builder1.setKey(msgLite.getKey()); - builder.setValue(""); - builder1.setTime(msgLite.getTime()); - - NetMsg send1 = NetMsg.newMessage(); - send1.setMessageLite(builder1); - send1.setMsgID(EMSGID.nr_read_res); - - webServeChannel.write(send); - - } - } - break; - case nm_read: { - nm_read msgLite = msg.getMessageLite(); - Integer state = getLockState(msgLite.getKey()); - if (state == LockKey.unLock) { - String value = (String) client.get(msgLite.getKey()); - if (value != null) { - nr_Read_res.Builder builder = nr_Read_res.newBuilder(); - builder.setKey(msgLite.getKey()); - builder.setTime(msgLite.getTime()); - builder.setValue(value); - NetMsg send = NetMsg.newMessage(); - send.setMessageLite(builder); - send.setMsgID(EMSGID.nr_read_res); - webServeChannel.write(send); - - nm_read_recovery.Builder builder1 = nm_read_recovery.newBuilder(); - builder1.setKey(msgLite.getKey()); - builder1.setTime(msgLite.getTime()); - builder1.setValue(value); - NetMsg send1 = NetMsg.newMessage(); - send.setMessageLite(builder1); - send.setMsgID(EMSGID.nm_read_recovery); - e.getChannel().write(send1); - return; - } - } - nr_Read_res.Builder builder = nr_Read_res.newBuilder(); - builder.setKey(msgLite.getKey()); - builder.setValue(""); - builder.setTime(msgLite.getTime()); - - NetMsg send = NetMsg.newMessage(); - send.setMessageLite(builder); - send.setMsgID(EMSGID.nr_read_res); - - webServeChannel.write(send); - } - break; - case nm_read_recovery: { - nm_read_recovery msgLite = msg.getMessageLite(); - Integer state = getLockState(msgLite.getKey()); - if(state == LockKey.waitLock) { - System.out.println("recovery fail because of waitlock."); - return; - }else if (state == LockKey.badLock) { - removeLock(msgLite.getKey()); - } - boolean res = client.set(msgLite.getKey(), msgLite.getValue()); - if (!res) { - setLockState(msgLite.getKey(), LockKey.badLock); - System.err.println("read recovery fail"); - } - } - break; - - case nr_write: { - nr_write msgLite = msg.getMessageLite(); - Integer state = getLockState(msgLite.getKey()); - if (state == LockKey.waitLock) { - System.out.println("write conflict, please request again."); - nr_write_res.Builder builder2 = nr_write_res.newBuilder(); - builder2.setKey(msgLite.getKey()); - builder2.setValue(""); - builder2.setTime(msgLite.getTime()); - - NetMsg send2 = NetMsg.newMessage(); - send2.setMessageLite(builder2); - send2.setMsgID(EMSGID.nr_write_res); - webServeChannel.write(send2); - return; - } -// else if (state == LockKey.badLock) { -// removeLock(msgLite.getKey()); -// } - LockKey lockKey = new LockKey( - ClientMgr.getInstance().mClientNumber, ClientMgr.nCopyNode-1, - System.currentTimeMillis(), LockKey.waitLock); - if (lockKey(msgLite.getKey(), lockKey) == false) { - System.out.println("nr_write lock fail"); - nr_write_res.Builder builder2 = nr_write_res.newBuilder(); - builder2.setKey(msgLite.getKey()); - builder2.setValue(""); - builder2.setTime(msgLite.getTime()); - - NetMsg send2 = NetMsg.newMessage(); - send2.setMessageLite(builder2); - send2.setMsgID(EMSGID.nr_write_res); - webServeChannel.write(send2); - System.out.println("write lock conflict, please request again."); - return; - } - nm_write_1.Builder builder = nm_write_1.newBuilder(); - builder.setKey(msgLite.getKey()); - builder.setValue(msgLite.getValue()); - builder.setMemID(ClientMgr.getInstance().mClientNumber); - builder.setTime(msgLite.getTime()); - - NetMsg send = NetMsg.newMessage(); - send.setMessageLite(builder); - send.setMsgID(EMSGID.nm_write_1); - int count = sendOtherAllCopyMsg(gethashMem(msgLite.getKey()), send); - - if (count != ClientMgr.nCopyNode-1) { - System.out.println("write failed in send invalidation msg to remote node."); - - nr_write_res.Builder builder2 = nr_write_res.newBuilder(); - builder2.setKey(msgLite.getKey()); - builder2.setValue(""); - builder2.setTime(msgLite.getTime()); - - NetMsg send2 = NetMsg.newMessage(); - send2.setMessageLite(builder2); - send2.setMsgID(EMSGID.nr_write_res); - webServeChannel.write(send2); - - } - } - break; - - case nm_write_1: { - nm_write_1 msgLite = msg.getMessageLite(); - - Integer state = getLockState(msgLite.getKey()); - if (state == LockKey.waitLock) { - removeLock(msgLite.getKey()); - } - else if (state == LockKey.badLock) { - removeLock(msgLite.getKey()); - } - -// System.out.println("ready to write key: "+msgLite.getKey()); - - LockKey lockKey = new LockKey( - ClientMgr.getInstance().mClientNumber, 0, - System.currentTimeMillis(), LockKey.waitLock); - if (lockKey(msgLite.getKey(), lockKey) == false) { - System.out.println("nm_write_1 Lock fail"); - } - - nm_write_1_res.Builder builder = nm_write_1_res.newBuilder(); - builder.setKey(msgLite.getKey()); - builder.setValue(msgLite.getValue()); - builder.setTime(msgLite.getTime()); - builder.setMemID(msgLite.getMemID()); - - NetMsg send = NetMsg.newMessage(); - send.setMessageLite(builder); - send.setMsgID(EMSGID.nm_write_1_res); - getClientChannel(msgLite.getMemID()).write(send); - - - } - break; - case nm_write_1_res: { - nm_write_1_res msgLite = msg.getMessageLite(); - - if (desLockKeyCount(msgLite.getKey()) == ClientMgr.protocol) { - boolean res = client.set(msgLite.getKey(), - msgLite.getValue()); - if (res) { - removeLock(msgLite.getKey()); -// System.out.println("key:"+msgLite.getKey()+", value:"+msgLite.getValue()); - nr_write_res.Builder builder2 = nr_write_res.newBuilder(); - builder2.setKey(msgLite.getKey()); - builder2.setValue(msgLite.getValue()); - builder2.setTime(msgLite.getTime()); - NetMsg send2 = NetMsg.newMessage(); - send2.setMessageLite(builder2); - send2.setMsgID(EMSGID.nr_write_res); - webServeChannel.write(send2); - - nm_write_2.Builder builder = nm_write_2.newBuilder(); - builder.setKey(msgLite.getKey()); - builder.setValue(msgLite.getValue()); - builder.setMemID(msgLite.getMemID()); - builder.setTime(msgLite.getTime()); - NetMsg send = NetMsg.newMessage(); - send.setMessageLite(builder); - send.setMsgID(EMSGID.nm_write_2); - sendOtherAllCopyMsg(gethashMem(msgLite.getKey()),send); - } else { - setLockState(msgLite.getKey(), LockKey.badLock); - System.err.println("write to memcached server error"); - nr_write_res.Builder builder2 = nr_write_res.newBuilder(); - builder2.setKey(msgLite.getKey()); - builder2.setValue(""); - builder2.setTime(msgLite.getTime()); - - NetMsg send2 = NetMsg.newMessage(); - send2.setMessageLite(builder2); - send2.setMsgID(EMSGID.nr_write_res); - webServeChannel.write(send2); - } - } - } - break; - case nm_write_2: { - nm_write_2 msgLite = msg.getMessageLite(); - - boolean res = client.set(msgLite.getKey(), msgLite.getValue()); - if (res) { - removeLock(msgLite.getKey()); -// System.out.println("key:"+msgLite.getKey()+", value:"+msgLite.getValue()); - } else { - setLockState(msgLite.getKey(), LockKey.badLock); - System.err.println("write in write_2 fail"); - } - } - break; - default: - System.err.println(msg.getMsgID().toString()); - break; - } - } - - public void addSession(MessageEvent e) { - recvQueue.offer(e); - } - - public int gethashMem(String key) { - return Math.abs(key.hashCode() % ClientMgr.getInstance().getSize()); - } - - public boolean sendOtherCopyMsg(Integer hash, NetMsg msg) { - for (int i = 0; i < ClientMgr.nCopyNode; i++) { - Integer index = (hash + i + ClientMgr.getInstance().getSize()) - % ClientMgr.getInstance().getSize(); - if (index == ClientMgr.getInstance().mClientNumber) - continue; - - Channel eChannel = getClientChannel(index); - if (eChannel != null) { - eChannel.write(msg); - return true; - } - } - return false; - } - - public int sendOtherAllCopyMsg(int hash, NetMsg msg) { - int count = 0; - for (int i = 0; i < ClientMgr.nCopyNode; i++) { - int index = (hash + i + ClientMgr.getInstance().getSize()) - % ClientMgr.getInstance().getSize(); - - if (index == ClientMgr.getInstance().mClientNumber) - continue; - - Channel eChannel = getClientChannel(index); - if (eChannel != null) { - eChannel.write(msg); - count++; - } - } - return count; - } -} diff --git a/src/test/MainTest.java b/src/test/MainTest.java deleted file mode 100644 index 70daba1..0000000 --- a/src/test/MainTest.java +++ /dev/null @@ -1,120 +0,0 @@ -package test; - -import java.util.Hashtable; - -import memcached.MemcachedClient; - -import org.apache.log4j.PropertyConfigurator; -/** - * Test the communication between R-Memcached and Memcached server in one cache node. - * @author Yanran Lu - */ -public class MainTest { - // store results from threads - private static Hashtable threadInfo = new Hashtable(); - - public static void main(String[] args) { - PropertyConfigurator.configure(MainTest.class.getClass() - .getResource("/").getPath() - + "log4j.properties"); - // String[] serverlist = { "127.0.0.1:20000", "127.0.0.1:20001" , - // "127.0.0.1:20002" }; - - int threads = Integer.parseInt(args[0]); // the number of threads - int runs = Integer.parseInt(args[1]); // how many request send out by a thread - int Nums = Integer.parseInt(args[2]); // the total size of data - int size = Integer.parseInt(args[3]); // the size of a data - - // get object to store - byte[] obj = new byte[size]; - for (int i = 0; i < size; i++) { - obj[i] = '1'; - } - String value = new String(obj); - - String[] keys = new String[size]; - for (int i = 0; i < Nums; i++) { - keys[i] = "key" + i; - } - - for (int i = 0; i < threads; i++) { - bench b = new bench(runs, Nums, i, value, keys); - b.start(); - } - - int i = 0; - while (i < threads) { - if (threadInfo.containsKey(new Integer(i))) { - System.out.println(threadInfo.get(new Integer(i))); - i++; - } else { - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - } - System.exit(1); - } - - /** - * Test code per thread. - */ - private static class bench extends Thread { - private int runs; - private int threadNum; - private String object; - private String[] keys; - private int size; - private int nums; - - public bench(int runs, int nums, int threadNum, String object, - String[] keys) { - this.runs = runs; - this.threadNum = threadNum; - this.object = object; - this.keys = keys; - this.size = object.length(); - this.nums = nums; - } - - public void run() { - StringBuilder result = new StringBuilder(); - - // get client instance - MemcachedClient mc = new MemcachedClient("127.0.0.1:20000"); - mc.setCompressEnable(false); - mc.setCompressThreshold(0); - - try { - Thread.sleep(0); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - // time deletes - long start = System.nanoTime(); - randReadWrite(mc, 0.8); - long elapse = (System.nanoTime() - start) / 1000000; - float avg = (float) elapse / runs; - result.append("\nthread " + threadNum + ": runs: " + runs - + " read or write of obj " + (size / 1024) - + "KB -- avg time per req " + avg + " ms (total: " + elapse - + " ms)"); - - threadInfo.put(new Integer(threadNum), result); - } - - public void randReadWrite(MemcachedClient mc, double scale) { - for (int i = 0; i < runs; i++) { - if (Math.random() < scale) { - mc.get(keys[i % nums]); - } else { - mc.set(keys[i % nums], object); - } - } - } - } -}