serge 02/04/18 07:45:47
Modified: src/java/org/apache/james/transport/mailets
RemoteDelivery.java
Log:
Added a "destroyed" thread that the remote delivery threads will now check, so it's
that much clearer that when destroy() is called on this mailet, the threads will stop.
Revision Changes Path
1.20 +6 -3
jakarta-james/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
Index: RemoteDelivery.java
===================================================================
RCS file:
/home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/RemoteDelivery.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- RemoteDelivery.java 18 Apr 2002 14:14:53 -0000 1.19
+++ RemoteDelivery.java 18 Apr 2002 14:45:47 -0000 1.20
@@ -45,8 +45,8 @@
* @author Serge Knystautas <[EMAIL PROTECTED]>
* @author Federico Barbieri <[EMAIL PROTECTED]>
*
- * This is $Revision: 1.19 $
- * Committed on $Date: 2002/04/18 14:14:53 $ by: $Author: serge $
+ * This is $Revision: 1.20 $
+ * Committed on $Date: 2002/04/18 14:45:47 $ by: $Author: serge $
*/
public class RemoteDelivery extends GenericMailet implements Runnable {
@@ -59,6 +59,7 @@
private String gatewayPort = null; //the port of the gateway server to send
all email to
private Collection deliveryThreads = new Vector();
private MailServer mailServer;
+ private boolean destroyed = false; //Flag that the run method will check and
end itself if set to true
public void init() throws MessagingException {
try {
@@ -405,6 +406,8 @@
// Need to synchronize to get object monitor for notifyAll()
public synchronized void destroy() {
+ //Mark flag so threads from this mailet stop themselves
+ destroyed = true;
//Wake up all threads from waiting for an accept
for (Iterator i = deliveryThreads.iterator(); i.hasNext(); ) {
Thread t = (Thread)i.next();
@@ -437,7 +440,7 @@
props.put("mail.smtp.port", gatewayPort);
}
Session session = Session.getInstance(props, null);
- while (!Thread.currentThread().interrupted()) {
+ while (!Thread.currentThread().interrupted() && !destroyed) {
try {
String key = outgoing.accept(delayTime);
try {
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>