亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? operationimpl.java

?? memcached JAVA客戶端API,應用廣泛,運行比較穩定。
?? JAVA
字號:
package net.spy.memcached.protocol.binary;import java.io.IOException;import java.nio.ByteBuffer;import java.nio.ByteOrder;import java.util.concurrent.atomic.AtomicInteger;import net.spy.memcached.CASResponse;import net.spy.memcached.KeyUtil;import net.spy.memcached.ops.CASOperationStatus;import net.spy.memcached.ops.OperationCallback;import net.spy.memcached.ops.OperationErrorType;import net.spy.memcached.ops.OperationState;import net.spy.memcached.ops.OperationStatus;import net.spy.memcached.protocol.BaseOperationImpl;/** * Base class for binary operations. */abstract class OperationImpl extends BaseOperationImpl {	protected static final byte REQ_MAGIC = (byte)0x80;	protected static final byte RES_MAGIC = (byte)0x81;	protected static final int MIN_RECV_PACKET=24;	/**	 * Error code for items that were not found.	 */	protected static final int ERR_NOT_FOUND = 1;	protected static final int ERR_EXISTS = 2;	protected static final int ERR_NOT_STORED = 5;	protected static final OperationStatus NOT_FOUND_STATUS =		new CASOperationStatus(false, "Not Found", CASResponse.NOT_FOUND);	protected static final OperationStatus EXISTS_STATUS =		new CASOperationStatus(false, "Object exists", CASResponse.EXISTS);	protected static final OperationStatus NOT_STORED_STATUS =		new CASOperationStatus(false, "Not Stored", CASResponse.NOT_FOUND);	protected static final byte[] EMPTY_BYTES = new byte[0];	protected static final OperationStatus STATUS_OK =		new CASOperationStatus(true, "OK", CASResponse.OK);	private static final AtomicInteger seqNumber=new AtomicInteger(0);	// request header fields	private final int cmd;	protected final int opaque;	private final byte[] header=new byte[MIN_RECV_PACKET];	private int headerOffset=0;	private byte[] payload=null;	// Response header fields	protected int keyLen;	protected int responseCmd;	protected int errorCode;	protected int responseOpaque;	protected long responseCas;	private int payloadOffset=0;	/**	 * Construct with opaque.	 *	 * @param o the opaque value.	 * @param cb	 */	protected OperationImpl(int c, int o, OperationCallback cb) {		super();		cmd=c;		opaque=o;		setCallback(cb);	}	protected void resetInput() {		payload=null;		payloadOffset=0;		headerOffset=0;	}	// Base response packet format:	//    0      1       2  3    4         5         6  7    8 9 10 11	//	# magic, opcode, keylen, extralen, datatype, status, bodylen,	//    12,3,4,5  16	//    opaque, cas	//	RES_PKT_FMT=">BBHBBHIIQ"	@Override	public void readFromBuffer(ByteBuffer b) throws IOException {		// First process headers if we haven't completed them yet		if(headerOffset < MIN_RECV_PACKET) {			int toRead=MIN_RECV_PACKET - headerOffset;			int available=b.remaining();			toRead=Math.min(toRead, available);			getLogger().debug("Reading %d header bytes", toRead);			b.get(header, headerOffset, toRead);			headerOffset+=toRead;			// We've completed reading the header.  Prepare body read.			if(headerOffset == MIN_RECV_PACKET) {				int magic=header[0];				assert magic == RES_MAGIC : "Invalid magic:  " + magic;				responseCmd=header[1];				assert cmd == -1 || responseCmd == cmd					: "Unexpected response command value";				keyLen=decodeShort(header, 2);				// TODO:  Examine extralen and datatype				errorCode=decodeShort(header, 6);				int bytesToRead=decodeInt(header, 8);				payload=new byte[bytesToRead];				responseOpaque=decodeInt(header, 12);				responseCas=decodeLong(header, 16);				assert opaqueIsValid() : "Opaque is not valid";			}		}		// Now process the payload if we can.		if(headerOffset >= MIN_RECV_PACKET && payload == null) {			finishedPayload(EMPTY_BYTES);		} else if(payload != null) {			int toRead=payload.length - payloadOffset;			int available=b.remaining();			toRead=Math.min(toRead, available);			getLogger().debug("Reading %d payload bytes", toRead);			b.get(payload, payloadOffset, toRead);			payloadOffset+=toRead;			// Have we read it all?			if(payloadOffset == payload.length) {				finishedPayload(payload);			}		} else {			// Haven't read enough to make up a payload.  Must read more.			getLogger().debug("Only read %d of the %d needed to fill a header",				headerOffset, MIN_RECV_PACKET);		}	}	protected void finishedPayload(byte[] pl) throws IOException {		if(errorCode != 0) {			OperationStatus status=getStatusForErrorCode(errorCode, pl);			if(status == null) {				handleError(OperationErrorType.SERVER, new String(pl));			} else {				getCallback().receivedStatus(status);				transitionState(OperationState.COMPLETE);			}		} else {			decodePayload(pl);			transitionState(OperationState.COMPLETE);		}	}	/**	 * Get the OperationStatus object for the given error code.	 *	 * @param errCode the error code	 * @return the status to return, or null if this is an exceptional case	 */	protected OperationStatus getStatusForErrorCode(int errCode, byte[] errPl) {		return null;	}	/**	 * Decode the given payload for this command.	 *	 * @param pl the payload.	 */	protected void decodePayload(byte[] pl) {		assert pl.length == 0 : "Payload has bytes, but decode isn't overridden";		getCallback().receivedStatus(STATUS_OK);	}	/**	 * Validate an opaque value from the header.	 * This may be overridden from a subclass where the opaque isn't expected	 * to always be the same as the request opaque.	 */	protected boolean opaqueIsValid() {		if(responseOpaque != opaque) {			getLogger().warn("Expected opaque:  %d, got opaque:  %d\n",					responseOpaque, opaque);		}		return responseOpaque == opaque;	}	static int decodeShort(byte[] data, int i) {		return (data[i] & 0xff) << 8			| (data[i+1] & 0xff);	}	static int decodeInt(byte[] data, int i) {		return (data[i]  & 0xff) << 24			| (data[i+1] & 0xff) << 16			| (data[i+2] & 0xff) << 8			| (data[i+3] & 0xff);	}	static long decodeUnsignedInt(byte[] data, int i) {		return ((long)(data[i]  & 0xff) << 24)			| ((data[i+1] & 0xff) << 16)			| ((data[i+2] & 0xff) << 8)			| (data[i+3] & 0xff);	}	static long decodeLong(byte[] data, int i) {		return(data[i  ] & 0xff) << 56			| (data[i+1] & 0xff) << 48			| (data[i+2] & 0xff) << 40			| (data[i+3] & 0xff) << 32			| (data[i+4] & 0xff) << 24			| (data[i+5] & 0xff) << 16			| (data[i+6] & 0xff) << 8			| (data[i+7] & 0xff);	}	/**	 * Prepare a send buffer.	 *	 * @param cmd the command identifier	 * @param key the key (for keyed ops)	 * @param val the data payload	 * @param extraHeaders any additional headers that need to be sent	 */	protected void prepareBuffer(String key, long cas, byte[] val,			Object... extraHeaders) {		int extraLen=0;		for(Object o : extraHeaders) {			if(o instanceof Integer) {				extraLen += 4;			} else if(o instanceof byte[]) {				extraLen += ((byte[])o).length;			} else if(o instanceof Long) {				extraLen += 8;			} else {				assert false : "Unhandled extra header type:  " + o.getClass();			}		}		final byte[] keyBytes=KeyUtil.getKeyBytes(key);		int bufSize=MIN_RECV_PACKET + keyBytes.length + val.length;		//	# magic, opcode, keylen, extralen, datatype, [reserved],		//    bodylen, opaque, cas		//	REQ_PKT_FMT=">BBHBBxxIIQ"		// set up the initial header stuff		ByteBuffer bb=ByteBuffer.allocate(bufSize + extraLen);		assert bb.order() == ByteOrder.BIG_ENDIAN;		bb.put(REQ_MAGIC);		bb.put((byte)cmd);		bb.putShort((short)keyBytes.length);		bb.put((byte)extraLen);		bb.put((byte)0); // data type		bb.putShort((short)0); // reserved		bb.putInt(keyBytes.length + val.length + extraLen);		bb.putInt(opaque);		bb.putLong(cas);		// Add the extra headers.		for(Object o : extraHeaders) {			if(o instanceof Integer) {				bb.putInt((Integer)o);			} else if(o instanceof byte[]) {				bb.put((byte[])o);			} else if(o instanceof Long) {				bb.putLong((Long)o);			} else {				assert false : "Unhandled extra header type:  " + o.getClass();			}		}		// Add the normal stuff		bb.put(keyBytes);		bb.put(val);		bb.flip();		setBuffer(bb);	}	/**	 * Generate an opaque ID.	 */	static int generateOpaque() {		int rv=seqNumber.incrementAndGet();		while(rv < 0) {			if(seqNumber.compareAndSet(rv, 0)) {				rv=seqNumber.incrementAndGet();			}		}		return rv;	}}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一二三级电影| 欧美中文字幕一区| 欧美三级视频在线| 国产喷白浆一区二区三区| 亚洲精品日韩一| 国产精品一二三区在线| 欧美日韩中文一区| 亚洲视频每日更新| 国产福利视频一区二区三区| 欧美美女一区二区在线观看| 亚洲欧美国产高清| 丁香网亚洲国际| 欧美r级电影在线观看| 亚洲aaa精品| 一本色道久久加勒比精品| 国产日韩欧美精品一区| 久久精品理论片| 日韩欧美国产午夜精品| 午夜免费欧美电影| 欧美亚一区二区| 亚洲视频 欧洲视频| 成人免费av资源| 亚洲国产精品黑人久久久| 国产尤物一区二区在线| 日韩精品一区二| 免费日本视频一区| 9191精品国产综合久久久久久| 亚洲精品老司机| 色综合中文字幕国产| 精品国产91亚洲一区二区三区婷婷| 五月天亚洲精品| 在线不卡免费欧美| 日本欧美一区二区三区| 91精品国产一区二区三区| 日韩国产欧美三级| 欧美一区二区视频在线观看2022| 午夜精品福利一区二区三区av| 欧美最猛性xxxxx直播| 亚洲国产中文字幕| 91精品国产麻豆国产自产在线| 日本视频中文字幕一区二区三区| 3d动漫精品啪啪一区二区竹菊| 日韩二区在线观看| 日韩情涩欧美日韩视频| 国内精品伊人久久久久av影院| 久久亚洲春色中文字幕久久久| 风间由美性色一区二区三区| 国产精品久久久久久一区二区三区| 99re热这里只有精品免费视频| **性色生活片久久毛片| 在线欧美日韩国产| 日日欢夜夜爽一区| 久久久久久亚洲综合影院红桃| 国产成人av电影在线观看| 国产精品不卡在线| 欧美探花视频资源| 久久99精品国产麻豆婷婷| 久久综合久久综合亚洲| av电影天堂一区二区在线 | 91色.com| 婷婷国产v国产偷v亚洲高清| 精品欧美一区二区三区精品久久| 国产精品一级在线| 亚洲国产美国国产综合一区二区| 日韩免费电影一区| 成人免费视频免费观看| 午夜精品久久久久久久久久| 精品国产伦一区二区三区观看体验| 成人性生交大片免费看在线播放 | 精品成人一区二区三区| 夫妻av一区二区| 性欧美大战久久久久久久久| 久久久久久久国产精品影院| 欧美亚洲国产一卡| 国产 欧美在线| 日韩精品成人一区二区三区| 中文字幕 久热精品 视频在线 | 91精品福利在线| 九九精品一区二区| 亚洲综合一区二区| 日本一区二区三区四区在线视频| 欧美性猛片aaaaaaa做受| 国产成人综合亚洲网站| 午夜精品久久久久久不卡8050| 国产精品久久久久久久浪潮网站 | 喷水一区二区三区| 亚洲欧洲综合另类| 久久久久久亚洲综合影院红桃| 欧美日韩在线播放一区| 99re热视频这里只精品| 国产成人综合在线| 久久www免费人成看片高清| 亚洲国产一区二区三区 | 国产高清精品久久久久| 三级不卡在线观看| 亚洲自拍偷拍图区| 亚洲欧美日韩一区| 国产精品免费视频一区| 国产欧美日产一区| 精品成人一区二区| 欧美www视频| 日韩视频一区在线观看| 欧美片网站yy| 欧美日韩一区二区在线视频| 91福利在线观看| 99国产欧美另类久久久精品| 国产aⅴ精品一区二区三区色成熟| 免费不卡在线视频| 免费在线一区观看| 日本大胆欧美人术艺术动态| 亚洲成av人片在线| 视频一区欧美精品| 午夜天堂影视香蕉久久| 亚洲亚洲精品在线观看| 亚洲h精品动漫在线观看| 亚洲大片一区二区三区| 亚洲第一激情av| 日av在线不卡| 另类调教123区| 久久超碰97人人做人人爱| 狠狠v欧美v日韩v亚洲ⅴ| 国内国产精品久久| 国产成人免费xxxxxxxx| www.视频一区| 色哟哟一区二区| 7777精品伊人久久久大香线蕉的| 欧美日韩成人在线| 精品国产乱码久久久久久影片| 亚洲精品在线一区二区| 久久久久国产一区二区三区四区 | 亚洲综合视频网| 天堂成人国产精品一区| 美国毛片一区二区三区| 国产一区二区调教| gogo大胆日本视频一区| 91黄视频在线观看| 91精品国产入口在线| 精品99999| 亚洲欧美另类综合偷拍| 香蕉加勒比综合久久| 韩国女主播成人在线观看| 高清不卡在线观看av| 欧美综合色免费| 欧美大片一区二区| 国产精品久久免费看| 亚洲午夜电影在线| 精品制服美女久久| 一本到三区不卡视频| 欧美一级在线视频| 中文字幕视频一区| 日本网站在线观看一区二区三区| 成人天堂资源www在线| 欧美福利电影网| 国产欧美精品日韩区二区麻豆天美| 亚洲黄一区二区三区| 极品少妇xxxx精品少妇| 日本伦理一区二区| 久久综合九色综合久久久精品综合| 国产精品国产自产拍在线| 蜜臀av一区二区在线免费观看| 成人理论电影网| 91精品福利在线一区二区三区| 国产精品久久看| 久久精品国产久精国产| 日本精品免费观看高清观看| 精品国产凹凸成av人网站| 亚洲综合在线电影| 风间由美中文字幕在线看视频国产欧美| 欧美日韩在线三级| 自拍偷在线精品自拍偷无码专区| 蜜桃久久久久久久| 欧亚一区二区三区| 国产精品久久久久久妇女6080| 久久精品免费观看| 欧美久久一区二区| 亚洲黄一区二区三区| 不卡免费追剧大全电视剧网站| 欧美videos中文字幕| 青椒成人免费视频| 欧美日韩国产精品自在自线| 亚洲欧美日韩久久| 99精品国产91久久久久久| 亚洲国产激情av| 国产成人精品影视| 精品国产一区二区三区不卡| 蜜桃视频在线一区| 欧美一区二区人人喊爽| 日韩av网站在线观看| 7777精品伊人久久久大香线蕉 | 亚洲三级电影全部在线观看高清| 国产麻豆成人精品| 精品久久免费看| 极品瑜伽女神91| 久久综合色婷婷| 韩国v欧美v日本v亚洲v| 精品国产一区二区三区久久久蜜月| 青草国产精品久久久久久| 日韩精品一区二区三区视频在线观看| 日韩国产一二三区| 精品久久一区二区|