static ServerCnxnFactory createNewServerInstance(File dataDir,
ServerCnxnFactory factory, String hostPort, int maxCnxns)
throws IOException, InterruptedException
{
ZooKeeperServer zks = new ZooKeeperServer(dataDir, dataDir, 3000);
final int PORT = getPort(hostPort);
if (factory == null) {
factory = ServerCnxnFactory.createFactory(PORT, maxCnxns);
}
factory.startup(zks);
Assert.assertTrue("waiting for server up",
ClientBaseWithFixes.waitForServerUp("127.0.0.1:" + PORT,
CONNECTION_TIMEOUT));
return factory;
}
java类org.apache.zookeeper.server.ServerCnxnFactory的实例源码
ClientBaseWithFixes.java 文件源码
项目:hadoop-oss
阅读 36
收藏 0
点赞 0
评论 0
ClientBaseWithFixes.java 文件源码
项目:hadoop-oss
阅读 32
收藏 0
点赞 0
评论 0
static void shutdownServerInstance(ServerCnxnFactory factory,
String hostPort)
{
if (factory != null) {
ZKDatabase zkDb;
{
ZooKeeperServer zs = getServer(factory);
zkDb = zs.getZKDatabase();
}
factory.shutdown();
try {
zkDb.close();
} catch (IOException ie) {
LOG.warn("Error closing logs ", ie);
}
final int PORT = getPort(hostPort);
Assert.assertTrue("waiting for server down",
ClientBaseWithFixes.waitForServerDown("127.0.0.1:" + PORT,
CONNECTION_TIMEOUT));
}
}
QuorumPeer.java 文件源码
项目:fuck_zookeeper
阅读 34
收藏 0
点赞 0
评论 0
public QuorumPeer(Map<Long, QuorumServer> quorumPeers, File dataDir,
File dataLogDir, int electionType,
long myid, int tickTime, int initLimit, int syncLimit,
boolean quorumListenOnAllIPs,
ServerCnxnFactory cnxnFactory,
QuorumVerifier quorumConfig) throws IOException {
this();
this.cnxnFactory = cnxnFactory;
this.quorumPeers = quorumPeers;
this.electionType = electionType;
this.myid = myid;
this.tickTime = tickTime;
this.initLimit = initLimit;
this.syncLimit = syncLimit;
this.quorumListenOnAllIPs = quorumListenOnAllIPs;
this.logFactory = new FileTxnSnapLog(dataLogDir, dataDir);
this.zkDb = new ZKDatabase(this.logFactory);
if(quorumConfig == null)
this.quorumConfig = new QuorumMaj(countParticipants(quorumPeers));
else this.quorumConfig = quorumConfig;
}
SessionTest.java 文件源码
项目:fuck_zookeeper
阅读 29
收藏 0
点赞 0
评论 0
@Before
public void setUp() throws Exception {
if (tmpDir == null) {
tmpDir = ClientBase.createTmpDir();
}
ClientBase.setupTestEnv();
zs = new ZooKeeperServer(tmpDir, tmpDir, TICK_TIME);
final int PORT = Integer.parseInt(HOSTPORT.split(":")[1]);
serverFactory = ServerCnxnFactory.createFactory(PORT, -1);
serverFactory.startup(zs);
Assert.assertTrue("waiting for server up",
ClientBase.waitForServerUp(HOSTPORT,
CONNECTION_TIMEOUT));
}
ClientBase.java 文件源码
项目:fuck_zookeeper
阅读 33
收藏 0
点赞 0
评论 0
/**
* Starting the given server instance
*/
public static void startServerInstance(File dataDir,
ServerCnxnFactory factory, String hostPort) throws IOException,
InterruptedException {
final int port = getPort(hostPort);
LOG.info("STARTING server instance 127.0.0.1:{}", port);
ZooKeeperServer zks = new ZooKeeperServer(dataDir, dataDir, 3000);
factory.startup(zks);
Assert.assertTrue("waiting for server up", ClientBase.waitForServerUp(
"127.0.0.1:" + port, CONNECTION_TIMEOUT));
}
ClientBase.java 文件源码
项目:fuck_zookeeper
阅读 34
收藏 0
点赞 0
评论 0
static void shutdownServerInstance(ServerCnxnFactory factory,
String hostPort)
{
if (factory != null) {
ZKDatabase zkDb = null;
{
ZooKeeperServer zs = getServer(factory);
if (zs != null) {
zkDb = zs.getZKDatabase();
}
}
factory.shutdown();
try {
if (zkDb != null) {
zkDb.close();
}
} catch (IOException ie) {
LOG.warn("Error closing logs ", ie);
}
final int PORT = getPort(hostPort);
Assert.assertTrue("waiting for server down",
ClientBase.waitForServerDown("127.0.0.1:" + PORT,
CONNECTION_TIMEOUT));
}
}
SessionTest.java 文件源码
项目:https-github.com-apache-zookeeper
阅读 35
收藏 0
点赞 0
评论 0
@Before
public void setUp() throws Exception {
if (tmpDir == null) {
tmpDir = ClientBase.createTmpDir();
}
ClientBase.setupTestEnv();
zs = new ZooKeeperServer(tmpDir, tmpDir, TICK_TIME);
final int PORT = Integer.parseInt(HOSTPORT.split(":")[1]);
serverFactory = ServerCnxnFactory.createFactory(PORT, -1);
serverFactory.startup(zs);
Assert.assertTrue("waiting for server up",
ClientBase.waitForServerUp(HOSTPORT,
CONNECTION_TIMEOUT));
}
SSLAuthTest.java 文件源码
项目:https-github.com-apache-zookeeper
阅读 36
收藏 0
点赞 0
评论 0
@Before
public void setUp() throws Exception {
String testDataPath = System.getProperty("test.data.dir", "build/test/data");
System.setProperty(ServerCnxnFactory.ZOOKEEPER_SERVER_CNXN_FACTORY, "org.apache.zookeeper.server.NettyServerCnxnFactory");
System.setProperty(ZKClientConfig.ZOOKEEPER_CLIENT_CNXN_SOCKET, "org.apache.zookeeper.ClientCnxnSocketNetty");
System.setProperty(ZKClientConfig.SECURE_CLIENT, "true");
System.setProperty(ZKConfig.SSL_AUTHPROVIDER, "x509");
System.setProperty(ZKConfig.SSL_KEYSTORE_LOCATION, testDataPath + "/ssl/testKeyStore.jks");
System.setProperty(ZKConfig.SSL_KEYSTORE_PASSWD, "testpass");
System.setProperty(ZKConfig.SSL_TRUSTSTORE_LOCATION, testDataPath + "/ssl/testTrustStore.jks");
System.setProperty(ZKConfig.SSL_TRUSTSTORE_PASSWD, "testpass");
System.setProperty("javax.net.debug", "ssl");
System.setProperty("zookeeper.authProvider.x509", "org.apache.zookeeper.server.auth.X509AuthenticationProvider");
String host = "localhost";
int port = PortAssignment.unique();
hostPort = host + ":" + port;
serverFactory = ServerCnxnFactory.createFactory();
serverFactory.configure(new InetSocketAddress(host, port), maxCnxns, true);
super.setUp();
}
ClientBaseWithFixes.java 文件源码
项目:hadoop
阅读 37
收藏 0
点赞 0
评论 0
static ServerCnxnFactory createNewServerInstance(File dataDir,
ServerCnxnFactory factory, String hostPort, int maxCnxns)
throws IOException, InterruptedException
{
ZooKeeperServer zks = new ZooKeeperServer(dataDir, dataDir, 3000);
final int PORT = getPort(hostPort);
if (factory == null) {
factory = ServerCnxnFactory.createFactory(PORT, maxCnxns);
}
factory.startup(zks);
Assert.assertTrue("waiting for server up",
ClientBaseWithFixes.waitForServerUp("127.0.0.1:" + PORT,
CONNECTION_TIMEOUT));
return factory;
}
ClientBaseWithFixes.java 文件源码
项目:hadoop
阅读 38
收藏 0
点赞 0
评论 0
static void shutdownServerInstance(ServerCnxnFactory factory,
String hostPort)
{
if (factory != null) {
ZKDatabase zkDb;
{
ZooKeeperServer zs = getServer(factory);
zkDb = zs.getZKDatabase();
}
factory.shutdown();
try {
zkDb.close();
} catch (IOException ie) {
LOG.warn("Error closing logs ", ie);
}
final int PORT = getPort(hostPort);
Assert.assertTrue("waiting for server down",
ClientBaseWithFixes.waitForServerDown("127.0.0.1:" + PORT,
CONNECTION_TIMEOUT));
}
}
QuorumPeer.java 文件源码
项目:ZooKeeper
阅读 37
收藏 0
点赞 0
评论 0
public QuorumPeer(Map<Long, QuorumServer> quorumPeers, File dataDir,
File dataLogDir, int electionType,
long myid, int tickTime, int initLimit, int syncLimit,
boolean quorumListenOnAllIPs,
ServerCnxnFactory cnxnFactory,
QuorumVerifier quorumConfig) throws IOException {
this();
this.cnxnFactory = cnxnFactory;
this.quorumPeers = quorumPeers;
this.electionType = electionType;
this.myid = myid;
this.tickTime = tickTime;
this.initLimit = initLimit;
this.syncLimit = syncLimit;
this.quorumListenOnAllIPs = quorumListenOnAllIPs;
this.logFactory = new FileTxnSnapLog(dataLogDir, dataDir);
this.zkDb = new ZKDatabase(this.logFactory);
if(quorumConfig == null)
this.quorumConfig = new QuorumMaj(countParticipants(quorumPeers));
else this.quorumConfig = quorumConfig;
}
SessionTest.java 文件源码
项目:ZooKeeper
阅读 27
收藏 0
点赞 0
评论 0
@Before
public void setUp() throws Exception {
if (tmpDir == null) {
tmpDir = ClientBase.createTmpDir();
}
ClientBase.setupTestEnv();
zs = new ZooKeeperServer(tmpDir, tmpDir, TICK_TIME);
final int PORT = Integer.parseInt(HOSTPORT.split(":")[1]);
serverFactory = ServerCnxnFactory.createFactory(PORT, -1);
serverFactory.startup(zs);
Assert.assertTrue("waiting for server up",
ClientBase.waitForServerUp(HOSTPORT,
CONNECTION_TIMEOUT));
}
ClientBase.java 文件源码
项目:ZooKeeper
阅读 46
收藏 0
点赞 0
评论 0
static void shutdownServerInstance(ServerCnxnFactory factory,
String hostPort)
{
if (factory != null) {
ZKDatabase zkDb = null;
{
ZooKeeperServer zs = getServer(factory);
if (zs != null) {
zkDb = zs.getZKDatabase();
}
}
factory.shutdown();
try {
if (zkDb != null) {
zkDb.close();
}
} catch (IOException ie) {
LOG.warn("Error closing logs ", ie);
}
final int PORT = getPort(hostPort);
Assert.assertTrue("waiting for server down",
ClientBase.waitForServerDown("127.0.0.1:" + PORT,
CONNECTION_TIMEOUT));
}
}
ClientBaseWithFixes.java 文件源码
项目:aliyun-oss-hadoop-fs
阅读 29
收藏 0
点赞 0
评论 0
static ServerCnxnFactory createNewServerInstance(File dataDir,
ServerCnxnFactory factory, String hostPort, int maxCnxns)
throws IOException, InterruptedException
{
ZooKeeperServer zks = new ZooKeeperServer(dataDir, dataDir, 3000);
final int PORT = getPort(hostPort);
if (factory == null) {
factory = ServerCnxnFactory.createFactory(PORT, maxCnxns);
}
factory.startup(zks);
Assert.assertTrue("waiting for server up",
ClientBaseWithFixes.waitForServerUp("127.0.0.1:" + PORT,
CONNECTION_TIMEOUT));
return factory;
}
ClientBaseWithFixes.java 文件源码
项目:aliyun-oss-hadoop-fs
阅读 34
收藏 0
点赞 0
评论 0
static void shutdownServerInstance(ServerCnxnFactory factory,
String hostPort)
{
if (factory != null) {
ZKDatabase zkDb;
{
ZooKeeperServer zs = getServer(factory);
zkDb = zs.getZKDatabase();
}
factory.shutdown();
try {
zkDb.close();
} catch (IOException ie) {
LOG.warn("Error closing logs ", ie);
}
final int PORT = getPort(hostPort);
Assert.assertTrue("waiting for server down",
ClientBaseWithFixes.waitForServerDown("127.0.0.1:" + PORT,
CONNECTION_TIMEOUT));
}
}
SessionTest.java 文件源码
项目:StreamProcessingInfrastructure
阅读 25
收藏 0
点赞 0
评论 0
@Before
public void setUp() throws Exception {
if (tmpDir == null) {
tmpDir = ClientBase.createTmpDir();
}
ClientBase.setupTestEnv();
zs = new ZooKeeperServer(tmpDir, tmpDir, TICK_TIME);
final int PORT = Integer.parseInt(HOSTPORT.split(":")[1]);
serverFactory = ServerCnxnFactory.createFactory(PORT, -1);
serverFactory.startup(zs);
Assert.assertTrue("waiting for server up",
ClientBase.waitForServerUp(HOSTPORT,
CONNECTION_TIMEOUT));
}
SessionTest.java 文件源码
项目:SecureKeeper
阅读 31
收藏 0
点赞 0
评论 0
@Before
public void setUp() throws Exception {
if (tmpDir == null) {
tmpDir = ClientBase.createTmpDir();
}
ClientBase.setupTestEnv();
zs = new ZooKeeperServer(tmpDir, tmpDir, TICK_TIME);
final int PORT = Integer.parseInt(HOSTPORT.split(":")[1]);
serverFactory = ServerCnxnFactory.createFactory(PORT, -1);
serverFactory.startup(zs);
Assert.assertTrue("waiting for server up",
ClientBase.waitForServerUp(HOSTPORT,
CONNECTION_TIMEOUT));
}
ClientBase.java 文件源码
项目:StreamProcessingInfrastructure
阅读 34
收藏 0
点赞 0
评论 0
static void shutdownServerInstance(ServerCnxnFactory factory,
String hostPort)
{
if (factory != null) {
ZKDatabase zkDb = null;
{
ZooKeeperServer zs = getServer(factory);
if (zs != null) {
zkDb = zs.getZKDatabase();
}
}
factory.shutdown();
try {
if (zkDb != null) {
zkDb.close();
}
} catch (IOException ie) {
LOG.warn("Error closing logs ", ie);
}
final int PORT = getPort(hostPort);
Assert.assertTrue("waiting for server down",
ClientBase.waitForServerDown("127.0.0.1:" + PORT,
CONNECTION_TIMEOUT));
}
}
ZKInstanceImpl.java 文件源码
项目:zookeeper-junit
阅读 33
收藏 0
点赞 0
评论 0
@Override
public Future<Unit> start() {
return Future(() -> {
ZooKeeperServer zkServer = new ZooKeeperServer();
FileTxnSnapLog log = new FileTxnSnapLog(new File(rootZooDir, "dataDir"), new File(rootZooDir, "snapDir"));
zkServer.setTxnLogFactory(log);
zkServer.setTickTime(2000);
zkServer.setMinSessionTimeout(10000);
zkServer.setMaxSessionTimeout(10000);
ServerCnxnFactory cnxnFactory = ServerCnxnFactory.createFactory();
cnxnFactory.configure(new InetSocketAddress(cfgPort), maxClientConnections);
cnxnFactory.startup(zkServer);
zkInstanceHolder = Some(new ZKInstanceHolder(log, cnxnFactory));
//remember the port. if 0 was provided then ZK will pick a free port
//it must be remembered for the scenario of restarting this instance
//in such case we want to get the same port again
cfgPort = cnxnFactory.getLocalPort();
});
}
SessionTest.java 文件源码
项目:bigstreams
阅读 35
收藏 0
点赞 0
评论 0
@Before
public void setUp() throws Exception {
if (tmpDir == null) {
tmpDir = ClientBase.createTmpDir();
}
ClientBase.setupTestEnv();
ZooKeeperServer zs = new ZooKeeperServer(tmpDir, tmpDir, TICK_TIME);
final int PORT = Integer.parseInt(HOSTPORT.split(":")[1]);
serverFactory = ServerCnxnFactory.createFactory(PORT, -1);
serverFactory.startup(zs);
Assert.assertTrue("waiting for server up",
ClientBase.waitForServerUp(HOSTPORT,
CONNECTION_TIMEOUT));
}
SessionTest.java 文件源码
项目:bigstreams
阅读 35
收藏 0
点赞 0
评论 0
@Before
public void setUp() throws Exception {
if (tmpDir == null) {
tmpDir = ClientBase.createTmpDir();
}
ClientBase.setupTestEnv();
ZooKeeperServer zs = new ZooKeeperServer(tmpDir, tmpDir, TICK_TIME);
final int PORT = Integer.parseInt(HOSTPORT.split(":")[1]);
serverFactory = ServerCnxnFactory.createFactory(PORT, -1);
serverFactory.startup(zs);
Assert.assertTrue("waiting for server up",
ClientBase.waitForServerUp(HOSTPORT,
CONNECTION_TIMEOUT));
}
ClientBase.java 文件源码
项目:bigstreams
阅读 34
收藏 0
点赞 0
评论 0
static ServerCnxnFactory createNewServerInstance(File dataDir,
ServerCnxnFactory factory, String hostPort, int maxCnxns)
throws IOException, InterruptedException
{
ZooKeeperServer zks = new ZooKeeperServer(dataDir, dataDir, 3000);
final int PORT = getPort(hostPort);
if (factory == null) {
factory = ServerCnxnFactory.createFactory(PORT, maxCnxns);
}
factory.startup(zks);
Assert.assertTrue("waiting for server up",
ClientBase.waitForServerUp("127.0.0.1:" + PORT,
CONNECTION_TIMEOUT));
return factory;
}
SSLAuthTest.java 文件源码
项目:SecureKeeper
阅读 34
收藏 0
点赞 0
评论 0
@Before
public void setUp() throws Exception {
String testDataPath = System.getProperty("test.data.dir", "build/test/data");
System.setProperty(ServerCnxnFactory.ZOOKEEPER_SERVER_CNXN_FACTORY, "org.apache.zookeeper.server.NettyServerCnxnFactory");
System.setProperty(ZooKeeper.ZOOKEEPER_CLIENT_CNXN_SOCKET, "org.apache.zookeeper.ClientCnxnSocketNetty");
System.setProperty(ZooKeeper.SECURE_CLIENT, "true");
System.setProperty(X509Util.SSL_AUTHPROVIDER, "x509");
System.setProperty(X509Util.SSL_KEYSTORE_LOCATION, testDataPath + "/ssl/testKeyStore.jks");
System.setProperty(X509Util.SSL_KEYSTORE_PASSWD, "testpass");
System.setProperty(X509Util.SSL_TRUSTSTORE_LOCATION, testDataPath + "/ssl/testTrustStore.jks");
System.setProperty(X509Util.SSL_TRUSTSTORE_PASSWD, "testpass");
System.setProperty("javax.net.debug", "ssl");
String host = "localhost";
int port = PortAssignment.unique();
hostPort = host + ":" + port;
serverFactory = ServerCnxnFactory.createFactory();
serverFactory.configure(new InetSocketAddress(host, port), maxCnxns, true);
super.setUp();
}
ClientBaseWithFixes.java 文件源码
项目:big-c
阅读 37
收藏 0
点赞 0
评论 0
static ServerCnxnFactory createNewServerInstance(File dataDir,
ServerCnxnFactory factory, String hostPort, int maxCnxns)
throws IOException, InterruptedException
{
ZooKeeperServer zks = new ZooKeeperServer(dataDir, dataDir, 3000);
final int PORT = getPort(hostPort);
if (factory == null) {
factory = ServerCnxnFactory.createFactory(PORT, maxCnxns);
}
factory.startup(zks);
Assert.assertTrue("waiting for server up",
ClientBaseWithFixes.waitForServerUp("127.0.0.1:" + PORT,
CONNECTION_TIMEOUT));
return factory;
}
ClientBaseWithFixes.java 文件源码
项目:big-c
阅读 38
收藏 0
点赞 0
评论 0
static void shutdownServerInstance(ServerCnxnFactory factory,
String hostPort)
{
if (factory != null) {
ZKDatabase zkDb;
{
ZooKeeperServer zs = getServer(factory);
zkDb = zs.getZKDatabase();
}
factory.shutdown();
try {
zkDb.close();
} catch (IOException ie) {
LOG.warn("Error closing logs ", ie);
}
final int PORT = getPort(hostPort);
Assert.assertTrue("waiting for server down",
ClientBaseWithFixes.waitForServerDown("127.0.0.1:" + PORT,
CONNECTION_TIMEOUT));
}
}
QuorumPeer.java 文件源码
项目:zookeeper
阅读 38
收藏 0
点赞 0
评论 0
public QuorumPeer(Map<Long, QuorumServer> quorumPeers, File dataDir,
File dataLogDir, int electionType,
long myid, int tickTime, int initLimit, int syncLimit,
boolean quorumListenOnAllIPs,
ServerCnxnFactory cnxnFactory,
QuorumVerifier quorumConfig) throws IOException {
this();
this.cnxnFactory = cnxnFactory;
this.quorumPeers = quorumPeers;
this.electionType = electionType;
this.myid = myid;
this.tickTime = tickTime;
this.initLimit = initLimit;
this.syncLimit = syncLimit;
this.quorumListenOnAllIPs = quorumListenOnAllIPs;
this.logFactory = new FileTxnSnapLog(dataLogDir, dataDir);
this.zkDb = new ZKDatabase(this.logFactory);
if(quorumConfig == null)
this.quorumConfig = new QuorumMaj(countParticipants(quorumPeers));
else this.quorumConfig = quorumConfig;
}
QuorumPeer.java 文件源码
项目:fuck_zookeeper
阅读 47
收藏 0
点赞 0
评论 0
/**
* For backward compatibility purposes, we instantiate QuorumMaj by default.
*/
public QuorumPeer(Map<Long, QuorumServer> quorumPeers, File dataDir,
File dataLogDir, int electionType,
long myid, int tickTime, int initLimit, int syncLimit,
ServerCnxnFactory cnxnFactory) throws IOException {
this(quorumPeers, dataDir, dataLogDir, electionType, myid, tickTime,
initLimit, syncLimit, false, cnxnFactory,
new QuorumMaj(countParticipants(quorumPeers)));
}
QuorumPeer.java 文件源码
项目:fuck_zookeeper
阅读 34
收藏 0
点赞 0
评论 0
/**
* This constructor is only used by the existing unit test code.
* It defaults to FileLogProvider persistence provider.
*/
public QuorumPeer(Map<Long,QuorumServer> quorumPeers, File snapDir,
File logDir, int clientPort, int electionAlg,
long myid, int tickTime, int initLimit, int syncLimit)
throws IOException
{
this(quorumPeers, snapDir, logDir, electionAlg,
myid,tickTime, initLimit,syncLimit, false,
ServerCnxnFactory.createFactory(new InetSocketAddress(clientPort), -1),
new QuorumMaj(countParticipants(quorumPeers)));
}
QuorumPeer.java 文件源码
项目:fuck_zookeeper
阅读 26
收藏 0
点赞 0
评论 0
/**
* This constructor is only used by the existing unit test code.
* It defaults to FileLogProvider persistence provider.
*/
public QuorumPeer(Map<Long,QuorumServer> quorumPeers, File snapDir,
File logDir, int clientPort, int electionAlg,
long myid, int tickTime, int initLimit, int syncLimit,
QuorumVerifier quorumConfig)
throws IOException
{
this(quorumPeers, snapDir, logDir, electionAlg,
myid,tickTime, initLimit,syncLimit, false,
ServerCnxnFactory.createFactory(new InetSocketAddress(clientPort), -1),
quorumConfig);
}
QuorumPeer.java 文件源码
项目:fuck_zookeeper
阅读 40
收藏 0
点赞 0
评论 0
/** Maximum number of connections allowed from particular host (ip) */
public int getMaxClientCnxnsPerHost() {
ServerCnxnFactory fac = getCnxnFactory();
if (fac == null) {
return -1;
}
return fac.getMaxClientCnxnsPerHost();
}