Java Code Examples for org.apache.distributedlog.api.namespace.Namespace#getNamespaceDriver()

The following examples show how to use org.apache.distributedlog.api.namespace.Namespace#getNamespaceDriver() . 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: DLAuditor.java    From distributedlog with Apache License 2.0 4 votes vote down vote up
private ZooKeeperClient getZooKeeperClient(Namespace namespace) {
    NamespaceDriver driver = namespace.getNamespaceDriver();
    assert(driver instanceof BKNamespaceDriver);
    return ((BKNamespaceDriver) driver).getWriterZKC();
}
 
Example 2
Source File: DLAuditor.java    From distributedlog with Apache License 2.0 4 votes vote down vote up
private BookKeeperClient getBookKeeperClient(Namespace namespace) {
    NamespaceDriver driver = namespace.getNamespaceDriver();
    assert(driver instanceof BKNamespaceDriver);
    return ((BKNamespaceDriver) driver).getReaderBKC();
}
 
Example 3
Source File: TestDistributedLogBase.java    From distributedlog with Apache License 2.0 4 votes vote down vote up
public BKDistributedLogManager createNewDLM(DistributedLogConfiguration conf,
                                            String name,
                                            PermitLimiter writeLimiter)
        throws Exception {
    URI uri = createDLMURI("/" + name);
    ensureURICreated(uri);
    final Namespace namespace = NamespaceBuilder.newBuilder()
            .uri(uri)
            .conf(conf)
            .build();
    final OrderedScheduler scheduler = OrderedScheduler.newBuilder()
            .corePoolSize(1)
            .name("test-scheduler")
            .build();
    AsyncCloseable resourcesCloseable = new AsyncCloseable() {
        @Override
        public CompletableFuture<Void> asyncClose() {
            LOG.info("Shutting down the scheduler");
            SchedulerUtils.shutdownScheduler(scheduler, 1, TimeUnit.SECONDS);
            LOG.info("Shut down the scheduler");
            LOG.info("Closing the namespace");
            namespace.close();
            LOG.info("Closed the namespace");
            return FutureUtils.Void();
        }
    };
    AsyncFailureInjector failureInjector = AsyncRandomFailureInjector.newBuilder()
            .injectDelays(conf.getEIInjectReadAheadDelay(),
                    conf.getEIInjectReadAheadDelayPercent(),
                    conf.getEIInjectMaxReadAheadDelayMs())
            .injectErrors(false, 10)
            .injectStops(conf.getEIInjectReadAheadStall(), 10)
            .injectCorruption(conf.getEIInjectReadAheadBrokenEntries())
            .build();
    return new BKDistributedLogManager(
            name,
            conf,
            ConfUtils.getConstDynConf(conf),
            uri,
            namespace.getNamespaceDriver(),
            new LogSegmentMetadataCache(conf, Ticker.systemTicker()),
            scheduler,
            DistributedLogConstants.UNKNOWN_CLIENT_ID,
            DistributedLogConstants.LOCAL_REGION_ID,
            writeLimiter,
            new SettableFeatureProvider("", 0),
            failureInjector,
            NullStatsLogger.INSTANCE,
            NullStatsLogger.INSTANCE,
            Optional.of(resourcesCloseable));
}
 
Example 4
Source File: TestDistributedLogBase.java    From distributedlog with Apache License 2.0 4 votes vote down vote up
protected ZooKeeperClient getZooKeeperClient(Namespace namespace) throws Exception {
    NamespaceDriver driver = namespace.getNamespaceDriver();
    assertTrue(driver instanceof BKNamespaceDriver);
    return ((BKNamespaceDriver) driver).getWriterZKC();
}
 
Example 5
Source File: TestDistributedLogBase.java    From distributedlog with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("deprecation")
protected BookKeeperClient getBookKeeperClient(Namespace namespace) throws Exception {
    NamespaceDriver driver = namespace.getNamespaceDriver();
    assertTrue(driver instanceof BKNamespaceDriver);
    return ((BKNamespaceDriver) driver).getReaderBKC();
}