]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/java/rocksjni/transaction_notifier_jnicallback.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / rocksdb / java / rocksjni / transaction_notifier_jnicallback.h
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).
5 //
6 // This file implements the callback "bridge" between Java and C++ for
7 // rocksdb::TransactionNotifier.
8
9 #ifndef JAVA_ROCKSJNI_TRANSACTION_NOTIFIER_JNICALLBACK_H_
10 #define JAVA_ROCKSJNI_TRANSACTION_NOTIFIER_JNICALLBACK_H_
11
12 #include <jni.h>
13
14 #include "rocksdb/utilities/transaction.h"
15 #include "rocksjni/jnicallback.h"
16
17 namespace rocksdb {
18
19 /**
20 * This class acts as a bridge between C++
21 * and Java. The methods in this class will be
22 * called back from the RocksDB TransactionDB or OptimisticTransactionDB (C++),
23 * we then callback to the appropriate Java method
24 * this enables TransactionNotifier to be implemented in Java.
25 *
26 * Unlike RocksJava's Comparator JNI Callback, we do not attempt
27 * to reduce Java object allocations by caching the Snapshot object
28 * presented to the callback. This could be revisited in future
29 * if performance is lacking.
30 */
31 class TransactionNotifierJniCallback: public JniCallback,
32 public TransactionNotifier {
33 public:
34 TransactionNotifierJniCallback(JNIEnv* env, jobject jtransaction_notifier);
35 virtual void SnapshotCreated(const Snapshot* newSnapshot);
36
37 private:
38 jmethodID m_jsnapshot_created_methodID;
39 };
40 } // namespace rocksdb
41
42 #endif // JAVA_ROCKSJNI_TRANSACTION_NOTIFIER_JNICALLBACK_H_