mirror of https://github.com/tikv/client-java.git
fix not stop scheduler (#207)
* fix not stop scheduler Signed-off-by: Little-Wallace <bupt2013211450@gmail.com> * address comment Signed-off-by: Little-Wallace <bupt2013211450@gmail.com>
This commit is contained in:
parent
d29cf0079c
commit
550487db9c
|
|
@ -197,7 +197,7 @@ public class TiSession implements AutoCloseable {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized RegionManager getRegionManager() {
|
public RegionManager getRegionManager() {
|
||||||
RegionManager res = regionManager;
|
RegionManager res = regionManager;
|
||||||
if (res == null) {
|
if (res == null) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
|
|
@ -474,7 +474,9 @@ public class TiSession implements AutoCloseable {
|
||||||
synchronized (sessionCachedMap) {
|
synchronized (sessionCachedMap) {
|
||||||
sessionCachedMap.remove(conf.getPdAddrsString());
|
sessionCachedMap.remove(conf.getPdAddrsString());
|
||||||
}
|
}
|
||||||
|
if (regionManager != null) {
|
||||||
|
regionManager.close();
|
||||||
|
}
|
||||||
if (tableScanThreadPool != null) {
|
if (tableScanThreadPool != null) {
|
||||||
tableScanThreadPool.shutdownNow();
|
tableScanThreadPool.shutdownNow();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,12 @@ public class RegionManager {
|
||||||
this.executor = null;
|
this.executor = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized void close() {
|
||||||
|
if (this.executor != null) {
|
||||||
|
this.executor.shutdownNow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Function<CacheInvalidateEvent, Void> getCacheInvalidateCallback() {
|
public Function<CacheInvalidateEvent, Void> getCacheInvalidateCallback() {
|
||||||
return cacheInvalidateCallback;
|
return cacheInvalidateCallback;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue