欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

Curator怎么實(shí)現(xiàn)分布式數(shù)字

這篇文章主要介紹“Curator怎么實(shí)現(xiàn)分布式數(shù)字”,在日常操作中,相信很多人在Curator怎么實(shí)現(xiàn)分布式數(shù)字問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”Curator怎么實(shí)現(xiàn)分布式數(shù)字”的疑惑有所幫助!接下來,請跟著小編一起來學(xué)習(xí)吧!

成都創(chuàng)新互聯(lián)公司于2013年成立,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目網(wǎng)站建設(shè)、做網(wǎng)站網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個夢想脫穎而出為使命,1280元登封做網(wǎng)站,已為上家服務(wù),為登封各地企業(yè)和個人服務(wù),聯(lián)系電話:028-86922220

Curator有2個實(shí)現(xiàn):

第一個:

package curator.counters;

import org.apache.curator.RetryPolicy;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.framework.recipes.shared.SharedCount;
import org.apache.curator.framework.recipes.shared.SharedCountListener;
import org.apache.curator.framework.recipes.shared.SharedCountReader;
import org.apache.curator.framework.state.ConnectionState;
import org.apache.curator.retry.ExponentialBackoffRetry;

public class SharedCounterDemo {

	public static void main(String[] args) throws Exception {
		RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
		final CuratorFramework client = CuratorFrameworkFactory.builder().connectString("127.0.0.1:2181").sessionTimeoutMs(5000).connectionTimeoutMs(10000).retryPolicy(retryPolicy).namespace("test").build();
		client.start();
		
		SharedCount count = new SharedCount(client,"/cut",0);
		count.start();
		
		count.addListener(new SharedCountListener(){

			@Override
			public void stateChanged(CuratorFramework client, ConnectionState newState) {
				
			}

			@Override
			public void countHasChanged(SharedCountReader sharedCount, int newCount) throws Exception {
				System.err.println("sharedCount.getCount : "+sharedCount.getCount());
				System.err.println(newCount);
			}});
		Thread.currentThread().sleep(5000);
		count.setCount(5);
		System.in.read();
	}

}

第二個:

package curator.counters;

import org.apache.curator.RetryPolicy;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.framework.recipes.atomic.AtomicValue;
import org.apache.curator.framework.recipes.atomic.DistributedAtomicInteger;
import org.apache.curator.retry.ExponentialBackoffRetry;
import org.apache.curator.retry.RetryNTimes;

public class DistributedAtomicIntegerDemo {

	public static void main(String[] args) throws Exception {
		RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
		final CuratorFramework client = CuratorFrameworkFactory.builder().connectString("127.0.0.1:2181").sessionTimeoutMs(5000).connectionTimeoutMs(10000).retryPolicy(retryPolicy).namespace("test").build();
		client.start();

		DistributedAtomicInteger atomicInteger = new DistributedAtomicInteger(client,"/autlog",new RetryNTimes(32,1000));
		AtomicValue<Integer> rc = atomicInteger.add(8);  
		System.out.println("success:" + rc.succeeded() + ";before:" + rc.preValue() + ";after:" + rc.postValue());
		System.in.read();
	}

}

到此,關(guān)于“Curator怎么實(shí)現(xiàn)分布式數(shù)字”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識,請繼續(xù)關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編會繼續(xù)努力為大家?guī)砀鄬?shí)用的文章!

網(wǎng)頁名稱:Curator怎么實(shí)現(xiàn)分布式數(shù)字
當(dāng)前網(wǎng)址:http://aaarwkj.com/article38/jjgipp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供自適應(yīng)網(wǎng)站、網(wǎng)站改版定制網(wǎng)站、外貿(mào)建站、網(wǎng)站導(dǎo)航、

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

h5響應(yīng)式網(wǎng)站建設(shè)
在线观看国产自拍精品| 把熟睡的少妇弄到高潮| 一区二区在线日韩视频| 6080yy精品一区二区三区| 国产91黑丝在线播放| 伊人丁香六月日日操操| 国产做a爰片久久91| 精品少妇熟女av免费久久| 天天操天天日天天射夜夜爽| 亚洲一区二区偷拍精品| 国产午夜精品自拍视频| 综合激情网激情五月天| 最新国产不卡一区二区| 国产亚洲精品视频二区| 精品人妻一区二区三区不卡| 成人精品淫片一级免费| 日本高清一区二区高清| 亚洲欧美中文日韩一区| 国语少妇高潮对白在线| 国模一区二区三区视频| 国产精品一区二区三区在线| 免费成人激情在线电影| 亚洲一区二区视频在线观看免费| 激情图区亚洲一区二区| 18禁免费无遮挡免费视频| 亚洲精品中的亚洲精品| 亚洲av色男人天堂网| 漂亮人妻被中出中文字幕| 人妻丰满熟妇九九久久| 丰满人妻被猛烈进入中文版| 国产日韩欧美亚洲一区二区| 国产美女主播一二三区| 日本亚洲精品在线观看| 美女午夜精品国产福利| 欧美日韩国产精品综合| 亚洲精品视频久久偷拍| 亚洲免费视频一二三区| 免费在线成人av观看| 午夜夫妻生活视频在线观看| 国产成人精品久久久亚洲| 日本免费精品一区二区三区四区|