KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > petals > component > common > listener > MessageExchangeWorker


1 /**
2  * PETALS - PETALS Services Platform.
3  * Copyright (c) 2006 EBM Websourcing, http://www.ebmwebsourcing.com/
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * -------------------------------------------------------------------------
19  * $Id: $
20  * -------------------------------------------------------------------------
21  */

22 package org.objectweb.petals.component.common.listener;
23
24 import java.util.logging.Level JavaDoc;
25 import java.util.logging.Logger JavaDoc;
26
27 import javax.jbi.JBIException;
28
29 import org.objectweb.petals.component.common.util.MessageExchangeWrapper;
30
31 /**
32  * MessageExchange worker
33  *
34  * @author Christophe DENEUX (Capgemini Sud), ofabre
35  *
36  */

37 public class MessageExchangeWorker extends Thread JavaDoc {
38
39     private MessageExchangeWrapper exchange = null;
40
41     private MessageExchangeProcessor processor = null;
42
43     private Logger JavaDoc logger = null;
44
45     public MessageExchangeWorker(MessageExchangeWrapper exchange,
46             MessageExchangeProcessor processor, Logger JavaDoc logger) {
47         super("MessageExchangeWorker");
48         this.exchange = exchange;
49         this.processor = processor;
50     }
51
52     /**
53      * call the processor's process() method
54      */

55     public void run() {
56         if (processor != null) {
57             try {
58                 processor.process(exchange);
59             } catch (JBIException e) {
60                 logger.log(Level.SEVERE, e.getMessage(), e);
61             }
62         }
63     }
64
65 }
66
Popular Tags