当前位置: 首页>>代码示例>>Java>>正文


Java KeeperState.SyncConnected方法代码示例

本文整理汇总了Java中org.apache.zookeeper.Watcher.Event.KeeperState.SyncConnected方法的典型用法代码示例。如果您正苦于以下问题:Java KeeperState.SyncConnected方法的具体用法?Java KeeperState.SyncConnected怎么用?Java KeeperState.SyncConnected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.zookeeper.Watcher.Event.KeeperState的用法示例。


在下文中一共展示了KeeperState.SyncConnected方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: process

import org.apache.zookeeper.Watcher.Event.KeeperState; //导入方法依赖的package包/类
@Override
synchronized public void process(WatchedEvent event) {
    if (event.getState() == KeeperState.SyncConnected ||
        event.getState() == KeeperState.ConnectedReadOnly) {
        connected = true;
        notifyAll();
        clientConnected.countDown();
    } else {
        connected = false;
        notifyAll();
    }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:13,代码来源:ClientBaseWithFixes.java

示例2: process

import org.apache.zookeeper.Watcher.Event.KeeperState; //导入方法依赖的package包/类
public void process(WatchedEvent event) {
    if (event.getState() == KeeperState.SyncConnected) {
        synchronized(this) {
            connected = true;
            notifyAll();
        }
    } else if (event.getState() == KeeperState.Disconnected) {
        synchronized(this) {
            connected = false;
            notifyAll();
        }
    }
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:14,代码来源:SimpleSysTest.java

示例3: queueEvent

import org.apache.zookeeper.Watcher.Event.KeeperState; //导入方法依赖的package包/类
void queueEvent(String clientPath, int err,
        Set<Watcher> materializedWatchers, EventType eventType) {
    KeeperState sessionState = KeeperState.SyncConnected;
    if (KeeperException.Code.SESSIONEXPIRED.intValue() == err
            || KeeperException.Code.CONNECTIONLOSS.intValue() == err) {
        sessionState = Event.KeeperState.Disconnected;
    }
    WatchedEvent event = new WatchedEvent(eventType, sessionState,
            clientPath);
    eventThread.queueEvent(event, materializedWatchers);
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:12,代码来源:ClientCnxn.java

示例4: process

import org.apache.zookeeper.Watcher.Event.KeeperState; //导入方法依赖的package包/类
public void process(WatchedEvent event) {
    LOG.info("Event:" + event.getState() + " " + event.getType() + " " + event.getPath());
    if (event.getState() == KeeperState.SyncConnected
            && startSignal != null && startSignal.getCount() > 0)
    {
        startSignal.countDown();
    }
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:9,代码来源:RecoveryTest.java

示例5: process

import org.apache.zookeeper.Watcher.Event.KeeperState; //导入方法依赖的package包/类
@Override
public void process(WatchedEvent event) {
	// TODO Auto-generated method stub
	System.out.println("Receive Watcher Event:" + event);
	if (KeeperState.SyncConnected == event.getState()) {
		countDownLatch.countDown();
	}	
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:9,代码来源:MyWatcher.java

示例6: onConnected

import org.apache.zookeeper.Watcher.Event.KeeperState; //导入方法依赖的package包/类
/**
 * Callback invoked by the ClientCnxnSocket once a connection has been
 * established.
 * 
 * @param _negotiatedSessionTimeout
 * @param _sessionId
 * @param _sessionPasswd
 * @param isRO
 * @throws IOException
 */
void onConnected(int _negotiatedSessionTimeout, long _sessionId,
        byte[] _sessionPasswd, boolean isRO) throws IOException {
    negotiatedSessionTimeout = _negotiatedSessionTimeout;
    if (negotiatedSessionTimeout <= 0) {
        state = States.CLOSED;

        eventThread.queueEvent(new WatchedEvent(
                Watcher.Event.EventType.None,
                Watcher.Event.KeeperState.Expired, null));
        eventThread.queueEventOfDeath();

        String warnInfo;
        warnInfo = "Unable to reconnect to ZooKeeper service, session 0x"
            + Long.toHexString(sessionId) + " has expired";
        LOG.warn(warnInfo);
        throw new SessionExpiredException(warnInfo);
    }
    if (!readOnly && isRO) {
        LOG.error("Read/write client got connected to read-only server");
    }
    readTimeout = negotiatedSessionTimeout * 2 / 3;
    connectTimeout = negotiatedSessionTimeout / hostProvider.size();
    hostProvider.onConnected();
    sessionId = _sessionId;
    sessionPasswd = _sessionPasswd;
    state = (isRO) ?
            States.CONNECTEDREADONLY : States.CONNECTED;
    seenRwServerBefore |= !isRO;
    LOG.info("Session establishment complete on server "
            + clientCnxnSocket.getRemoteSocketAddress()
            + ", sessionid = 0x" + Long.toHexString(sessionId)
            + ", negotiated timeout = " + negotiatedSessionTimeout
            + (isRO ? " (READ-ONLY mode)" : ""));
    KeeperState eventState = (isRO) ?
            KeeperState.ConnectedReadOnly : KeeperState.SyncConnected;
    eventThread.queueEvent(new WatchedEvent(
            Watcher.Event.EventType.None,
            eventState, null));
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:50,代码来源:ClientCnxn.java

示例7: process

import org.apache.zookeeper.Watcher.Event.KeeperState; //导入方法依赖的package包/类
public void process(WatchedEvent event) {
    LOG.info(name + " event:" + event.getState() + " "
            + event.getType() + " " + event.getPath());
    if (event.getState() == KeeperState.SyncConnected
            && startSignal != null && startSignal.getCount() > 0)
    {
        startSignal.countDown();
    }
}
 
开发者ID:l294265421,项目名称:ZooKeeper,代码行数:10,代码来源:SessionTest.java

示例8: process

import org.apache.zookeeper.Watcher.Event.KeeperState; //导入方法依赖的package包/类
public void process(WatchedEvent event) {
    LOG.info("Event:" + event.getState() + " " + event.getType() + " "
             + event.getPath());
    if (event.getState() == KeeperState.SyncConnected) {
        if (startSignal != null && startSignal.getCount() > 0) {
            LOG.info("startsignal.countDown()");
            startSignal.countDown();
        } else {
            LOG.warn("startsignal " + startSignal);
        }
    }
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:13,代码来源:ACLTest.java

示例9: process

import org.apache.zookeeper.Watcher.Event.KeeperState; //导入方法依赖的package包/类
public void process(WatchedEvent event) {
    if(event.getState()==KeeperState.SyncConnected){
        synchronized(this){
            notifyAll();
        }
    }
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:8,代码来源:IntegrityCheck.java

示例10: isConnected

import org.apache.zookeeper.Watcher.Event.KeeperState; //导入方法依赖的package包/类
@Override
public boolean isConnected() {
    return _currentState == KeeperState.SyncConnected;
}
 
开发者ID:lemonJun,项目名称:TakinRPC,代码行数:5,代码来源:ZkClient.java

示例11: isConnected

import org.apache.zookeeper.Watcher.Event.KeeperState; //导入方法依赖的package包/类
public boolean isConnected() {
	return state == KeeperState.SyncConnected;
}
 
开发者ID:zhuxiaolei,项目名称:dubbo2,代码行数:4,代码来源:ZkclientZookeeperClient.java

示例12: process

import org.apache.zookeeper.Watcher.Event.KeeperState; //导入方法依赖的package包/类
public void process(WatchedEvent event) {
    if (event.getState() == KeeperState.SyncConnected) {
        clientConnected.countDown();
    }
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:6,代码来源:SessionTest.java


注:本文中的org.apache.zookeeper.Watcher.Event.KeeperState.SyncConnected方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。