|
@@ -74,9 +74,11 @@ public class FileMD5Util {
|
|
|
try {
|
|
|
Method getCleanerMethod = mappedByteBuffer.getClass().getMethod("cleaner", new Class[0]);
|
|
|
getCleanerMethod.setAccessible(true);
|
|
|
- sun.misc.Cleaner cleaner = (sun.misc.Cleaner) getCleanerMethod.invoke(mappedByteBuffer,
|
|
|
- new Object[0]);
|
|
|
- cleaner.clean();
|
|
|
+ Object cleaner = getCleanerMethod.invoke(mappedByteBuffer);
|
|
|
+ if (cleaner != null) {
|
|
|
+ Method cleanMethod = cleaner.getClass().getMethod("clean");
|
|
|
+ cleanMethod.invoke(cleaner);
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
logger.error("clean MappedByteBuffer error!!!", e);
|
|
|
}
|