提交 b1e9a8d2 编写于 作者: X xwhqsj

add socketThreadpool.cpp

上级 ba6de355
......@@ -12,36 +12,22 @@
</component>
<component name="ChangeListManager">
<list default="true" id="599c0760-bab6-4b6f-b494-132266cf439a" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/cmake-build-debug/hs_err_pid17128.log" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cmake-build-debug/hs_err_pid17209.log" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cmake-build-debug/hs_err_pid17273.log" afterDir="false" />
<change afterPath="$PROJECT_DIR$/socketThreadpool.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeLists.txt" beforeDir="false" afterPath="$PROJECT_DIR$/CMakeLists.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeCache.txt" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeCache.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/CMakeDirectoryInformation.cmake" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/CMakeDirectoryInformation.cmake" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/CMakeOutput.log" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/CMakeOutput.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/Makefile.cmake" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/Makefile.cmake" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/Makefile2" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/Makefile2" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/TargetDirectories.txt" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/TargetDirectories.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/clion-log.txt" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/clion-log.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/main.dir/CXX.includecache" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/main.dir/DependInfo.cmake" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/main.dir/DependInfo.cmake" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/main.dir/build.make" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/main.dir/build.make" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/main.dir/cmake_clean.cmake" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/main.dir/cmake_clean.cmake" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/main.dir/depend.internal" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/main.dir/depend.make" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/main.dir/depend.make" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/main.dir/link.txt" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/main.dir/link.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/main.dir/multithread.cpp.o" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/main.dir/server.cpp.o" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/main.dir/threadpool.cpp.o" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/main.dir/threadpool.cpp.o" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/main.dir/tpool.cpp.o" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/main.dir/progress.make" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/main.dir/progress.make" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/progress.marks" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/progress.marks" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/Makefile" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/Makefile" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/callJvmThreadpool.cbp" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/callJvmThreadpool.cbp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/cmake_install.cmake" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/cmake_install.cmake" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/main" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/main" afterDir="false" />
<change beforePath="$PROJECT_DIR$/multithread.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/pureMultithread.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/socketMultithread.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/socketMultithread.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/threadpool.cpp" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/main" beforeDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
......@@ -95,7 +81,7 @@
<updated>1570793342779</updated>
<workItem from="1570793344392" duration="1218000" />
<workItem from="1570848279077" duration="10800000" />
<workItem from="1572923636254" duration="955000" />
<workItem from="1572923636254" duration="1095000" />
</task>
<servers />
</component>
......
......@@ -16,9 +16,10 @@ add_executable(main jni.h jni_md.h tpool.cpp tpool.h
# test.cpp
# main.cpp
# multithread.cpp
socketMultithread.cpp
# socketMultithread.cpp
# server.cpp
)
socketThreadpool.cpp
)
target_link_libraries(main /usr/local/java/jre/lib/amd64/server/libjvm.so /usr/lib/x86_64-linux-gnu/libpthread.so)
......@@ -11,90 +11,22 @@ set(CMAKE_MAKEFILE_DEPENDS
"CMakeFiles/3.14.5/CMakeCCompiler.cmake"
"CMakeFiles/3.14.5/CMakeCXXCompiler.cmake"
"CMakeFiles/3.14.5/CMakeSystem.cmake"
"CMakeFiles/feature_tests.c"
"CMakeFiles/feature_tests.cxx"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeCCompiler.cmake.in"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeCCompilerABI.c"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeCInformation.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeCXXCompiler.cmake.in"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeCXXCompilerABI.cpp"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeCXXInformation.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeCommonLanguageInclude.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeCompilerIdDetection.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeDetermineCCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeDetermineCXXCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeDetermineCompileFeatures.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeDetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeDetermineCompilerABI.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeDetermineCompilerId.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeDetermineSystem.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeFindBinUtils.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeFindCodeBlocks.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeGenericSystem.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeInitializeConfigs.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeLanguageInformation.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeParseImplicitIncludeInfo.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeParseImplicitLinkInfo.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeSystem.cmake.in"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeSystemSpecificInformation.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeSystemSpecificInitialize.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeTestCCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeTestCXXCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeTestCompilerCommon.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/CMakeUnixFindMake.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/ADSP-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/ARMCC-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/AppleClang-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/Borland-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/Bruce-C-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/CMakeCommonCompilerMacros.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/Clang-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/Clang-DetermineCompilerInternal.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/Compaq-C-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/Cray-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/Embarcadero-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/Fujitsu-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/GHS-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/GNU-C-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/GNU-C-FeatureTests.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/GNU-C.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/GNU-CXX-FeatureTests.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/GNU-CXX.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/GNU-FindBinUtils.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/GNU.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/HP-C-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/HP-CXX-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/IAR-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/Intel-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/MIPSpro-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/MSVC-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/NVIDIA-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/PGI-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/PathScale-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/SCO-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/SDCC-C-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/SunPro-C-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/TI-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/TinyCC-C-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/VisualAge-C-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/Watcom-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/XL-C-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/XL-CXX-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/zOS-C-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Compiler/zOS-CXX-DetermineCompiler.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Internal/CMakeCheckCompilerFlag.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Internal/FeatureTesting.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Platform/Linux-Determine-CXX.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Platform/Linux-GNU-C.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Platform/Linux-GNU-CXX.cmake"
"/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/share/cmake-3.14/Modules/Platform/Linux-GNU.cmake"
......@@ -111,11 +43,6 @@ set(CMAKE_MAKEFILE_OUTPUTS
# Byproducts of CMake generate step:
set(CMAKE_MAKEFILE_PRODUCTS
"CMakeFiles/3.14.5/CMakeSystem.cmake"
"CMakeFiles/3.14.5/CMakeCCompiler.cmake"
"CMakeFiles/3.14.5/CMakeCXXCompiler.cmake"
"CMakeFiles/3.14.5/CMakeCCompiler.cmake"
"CMakeFiles/3.14.5/CMakeCXXCompiler.cmake"
"CMakeFiles/CMakeDirectoryInformation.cmake"
)
......
/home/wanhui/Downloads/clion-2019.2.1/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /home/wanhui/Documents/CallJvm/callJvmThreadpool
-- The C compiler identification is GNU 7.4.0
-- The CXX compiler identification is GNU 7.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/wanhui/Documents/CallJvm/callJvmThreadpool/cmake-build-debug
#IncludeRegexLine: ^[ ]*[#%][ ]*(include|import)[ ]*[<"]([^">]+)([">])
#IncludeRegexScan: ^.*$
#IncludeRegexComplain: ^$
#IncludeRegexTransform:
......@@ -4,7 +4,7 @@ set(CMAKE_DEPENDS_LANGUAGES
)
# The set of files for implicit dependencies of each language:
set(CMAKE_DEPENDS_CHECK_CXX
"/home/wanhui/Documents/CallJvm/callJvmThreadpool/socketMultithread.cpp" "/home/wanhui/Documents/CallJvm/callJvmThreadpool/cmake-build-debug/CMakeFiles/main.dir/socketMultithread.cpp.o"
"/home/wanhui/Documents/CallJvm/callJvmThreadpool/socketThreadpool.cpp" "/home/wanhui/Documents/CallJvm/callJvmThreadpool/cmake-build-debug/CMakeFiles/main.dir/socketThreadpool.cpp.o"
"/home/wanhui/Documents/CallJvm/callJvmThreadpool/tpool.cpp" "/home/wanhui/Documents/CallJvm/callJvmThreadpool/cmake-build-debug/CMakeFiles/main.dir/tpool.cpp.o"
)
set(CMAKE_CXX_COMPILER_ID "GNU")
......
......@@ -70,29 +70,29 @@ CMakeFiles/main.dir/tpool.cpp.s: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/main.dir/tpool.cpp.s"
/usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/wanhui/Documents/CallJvm/callJvmThreadpool/tpool.cpp -o CMakeFiles/main.dir/tpool.cpp.s
CMakeFiles/main.dir/socketMultithread.cpp.o: CMakeFiles/main.dir/flags.make
CMakeFiles/main.dir/socketMultithread.cpp.o: ../socketMultithread.cpp
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/wanhui/Documents/CallJvm/callJvmThreadpool/cmake-build-debug/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Building CXX object CMakeFiles/main.dir/socketMultithread.cpp.o"
/usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o CMakeFiles/main.dir/socketMultithread.cpp.o -c /home/wanhui/Documents/CallJvm/callJvmThreadpool/socketMultithread.cpp
CMakeFiles/main.dir/socketThreadpool.cpp.o: CMakeFiles/main.dir/flags.make
CMakeFiles/main.dir/socketThreadpool.cpp.o: ../socketThreadpool.cpp
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/wanhui/Documents/CallJvm/callJvmThreadpool/cmake-build-debug/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Building CXX object CMakeFiles/main.dir/socketThreadpool.cpp.o"
/usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o CMakeFiles/main.dir/socketThreadpool.cpp.o -c /home/wanhui/Documents/CallJvm/callJvmThreadpool/socketThreadpool.cpp
CMakeFiles/main.dir/socketMultithread.cpp.i: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/main.dir/socketMultithread.cpp.i"
/usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/wanhui/Documents/CallJvm/callJvmThreadpool/socketMultithread.cpp > CMakeFiles/main.dir/socketMultithread.cpp.i
CMakeFiles/main.dir/socketThreadpool.cpp.i: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/main.dir/socketThreadpool.cpp.i"
/usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/wanhui/Documents/CallJvm/callJvmThreadpool/socketThreadpool.cpp > CMakeFiles/main.dir/socketThreadpool.cpp.i
CMakeFiles/main.dir/socketMultithread.cpp.s: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/main.dir/socketMultithread.cpp.s"
/usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/wanhui/Documents/CallJvm/callJvmThreadpool/socketMultithread.cpp -o CMakeFiles/main.dir/socketMultithread.cpp.s
CMakeFiles/main.dir/socketThreadpool.cpp.s: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/main.dir/socketThreadpool.cpp.s"
/usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/wanhui/Documents/CallJvm/callJvmThreadpool/socketThreadpool.cpp -o CMakeFiles/main.dir/socketThreadpool.cpp.s
# Object files for target main
main_OBJECTS = \
"CMakeFiles/main.dir/tpool.cpp.o" \
"CMakeFiles/main.dir/socketMultithread.cpp.o"
"CMakeFiles/main.dir/socketThreadpool.cpp.o"
# External object files for target main
main_EXTERNAL_OBJECTS =
main: CMakeFiles/main.dir/tpool.cpp.o
main: CMakeFiles/main.dir/socketMultithread.cpp.o
main: CMakeFiles/main.dir/socketThreadpool.cpp.o
main: CMakeFiles/main.dir/build.make
main: /usr/local/java/jre/lib/amd64/server/libjvm.so
main: /usr/lib/x86_64-linux-gnu/libpthread.so
......
file(REMOVE_RECURSE
"CMakeFiles/main.dir/tpool.cpp.o"
"CMakeFiles/main.dir/socketMultithread.cpp.o"
"CMakeFiles/main.dir/socketThreadpool.cpp.o"
"main.pdb"
"main"
)
......
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.14
CMakeFiles/main.dir/socketThreadpool.cpp.o
/home/wanhui/Documents/CallJvm/callJvmThreadpool/socketThreadpool.cpp
/home/wanhui/Documents/CallJvm/callJvmThreadpool/tpool.h
/usr/local/java/include/jni.h
/usr/local/java/include/linux/jni_md.h
CMakeFiles/main.dir/tpool.cpp.o
/home/wanhui/Documents/CallJvm/callJvmThreadpool/tpool.cpp
/home/wanhui/Documents/CallJvm/callJvmThreadpool/tpool.h
# Empty dependencies file for main.
# This may be replaced when dependencies are built.
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.14
CMakeFiles/main.dir/socketThreadpool.cpp.o: ../socketThreadpool.cpp
CMakeFiles/main.dir/socketThreadpool.cpp.o: ../tpool.h
CMakeFiles/main.dir/socketThreadpool.cpp.o: /usr/local/java/include/jni.h
CMakeFiles/main.dir/socketThreadpool.cpp.o: /usr/local/java/include/linux/jni_md.h
CMakeFiles/main.dir/tpool.cpp.o: ../tpool.cpp
CMakeFiles/main.dir/tpool.cpp.o: ../tpool.h
/usr/bin/c++ -g CMakeFiles/main.dir/tpool.cpp.o CMakeFiles/main.dir/socketMultithread.cpp.o -o main -Wl,-rpath,/usr/local/java/jre/lib/amd64/server /usr/local/java/jre/lib/amd64/server/libjvm.so -lpthread
/usr/bin/c++ -g CMakeFiles/main.dir/tpool.cpp.o CMakeFiles/main.dir/socketThreadpool.cpp.o -o main -Wl,-rpath,/usr/local/java/jre/lib/amd64/server /usr/local/java/jre/lib/amd64/server/libjvm.so -lpthread
......@@ -123,32 +123,32 @@ main/fast:
$(MAKE) -f CMakeFiles/main.dir/build.make CMakeFiles/main.dir/build
.PHONY : main/fast
socketMultithread.o: socketMultithread.cpp.o
socketThreadpool.o: socketThreadpool.cpp.o
.PHONY : socketMultithread.o
.PHONY : socketThreadpool.o
# target to build an object file
socketMultithread.cpp.o:
$(MAKE) -f CMakeFiles/main.dir/build.make CMakeFiles/main.dir/socketMultithread.cpp.o
.PHONY : socketMultithread.cpp.o
socketThreadpool.cpp.o:
$(MAKE) -f CMakeFiles/main.dir/build.make CMakeFiles/main.dir/socketThreadpool.cpp.o
.PHONY : socketThreadpool.cpp.o
socketMultithread.i: socketMultithread.cpp.i
socketThreadpool.i: socketThreadpool.cpp.i
.PHONY : socketMultithread.i
.PHONY : socketThreadpool.i
# target to preprocess a source file
socketMultithread.cpp.i:
$(MAKE) -f CMakeFiles/main.dir/build.make CMakeFiles/main.dir/socketMultithread.cpp.i
.PHONY : socketMultithread.cpp.i
socketThreadpool.cpp.i:
$(MAKE) -f CMakeFiles/main.dir/build.make CMakeFiles/main.dir/socketThreadpool.cpp.i
.PHONY : socketThreadpool.cpp.i
socketMultithread.s: socketMultithread.cpp.s
socketThreadpool.s: socketThreadpool.cpp.s
.PHONY : socketMultithread.s
.PHONY : socketThreadpool.s
# target to generate assembly for a file
socketMultithread.cpp.s:
$(MAKE) -f CMakeFiles/main.dir/build.make CMakeFiles/main.dir/socketMultithread.cpp.s
.PHONY : socketMultithread.cpp.s
socketThreadpool.cpp.s:
$(MAKE) -f CMakeFiles/main.dir/build.make CMakeFiles/main.dir/socketThreadpool.cpp.s
.PHONY : socketThreadpool.cpp.s
tpool.o: tpool.cpp.o
......@@ -186,9 +186,9 @@ help:
@echo "... rebuild_cache"
@echo "... main"
@echo "... edit_cache"
@echo "... socketMultithread.o"
@echo "... socketMultithread.i"
@echo "... socketMultithread.s"
@echo "... socketThreadpool.o"
@echo "... socketThreadpool.i"
@echo "... socketThreadpool.s"
@echo "... tpool.o"
@echo "... tpool.i"
@echo "... tpool.s"
......
......@@ -102,7 +102,7 @@
<Unit filename="/home/wanhui/Documents/CallJvm/callJvmThreadpool/jni_md.h">
<Option target="main"/>
</Unit>
<Unit filename="/home/wanhui/Documents/CallJvm/callJvmThreadpool/socketMultithread.cpp">
<Unit filename="/home/wanhui/Documents/CallJvm/callJvmThreadpool/socketThreadpool.cpp">
<Option target="main"/>
</Unit>
<Unit filename="/home/wanhui/Documents/CallJvm/callJvmThreadpool/tpool.cpp">
......
此差异已折叠。
此差异已折叠。
//
// Created by wanhui on 11/5/19.
//
#include <cstdio>
#include <cstdlib>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <cstring>
#include <iostream>
#include <vector>
#include <jni.h>
#include "tpool.h"
#define NUM_THREADS 6
#define PORT 8080
struct JVM {
JavaVM *jvm;
};
struct ARGS
{
struct JVM* jvm;
int socket;
};
void *jvmThreads(void *myJvm, char* plainsql, char* dbname);
JNIEnv *create_vm(struct JVM *jvm);
void invoke_class(JNIEnv* env, char* plainsql, char* dbname);
int socket_init();
void* handle_stream(void* arg);
int socket_init()
{
int server_fd, new_socket;
struct sockaddr_in address;
int opt = 1;
int addrlen = sizeof(address);
if ((server_fd = socket(AF_INET, SOCK_STREAM, 0)) == 0) {
perror("socket failed");
exit(EXIT_FAILURE);
}
if (setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR | SO_REUSEPORT, &opt, sizeof(opt))) {
perror("setsockopt");
exit(EXIT_FAILURE);
}
address.sin_family = AF_INET;
address.sin_addr.s_addr = htonl(INADDR_ANY);
address.sin_port = htons(PORT);
if (bind(server_fd, (struct sockaddr *) &address, sizeof(address)) < 0) {
perror("bind failed");
exit(EXIT_FAILURE);
}
if (listen(server_fd, 10) < 0) {
perror("listen failed");
exit(EXIT_FAILURE);
}
printf("listening...\n");
if ((new_socket = accept(server_fd, (struct sockaddr *) &address, (socklen_t *) &addrlen)) < 0) {
perror("accept failed");
exit(EXIT_FAILURE);
}
return new_socket;
}
JNIEnv *create_vm (struct JVM *jvm) {
JNIEnv *env;
JavaVMInitArgs vm_args;
JavaVMOption options[3];
options[0].optionString = "-Djava.compiler=NONE";
options[1].optionString = "-Djava.class.path=.:/home/wanhui/CallJvm/callJvmThreadpool/qin_test1.jar";
options[2].optionString = "-verbose:jni";
vm_args.options = options;
vm_args.nOptions = 3;
vm_args.ignoreUnrecognized = JNI_TRUE;
vm_args.version = JNI_VERSION_1_8;
int status = JNI_CreateJavaVM (&jvm->jvm, (void **) &env, &vm_args);
if (status < 0 || !env) {
printf ("Error: %d\n", status);
return nullptr;
}
return env;
}
void* handle_stream(void* args)
{
struct ARGS *arg = static_cast<ARGS *>(args);
struct JVM* myJvm = arg->jvm;
int client_fd = arg->socket;
char buf[1024] = {0};
char* psql;
char* dbn;
char delims[] = "$";
char *res = nullptr;
std::vector<char*> resvec;
read(client_fd, buf, 1024);
res = strtok(buf, delims);
while (res != nullptr)
{
resvec.push_back(res);
res = strtok(nullptr, delims);
}
psql = resvec[0];
dbn = resvec[1];
jvmThreads(myJvm, psql, dbn);
char hello[] = "Hello send";
send(client_fd, hello, strlen(hello), 0);
close(client_fd);
}
void* jvmThreads(void *myJvm, char* plainsql, char* dbname)
{
auto* myJvmptr = (struct JVM*) myJvm;
JavaVM *jvmPtr = myJvmptr->jvm;
JNIEnv* env = nullptr;
jvmPtr->AttachCurrentThread((void**)&(env), nullptr);
invoke_class(env, plainsql, dbname);
jvmPtr->DetachCurrentThread();
return nullptr;
}
void invoke_class (JNIEnv * env, char* plainsql, char* dbname) {
jclass Main_class;
jmethodID fun_id;
jmethodID static_id;
jmethodID stu_id;
jmethodID hello_id;
jobject obj1;
Main_class = env->FindClass ("com/testjvm/Helloworld");
if(Main_class == nullptr)
return;
// test static function main()
// fun_id = env->GetStaticMethodID (Main_class, "main", "([Ljava/lang/String;)V");
// jstring str = env->NewStringUTF("XWH");
// env->CallStaticVoidMethod(Main_class, fun_id, str);
// test static function name()
// static_id = env->GetStaticMethodID(Main_class, "name", "([Ljava/lang/String;)V");
// jstring str = env->NewStringUTF("XWH");
// env->CallStaticVoidMethod(Main_class, static_id, str);
// test generally function student()
hello_id = env->GetMethodID(Main_class, "<init>", "()V");
obj1 = env->NewObject(Main_class, hello_id);
jstring plainsqlstr = env->NewStringUTF(plainsql);
jstring dbnamestr = env->NewStringUTF(dbname);
stu_id = env->GetMethodID(Main_class, "student", "([Ljava/lang/String;)V");
env->CallObjectMethod(obj1, stu_id, dbnamestr);
}
int main () {
struct JVM myJvm{};
JNIEnv *myEnv = create_vm (&myJvm);
if (myEnv == nullptr)
{
printf("create_vm failed\n");
exit(1);
}
if(tpool_create(NUM_THREADS) != 0)
{
printf("tpool_create failed\n");
exit(1);
}
int client_fd, new_socket;
struct sockaddr_in address;
int addrlen = sizeof(address);
client_fd = socket_init();
while (1){
new_socket = accept(client_fd, (struct sockaddr *) &address, (socklen_t *) &addrlen);
struct ARGS *args;
args = static_cast<ARGS *>(malloc(sizeof(struct args *)));
args->jvm = &myJvm;
args->socket = new_socket;
tpool_add_work(handle_stream, args);
}
// handle_stream(args);
// while (1)
// {
//
//
// tpool_add_work(handle_stream, args);
// }
// only 10 tasks
// int i;
// for(i = 0; i < 10; i++)
// {
// tpool_add_work(handle_stream, args);
// }
sleep(2);
tpool_destroy();
myJvm.jvm->DestroyJavaVM ();