jdk/src/java.base/share/classes/sun/misc/JavaNioAccess.java
author martin
Thu, 30 Oct 2014 07:31:41 -0700
changeset 28059 e576535359cc
parent 25859 3317bb8137f4
permissions -rw-r--r--
8067377: My hobby: caning, then then canning, the the can-can Summary: Fix ALL the stutters! Reviewed-by: rriggs, mchung, lancea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1143
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents:
diff changeset
     1
/*
10325
b72c20cd583a 7047325: Internal API to improve management of direct buffers
coffeys
parents: 5506
diff changeset
     2
 * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
1143
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents:
diff changeset
     4
 *
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3066
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
1143
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3066
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
1143
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents:
diff changeset
    10
 *
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents:
diff changeset
    15
 * accompanied this code).
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents:
diff changeset
    16
 *
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3066
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3066
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3066
diff changeset
    23
 * questions.
1143
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents:
diff changeset
    24
 */
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents:
diff changeset
    25
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents:
diff changeset
    26
package sun.misc;
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents:
diff changeset
    27
10325
b72c20cd583a 7047325: Internal API to improve management of direct buffers
coffeys
parents: 5506
diff changeset
    28
import java.nio.Buffer;
b72c20cd583a 7047325: Internal API to improve management of direct buffers
coffeys
parents: 5506
diff changeset
    29
import java.nio.ByteBuffer;
b72c20cd583a 7047325: Internal API to improve management of direct buffers
coffeys
parents: 5506
diff changeset
    30
1143
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents:
diff changeset
    31
public interface JavaNioAccess {
3066
cd3861104f4d 6844054: (bf) Eliminate dependency on javax.management.ObjectName
alanb
parents: 1143
diff changeset
    32
    /**
cd3861104f4d 6844054: (bf) Eliminate dependency on javax.management.ObjectName
alanb
parents: 1143
diff changeset
    33
     * Provides access to information on buffer usage.
cd3861104f4d 6844054: (bf) Eliminate dependency on javax.management.ObjectName
alanb
parents: 1143
diff changeset
    34
     */
cd3861104f4d 6844054: (bf) Eliminate dependency on javax.management.ObjectName
alanb
parents: 1143
diff changeset
    35
    interface BufferPool {
cd3861104f4d 6844054: (bf) Eliminate dependency on javax.management.ObjectName
alanb
parents: 1143
diff changeset
    36
        String getName();
cd3861104f4d 6844054: (bf) Eliminate dependency on javax.management.ObjectName
alanb
parents: 1143
diff changeset
    37
        long getCount();
cd3861104f4d 6844054: (bf) Eliminate dependency on javax.management.ObjectName
alanb
parents: 1143
diff changeset
    38
        long getTotalCapacity();
cd3861104f4d 6844054: (bf) Eliminate dependency on javax.management.ObjectName
alanb
parents: 1143
diff changeset
    39
        long getMemoryUsed();
cd3861104f4d 6844054: (bf) Eliminate dependency on javax.management.ObjectName
alanb
parents: 1143
diff changeset
    40
    }
cd3861104f4d 6844054: (bf) Eliminate dependency on javax.management.ObjectName
alanb
parents: 1143
diff changeset
    41
    BufferPool getDirectBufferPool();
10325
b72c20cd583a 7047325: Internal API to improve management of direct buffers
coffeys
parents: 5506
diff changeset
    42
b72c20cd583a 7047325: Internal API to improve management of direct buffers
coffeys
parents: 5506
diff changeset
    43
    /**
b72c20cd583a 7047325: Internal API to improve management of direct buffers
coffeys
parents: 5506
diff changeset
    44
     * Constructs a direct ByteBuffer referring to the block of memory starting
28059
e576535359cc 8067377: My hobby: caning, then then canning, the the can-can
martin
parents: 25859
diff changeset
    45
     * at the given memory address and extending {@code cap} bytes.
10325
b72c20cd583a 7047325: Internal API to improve management of direct buffers
coffeys
parents: 5506
diff changeset
    46
     * The {@code ob} parameter is an arbitrary object that is attached
b72c20cd583a 7047325: Internal API to improve management of direct buffers
coffeys
parents: 5506
diff changeset
    47
     * to the resulting buffer.
b72c20cd583a 7047325: Internal API to improve management of direct buffers
coffeys
parents: 5506
diff changeset
    48
     */
b72c20cd583a 7047325: Internal API to improve management of direct buffers
coffeys
parents: 5506
diff changeset
    49
    ByteBuffer newDirectByteBuffer(long addr, int cap, Object ob);
b72c20cd583a 7047325: Internal API to improve management of direct buffers
coffeys
parents: 5506
diff changeset
    50
b72c20cd583a 7047325: Internal API to improve management of direct buffers
coffeys
parents: 5506
diff changeset
    51
    /**
b72c20cd583a 7047325: Internal API to improve management of direct buffers
coffeys
parents: 5506
diff changeset
    52
     * Truncates a buffer by changing its capacity to 0.
b72c20cd583a 7047325: Internal API to improve management of direct buffers
coffeys
parents: 5506
diff changeset
    53
     */
b72c20cd583a 7047325: Internal API to improve management of direct buffers
coffeys
parents: 5506
diff changeset
    54
    void truncate(Buffer buf);
b72c20cd583a 7047325: Internal API to improve management of direct buffers
coffeys
parents: 5506
diff changeset
    55
1143
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents:
diff changeset
    56
}