01: /*
02: *
03: * Jsmtpd, Java SMTP daemon
04: * Copyright (C) 2005 Jean-Francois POUX, jf.poux@laposte.net
05: *
06: * This program is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU General Public License
08: * as published by the Free Software Foundation; either version 2
09: * 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;
24: import java.net.Socket;
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 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 e) {
47:
48: }
49: }
50:
51: public void gracefullShutdown() {
52: try {
53: if (rec != null)
54: rec.close();
55: } catch (IOException e) {
56:
57: }
58: }
59:
60: public void setParam(Object o) {
61: rec = (Socket) o;
62: }
63:
64: }
|