rocks_callback_object.cc 1.3 KB

12345678910111213141516171819202122232425262728293031
  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. #include <jni.h>
  9. #include "include/org_rocksdb_RocksCallbackObject.h"
  10. #include "jnicallback.h"
  11. /*
  12. * Class: org_rocksdb_RocksCallbackObject
  13. * Method: disposeInternal
  14. * Signature: (J)V
  15. */
  16. void Java_org_rocksdb_RocksCallbackObject_disposeInternal(JNIEnv* /*env*/,
  17. jobject /*jobj*/,
  18. jlong handle) {
  19. // TODO(AR) is deleting from the super class JniCallback OK, or must we delete
  20. // the subclass? Example hierarchies:
  21. // 1) Comparator -> BaseComparatorJniCallback + JniCallback ->
  22. // DirectComparatorJniCallback 2) Comparator -> BaseComparatorJniCallback +
  23. // JniCallback -> ComparatorJniCallback
  24. // I think this is okay, as Comparator and JniCallback both have virtual
  25. // destructors...
  26. delete reinterpret_cast<ROCKSDB_NAMESPACE::JniCallback*>(handle);
  27. // @lint-ignore TXT4 T25377293 Grandfathered in
  28. }