Java Code Examples for org.apache.zookeeper.server.ServerCnxnFactory#closeAll()
The following examples show how to use
org.apache.zookeeper.server.ServerCnxnFactory#closeAll() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestingZooKeeperMain.java From xian with Apache License 2.0 | 6 votes |
@Override public void kill() { try { Field cnxnFactoryField = ZooKeeperServerMain.class.getDeclaredField("cnxnFactory"); cnxnFactoryField.setAccessible(true); ServerCnxnFactory cnxnFactory = (ServerCnxnFactory)cnxnFactoryField.get(this); cnxnFactory.closeAll(); Field ssField = cnxnFactory.getClass().getDeclaredField("ss"); ssField.setAccessible(true); ServerSocketChannel ss = (ServerSocketChannel)ssField.get(cnxnFactory); ss.close(); close(); } catch ( Exception e ) { e.printStackTrace(); // just ignore - this class is only for testing } }
Example 2
Source File: TestingQuorumPeerMain.java From xian with Apache License 2.0 | 6 votes |
@Override public void kill() { try { if ( quorumPeer != null ) { Field cnxnFactoryField = QuorumPeer.class.getDeclaredField("cnxnFactory"); cnxnFactoryField.setAccessible(true); ServerCnxnFactory cnxnFactory = (ServerCnxnFactory)cnxnFactoryField.get(quorumPeer); cnxnFactory.closeAll(); Field ssField = cnxnFactory.getClass().getDeclaredField("ss"); ssField.setAccessible(true); ServerSocketChannel ss = (ServerSocketChannel)ssField.get(cnxnFactory); ss.close(); } close(); } catch ( Exception e ) { e.printStackTrace(); } }
Example 3
Source File: KafkaOperatorTestBase.java From attic-apex-malhar with Apache License 2.0 | 6 votes |
public static void stopZookeeper() { for (ZooKeeperServer zs : zkServer) { if (zs != null) { zs.shutdown(); } } for (ServerCnxnFactory zkf : zkFactory) { if (zkf != null) { zkf.closeAll(); zkf.shutdown(); } } zkServer = new ZooKeeperServer[2]; zkFactory = new ServerCnxnFactory[2]; }
Example 4
Source File: KafkaOperatorTestBase.java From attic-apex-malhar with Apache License 2.0 | 6 votes |
public static void stopZookeeper() { for (ZooKeeperServer zs : zkServer) { if (zs != null) { zs.shutdown(); } } for (ServerCnxnFactory zkf : zkFactory) { if (zkf != null) { zkf.closeAll(); zkf.shutdown(); } } zkServer = new ZooKeeperServer[2]; zkFactory = new ServerCnxnFactory[2]; }