CommonSignThread.java 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /**
  2. * @(#)file SignThread.java
  3. * @(#)author DaeJin Lee
  4. * @(#)version 1.0
  5. * @(#)date Jun 10, 2005
  6. * @(#)since JDK 1.4.2
  7. *
  8. * Copyright (c) www.dcchem.co.kr, Inc.
  9. * All rights reserved.
  10. * This software is the proprietary information of dcchem, Inc.
  11. */
  12. package kr.co.udapsoft.common.commonSign;
  13. import kr.co.hsnc.common.logger.Logger;
  14. /**
  15. *
  16. * @version 1.0
  17. * @author DaeJin Lee
  18. */
  19. public class CommonSignThread extends Thread {
  20. private boolean IS_RUN = false;
  21. private long INTERVAL = 1000l * 120 * 1;
  22. private static CommonSignThreadBiz biz = null;
  23. protected CommonSignThread() {
  24. biz = new CommonSignThreadBiz();
  25. }
  26. /**
  27. * Thread 가동여부를 리턴
  28. * @return
  29. */
  30. public boolean isRun() {
  31. return this.IS_RUN;
  32. }
  33. /**
  34. * Thread Start
  35. */
  36. public void doStart() {
  37. if( !this.IS_RUN ) {
  38. this.IS_RUN = true;
  39. this.start();
  40. }
  41. }
  42. /**
  43. * Thread Stop
  44. */
  45. public void doStop() {
  46. if( this.IS_RUN ) {
  47. this.IS_RUN = false;
  48. super.interrupt();
  49. }
  50. }
  51. /* (non-Javadoc)
  52. * @see java.lang.Runnable#run()
  53. */
  54. public void run() {
  55. while(IS_RUN) {
  56. try {
  57. Thread.sleep(INTERVAL);
  58. }
  59. catch(InterruptedException ie) {
  60. }
  61. try {
  62. if( IS_RUN ) {
  63. Logger.debug.println("hwenc.pcms.common.commonSign.CommonSignThread run.");
  64. biz.doBiz();
  65. }
  66. }
  67. catch(Exception e) {
  68. e.printStackTrace(System.out);
  69. Logger.err.printStackTrace(e);
  70. }
  71. }
  72. }
  73. }