1 25 26 package org.objectweb.easybeans.jca.workmanager; 27 28 import javax.resource.spi.work.WorkException ; 29 30 import org.objectweb.easybeans.log.JLog; 31 import org.objectweb.easybeans.log.JLogFactory; 32 33 38 public class ResourceWorkThread extends Thread { 39 40 43 private JLog logger = JLogFactory.getLog(ResourceWorkThread.class); 44 45 48 private ResourceWorkManager workManager; 49 50 56 ResourceWorkThread(final ResourceWorkManager workManager, final int workManagerNumber, final int threadNumber) { 57 this.workManager = workManager; 58 setName(this.getClass().getName() + "-" + workManagerNumber + "/" + threadNumber); 59 } 60 61 64 @Override 65 public void run() { 66 67 while (true) { 68 try { 69 workManager.nextWork(); 70 } catch (InterruptedException e) { 71 logger.error("Exception while waiting during a work", e); 72 return; 73 } catch (WorkException e) { 74 logger.error("Exception during work run", e); 75 } catch (ResourceWorkManagerStoppedException e) { 76 logger.debug("Manager has been stopped", e); 77 return; 78 } 79 } 80 } 81 } 82 | Popular Tags |