[HUDI-1358] Fix Memory Leak in HoodieLogFormatWriter (#2217)
This commit is contained in:
committed by
GitHub
parent
0364498ae3
commit
42b6aeca28
@@ -97,6 +97,7 @@ public class SparkHoodieHBaseIndex<T extends HoodieRecordPayload> extends SparkH
|
||||
private int maxQpsPerRegionServer;
|
||||
private long totalNumInserts;
|
||||
private int numWriteStatusWithInserts;
|
||||
private static transient Thread shutdownThread;
|
||||
|
||||
/**
|
||||
* multiPutBatchSize will be computed and re-set in updateLocation if
|
||||
@@ -155,13 +156,16 @@ public class SparkHoodieHBaseIndex<T extends HoodieRecordPayload> extends SparkH
|
||||
* exits.
|
||||
*/
|
||||
private void addShutDownHook() {
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||
try {
|
||||
hbaseConnection.close();
|
||||
} catch (Exception e) {
|
||||
// fail silently for any sort of exception
|
||||
}
|
||||
}));
|
||||
if (null == shutdownThread) {
|
||||
shutdownThread = new Thread(() -> {
|
||||
try {
|
||||
hbaseConnection.close();
|
||||
} catch (Exception e) {
|
||||
// fail silently for any sort of exception
|
||||
}
|
||||
});
|
||||
Runtime.getRuntime().addShutdownHook(shutdownThread);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user