1 21 22 package org.jacorb.notification.engine; 23 24 import org.jacorb.notification.interfaces.Message; 25 26 30 public abstract class AbstractMessageTask extends AbstractTask 31 { 32 private Message message_; 33 34 37 public void setMessage(Message message) 38 { 39 if (message_ != null) 40 { 41 throw new RuntimeException ("remove old first"); 42 } 43 44 message_ = message; 45 } 46 47 public Message removeMessage() 48 { 49 Message _mesg = message_; 50 51 message_ = null; 52 53 return _mesg; 54 } 55 56 public Message copyMessage() 57 { 58 return (Message) message_.clone(); 59 } 60 61 protected boolean isRunnable() 62 { 63 return !message_.isInvalid(); 64 } 65 66 protected void checkInterrupt() throws InterruptedException 67 { 68 super.checkInterrupt(); 69 70 if (message_.isInvalid()) 71 { 72 throw new InterruptedException (); 73 } 74 } 75 76 protected Message getMessage() 77 { 78 return message_; 79 } 80 81 public void dispose() 82 { 83 if (message_ != null) 84 { 85 message_.dispose(); 86 } 87 88 super.dispose(); 89 } 90 91 public void reset() 92 { 93 message_ = null; 94 } 95 } | Popular Tags |