gestorpooling.java
来自「java 实现的P2P Chord算法。chord算法是结构式的P2P搜索与管理」· Java 代码 · 共 47 行
JAVA
47 行
/* * GestorPooling.java * * Created on 14 de abril de 2005, 15:48 */package org.mikel.jchord.red;import java.util.*;/** * * @author mikel */public class GestorPooling { private Vector colaEjecutables; /** Creates a new instance of GestorPoolThreads */ public GestorPooling(int tama駉) { colaEjecutables = new Vector(1,10); for(int i=0; i<tama駉; i++){ new EjecutorParaPool(this); } } synchronized void esperarEjecucion (EjecutorParaPool ejecutor) throws InterruptedException{ while(colaEjecutables.size()==0) wait(); Runnable e = (Runnable) colaEjecutables.elementAt(0); colaEjecutables.removeElementAt(0); ejecutor.ejecutar(e); } synchronized void a馻dir(Runnable r){ colaEjecutables.addElement(r); notify(); } }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?