Project

General

Profile

Statistics
| Revision:

root / src / messages / MessageHandler.java @ 1

History | View | Annotate | Download (718 Bytes)

1 1 up20150524
package messages;
2
3
import messages.Message;
4
5
import java.io.IOException;
6
import java.net.UnknownHostException;
7
8
public class MessageHandler implements Runnable{
9
10
    Message message;
11
12
    public MessageHandler(Object messageObject)
13
    {
14
        if (messageObject != null) {
15
            System.out.println("Received: " + messageObject);
16
            if(messageObject instanceof Message){
17
                message = (Message) messageObject;
18
            }
19
        }
20
    }
21
22
    @Override
23
    public void run() {
24
25
        try {
26
          message.handleMessage();
27
        } catch (UnknownHostException e) {
28
            e.printStackTrace();
29
        } catch (IOException e) {
30
            e.printStackTrace();
31
        }
32
    }
33
}