blob: 167f3b7bb1a2146b1fe6cf405de545f9d1641f70 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
package pl.edu.mimuw.cloudatlas.agent;
import pl.edu.mimuw.cloudatlas.agent.message.AgentMessage;
/*
* A Module is a (potentially stateful) event handler.
*/
public abstract class Module {
private AgentMessage.AgentModule moduleType;
private Executor executor;
Module(AgentMessage.AgentModule moduleType) {
this.moduleType = moduleType;
}
public abstract void handle(AgentMessage event) throws InterruptedException ;
public void setExecutor(Executor executor) {
this.executor = executor;
}
public void sendMessage(AgentMessage event) throws InterruptedException {
this.executor.passMessage(event);
}
@Override
public String toString() {
return moduleType.toString();
}
}
|