當前位置: 首頁>>代碼示例>>Java>>正文


Java TestingServer.close方法代碼示例

本文整理匯總了Java中org.apache.curator.test.TestingServer.close方法的典型用法代碼示例。如果您正苦於以下問題:Java TestingServer.close方法的具體用法?Java TestingServer.close怎麽用?Java TestingServer.close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.curator.test.TestingServer的用法示例。


在下文中一共展示了TestingServer.close方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: main

import org.apache.curator.test.TestingServer; //導入方法依賴的package包/類
/**
 * 測試入口
 */
public static void main(String[] args) throws Exception {
	String path = "/zookeeper";

	TestingServer server = new TestingServer(2181, new File(
			"/download/zk/data"));

	CuratorFramework client = CuratorFrameworkFactory.builder()
			.connectString(server.getConnectString())
			.sessionTimeoutMs(50000).connectionTimeoutMs(100000)
			.retryPolicy(new ExponentialBackoffRetry(1000, 5)).build();
	client.start();

	System.out.println(client.getChildren().forPath(path));

	server.close();
}
 
開發者ID:bdceo,項目名稱:bd-codes,代碼行數:20,代碼來源:CuratorTestingServer.java

示例2: closeServer

import org.apache.curator.test.TestingServer; //導入方法依賴的package包/類
/**
 * 關閉內嵌的Zookeeper服務.
 * 
 * @param port 端口號
 */
public void closeServer(final int port) {
    TestingServer nestedServer = nestedServers.get(port);
    if (null == nestedServer) {
        return;
    }
    try {
        nestedServer.close();
        nestedServers.remove(port);
    } catch (final IOException ex) {
        RegExceptionHandler.handleException(ex);
    }
}
 
開發者ID:artoderk,項目名稱:elastic-jobx,代碼行數:18,代碼來源:NestedZookeeperServers.java

示例3: closeServer

import org.apache.curator.test.TestingServer; //導入方法依賴的package包/類
/**
 * 關閉內嵌的Zookeeper服務.
 * 
 * @param port 端口號
 */
public void closeServer(final int port) {
    TestingServer nestedServer = nestedServers.get(port);
    if (null == nestedServer) {
        return;
    }
    try {
        nestedServer.close();
        nestedServers.remove(port);
    }
    catch (final IOException ex) {
        RegisterExceptionHandler.handleException(ex);
    }
}
 
開發者ID:ErinDavid,項目名稱:elastic-config,代碼行數:19,代碼來源:NestedZookeeperServers.java

示例4: testOwnershipOfExistingBucket

import org.apache.curator.test.TestingServer; //導入方法依賴的package包/類
@Test(timeout = 10000)
public void testOwnershipOfExistingBucket() throws Exception {
    TestingServer zkServer2 = new TestingServerStarter().start();
    zkServer2.start();
    CuratorFramework zkClient2 = CuratorFrameworkFactory.newClient(zkServer2.getConnectString(), 10000, 1000,
            (r, e, s) -> false);
    zkClient2.start();

    ScheduledExecutorService executor2 = Executors.newScheduledThreadPool(10);
    String hostId = UUID.randomUUID().toString();

    StreamMetadataStore streamMetadataStore2 = StreamStoreFactory.createZKStore(zkClient2, 1, executor2);

    TaskMetadataStore taskMetadataStore = TaskStoreFactory.createInMemoryStore(executor2);
    HostControllerStore hostStore = HostStoreFactory.createInMemoryStore(HostMonitorConfigImpl.dummyConfig());

    SegmentHelper segmentHelper = SegmentHelperMock.getSegmentHelperMock();
    ConnectionFactoryImpl connectionFactory = new ConnectionFactoryImpl(false);

    StreamMetadataTasks streamMetadataTasks2 = new StreamMetadataTasks(streamMetadataStore2, hostStore, taskMetadataStore, segmentHelper, executor2, hostId, connectionFactory);

    String scope = "scope1";
    String streamName = "stream1";
    streamMetadataStore2.addUpdateStreamForAutoStreamCut(scope, streamName, RetentionPolicy.builder().build(), null, executor2).join();

    String scope2 = "scope2";
    String streamName2 = "stream2";
    streamMetadataStore2.addUpdateStreamForAutoStreamCut(scope2, streamName2, RetentionPolicy.builder().build(), null, executor2).join();

    StreamCutService service2 = new StreamCutService(1, hostId, streamMetadataStore2, streamMetadataTasks2, executor2);
    service2.startAsync();
    service2.awaitRunning();

    assertTrue(service2.getBuckets().stream().allMatch(x -> x.getRetentionFutureMap().size() == 2));

    service2.stopAsync();
    service2.awaitTerminated();
    zkClient2.close();
    zkServer2.close();
    streamMetadataTasks2.close();
    connectionFactory.close();
    executor2.shutdown();
}
 
開發者ID:pravega,項目名稱:pravega,代碼行數:44,代碼來源:ZkStoreRetentionTest.java


注:本文中的org.apache.curator.test.TestingServer.close方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。