KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jsmtpd > core > receive > ReceiverWorkerImpl


1 /*
2  *
3  * Jsmtpd, Java SMTP daemon
4  * Copyright (C) 2005 Jean-Francois POUX, jf.poux@laposte.net
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  *
20  */

21 package org.jsmtpd.core.receive;
22
23 import java.io.IOException JavaDoc;
24 import java.net.Socket JavaDoc;
25
26 import org.jsmtpd.generic.threadpool.IThreadedClass;
27
28 /**
29  * Implements the threaded interface of generic pool
30  * holds instance of the smtp protocol receiving handler
31  * @author Jean-Francois POUX
32  */

33 public class ReceiverWorkerImpl implements IThreadedClass {
34
35     private ProtocolHandler proto = new ProtocolHandler();
36     private Socket JavaDoc rec = null;
37
38     public void doJob() {
39         proto.init(rec);
40     }
41
42     public void forceShutdown() {
43         try {
44             if (rec != null)
45                 rec.close();
46         } catch (IOException JavaDoc e) {
47
48         }
49     }
50
51     public void gracefullShutdown() {
52         try {
53             if (rec != null)
54                 rec.close();
55         } catch (IOException JavaDoc e) {
56
57         }
58     }
59
60     public void setParam(Object JavaDoc o) {
61         rec = (Socket JavaDoc) o;
62     }
63
64 }
Popular Tags