1 23 package com.sun.enterprise.web.connector.grizzly; 24 25 import java.util.logging.Level ; 26 27 28 29 35 public class WorkerThread extends Thread { 36 37 40 private Pipeline pipeline; 41 42 45 private volatile boolean doTask = true; 46 47 48 51 private final static ThreadGroup threadGroup = new ThreadGroup ("Grizzly"); 52 53 54 58 public WorkerThread(Pipeline pipeline, String name){ 59 super(threadGroup, name); 60 this.pipeline = pipeline; 61 setDaemon(true); 62 } 63 64 65 68 public void run(){ 69 70 while (doTask) { 71 try{ 72 Task t = pipeline.getTask(); 74 if ( t != null){ 75 t.run(); 76 t = null; 77 } 78 } catch (Throwable t) { 79 SelectorThread.logger().log(Level.FINE, 80 "workerThread.httpException",t); 81 } 82 } 83 } 84 85 86 90 public void terminate(){ 91 doTask = false; 92 } 93 } 94 95 | Popular Tags |