| 683 | private void clean(final Object buffer) throws Exception { |
| 684 | AccessController.doPrivileged(new PrivilegedAction<Object>() { |
| 685 | public Object run() { |
| 686 | try { |
| 687 | Method getCleanerMethod = buffer.getClass().getMethod( |
| 688 | "cleaner", new Class[0]); |
| 689 | getCleanerMethod.setAccessible(true); |
| 690 | sun.misc.Cleaner cleaner = (sun.misc.Cleaner) getCleanerMethod |
| 691 | .invoke(buffer, new Object[0]); |
| 692 | cleaner.clean(); |
| 693 | } catch (Exception e) { |
| 694 | e.printStackTrace(); |
| 695 | } |
| 696 | return null; |
| 697 | } |
| 698 | }); |
| 699 | } |
| 700 | |