Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ public class ManagedBloomFilter extends BloomFilter {

@Override
public void close() {
super.close();
leakTracker.close();
try {
super.close();
} finally {
leakTracker.close();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late comment @adoroszlai. We could've just put leakTracker before the main close. This would mean that leakTracker is meant to track if resource closure is invoked by the application code, regardless of the result (success or failure).

  public void close() {
   leakTracker.close();
   super.close();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @duongkame for the suggestion. I had the same idea, but preferred the one in the PR: a problem in leakTracker.close() might prevent release of the underlying (real) resource. try-finally is not that much more complex.

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,11 @@ public boolean isReused() {

@Override
public void close() {
super.close();
leakTracker.close();
try {
super.close();
} finally {
leakTracker.close();
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ public class ManagedCompactRangeOptions extends CompactRangeOptions {

@Override
public void close() {
super.close();
leakTracker.close();
try {
super.close();
} finally {
leakTracker.close();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ public class ManagedDBOptions extends DBOptions {

@Override
public void close() {
super.close();
leakTracker.close();
try {
super.close();
} finally {
leakTracker.close();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ public class ManagedEnvOptions extends EnvOptions {

@Override
public void close() {
super.close();
leakTracker.close();
try {
super.close();
} finally {
leakTracker.close();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ public class ManagedFlushOptions extends FlushOptions {

@Override
public void close() {
super.close();
leakTracker.close();
try {
super.close();
} finally {
leakTracker.close();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ public class ManagedIngestExternalFileOptions extends IngestExternalFileOptions

@Override
public void close() {
super.close();
leakTracker.close();
try {
super.close();
} finally {
leakTracker.close();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ public ManagedLRUCache(long capacity) {

@Override
public void close() {
super.close();
leakTracker.close();
try {
super.close();
} finally {
leakTracker.close();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ public T get() {

@Override
public void close() {
original.close();
leakTracker.close();
try {
original.close();
} finally {
leakTracker.close();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ public class ManagedOptions extends Options {

@Override
public void close() {
super.close();
leakTracker.close();
try {
super.close();
} finally {
leakTracker.close();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ public class ManagedReadOptions extends ReadOptions {

@Override
public void close() {
super.close();
leakTracker.close();
try {
super.close();
} finally {
leakTracker.close();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@ public synchronized long getNativeHandle() {

@Override
protected void disposeInternal() {
super.disposeInternal();
// RocksMutableObject.close is final thus can't be decorated.
// So, we decorate disposeInternal instead to track closure.
leakTracker.close();
try {
super.disposeInternal();
} finally {
leakTracker.close();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ public ManagedSstFileWriter(EnvOptions envOptions,

@Override
public void close() {
super.close();
leakTracker.close();
try {
super.close();
} finally {
leakTracker.close();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ public class ManagedStatistics extends Statistics {

@Override
public void close() {
super.close();
leakTracker.close();
try {
super.close();
} finally {
leakTracker.close();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ public ManagedWriteBatch(byte[] data) {

@Override
public void close() {
super.close();
leakTracker.close();
try {
super.close();
} finally {
leakTracker.close();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ public class ManagedWriteOptions extends WriteOptions {

@Override
public void close() {
super.close();
leakTracker.close();
try {
super.close();
} finally {
leakTracker.close();
}
}
}