本文整理匯總了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();