本文整理汇总了Java中com.mpush.api.srd.ServiceDiscovery类的典型用法代码示例。如果您正苦于以下问题:Java ServiceDiscovery类的具体用法?Java ServiceDiscovery怎么用?Java ServiceDiscovery使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ServiceDiscovery类属于com.mpush.api.srd包,在下文中一共展示了ServiceDiscovery类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import com.mpush.api.srd.ServiceDiscovery; //导入依赖的package包/类
public void start() {
CacheManagerFactory.create().init(); //启动缓冲服务
ServiceDiscovery discovery = ServiceDiscoveryFactory.create();// 启动发现服务
discovery.syncStart();
discovery.subscribe(ServiceNames.CONN_SERVER, new ConnServerNodeListener());
scheduledExecutor = Executors.newSingleThreadScheduledExecutor();
scheduledExecutor.scheduleAtFixedRate(this::refresh, 0, 5, TimeUnit.MINUTES);
}
示例2: doStart
import com.mpush.api.srd.ServiceDiscovery; //导入依赖的package包/类
@Override
protected void doStart(Listener listener) throws Throwable {
Utils.newThread("udp-client", () -> gatewayUDPConnector.start(listener)).start();
ServiceDiscovery discovery = ServiceDiscoveryFactory.create();
discovery.subscribe(GATEWAY_SERVER, this);
discovery.lookup(GATEWAY_SERVER).forEach(this::addConnection);
}
示例3: doStart
import com.mpush.api.srd.ServiceDiscovery; //导入依赖的package包/类
@Override
protected void doStart(Listener listener) throws Throwable {
ServiceDiscovery discovery = ServiceDiscoveryFactory.create();
discovery.subscribe(DNS_MAPPING, this);
discovery.lookup(DNS_MAPPING).forEach(this::add);
if (all.size() > 0) {
executorService = Executors.newSingleThreadScheduledExecutor(
new NamedPoolThreadFactory(ThreadNames.T_HTTP_DNS_TIMER)
);
executorService.scheduleAtFixedRate(this, 1, 20, TimeUnit.SECONDS); //20秒 定时扫描dns
}
listener.onSuccess();
}
示例4: getDiscovery
import com.mpush.api.srd.ServiceDiscovery; //导入依赖的package包/类
@Override
public ServiceDiscovery getDiscovery() {
return ServiceDiscoveryFactory.create();
}
示例5: create
import com.mpush.api.srd.ServiceDiscovery; //导入依赖的package包/类
static ServiceDiscovery create() {
return SpiLoader.load(ServiceDiscoveryFactory.class).get();
}
示例6: get
import com.mpush.api.srd.ServiceDiscovery; //导入依赖的package包/类
@Override
public ServiceDiscovery get() {
return ZKServiceRegistryAndDiscovery.I;
}
示例7: get
import com.mpush.api.srd.ServiceDiscovery; //导入依赖的package包/类
@Override
public ServiceDiscovery get() {
return FileSrd.I;
}
示例8: getDiscovery
import com.mpush.api.srd.ServiceDiscovery; //导入依赖的package包/类
ServiceDiscovery getDiscovery();