sijie commented on a change in pull request #510: Issue-605 BP-15 New CreateLedger API URL: https://github.com/apache/bookkeeper/pull/510#discussion_r143035314
########## File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/client/impl/BookKeeperBuilderImpl.java ########## @@ -0,0 +1,104 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.bookkeeper.client.impl; + +import com.google.common.base.Preconditions; +import io.netty.channel.EventLoopGroup; +import io.netty.util.HashedWheelTimer; +import java.io.IOException; +import org.apache.bookkeeper.client.BKException.ZKException; +import org.apache.bookkeeper.client.api.BookKeeper; +import org.apache.bookkeeper.client.api.BookKeeperBuilder; +import org.apache.bookkeeper.client.api.BookKeeperException; +import org.apache.bookkeeper.conf.ClientConfiguration; +import org.apache.bookkeeper.feature.FeatureProvider; +import org.apache.bookkeeper.net.DNSToSwitchMapping; +import org.apache.bookkeeper.stats.StatsLogger; +import org.apache.zookeeper.KeeperException; +import org.apache.zookeeper.ZooKeeper; + +/** + * Internal builder for {@link org.apache.bookkeeper.client.api.BookKeeper} client. + * + * @since 4.6 + */ +public class BookKeeperBuilderImpl implements BookKeeperBuilder { + + private final org.apache.bookkeeper.client.BookKeeper.Builder builder; + + public BookKeeperBuilderImpl(ClientConfiguration conf) { + this.builder = org.apache.bookkeeper.client.BookKeeper.forConfig(conf); + } + + @Override + public BookKeeperBuilder eventLoopGroup(EventLoopGroup component) { + Preconditions.checkNotNull(component); + builder.eventLoopGroup(component); + return this; + } + + @Override + public BookKeeperBuilder zk(ZooKeeper component) { + Preconditions.checkNotNull(component); + builder.zk(component); + return this; + } + + @Override + public BookKeeperBuilder statsLogger(StatsLogger component) { + Preconditions.checkNotNull(component); + builder.statsLogger(component); + return this; + } + + @Override + public BookKeeperBuilder dnsResolver(DNSToSwitchMapping component) { + Preconditions.checkNotNull(component); + builder.dnsResolver(component); + return this; + } + + @Override + public BookKeeperBuilder requestTimer(HashedWheelTimer component) { + Preconditions.checkNotNull(component); Review comment: it is okay to be null as well. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
