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 "bridge" between Java and C++ for
7 // JNI Callbacks from C++ to sub-classes or org.rocksdb.RocksCallbackObject
8 
9 #include <jni.h>
10 
11 #include "include/org_rocksdb_RocksCallbackObject.h"
12 #include "jnicallback.h"
13 
14 /*
15  * Class:     org_rocksdb_RocksCallbackObject
16  * Method:    disposeInternal
17  * Signature: (J)V
18  */
Java_org_rocksdb_RocksCallbackObject_disposeInternal(JNIEnv *,jobject,jlong handle)19 void Java_org_rocksdb_RocksCallbackObject_disposeInternal(JNIEnv* /*env*/,
20                                                           jobject /*jobj*/,
21                                                           jlong handle) {
22   // TODO(AR) is deleting from the super class JniCallback OK, or must we delete
23   // the subclass? Example hierarchies:
24   //   1) Comparator -> BaseComparatorJniCallback + JniCallback ->
25   //   DirectComparatorJniCallback 2) Comparator -> BaseComparatorJniCallback +
26   //   JniCallback -> ComparatorJniCallback
27   // I think this is okay, as Comparator and JniCallback both have virtual
28   // destructors...
29   delete reinterpret_cast<ROCKSDB_NAMESPACE::JniCallback*>(handle);
30 }
31