Java 类org.apache.zookeeper.retry.ZooKeeperRetry 实例源码

项目:fuck_zookeeper    文件:ZooInspectorManagerImpl.java   
public boolean connect(Properties connectionProps) {
    try {
        if (this.zooKeeper == null) {
            String connectString = connectionProps
                    .getProperty(CONNECT_STRING);
            String sessionTimeout = connectionProps
                    .getProperty(SESSION_TIMEOUT);
            String encryptionManager = connectionProps
                    .getProperty(DATA_ENCRYPTION_MANAGER);
            String authScheme = connectionProps
                    .getProperty(AUTH_SCHEME_KEY);
            String authData = connectionProps
                    .getProperty(AUTH_DATA_KEY);

            if (connectString == null || sessionTimeout == null) {
                throw new IllegalArgumentException(
                        "Both connect string and session timeout are required.");
            }
            if (encryptionManager == null) {
                this.encryptionManager = new BasicDataEncryptionManager();
            } else {
                Class<?> clazz = Class.forName(encryptionManager);

                if (Arrays.asList(clazz.getInterfaces()).contains(
                        DataEncryptionManager.class)) {
                    this.encryptionManager = (DataEncryptionManager) Class
                            .forName(encryptionManager).newInstance();
                } else {
                    throw new IllegalArgumentException(
                            "Data encryption manager must implement DataEncryptionManager interface");
                }
            }
            this.connectString = connectString;
            this.sessionTimeout = Integer.valueOf(sessionTimeout);
            this.zooKeeper = new ZooKeeperRetry(connectString, Integer
                    .valueOf(sessionTimeout), new Watcher() {

                public void process(WatchedEvent event) {
                    if (event.getState() == KeeperState.Expired) {
                        connected = false;
                    }
                }
            });
            if (authData != null && authData.length() > 0){
                this.zooKeeper.addAuthInfo(authScheme, authData.getBytes());
            }
            ((ZooKeeperRetry) this.zooKeeper).setRetryLimit(10);
            connected = ((ZooKeeperRetry) this.zooKeeper).testConnection();
        }
    } catch (Exception e) {
        connected = false;
        e.printStackTrace();
    }
    if (!connected){
        disconnect();
    }
    return connected;
}
项目:https-github.com-apache-zookeeper    文件:ZooInspectorManagerImpl.java   
public boolean connect(Properties connectionProps) {
    try {
        if (this.zooKeeper == null) {
            String connectString = connectionProps
                    .getProperty(CONNECT_STRING);
            String sessionTimeout = connectionProps
                    .getProperty(SESSION_TIMEOUT);
            String encryptionManager = connectionProps
                    .getProperty(DATA_ENCRYPTION_MANAGER);
            String authScheme = connectionProps
                    .getProperty(AUTH_SCHEME_KEY);
            String authData = connectionProps
                    .getProperty(AUTH_DATA_KEY);

            if (connectString == null || sessionTimeout == null) {
                throw new IllegalArgumentException(
                        "Both connect string and session timeout are required.");
            }
            if (encryptionManager == null) {
                this.encryptionManager = new BasicDataEncryptionManager();
            } else {
                Class<?> clazz = Class.forName(encryptionManager);

                if (Arrays.asList(clazz.getInterfaces()).contains(
                        DataEncryptionManager.class)) {
                    this.encryptionManager = (DataEncryptionManager) Class
                            .forName(encryptionManager).newInstance();
                } else {
                    throw new IllegalArgumentException(
                            "Data encryption manager must implement DataEncryptionManager interface");
                }
            }
            this.connectString = connectString;
            this.sessionTimeout = Integer.valueOf(sessionTimeout);
            this.zooKeeper = new ZooKeeperRetry(connectString, Integer
                    .valueOf(sessionTimeout), new Watcher() {

                public void process(WatchedEvent event) {
                    if (event.getState() == KeeperState.Expired) {
                        connected = false;
                    }
                }
            });
            if (authData != null && authData.length() > 0){
                this.zooKeeper.addAuthInfo(authScheme, authData.getBytes());
            }
            ((ZooKeeperRetry) this.zooKeeper).setRetryLimit(10);
            connected = ((ZooKeeperRetry) this.zooKeeper).testConnection();
        }
    } catch (Exception e) {
        connected = false;
        e.printStackTrace();
    }
    if (!connected){
        disconnect();
    } else {
        this.nodesCache = new NodesCache(zooKeeper);
    }
    return connected;
}
项目:ZooKeeper    文件:ZooInspectorManagerImpl.java   
public boolean connect(Properties connectionProps) {
    try {
        if (this.zooKeeper == null) {
            String connectString = connectionProps
                    .getProperty(CONNECT_STRING);
            String sessionTimeout = connectionProps
                    .getProperty(SESSION_TIMEOUT);
            String encryptionManager = connectionProps
                    .getProperty(DATA_ENCRYPTION_MANAGER);
            String authScheme = connectionProps
                    .getProperty(AUTH_SCHEME_KEY);
            String authData = connectionProps
                    .getProperty(AUTH_DATA_KEY);

            if (connectString == null || sessionTimeout == null) {
                throw new IllegalArgumentException(
                        "Both connect string and session timeout are required.");
            }
            if (encryptionManager == null) {
                this.encryptionManager = new BasicDataEncryptionManager();
            } else {
                Class<?> clazz = Class.forName(encryptionManager);

                if (Arrays.asList(clazz.getInterfaces()).contains(
                        DataEncryptionManager.class)) {
                    this.encryptionManager = (DataEncryptionManager) Class
                            .forName(encryptionManager).newInstance();
                } else {
                    throw new IllegalArgumentException(
                            "Data encryption manager must implement DataEncryptionManager interface");
                }
            }
            this.connectString = connectString;
            this.sessionTimeout = Integer.valueOf(sessionTimeout);
            this.zooKeeper = new ZooKeeperRetry(connectString, Integer
                    .valueOf(sessionTimeout), new Watcher() {

                public void process(WatchedEvent event) {
                    if (event.getState() == KeeperState.Expired) {
                        connected = false;
                    }
                }
            });
            if (authData != null && authData.length() > 0){
                this.zooKeeper.addAuthInfo(authScheme, authData.getBytes());
            }
            ((ZooKeeperRetry) this.zooKeeper).setRetryLimit(10);
            connected = ((ZooKeeperRetry) this.zooKeeper).testConnection();
        }
    } catch (Exception e) {
        connected = false;
        e.printStackTrace();
    }
    if (!connected){
        disconnect();
    }
    return connected;
}
项目:ZooKeeper    文件:ZooInspectorManagerImpl.java   
public boolean connect(Properties connectionProps) {
    try {
        if (this.zooKeeper == null) {
            String connectString = connectionProps
                    .getProperty(CONNECT_STRING);
            String sessionTimeout = connectionProps
                    .getProperty(SESSION_TIMEOUT);
            String encryptionManager = connectionProps
                    .getProperty(DATA_ENCRYPTION_MANAGER);
            String authScheme = connectionProps
                    .getProperty(AUTH_SCHEME_KEY);
            String authData = connectionProps
                    .getProperty(AUTH_DATA_KEY);

            if (connectString == null || sessionTimeout == null) {
                throw new IllegalArgumentException(
                        "Both connect string and session timeout are required.");
            }
            if (encryptionManager == null) {
                this.encryptionManager = new BasicDataEncryptionManager();
            } else {
                Class<?> clazz = Class.forName(encryptionManager);

                if (Arrays.asList(clazz.getInterfaces()).contains(
                        DataEncryptionManager.class)) {
                    this.encryptionManager = (DataEncryptionManager) Class
                            .forName(encryptionManager).newInstance();
                } else {
                    throw new IllegalArgumentException(
                            "Data encryption manager must implement DataEncryptionManager interface");
                }
            }
            this.connectString = connectString;
            this.sessionTimeout = Integer.valueOf(sessionTimeout);
            this.zooKeeper = new ZooKeeperRetry(connectString, Integer
                    .valueOf(sessionTimeout), new Watcher() {

                public void process(WatchedEvent event) {
                    if (event.getState() == KeeperState.Expired) {
                        connected = false;
                    }
                }
            });
            if (authData != null && authData.length() > 0){
                this.zooKeeper.addAuthInfo(authScheme, authData.getBytes());
            }
            ((ZooKeeperRetry) this.zooKeeper).setRetryLimit(10);
            connected = ((ZooKeeperRetry) this.zooKeeper).testConnection();
        }
    } catch (Exception e) {
        connected = false;
        e.printStackTrace();
    }
    if (!connected){
        disconnect();
    }
    return connected;
}
项目:StreamProcessingInfrastructure    文件:ZooInspectorManagerImpl.java   
public boolean connect(Properties connectionProps) {
    try {
        if (this.zooKeeper == null) {
            String connectString = connectionProps
                    .getProperty(CONNECT_STRING);
            String sessionTimeout = connectionProps
                    .getProperty(SESSION_TIMEOUT);
            String encryptionManager = connectionProps
                    .getProperty(DATA_ENCRYPTION_MANAGER);
            String authScheme = connectionProps
                    .getProperty(AUTH_SCHEME_KEY);
            String authData = connectionProps
                    .getProperty(AUTH_DATA_KEY);

            if (connectString == null || sessionTimeout == null) {
                throw new IllegalArgumentException(
                        "Both connect string and session timeout are required.");
            }
            if (encryptionManager == null) {
                this.encryptionManager = new BasicDataEncryptionManager();
            } else {
                Class<?> clazz = Class.forName(encryptionManager);

                if (Arrays.asList(clazz.getInterfaces()).contains(
                        DataEncryptionManager.class)) {
                    this.encryptionManager = (DataEncryptionManager) Class
                            .forName(encryptionManager).newInstance();
                } else {
                    throw new IllegalArgumentException(
                            "Data encryption manager must implement DataEncryptionManager interface");
                }
            }
            this.connectString = connectString;
            this.sessionTimeout = Integer.valueOf(sessionTimeout);
            this.zooKeeper = new ZooKeeperRetry(connectString, Integer
                    .valueOf(sessionTimeout), new Watcher() {

                public void process(WatchedEvent event) {
                    if (event.getState() == KeeperState.Expired) {
                        connected = false;
                    }
                }
            });
            if (authData != null && authData.length() > 0){
                this.zooKeeper.addAuthInfo(authScheme, authData.getBytes());
            }
            ((ZooKeeperRetry) this.zooKeeper).setRetryLimit(10);
            connected = ((ZooKeeperRetry) this.zooKeeper).testConnection();
        }
    } catch (Exception e) {
        connected = false;
        e.printStackTrace();
    }
    if (!connected){
        disconnect();
    }
    return connected;
}
项目:StreamProcessingInfrastructure    文件:ZooInspectorManagerImpl.java   
public boolean connect(Properties connectionProps) {
    try {
        if (this.zooKeeper == null) {
            String connectString = connectionProps
                    .getProperty(CONNECT_STRING);
            String sessionTimeout = connectionProps
                    .getProperty(SESSION_TIMEOUT);
            String encryptionManager = connectionProps
                    .getProperty(DATA_ENCRYPTION_MANAGER);
            String authScheme = connectionProps
                    .getProperty(AUTH_SCHEME_KEY);
            String authData = connectionProps
                    .getProperty(AUTH_DATA_KEY);

            if (connectString == null || sessionTimeout == null) {
                throw new IllegalArgumentException(
                        "Both connect string and session timeout are required.");
            }
            if (encryptionManager == null) {
                this.encryptionManager = new BasicDataEncryptionManager();
            } else {
                Class<?> clazz = Class.forName(encryptionManager);

                if (Arrays.asList(clazz.getInterfaces()).contains(
                        DataEncryptionManager.class)) {
                    this.encryptionManager = (DataEncryptionManager) Class
                            .forName(encryptionManager).newInstance();
                } else {
                    throw new IllegalArgumentException(
                            "Data encryption manager must implement DataEncryptionManager interface");
                }
            }
            this.connectString = connectString;
            this.sessionTimeout = Integer.valueOf(sessionTimeout);
            this.zooKeeper = new ZooKeeperRetry(connectString, Integer
                    .valueOf(sessionTimeout), new Watcher() {

                public void process(WatchedEvent event) {
                    if (event.getState() == KeeperState.Expired) {
                        connected = false;
                    }
                }
            });
            if (authData != null && authData.length() > 0){
                this.zooKeeper.addAuthInfo(authScheme, authData.getBytes());
            }
            ((ZooKeeperRetry) this.zooKeeper).setRetryLimit(10);
            connected = ((ZooKeeperRetry) this.zooKeeper).testConnection();
        }
    } catch (Exception e) {
        connected = false;
        e.printStackTrace();
    }
    if (!connected){
        disconnect();
    }
    return connected;
}
项目:bigstreams    文件:ZooInspectorManagerImpl.java   
public boolean connect(Properties connectionProps) {
    try {
        if (this.zooKeeper == null) {
            String connectString = connectionProps
                    .getProperty(CONNECT_STRING);
            String sessionTimeout = connectionProps
                    .getProperty(SESSION_TIMEOUT);
            String encryptionManager = connectionProps
                    .getProperty(DATA_ENCRYPTION_MANAGER);
            if (connectString == null || sessionTimeout == null) {
                throw new IllegalArgumentException(
                        "Both connect string and session timeout are required.");
            }
            if (encryptionManager == null) {
                this.encryptionManager = new BasicDataEncryptionManager();
            } else {
                Class<?> clazz = Class.forName(encryptionManager);

                if (Arrays.asList(clazz.getInterfaces()).contains(
                        DataEncryptionManager.class)) {
                    this.encryptionManager = (DataEncryptionManager) Class
                            .forName(encryptionManager).newInstance();
                } else {
                    throw new IllegalArgumentException(
                            "Data encryption manager must implement DataEncryptionManager interface");
                }
            }
            this.connectString = connectString;
            this.sessionTimeout = Integer.valueOf(sessionTimeout);
            this.zooKeeper = new ZooKeeperRetry(connectString, Integer
                    .valueOf(sessionTimeout), new Watcher() {

                public void process(WatchedEvent event) {
                    if (event.getState() == KeeperState.Expired) {
                        connected = false;
                    }
                }
            });
            ((ZooKeeperRetry) this.zooKeeper).setRetryLimit(10);
            connected = ((ZooKeeperRetry) this.zooKeeper).testConnection();
            return connected;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    connected = false;
    return connected;
}
项目:bigstreams    文件:ZooInspectorManagerImpl.java   
public boolean connect(Properties connectionProps) {
    try {
        if (this.zooKeeper == null) {
            String connectString = connectionProps
                    .getProperty(CONNECT_STRING);
            String sessionTimeout = connectionProps
                    .getProperty(SESSION_TIMEOUT);
            String encryptionManager = connectionProps
                    .getProperty(DATA_ENCRYPTION_MANAGER);
            if (connectString == null || sessionTimeout == null) {
                throw new IllegalArgumentException(
                        "Both connect string and session timeout are required.");
            }
            if (encryptionManager == null) {
                this.encryptionManager = new BasicDataEncryptionManager();
            } else {
                Class<?> clazz = Class.forName(encryptionManager);

                if (Arrays.asList(clazz.getInterfaces()).contains(
                        DataEncryptionManager.class)) {
                    this.encryptionManager = (DataEncryptionManager) Class
                            .forName(encryptionManager).newInstance();
                } else {
                    throw new IllegalArgumentException(
                            "Data encryption manager must implement DataEncryptionManager interface");
                }
            }
            this.connectString = connectString;
            this.sessionTimeout = Integer.valueOf(sessionTimeout);
            this.zooKeeper = new ZooKeeperRetry(connectString, Integer
                    .valueOf(sessionTimeout), new Watcher() {

                public void process(WatchedEvent event) {
                    if (event.getState() == KeeperState.Expired) {
                        connected = false;
                    }
                }
            });
            ((ZooKeeperRetry) this.zooKeeper).setRetryLimit(10);
            connected = ((ZooKeeperRetry) this.zooKeeper).testConnection();
            return connected;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    connected = false;
    return connected;
}
项目:bigstreams    文件:ZooInspectorManagerImpl.java   
public boolean connect(Properties connectionProps) {
    try {
        if (this.zooKeeper == null) {
            String connectString = connectionProps
                    .getProperty(CONNECT_STRING);
            String sessionTimeout = connectionProps
                    .getProperty(SESSION_TIMEOUT);
            String encryptionManager = connectionProps
                    .getProperty(DATA_ENCRYPTION_MANAGER);
            if (connectString == null || sessionTimeout == null) {
                throw new IllegalArgumentException(
                        "Both connect string and session timeout are required.");
            }
            if (encryptionManager == null) {
                this.encryptionManager = new BasicDataEncryptionManager();
            } else {
                Class<?> clazz = Class.forName(encryptionManager);

                if (Arrays.asList(clazz.getInterfaces()).contains(
                        DataEncryptionManager.class)) {
                    this.encryptionManager = (DataEncryptionManager) Class
                            .forName(encryptionManager).newInstance();
                } else {
                    throw new IllegalArgumentException(
                            "Data encryption manager must implement DataEncryptionManager interface");
                }
            }
            this.connectString = connectString;
            this.sessionTimeout = Integer.valueOf(sessionTimeout);
            this.zooKeeper = new ZooKeeperRetry(connectString, Integer
                    .valueOf(sessionTimeout), new Watcher() {

                public void process(WatchedEvent event) {
                    if (event.getState() == KeeperState.Expired) {
                        connected = false;
                    }
                }
            });
            ((ZooKeeperRetry) this.zooKeeper).setRetryLimit(10);
            connected = ((ZooKeeperRetry) this.zooKeeper).testConnection();
            return connected;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    connected = false;
    return connected;
}
项目:bigstreams    文件:ZooInspectorManagerImpl.java   
public boolean connect(Properties connectionProps) {
    try {
        if (this.zooKeeper == null) {
            String connectString = connectionProps
                    .getProperty(CONNECT_STRING);
            String sessionTimeout = connectionProps
                    .getProperty(SESSION_TIMEOUT);
            String encryptionManager = connectionProps
                    .getProperty(DATA_ENCRYPTION_MANAGER);
            if (connectString == null || sessionTimeout == null) {
                throw new IllegalArgumentException(
                        "Both connect string and session timeout are required.");
            }
            if (encryptionManager == null) {
                this.encryptionManager = new BasicDataEncryptionManager();
            } else {
                Class<?> clazz = Class.forName(encryptionManager);

                if (Arrays.asList(clazz.getInterfaces()).contains(
                        DataEncryptionManager.class)) {
                    this.encryptionManager = (DataEncryptionManager) Class
                            .forName(encryptionManager).newInstance();
                } else {
                    throw new IllegalArgumentException(
                            "Data encryption manager must implement DataEncryptionManager interface");
                }
            }
            this.connectString = connectString;
            this.sessionTimeout = Integer.valueOf(sessionTimeout);
            this.zooKeeper = new ZooKeeperRetry(connectString, Integer
                    .valueOf(sessionTimeout), new Watcher() {

                public void process(WatchedEvent event) {
                    if (event.getState() == KeeperState.Expired) {
                        connected = false;
                    }
                }
            });
            ((ZooKeeperRetry) this.zooKeeper).setRetryLimit(10);
            connected = ((ZooKeeperRetry) this.zooKeeper).testConnection();
            return connected;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    connected = false;
    return connected;
}
项目:SecureKeeper    文件:ZooInspectorManagerImpl.java   
public boolean connect(Properties connectionProps) {
    try {
        if (this.zooKeeper == null) {
            String connectString = connectionProps
                    .getProperty(CONNECT_STRING);
            String sessionTimeout = connectionProps
                    .getProperty(SESSION_TIMEOUT);
            String encryptionManager = connectionProps
                    .getProperty(DATA_ENCRYPTION_MANAGER);
            String authScheme = connectionProps
                    .getProperty(AUTH_SCHEME_KEY);
            String authData = connectionProps
                    .getProperty(AUTH_DATA_KEY);

            if (connectString == null || sessionTimeout == null) {
                throw new IllegalArgumentException(
                        "Both connect string and session timeout are required.");
            }
            if (encryptionManager == null) {
                this.encryptionManager = new BasicDataEncryptionManager();
            } else {
                Class<?> clazz = Class.forName(encryptionManager);

                if (Arrays.asList(clazz.getInterfaces()).contains(
                        DataEncryptionManager.class)) {
                    this.encryptionManager = (DataEncryptionManager) Class
                            .forName(encryptionManager).newInstance();
                } else {
                    throw new IllegalArgumentException(
                            "Data encryption manager must implement DataEncryptionManager interface");
                }
            }
            this.connectString = connectString;
            this.sessionTimeout = Integer.valueOf(sessionTimeout);
            this.zooKeeper = new ZooKeeperRetry(connectString, Integer
                    .valueOf(sessionTimeout), new Watcher() {

                public void process(WatchedEvent event) {
                    if (event.getState() == KeeperState.Expired) {
                        connected = false;
                    }
                }
            });
            if (authData != null && authData.length() > 0){
                this.zooKeeper.addAuthInfo(authScheme, authData.getBytes());
            }
            ((ZooKeeperRetry) this.zooKeeper).setRetryLimit(10);
            connected = ((ZooKeeperRetry) this.zooKeeper).testConnection();
        }
    } catch (Exception e) {
        connected = false;
        e.printStackTrace();
    }
    if (!connected){
        disconnect();
    }
    return connected;
}
项目:SecureKeeper    文件:ZooInspectorManagerImpl.java   
public boolean connect(Properties connectionProps) {
    try {
        if (this.zooKeeper == null) {
            String connectString = connectionProps
                    .getProperty(CONNECT_STRING);
            String sessionTimeout = connectionProps
                    .getProperty(SESSION_TIMEOUT);
            String encryptionManager = connectionProps
                    .getProperty(DATA_ENCRYPTION_MANAGER);
            String authScheme = connectionProps
                    .getProperty(AUTH_SCHEME_KEY);
            String authData = connectionProps
                    .getProperty(AUTH_DATA_KEY);

            if (connectString == null || sessionTimeout == null) {
                throw new IllegalArgumentException(
                        "Both connect string and session timeout are required.");
            }
            if (encryptionManager == null) {
                this.encryptionManager = new BasicDataEncryptionManager();
            } else {
                Class<?> clazz = Class.forName(encryptionManager);

                if (Arrays.asList(clazz.getInterfaces()).contains(
                        DataEncryptionManager.class)) {
                    this.encryptionManager = (DataEncryptionManager) Class
                            .forName(encryptionManager).newInstance();
                } else {
                    throw new IllegalArgumentException(
                            "Data encryption manager must implement DataEncryptionManager interface");
                }
            }
            this.connectString = connectString;
            this.sessionTimeout = Integer.valueOf(sessionTimeout);
            this.zooKeeper = new ZooKeeperRetry(connectString, Integer
                    .valueOf(sessionTimeout), new Watcher() {

                public void process(WatchedEvent event) {
                    if (event.getState() == KeeperState.Expired) {
                        connected = false;
                    }
                }
            });
            if (authData != null && authData.length() > 0){
                this.zooKeeper.addAuthInfo(authScheme, authData.getBytes());
            }
            ((ZooKeeperRetry) this.zooKeeper).setRetryLimit(10);
            connected = ((ZooKeeperRetry) this.zooKeeper).testConnection();
        }
    } catch (Exception e) {
        connected = false;
        e.printStackTrace();
    }
    if (!connected){
        disconnect();
    }
    return connected;
}
项目:StreamBench    文件:ZooInspectorManagerImpl.java   
public boolean connect(Properties connectionProps) {
    try {
        if (this.zooKeeper == null) {
            String connectString = connectionProps
                    .getProperty(CONNECT_STRING);
            String sessionTimeout = connectionProps
                    .getProperty(SESSION_TIMEOUT);
            String encryptionManager = connectionProps
                    .getProperty(DATA_ENCRYPTION_MANAGER);
            String authScheme = connectionProps
                    .getProperty(AUTH_SCHEME_KEY);
            String authData = connectionProps
                    .getProperty(AUTH_DATA_KEY);

            if (connectString == null || sessionTimeout == null) {
                throw new IllegalArgumentException(
                        "Both connect string and session timeout are required.");
            }
            if (encryptionManager == null) {
                this.encryptionManager = new BasicDataEncryptionManager();
            } else {
                Class<?> clazz = Class.forName(encryptionManager);

                if (Arrays.asList(clazz.getInterfaces()).contains(
                        DataEncryptionManager.class)) {
                    this.encryptionManager = (DataEncryptionManager) Class
                            .forName(encryptionManager).newInstance();
                } else {
                    throw new IllegalArgumentException(
                            "Data encryption manager must implement DataEncryptionManager interface");
                }
            }
            this.connectString = connectString;
            this.sessionTimeout = Integer.valueOf(sessionTimeout);
            this.zooKeeper = new ZooKeeperRetry(connectString, Integer
                    .valueOf(sessionTimeout), new Watcher() {

                public void process(WatchedEvent event) {
                    if (event.getState() == KeeperState.Expired) {
                        connected = false;
                    }
                }
            });
            if (authData != null && authData.length() > 0){
                this.zooKeeper.addAuthInfo(authScheme, authData.getBytes());
            }
            ((ZooKeeperRetry) this.zooKeeper).setRetryLimit(10);
            connected = ((ZooKeeperRetry) this.zooKeeper).testConnection();
        }
    } catch (Exception e) {
        connected = false;
        e.printStackTrace();
    }
    if (!connected){
        disconnect();
    }
    return connected;
}
项目:StreamBench    文件:ZooInspectorManagerImpl.java   
public boolean connect(Properties connectionProps) {
    try {
        if (this.zooKeeper == null) {
            String connectString = connectionProps
                    .getProperty(CONNECT_STRING);
            String sessionTimeout = connectionProps
                    .getProperty(SESSION_TIMEOUT);
            String encryptionManager = connectionProps
                    .getProperty(DATA_ENCRYPTION_MANAGER);
            String authScheme = connectionProps
                    .getProperty(AUTH_SCHEME_KEY);
            String authData = connectionProps
                    .getProperty(AUTH_DATA_KEY);

            if (connectString == null || sessionTimeout == null) {
                throw new IllegalArgumentException(
                        "Both connect string and session timeout are required.");
            }
            if (encryptionManager == null) {
                this.encryptionManager = new BasicDataEncryptionManager();
            } else {
                Class<?> clazz = Class.forName(encryptionManager);

                if (Arrays.asList(clazz.getInterfaces()).contains(
                        DataEncryptionManager.class)) {
                    this.encryptionManager = (DataEncryptionManager) Class
                            .forName(encryptionManager).newInstance();
                } else {
                    throw new IllegalArgumentException(
                            "Data encryption manager must implement DataEncryptionManager interface");
                }
            }
            this.connectString = connectString;
            this.sessionTimeout = Integer.valueOf(sessionTimeout);
            this.zooKeeper = new ZooKeeperRetry(connectString, Integer
                    .valueOf(sessionTimeout), new Watcher() {

                public void process(WatchedEvent event) {
                    if (event.getState() == KeeperState.Expired) {
                        connected = false;
                    }
                }
            });
            if (authData != null && authData.length() > 0){
                this.zooKeeper.addAuthInfo(authScheme, authData.getBytes());
            }
            ((ZooKeeperRetry) this.zooKeeper).setRetryLimit(10);
            connected = ((ZooKeeperRetry) this.zooKeeper).testConnection();
        }
    } catch (Exception e) {
        connected = false;
        e.printStackTrace();
    }
    if (!connected){
        disconnect();
    }
    return connected;
}
项目:LoadBalanced_zk    文件:ZooInspectorManagerImpl.java   
public boolean connect(Properties connectionProps) {
    try {
        if (this.zooKeeper == null) {
            String connectString = connectionProps
                    .getProperty(CONNECT_STRING);
            String sessionTimeout = connectionProps
                    .getProperty(SESSION_TIMEOUT);
            String encryptionManager = connectionProps
                    .getProperty(DATA_ENCRYPTION_MANAGER);
            if (connectString == null || sessionTimeout == null) {
                throw new IllegalArgumentException(
                        "Both connect string and session timeout are required.");
            }
            if (encryptionManager == null) {
                this.encryptionManager = new BasicDataEncryptionManager();
            } else {
                Class<?> clazz = Class.forName(encryptionManager);

                if (Arrays.asList(clazz.getInterfaces()).contains(
                        DataEncryptionManager.class)) {
                    this.encryptionManager = (DataEncryptionManager) Class
                            .forName(encryptionManager).newInstance();
                } else {
                    throw new IllegalArgumentException(
                            "Data encryption manager must implement DataEncryptionManager interface");
                }
            }
            this.connectString = connectString;
            this.sessionTimeout = Integer.valueOf(sessionTimeout);
            this.zooKeeper = new ZooKeeperRetry(connectString, Integer
                    .valueOf(sessionTimeout), new Watcher() {

                public void process(WatchedEvent event) {
                    if (event.getState() == KeeperState.Expired) {
                        connected = false;
                    }
                }
            });
            ((ZooKeeperRetry) this.zooKeeper).setRetryLimit(10);
            connected = ((ZooKeeperRetry) this.zooKeeper).testConnection();
            return connected;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    connected = false;
    return connected;
}
项目:LoadBalanced_zk    文件:ZooInspectorManagerImpl.java   
public boolean connect(Properties connectionProps) {
    try {
        if (this.zooKeeper == null) {
            String connectString = connectionProps
                    .getProperty(CONNECT_STRING);
            String sessionTimeout = connectionProps
                    .getProperty(SESSION_TIMEOUT);
            String encryptionManager = connectionProps
                    .getProperty(DATA_ENCRYPTION_MANAGER);
            if (connectString == null || sessionTimeout == null) {
                throw new IllegalArgumentException(
                        "Both connect string and session timeout are required.");
            }
            if (encryptionManager == null) {
                this.encryptionManager = new BasicDataEncryptionManager();
            } else {
                Class<?> clazz = Class.forName(encryptionManager);

                if (Arrays.asList(clazz.getInterfaces()).contains(
                        DataEncryptionManager.class)) {
                    this.encryptionManager = (DataEncryptionManager) Class
                            .forName(encryptionManager).newInstance();
                } else {
                    throw new IllegalArgumentException(
                            "Data encryption manager must implement DataEncryptionManager interface");
                }
            }
            this.connectString = connectString;
            this.sessionTimeout = Integer.valueOf(sessionTimeout);
            this.zooKeeper = new ZooKeeperRetry(connectString, Integer
                    .valueOf(sessionTimeout), new Watcher() {

                public void process(WatchedEvent event) {
                    if (event.getState() == KeeperState.Expired) {
                        connected = false;
                    }
                }
            });
            ((ZooKeeperRetry) this.zooKeeper).setRetryLimit(10);
            connected = ((ZooKeeperRetry) this.zooKeeper).testConnection();
            return connected;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    connected = false;
    return connected;
}
项目:LoadBalanced_zk    文件:ZooInspectorManagerImpl.java   
public boolean connect(Properties connectionProps) {
    try {
        if (this.zooKeeper == null) {
            String connectString = connectionProps
                    .getProperty(CONNECT_STRING);
            String sessionTimeout = connectionProps
                    .getProperty(SESSION_TIMEOUT);
            String encryptionManager = connectionProps
                    .getProperty(DATA_ENCRYPTION_MANAGER);
            if (connectString == null || sessionTimeout == null) {
                throw new IllegalArgumentException(
                        "Both connect string and session timeout are required.");
            }
            if (encryptionManager == null) {
                this.encryptionManager = new BasicDataEncryptionManager();
            } else {
                Class<?> clazz = Class.forName(encryptionManager);

                if (Arrays.asList(clazz.getInterfaces()).contains(
                        DataEncryptionManager.class)) {
                    this.encryptionManager = (DataEncryptionManager) Class
                            .forName(encryptionManager).newInstance();
                } else {
                    throw new IllegalArgumentException(
                            "Data encryption manager must implement DataEncryptionManager interface");
                }
            }
            this.connectString = connectString;
            this.sessionTimeout = Integer.valueOf(sessionTimeout);
            this.zooKeeper = new ZooKeeperRetry(connectString, Integer
                    .valueOf(sessionTimeout), new Watcher() {

                public void process(WatchedEvent event) {
                    if (event.getState() == KeeperState.Expired) {
                        connected = false;
                    }
                }
            });
            ((ZooKeeperRetry) this.zooKeeper).setRetryLimit(10);
            connected = ((ZooKeeperRetry) this.zooKeeper).testConnection();
            return connected;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    connected = false;
    return connected;
}
项目:LoadBalanced_zk    文件:ZooInspectorManagerImpl.java   
public boolean connect(Properties connectionProps) {
    try {
        if (this.zooKeeper == null) {
            String connectString = connectionProps
                    .getProperty(CONNECT_STRING);
            String sessionTimeout = connectionProps
                    .getProperty(SESSION_TIMEOUT);
            String encryptionManager = connectionProps
                    .getProperty(DATA_ENCRYPTION_MANAGER);
            if (connectString == null || sessionTimeout == null) {
                throw new IllegalArgumentException(
                        "Both connect string and session timeout are required.");
            }
            if (encryptionManager == null) {
                this.encryptionManager = new BasicDataEncryptionManager();
            } else {
                Class<?> clazz = Class.forName(encryptionManager);

                if (Arrays.asList(clazz.getInterfaces()).contains(
                        DataEncryptionManager.class)) {
                    this.encryptionManager = (DataEncryptionManager) Class
                            .forName(encryptionManager).newInstance();
                } else {
                    throw new IllegalArgumentException(
                            "Data encryption manager must implement DataEncryptionManager interface");
                }
            }
            this.connectString = connectString;
            this.sessionTimeout = Integer.valueOf(sessionTimeout);
            this.zooKeeper = new ZooKeeperRetry(connectString, Integer
                    .valueOf(sessionTimeout), new Watcher() {

                public void process(WatchedEvent event) {
                    if (event.getState() == KeeperState.Expired) {
                        connected = false;
                    }
                }
            });
            ((ZooKeeperRetry) this.zooKeeper).setRetryLimit(10);
            connected = ((ZooKeeperRetry) this.zooKeeper).testConnection();
            return connected;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    connected = false;
    return connected;
}
项目:zookeeper.dsc    文件:ZooInspectorManagerImpl.java   
public boolean connect(Properties connectionProps) {
    try {
        if (this.zooKeeper == null) {
            String connectString = connectionProps
                    .getProperty(CONNECT_STRING);
            String sessionTimeout = connectionProps
                    .getProperty(SESSION_TIMEOUT);
            String encryptionManager = connectionProps
                    .getProperty(DATA_ENCRYPTION_MANAGER);
            if (connectString == null || sessionTimeout == null) {
                throw new IllegalArgumentException(
                        "Both connect string and session timeout are required.");
            }
            if (encryptionManager == null) {
                this.encryptionManager = new BasicDataEncryptionManager();
            } else {
                Class<?> clazz = Class.forName(encryptionManager);

                if (Arrays.asList(clazz.getInterfaces()).contains(
                        DataEncryptionManager.class)) {
                    this.encryptionManager = (DataEncryptionManager) Class
                            .forName(encryptionManager).newInstance();
                } else {
                    throw new IllegalArgumentException(
                            "Data encryption manager must implement DataEncryptionManager interface");
                }
            }
            this.connectString = connectString;
            this.sessionTimeout = Integer.valueOf(sessionTimeout);
            this.zooKeeper = new ZooKeeperRetry(connectString, Integer
                    .valueOf(sessionTimeout), new Watcher() {

                public void process(WatchedEvent event) {
                    if (event.getState() == KeeperState.Expired) {
                        connected = false;
                    }
                }
            });
            ((ZooKeeperRetry) this.zooKeeper).setRetryLimit(10);
            connected = ((ZooKeeperRetry) this.zooKeeper).testConnection();
            return connected;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    connected = false;
    return connected;
}
项目:zookeeper-pkg    文件:ZooInspectorManagerImpl.java   
public boolean connect(Properties connectionProps) {
    try {
        if (this.zooKeeper == null) {
            String connectString = connectionProps
                    .getProperty(CONNECT_STRING);
            String sessionTimeout = connectionProps
                    .getProperty(SESSION_TIMEOUT);
            String encryptionManager = connectionProps
                    .getProperty(DATA_ENCRYPTION_MANAGER);
            if (connectString == null || sessionTimeout == null) {
                throw new IllegalArgumentException(
                        "Both connect string and session timeout are required.");
            }
            if (encryptionManager == null) {
                this.encryptionManager = new BasicDataEncryptionManager();
            } else {
                Class<?> clazz = Class.forName(encryptionManager);

                if (Arrays.asList(clazz.getInterfaces()).contains(
                        DataEncryptionManager.class)) {
                    this.encryptionManager = (DataEncryptionManager) Class
                            .forName(encryptionManager).newInstance();
                } else {
                    throw new IllegalArgumentException(
                            "Data encryption manager must implement DataEncryptionManager interface");
                }
            }
            this.connectString = connectString;
            this.sessionTimeout = Integer.valueOf(sessionTimeout);
            this.zooKeeper = new ZooKeeperRetry(connectString, Integer
                    .valueOf(sessionTimeout), new Watcher() {

                public void process(WatchedEvent event) {
                    if (event.getState() == KeeperState.Expired) {
                        connected = false;
                    }
                }
            });
            ((ZooKeeperRetry) this.zooKeeper).setRetryLimit(10);
            connected = ((ZooKeeperRetry) this.zooKeeper).testConnection();
            return connected;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    connected = false;
    return connected;
}
项目:zookeeper-pkg    文件:ZooInspectorManagerImpl.java   
public boolean connect(Properties connectionProps) {
    try {
        if (this.zooKeeper == null) {
            String connectString = connectionProps
                    .getProperty(CONNECT_STRING);
            String sessionTimeout = connectionProps
                    .getProperty(SESSION_TIMEOUT);
            String encryptionManager = connectionProps
                    .getProperty(DATA_ENCRYPTION_MANAGER);
            if (connectString == null || sessionTimeout == null) {
                throw new IllegalArgumentException(
                        "Both connect string and session timeout are required.");
            }
            if (encryptionManager == null) {
                this.encryptionManager = new BasicDataEncryptionManager();
            } else {
                Class<?> clazz = Class.forName(encryptionManager);

                if (Arrays.asList(clazz.getInterfaces()).contains(
                        DataEncryptionManager.class)) {
                    this.encryptionManager = (DataEncryptionManager) Class
                            .forName(encryptionManager).newInstance();
                } else {
                    throw new IllegalArgumentException(
                            "Data encryption manager must implement DataEncryptionManager interface");
                }
            }
            this.connectString = connectString;
            this.sessionTimeout = Integer.valueOf(sessionTimeout);
            this.zooKeeper = new ZooKeeperRetry(connectString, Integer
                    .valueOf(sessionTimeout), new Watcher() {

                public void process(WatchedEvent event) {
                    if (event.getState() == KeeperState.Expired) {
                        connected = false;
                    }
                }
            });
            ((ZooKeeperRetry) this.zooKeeper).setRetryLimit(10);
            connected = ((ZooKeeperRetry) this.zooKeeper).testConnection();
            return connected;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    connected = false;
    return connected;
}