Package sun.misc

Examples of sun.misc.Cleaner


        b.put(data);
    }

    private void unmapBuffer(MappedByteBuffer b) {
        if(b!=null){
            Cleaner cleaner = ((sun.nio.ch.DirectBuffer) b).cleaner();
            if(cleaner!=null)
                cleaner.clean();
        }
    }
View Full Code Here


    static void throwException(Throwable t) {
        UNSAFE.throwException(t);
    }

    static void freeDirectBuffer(ByteBuffer buffer) {
        Cleaner cleaner;
        try {
            cleaner = (Cleaner) getObject(buffer, CLEANER_FIELD_OFFSET);
            if (cleaner == null) {
                throw new IllegalArgumentException(
                        "attempted to deallocate the buffer which was allocated via JNIEnv->NewDirectByteBuffer()");
            }
            cleaner.clean();
        } catch (Throwable t) {
            // Nothing we can do here.
        }
    }
View Full Code Here

    }

    return AccessController.doPrivileged(new PrivilegedAction<Object>() {
      public Object run() {
        try {
          Cleaner cleaner = ((DirectBuffer)buffer).cleaner();
          if (cleaner != null) cleaner.clean(); // Already cleaned otherwise
          return null;
        }
        catch (Exception e) {
          return buffer;
        }
View Full Code Here

      final boolean toBeWrote) throws FileIOErrorException {
    try {
      if (toBeWrote) {
        if (byteBuffer.isDirect()) {
          ((MappedByteBuffer) byteBuffer).force();
          final Cleaner cleaner = ((sun.nio.ch.DirectBuffer) byteBuffer)
              .cleaner();
          if (cleaner != null) {
            cleaner.clean();
          }
        } else {
          writeByteBuffer(byteBuffer, index);
        }
      } else {
        if (byteBuffer.isDirect()) {
          final Cleaner cleaner = ((sun.nio.ch.DirectBuffer) byteBuffer)
              .cleaner();
          if (cleaner != null) {
            cleaner.clean();
          }
        }
      }
    } catch (Exception exception) {
      String fileSize;
View Full Code Here

        }

    }

    private static void unmap(MappedByteBuffer bb) {
        Cleaner cl = ((DirectBuffer)bb).cleaner();
        if (cl != null)
            cl.clean();
    }
View Full Code Here

        }

    }

    private static void unmap(MappedByteBuffer bb) {
        Cleaner cl = ((DirectBuffer)bb).cleaner();
        if (cl != null)
            cl.clean();
    }
View Full Code Here

TOP

Related Classes of sun.misc.Cleaner

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.