📄 responsehash.java
字号:
/* * Copyright (C) 2005 Stefan Strigler <steve@zeank.in-berlin.de> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */package org.jabber.JabberHTTPBind;import java.util.Hashtable;/** * a <list> of Response objects * thus enabling us to handle concurrent requests * * @author Stefan Strigler <steve@zeank.in-berlin.de> */public class ResponseHash extends Hashtable { public class JHBRidInvalidException extends Exception { public JHBRidInvalidException() { super(); } } private int windowSize; /** * @param windowSize */ public ResponseHash(int windowSize) { super(windowSize); this.windowSize = windowSize; } /** * determines how many requests we are processing at the moment by counting * responses that arent closed yet. * * @return number of unsent responses */ public int pendingResponses() { return 0; } public boolean isValidRid(long rid) { boolean valid = false; return valid; } /** * Checks whether rid is valid after all (within valid window). Throws an * exception if not. If rid matches a closed response this one's returned. * * @param rid * A request ID as passed along from incoming client request * * @return A closed or a new Response depending on rid * * @throws JHBRidInvalidException * Thrown if rid is not within valid window. */ public synchronized Response getResponse(long rid) throws JHBRidInvalidException { Response resp = (Response) get(new Long(rid)); if (resp != null && resp.getStatus() == Response.STATUS_DONE) { return resp; } return resp; } public synchronized Response addResponse(Response resp, String rid) { this.put(rid,resp); return resp; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -