class SBuffer public synchronized void putDesc(String st) while (available == true) try wait() catch(InterruptedException e) { } } s = st available = true notifyAll() } public synchronized void sortRotDes() while (rotdone == false) try wait() catch(InterruptedException e) { } try Collections.sort(rtvec); catch(Exception e) e.printStackTrace(); stdone = true; notifyAll();
public class Index public static BufferedInputReader bin; public static Kwic kw; public static SBuffer ct; public static void main(String args[]) { Index oIndex = new Index(); InputRunnable ir = new InputRunnable(); Thread thInput = new Thread(ir); thInput.start(); } } public class InputRunnable public void run() while (Index.bin.getContinue()) Index.ct.writeToBuffer() Index.bin.closeStream()
public static void main (String args[]) VectorContainer sc = new VectorContainer() StringContainer srot = new StringContainer() StringContainer rotate = new StringContainer() StringContainer sp = new StringContainer() (new Thread(new ReadInput (sc ))).start() (new Thread(new Rotate (sc, srot ))).start() (new Thread(new Descriptions(srot, rotate))).start() (new Thread(new SortAndMap (rotate, sp ))).start() (new Thread(new PrintThread (sp ))).start()
class ListBuffer { private Collection lBuffer = new LinkedList(); private boolean buffer_full = false; public synchronized Collection get() while (!buffer_full) try wait() catch (InterruptedException ie) { } Collection listTemp = new LinkedList(lBuffer) lBuffer.clear() buffer_full = false notify() return listTemp
System.exit()
is not a good plan.
This page last modified on 30 July 2002.