src/jdk.nio.mapmode/share/classes/jdk/nio/mapmode/ExtendedMapMode.java
author jlaskey
Thu, 14 Nov 2019 12:39:49 -0400
branchJDK-8193209-branch
changeset 59086 214afc7a1e02
parent 57804 9b7b9f16dfd9
permissions -rw-r--r--
[mq]: refresh
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
57804
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
     1
/*
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
     2
 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
     4
 *
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    10
 *
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    15
 * accompanied this code).
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    16
 *
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    20
 *
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    23
 * questions.
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    24
 */
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    25
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    26
package jdk.nio.mapmode;
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    27
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    28
import java.nio.channels.FileChannel.MapMode;
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    29
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    30
/**
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    31
 * JDK-specific map modes.
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    32
 *
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    33
 * @since 14
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    34
 * @see java.nio.channels.FileChannel#map
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    35
 */
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    36
public class ExtendedMapMode {
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    37
    private ExtendedMapMode() { }
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    38
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    39
    /**
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    40
     * File mapping mode for a read-only mapping of a file backed by
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    41
     * non-volatile RAM.
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    42
     *
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    43
     * <p> The {@linkplain FileChannel#map map} method throws
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    44
     * {@linkplain UnsupportedOperationException} when this map mode
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    45
     * is used on an implementation that does not support it.
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    46
     *
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    47
     * @implNote On Linux, the {@code MAP_SYNC} and {@code
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    48
     * MAP_SHARED_VALIDATE} flags are specified to {@code mmap} when
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    49
     * mapping the file into memory.
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    50
     */
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    51
    public static final MapMode READ_ONLY_SYNC = jdk.internal.misc.ExtendedMapMode.READ_ONLY_SYNC;
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    52
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    53
    /**
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    54
     * File mapping mode for a read-write mapping of a file backed by
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    55
     * non-volatile RAM. {@linkplain MappedByteBufefr#force force}
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    56
     * operations on a buffer created with this mode will be performed
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    57
     * using cache line writeback rather than proceeding via a file
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    58
     * device flush.
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    59
     *
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    60
     * <p> The {@linkplain FileChannel#map map} method throws
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    61
     * {@linkplain UnsupportedOperationException} when this map mode
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    62
     * is used on an implementation that does not support it.
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    63
     *
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    64
     * @implNote On Linux, the {@code MAP_SYNC} and {@code
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    65
     * MAP_SHARED_VALIDATE} flags are specified to {@code mmap} when
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    66
     * mapping the file into memory.
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    67
     */
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    68
    public static final MapMode READ_WRITE_SYNC = jdk.internal.misc.ExtendedMapMode.READ_WRITE_SYNC;
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    69
9b7b9f16dfd9 8224974: Implement JEP 352
adinn
parents:
diff changeset
    70
}