-
Notifications
You must be signed in to change notification settings - Fork 0
/
Outbound.java
33 lines (28 loc) · 1.12 KB
/
Outbound.java
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
31
32
33
package com.wwc.Protocol;
import com.wwc.Utils.Handler;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.net.SocketAddress;
/**
* Outbound只有这一个接口,如何被调用应该由Outbound的编写者来规定参数。
*/
//Inbound通过process来传递数据,但是如何传递?
public interface Outbound extends IBound{
default Outbound getInstance(){
try {
return this.getClass().newInstance();
} catch (IllegalAccessException
| InstantiationException e) {
e.printStackTrace();
}
return null;
}
/**
* 这里的Inbound和Outbound并不一定真的是Inbound,OutboundHandler,又可能是另一个实现了Processable接口的类比如
* InboundHandler,
* Inbound对于每一个连接应该只使用process一次,后面的数据传递应该通过Processable p来进行
* 调用process来向Outbound传递消息,这时Outbound应该保存这三个参数
* @param data
* @param addr
* @param handler */
void process(Buffer data, SocketAddress addr, Handler<Buffer> handler, Inbound in);
}