1 20 21 22 package org.jacorb.util.threadpool; 23 24 32 33 public class ConsumerTie 34 implements Runnable  35 { 36 private boolean run = true; 37 private ThreadPool pool = null; 38 private Consumer delegate = null; 39 40 public ConsumerTie( ThreadPool pool, 41 Consumer delegate ) 42 { 43 this.pool = pool; 44 this.delegate = delegate; 45 } 46 47 public void run() 48 { 49 try 50 { 51 while( run ) 52 { 53 Object job = pool.getJob(); 54 55 if( job == null ) 56 { 57 61 return; 62 } 63 else 64 { 65 delegate.doWork( job ); 66 } 67 } 68 } 69 catch( Exception e ) 70 { 71 return; 72 } 73 } 74 } 76 77 78 | Popular Tags |