1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under both the GPLv2 (found in the
3 // COPYING file in the root directory) and Apache 2.0 License
4 // (found in the LICENSE.Apache file in the root directory).
8 * Determines the type of synchronisation primitive used
11 public enum ReusedSynchronisationType
{
18 * Use adaptive mutex, which spins in the user space before resorting
19 * to kernel. This could reduce context switch when the mutex is not
20 * heavily contended. However, if the mutex is hot, we could end up
23 ADAPTIVE_MUTEX((byte)0x1),
26 * There is a reused buffer per-thread.
28 THREAD_LOCAL((byte)0x2);
30 private final byte value
;
32 ReusedSynchronisationType(final byte value
) {
37 * Returns the byte value of the enumerations value
39 * @return byte representation
41 public byte getValue() {
46 * Get ReusedSynchronisationType by byte value.
48 * @param value byte representation of ReusedSynchronisationType.
50 * @return {@link org.rocksdb.ReusedSynchronisationType} instance.
51 * @throws java.lang.IllegalArgumentException if an invalid
54 public static ReusedSynchronisationType
getReusedSynchronisationType(
56 for (final ReusedSynchronisationType reusedSynchronisationType
57 : ReusedSynchronisationType
.values()) {
58 if (reusedSynchronisationType
.getValue() == value
) {
59 return reusedSynchronisationType
;
62 throw new IllegalArgumentException(
63 "Illegal value provided for ReusedSynchronisationType.");