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).
6 // This file implements the callback "bridge" between Java and C++ for
7 // rocksdb::TransactionNotifier.
9 #ifndef JAVA_ROCKSJNI_TRANSACTION_NOTIFIER_JNICALLBACK_H_
10 #define JAVA_ROCKSJNI_TRANSACTION_NOTIFIER_JNICALLBACK_H_
14 #include "rocksdb/utilities/transaction.h"
15 #include "rocksjni/jnicallback.h"
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.
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.
31 class TransactionNotifierJniCallback
: public JniCallback
,
32 public TransactionNotifier
{
34 TransactionNotifierJniCallback(JNIEnv
* env
, jobject jtransaction_notifier
);
35 virtual void SnapshotCreated(const Snapshot
* newSnapshot
);
38 jmethodID m_jsnapshot_created_methodID
;
40 } // namespace rocksdb
42 #endif // JAVA_ROCKSJNI_TRANSACTION_NOTIFIER_JNICALLBACK_H_