mirror of https://github.com/tikv/client-java.git
fix unclosed Thread when create TiSession error (#300)
Signed-off-by: marsishandsome <marsishandsome@gmail.com>
This commit is contained in:
parent
f9cb05784d
commit
489e5c22ec
|
|
@ -77,6 +77,10 @@ public class TiSession implements AutoCloseable {
|
|||
private static final int MAX_SPLIT_REGION_STACK_DEPTH = 6;
|
||||
|
||||
public TiSession(TiConfiguration conf) {
|
||||
// may throw org.tikv.common.MetricsServer - http server not up
|
||||
// put it at the beginning of this function to avoid unclosed Thread
|
||||
this.metricsServer = MetricsServer.getInstance(conf);
|
||||
|
||||
this.conf = conf;
|
||||
this.channelFactory =
|
||||
conf.isTlsEnable()
|
||||
|
|
@ -92,7 +96,6 @@ public class TiSession implements AutoCloseable {
|
|||
|
||||
this.client = PDClient.createRaw(conf, channelFactory);
|
||||
this.enableGrpcForward = conf.getEnableGrpcForward();
|
||||
this.metricsServer = MetricsServer.getInstance(conf);
|
||||
if (this.enableGrpcForward) {
|
||||
logger.info("enable grpc forward for high available");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue