1 package org.oddjob.jobs; 2 3 import java.io.Serializable ; 4 5 import org.oddjob.util.OddjobConfigException; 6 7 31 public class EchoJob 32 implements Runnable , Serializable { 33 private static final long serialVersionUID = 20051130; 34 35 40 private String name; 41 42 47 volatile private String text; 48 49 54 public String getName() { 55 return name; 56 } 57 58 63 public void setName(String name) { 64 this.name = name; 65 } 66 67 72 public String getText() { 73 return text; 74 } 75 76 81 public void setText(String text) { 82 this.text = text; 83 } 84 85 90 public void addText(String text) { 91 this.text += text; 92 } 93 94 98 public void run() { 99 if (text == null) { 100 throw new OddjobConfigException("No text to echo."); 101 } 102 System.out.println(text); 103 } 104 105 109 public String toString() { 110 if (name == null) { 111 return "Echo to Console"; 112 } 113 return name; 114 } 115 } 116 | Popular Tags |