]>
Commit | Line | Data |
---|---|---|
1e59de90 TL |
1 | // Copyright (c) Meta Platforms, Inc. and affiliates. |
2 | // | |
3 | // This source code is licensed under both the GPLv2 (found in the | |
4 | // COPYING file in the root directory) and Apache 2.0 License | |
5 | // (found in the LICENSE.Apache file in the root directory). | |
6 | ||
20effc67 TL |
7 | package org.rocksdb; |
8 | ||
9 | public class ConcurrentTaskLimiterImpl extends ConcurrentTaskLimiter { | |
10 | public ConcurrentTaskLimiterImpl(final String name, final int maxOutstandingTask) { | |
11 | super(newConcurrentTaskLimiterImpl0(name, maxOutstandingTask)); | |
12 | } | |
13 | ||
14 | @Override | |
15 | public String name() { | |
16 | assert (isOwningHandle()); | |
17 | return name(nativeHandle_); | |
18 | } | |
19 | ||
20 | @Override | |
21 | public ConcurrentTaskLimiter setMaxOutstandingTask(final int maxOutstandingTask) { | |
22 | assert (isOwningHandle()); | |
23 | setMaxOutstandingTask(nativeHandle_, maxOutstandingTask); | |
24 | return this; | |
25 | } | |
26 | ||
27 | @Override | |
28 | public ConcurrentTaskLimiter resetMaxOutstandingTask() { | |
29 | assert (isOwningHandle()); | |
30 | resetMaxOutstandingTask(nativeHandle_); | |
31 | return this; | |
32 | } | |
33 | ||
34 | @Override | |
35 | public int outstandingTask() { | |
36 | assert (isOwningHandle()); | |
37 | return outstandingTask(nativeHandle_); | |
38 | } | |
39 | ||
40 | private static native long newConcurrentTaskLimiterImpl0( | |
41 | final String name, final int maxOutstandingTask); | |
42 | private static native String name(final long handle); | |
43 | private static native void setMaxOutstandingTask(final long handle, final int limit); | |
44 | private static native void resetMaxOutstandingTask(final long handle); | |
45 | private static native int outstandingTask(final long handle); | |
46 | ||
47 | @Override protected final native void disposeInternal(final long handle); | |
48 | } |