/* * 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 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(); } }