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;
|
||||
}
|
||||
|
||||
public synchronized RegionManager getRegionManager() {
|
||||
public RegionManager getRegionManager() {
|
||||
RegionManager res = regionManager;
|
||||
if (res == null) {
|
||||
synchronized (this) {
|
||||
|
|
@ -474,7 +474,9 @@ public class TiSession implements AutoCloseable {
|
|||
synchronized (sessionCachedMap) {
|
||||
sessionCachedMap.remove(conf.getPdAddrsString());
|
||||
}
|
||||
|
||||
if (regionManager != null) {
|
||||
regionManager.close();
|
||||
}
|
||||
if (tableScanThreadPool != null) {
|
||||
tableScanThreadPool.shutdownNow();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,6 +99,12 @@ public class RegionManager {
|
|||
this.executor = null;
|
||||
}
|
||||
|
||||
public synchronized void close() {
|
||||
if (this.executor != null) {
|
||||
this.executor.shutdownNow();
|
||||
}
|
||||
}
|
||||
|
||||
public Function<CacheInvalidateEvent, Void> getCacheInvalidateCallback() {
|
||||
return cacheInvalidateCallback;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue