1078-查询终端属性完成
This commit is contained in:
@@ -5,6 +5,8 @@ import io.netty.channel.Channel;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.SynchronousQueue;
|
||||
@@ -109,6 +111,23 @@ public enum SessionManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Boolean response(String key, Object data) {
|
||||
SynchronousQueue<Object> queue = topicSubscribers.get(key);
|
||||
if (queue != null) {
|
||||
try {
|
||||
return queue.offer(data, 2, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
log.error("{}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
log.warn("Not find response,key:{} data:{} ", key, data);
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<String> getAllRequestKey() {
|
||||
return new ArrayList<>(topicSubscribers.keySet());
|
||||
}
|
||||
|
||||
private void unsubscribe(String key) {
|
||||
topicSubscribers.remove(key);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user