Skip to content

Commit

Permalink
ARROW-1163: [Java] Java client support for plasma
Browse files Browse the repository at this point in the history
--------------------------
This commit includes the support of java client for plasma, which is part of the java worker support of Ray.
In addition to some minor changes in build system, it consists of the following modules:
 - java/plasma: java client support for plasma
 - cpp/src/plasma/lib/java: JNI support for plasma client
 - java/plasma/Readme.md: Readme.md for help document
 - java/plasma/test.sh: test.sh for test

Author: salah-man <[email protected]>
Author: Philipp Moritz <[email protected]>
Author: salah <[email protected]>

Closes apache#2065 from salah-man/java_lib and squashes the following commits:

be067e8 <salah-man> add the test case of contains and hash of plasma java client
b7f5e94 <salah-man> fix ci lint error
80e9580 <salah-man> small change for feedback
b745465 <salah-man> fix the problems after the feedback
52b26e7 <Philipp Moritz> Google C++ convention
2f3f129 <Philipp Moritz> cleanups
1c327a7 <salah-man> add ci of plasma java client
14393f5 <salah-man> fix the ci problem
3e9ba0d <salah-man> Changes for the feedback from pr -------------------------- It consists of the following changes:  add java/plasma/README.md for help document  add java/plasma/test.sh for plasma java client test case  fix some ci error  delete the useless parameters of connect api from jni
9da40d0 <salah-man> Delete the ObjectId.java and ObjectBuffer.java, change the input and output of plasma java client api from custem type to byte
87ba3b9 <salah> Java client support for plasma -------------------------- This commit includes the support of java client for plasma, which is part of the java worker support of Ray. In addition to some minor changes in build system, it consists of the following modules:  - java/plasma: java client support for plasma  - cpp/src/plasma/lib/java: JNI support for plasma client
  • Loading branch information
salah-man authored and pcmoritz committed May 25, 2018
1 parent 01202cc commit ce23c06
Show file tree
Hide file tree
Showing 15 changed files with 1,114 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ matrix:
env: ARROW_TEST_GROUP=integration
jdk: openjdk8
env:
- ARROW_TRAVIS_PLASMA=1
- ARROW_TRAVIS_PLASMA_JAVA_CLIENT=1
- CC="clang-6.0"
- CXX="clang++-6.0"
before_script:
Expand All @@ -140,6 +142,7 @@ matrix:
- $TRAVIS_BUILD_DIR/ci/travis_before_script_cpp.sh
script:
- $TRAVIS_BUILD_DIR/ci/travis_script_integration.sh
- $TRAVIS_BUILD_DIR/ci/travis_script_plasma_java_client.sh
# NodeJS
- language: node_js
os: linux
Expand Down
4 changes: 4 additions & 0 deletions ci/travis_before_script_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ if [ $ARROW_TRAVIS_PLASMA == "1" ]; then
CMAKE_COMMON_FLAGS="$CMAKE_COMMON_FLAGS -DARROW_PLASMA=ON"
fi

if [ $ARROW_TRAVIS_PLASMA_JAVA_CLIENT == "1" ]; then
CMAKE_COMMON_FLAGS="$CMAKE_COMMON_FLAGS -DARROW_PLASMA_JAVA_CLIENT=ON"
fi

if [ $ARROW_TRAVIS_ORC == "1" ]; then
CMAKE_COMMON_FLAGS="$CMAKE_COMMON_FLAGS -DARROW_ORC=ON"
fi
Expand Down
30 changes: 30 additions & 0 deletions ci/travis_script_plasma_java_client.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

set -e

PLASMA_JAVA_DIR=${TRAVIS_BUILD_DIR}/java/plasma

pushd $PLASMA_JAVA_DIR

mvn clean install
export PLASMA_STORE=${TRAVIS_BUILD_DIR}/cpp-install/bin/plasma_store
java -cp target/test-classes:target/classes -Djava.library.path=${TRAVIS_BUILD_DIR}/cpp-build/debug/ org.apache.arrow.plasma.PlasmaClientTest

popd
4 changes: 4 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
"Build the plasma object store along with Arrow"
OFF)

option(ARROW_PLASMA_JAVA_CLIENT
"Build the plasma object store java client"
OFF)

option(ARROW_USE_SSE
"Build with SSE4 optimizations"
OFF)
Expand Down
35 changes: 35 additions & 0 deletions cpp/src/plasma/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,41 @@ install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/plasma.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/")

if(ARROW_PLASMA_JAVA_CLIENT)
# Plasma java client support
find_package(JNI REQUIRED)
# add jni support
include_directories(${JAVA_INCLUDE_PATH})
include_directories(${JAVA_INCLUDE_PATH2})
if (JNI_FOUND)
message (STATUS "JNI_INCLUDE_DIRS = ${JNI_INCLUDE_DIRS}")
message (STATUS "JNI_LIBRARIES = ${JNI_LIBRARIES}")
else()
message (WARNING "Could not find JNI")
endif()

add_compile_options("-I$ENV{JAVA_HOME}/include/")
if(WIN32)
add_compile_options("-I$ENV{JAVA_HOME}/include/win32")
elseif(APPLE)
add_compile_options("-I$ENV{JAVA_HOME}/include/darwin")
else() # linux
add_compile_options("-I$ENV{JAVA_HOME}/include/linux")
endif()

include_directories("${CMAKE_CURRENT_LIST_DIR}/lib/java")

file(GLOB PLASMA_LIBRARY_EXT_java_SRC
lib/java/*.cc lib/*.cc)
add_library(plasma_java SHARED
${PLASMA_LIBRARY_EXT_java_SRC})

if(APPLE)
target_link_libraries(plasma_java plasma_static ${PLASMA_LINK_LIBS} "-undefined dynamic_lookup" -Wl,-force_load,${FLATBUFFERS_STATIC_LIB} ${FLATBUFFERS_STATIC_LIB} ${PTHREAD_LIBRARY})
else(APPLE)
target_link_libraries(plasma_java plasma_static ${PLASMA_LINK_LIBS} -Wl,--whole-archive ${FLATBUFFERS_STATIC_LIB} -Wl,--no-whole-archive ${FLATBUFFERS_STATIC_LIB} ${PTHREAD_LIBRARY})
endif(APPLE)
endif()
#######################################
# Unit tests
#######################################
Expand Down
Loading

0 comments on commit ce23c06

Please sign in to comment.