hprose-java
hprose-java copied to clipboard
Hprose-java推送服务功能出现堵塞,直至服务端超时
场景复现: 1、服务端,每秒钟推送一次 public static void main(String[] args)throws Exception{ HproseTcpServer server=new HproseTcpServer("tcp://127.0.0.1:4321"); server.publish("time",12000,3000); server.start(); Timer timer=new Timer(); timer.schedule(new TimerTask() { @Override public void run() { System.out.println(LocalDateTime.now()+" "+ JSON.toJSONString(server.idlist("time") )+" "+ LocalTime.now().getSecond()); server.unicast("time","test",LocalTime.now().getSecond()); } },0,1000); } 2、客户端订阅接收 public static void main(String[] args) throws Exception{ //订阅服务 HproseClient client=HproseClient.create("tcp://127.0.0.1:4321");
Thread thread=new Thread(new Runnable() {
@Override
public void run() {
client.subscribe("time","test",(String msg)->{
System.out.println(LocalDateTime.now()+" "+msg );
},String.class);
}
});
thread.start();
}
现象:服务端看到订阅的客户端掉线
客户端接收日志
这是来自QQ邮箱的假期自动回复邮件。 您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。
java 版本的不完善,像 golang、dotnet、typescript 这些都已经升级到 3.0 了,3.0 的推送已经很完善了。但是 java 语言本身太不思进取了,实在没精力把 java 版本的也升级到 3.0。等什么时候 java 支持 async/await 之后再看看吧。