This commit is contained in:
Redkale
2017-05-20 13:14:00 +08:00
parent e939241a8c
commit 4029b09d81
3 changed files with 8 additions and 2 deletions

View File

@@ -123,7 +123,9 @@ public class NodeHttpServer extends NodeServer {
protected void loadHttpServlet(final AnyValue servletsConf, final ClassFilter<? extends Servlet> filter) throws Exception {
final StringBuilder sb = logger.isLoggable(Level.INFO) ? new StringBuilder() : null;
final String prefix = servletsConf == null ? "" : servletsConf.getValue("path", "");
String prefix0 = servletsConf == null ? "" : servletsConf.getValue("path", "");
if (!prefix0.isEmpty() && prefix0.charAt(prefix0.length() - 1) == '/') prefix0 = prefix0.substring(0, prefix0.length() - 1);
final String prefix = prefix0;
final String threadName = "[" + Thread.currentThread().getName() + "] ";
List<FilterEntry<? extends Servlet>> list = new ArrayList(filter.getFilterEntrys());
list.sort((FilterEntry<? extends Servlet> o1, FilterEntry<? extends Servlet> o2) -> { //必须保证WebSocketServlet优先加载 因为要确保其他的HttpServlet可以注入本地模式的WebSocketNode

View File

@@ -518,6 +518,10 @@ public abstract class WebSocket {
public void onClose(int code, String reason) {
}
public long getLastSendTime() {
return this._runner == null ? 0 : this._runner.lastSendTime;
}
/**
* 显式地关闭WebSocket
*/

View File

@@ -49,7 +49,7 @@ public class WebSocketRunner implements Runnable {
private final boolean wsbinary;
private long lastSendTime;
protected long lastSendTime;
public WebSocketRunner(Context context, WebSocket webSocket, AsyncConnection channel, final boolean wsbinary) {
this.context = context;