通用订阅器Helper close 错误修正
添加 通用带超时订阅器
This commit is contained in:
parent
cc4577cc4e
commit
2ab7e9dff5
@ -4,6 +4,7 @@ import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Flow;
|
||||
import java.util.concurrent.SubmissionPublisher;
|
||||
@ -31,7 +32,7 @@ public interface GenericSubscribe<T> {
|
||||
|
||||
public static <T> void delPublisher(Map<String, SubmissionPublisher<T>> publishers, String key){
|
||||
SubmissionPublisher<T> publisher = publishers.remove(key);
|
||||
publisher.close();
|
||||
Optional.ofNullable(publisher).ifPresent(SubmissionPublisher::close);
|
||||
}
|
||||
|
||||
public static <T> void addPublisher(Executor executor, Map<String, SubmissionPublisher<T>> publishers, String key){
|
||||
|
@ -0,0 +1,16 @@
|
||||
package cn.skcks.docking.gb28181.core.sip.message.subscribe;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Flow;
|
||||
import java.util.concurrent.SubmissionPublisher;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public interface GenericTimeoutSubscribe<T> extends GenericSubscribe<T>{
|
||||
void addPublisher(String key, long time, TimeUnit timeUnit);
|
||||
|
||||
void refreshPublisher(String key, long time, TimeUnit timeUnit);
|
||||
}
|
Loading…
Reference in New Issue
Block a user