⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gcpast.java

📁 pastry的java实现的2.0b版
💻 JAVA
字号:
/*************************************************************************"FreePastry" Peer-to-Peer Application Development Substrate Copyright 2002, Rice University. All rights reserved.Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditions aremet:- Redistributions of source code must retain the above copyrightnotice, this list of conditions and the following disclaimer.- Redistributions in binary form must reproduce the above copyrightnotice, this list of conditions and the following disclaimer in thedocumentation and/or other materials provided with the distribution.- Neither  the name  of Rice  University (RICE) nor  the names  of itscontributors may be  used to endorse or promote  products derived fromthis software without specific prior written permission.This software is provided by RICE and the contributors on an "as is"basis, without any representations or warranties of any kind, expressor implied including, but not limited to, representations orwarranties of non-infringement, merchantability or fitness for aparticular purpose. In no event shall RICE or contributors be liablefor any direct, indirect, incidental, special, exemplary, orconsequential damages (including, but not limited to, procurement ofsubstitute goods or services; loss of use, data, or profits; orbusiness interruption) however caused and on any theory of liability,whether in contract, strict liability, or tort (including negligenceor otherwise) arising in any way out of the use of this software, evenif advised of the possibility of such damage.********************************************************************************/package rice.p2p.past.gc;import rice.*;import rice.p2p.commonapi.*;import rice.p2p.past.*;/** * @(#) GCPast.java This interface represents an extension to the Past * interface, which adds support for garbage collection and versionsing. * Individual objects are each given versions and timeout times. Version numbers * are used to keep different replicas in sync, and the timeout times are used * to determine when space can be reclaimed. Applications must periodically * invoke the refresh() operation on all objects which they are interested in. * Otherwise, objects may be reclaimed and will be no longer available. * * @version $Id: GCPast.java 2372 2005-03-21 18:56:11Z amislove $ * @author Alan Mislove * @author Andreas Haeberlen */public interface GCPast extends Past {  /**   * Timeout value which indicates that the object should never expire. Note   * that objects with this timeout value _will_ be deleted in the year   * 292473178. If this is a problem, applications should check for this value   * explicitly.   */  public final static long INFINITY_EXPIRATION = Long.MAX_VALUE;  /**   * Inserts an object with the given ID into this instance of Past.   * Asynchronously returns a PastException to command, if the operation was   * unsuccessful. If the operation was successful, a Boolean[] is returned   * representing the responses from each of the replicas which inserted the   * object. This method is equivalent to insert(obj, INFINITY_EXPIRATION,   * command) as it inserts the object with a timeout value of infinity. This is   * done for simplicity, as well as backwards-compatibility for applications.   *   * @param obj the object to be inserted   * @param command Command to be performed when the result is received   */  public void insert(PastContent obj, Continuation command);  /**   * Inserts an object with the given ID into this instance of Past.   * Asynchronously returns a PastException to command, if the operation was   * unsuccessful. If the operation was successful, a Boolean[] is returned   * representing the responses from each of the replicas which inserted the   * object. The contract for this method is that the provided object will be   * stored until the provided expiration time. Thus, if the application   * determines that it is still interested in this object, it must refresh the   * object via the refresh() method.   *   * @param obj the object to be inserted   * @param expiration the time until which the object must be stored   * @param command Command to be performed when the result is received   */  public void insert(PastContent obj, long expiration, Continuation command);  /**   * Updates the objects stored under the provided keys id to expire no earlier   * than the provided expiration time. Asyncroniously returns the result to the   * caller via the provided continuation. The result of this operation is an   * Object[], which is the same length as the input array of Ids. Each element   * in the array is either Boolean(true), representing that the refresh   * succeeded for the cooresponding Id, or an Exception describing why the   * refresh failed. Specifically, the possible exceptions which can be returned   * are: ObjectNotFoundException - if no object was found under the given key   * RefreshFailedException - if the refresh operation failed for any other   * reason (the getMessage() will describe the failure)   *   * @param expiration The time to extend the lifetime to   * @param command Command to be performed when the result is received   * @param ids DESCRIBE THE PARAMETER   */  public void refresh(Id[] ids, long[] expiration, Continuation command);  /**   * Updates the objects stored under the provided keys id to expire no earlier   * than the provided expiration time. Asyncroniously returns the result to the   * caller via the provided continuation. The result of this operation is an   * Object[], which is the same length as the input array of Ids. Each element   * in the array is either Boolean(true), representing that the refresh   * succeeded for the cooresponding Id, or an Exception describing why the   * refresh failed. Specifically, the possible exceptions which can be returned   * are: ObjectNotFoundException - if no object was found under the given key   * RefreshFailedException - if the refresh operation failed for any other   * reason (the getMessage() will describe the failure)   *   * @param expiration The time to extend the lifetime to (applies to all keys)   * @param command Command to be performed when the result is received   * @param ids DESCRIBE THE PARAMETER   */  public void refresh(Id[] ids, long expiration, Continuation command);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -