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).
9 * Mode for {@link RateLimiter#RateLimiter(long, long, int, RateLimiterMode)}.
11 public enum RateLimiterMode
{
12 READS_ONLY((byte)0x0),
13 WRITES_ONLY((byte)0x1),
16 private final byte value
;
18 RateLimiterMode(final byte value
) {
23 * <p>Returns the byte value of the enumerations value.</p>
25 * @return byte representation
27 public byte getValue() {
32 * <p>Get the RateLimiterMode enumeration value by
33 * passing the byte identifier to this method.</p>
35 * @param byteIdentifier of RateLimiterMode.
37 * @return AccessHint instance.
39 * @throws IllegalArgumentException if the access hint for the byteIdentifier
42 public static RateLimiterMode
getRateLimiterMode(final byte byteIdentifier
) {
43 for (final RateLimiterMode rateLimiterMode
: RateLimiterMode
.values()) {
44 if (rateLimiterMode
.getValue() == byteIdentifier
) {
45 return rateLimiterMode
;
49 throw new IllegalArgumentException(
50 "Illegal value provided for RateLimiterMode.");