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

📄 chordcallback.java

📁 一个对等计算发生器
💻 JAVA
字号:
/***************************************************************************
 *                                                                         *
 *                            ChordCallback.java                           *
 *                            -------------------                          *
 *   date                 : 15.10.2005                                     *
 *   copyright            : (C) 2004/2005 Distributed and                  *
 *								Mobile Systems Group                       *
 *                              Lehrstuhl fuer Praktische Informatik       *
 *                              Universitaet Bamberg                       *
 *                              http://www.lspi.wiai.uni-bamberg.de/       *
 *   email                : sven.kaffille@wiai.uni-bamberg.de              *
 *   						karsten.loesing@wiai.uni-bamberg.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.                                   *
 *                                                                         *
 *   A copy of the license can be found in the license.txt file supplied   *
 *   with this software or at: http://www.gnu.org/copyleft/gpl.html        *
 *                                                                         *
 ***************************************************************************/
package de.uniba.wiai.lspi.chord.service;

import java.io.Serializable;
import java.util.Set;

/**
 * <p>
 * This is the interface that must be implemented by classes 
 * that can be used as callback for method invocations on {@link AsynChord}.
 * </p> 
 * 
 * <p>
 * An instance of this must be passed as parameter to on of the 
 * methods:
 * <ul>
 * <li>{@link AsynChord#insert(Key, Serializable, ChordCallback)}</li>
 * <li>{@link AsynChord#remove(Key, Serializable, ChordCallback)}</li>
 * <li>{@link AsynChord#retrieve(Key, ChordCallback)}</li>
 * </ul>
 * On termination of those methods the corresponding callback method 
 * on this is called. These methods are: 
 * <ul>
 * <li>{@link #inserted(Key, Serializable, Throwable)}</li>
 * <li>{@link #removed(Key, Serializable, Throwable)}</li>
 * <li>{@link #retrieved(Key, Set, Throwable)}</li>
 * </ul>
 * The {@link Throwable} parameter of these methods is <code>null</code> 
 * if the corresponding method has been executed successfully. 
 * </p>
 * 
 *  
 * @author sven
 * @version 1.0.1
 *
 */
public interface ChordCallback {

	/**
	 * This is the callback method for retrieval of values 
	 * associated with <code>key</code>. This method is called 
	 * when an invocation of 
	 * {@link AsynChord#retrieve(Key, ChordCallback)} has finished.   
	 * 
	 * @param key The {@link Key} that has been used for the retrieval.   
	 * @param entries The retrieved entries. Empty Set, if no values 
	 * are associated with <code>key</code>. 
	 * @param t Any {@link Throwable} that occured during execution 
	 * of {@link AsynChord#retrieve(Key, ChordCallback)}. 
	 * This is <code>null</code> if retrieval of <code>key</code> 
	 * was succesful.
	 */
	public void retrieved(Key key, Set<Serializable> entries, Throwable t);
	
	/**
	 * This method is called, when a call to 
	 * {@link AsynChord#insert(Key, Serializable, ChordCallback)}
	 * has been finished. 
	 * 
	 * @param key The {@link Key} that should be used for insertion.
	 * @param entry The entry that should be inserted. 
	 * @param t Any {@link Throwable} that occured during execution 
	 * of {@link AsynChord#insert(Key, Serializable, ChordCallback)}. 
	 * This is <code>null</code> if insertion of <code>key</code> and 
	 * <code>entry</code> was succesful.  
	 */
	public void inserted(Key key, Serializable entry, Throwable t); 
	
	/**
	 * This is the callback method for removal of the <code>entry</code> 
	 * with <code>key</code>. 
	 * 
	 * @param key The {@link Key} of the entry that should be removed. 
	 * @param entry The entry that should be removed. 
	 * @param t Any {@link Throwable} that occured during execution 
	 * of {@link AsynChord#remove(Key, Serializable, ChordCallback)}. 
	 * This is <code>null</code> if removal of 
	 * <code>entry</code> was succesful.
	 */
	public void removed(Key key, Serializable entry, Throwable t); 
	
}

⌨️ 快捷键说明

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