.zk(zkc.get()) .channelFactory(channelFactory) .statsLogger(statsLogger) .dnsResolver(dnsResolver) .requestTimer(requestTimer)
static BookKeeper createBookKeeperClient(ServerConfiguration conf, StatsLogger statsLogger) throws InterruptedException, IOException { ClientConfiguration clientConfiguration = new ClientConfiguration(conf); clientConfiguration.setClientRole(ClientConfiguration.CLIENT_ROLE_SYSTEM); try { return BookKeeper.forConfig(clientConfiguration).statsLogger(statsLogger).build(); } catch (BKException e) { throw new IOException("Failed to create bookkeeper client", e); } }
@Override public void start() throws LogNotAvailableException { try { this.bookKeeper = BookKeeper .forConfig(config) .statsLogger(statsLogger) .build(); if (maxIdleTime > 0) { this.forceLastAddConfirmedTimer.scheduleWithFixedDelay(() -> { this.forceLastAddConfirmed(); }, maxIdleTime, maxIdleTime, TimeUnit.MILLISECONDS); } } catch (IOException | InterruptedException | BKException t) { close(); throw new LogNotAvailableException(t); } }
@Override public BookKeeperBuilder statsLogger(StatsLogger statsLogger) { builder.statsLogger(statsLogger); return this; }