diff --git a/disruptor_nmc/.gitignore b/disruptor_nmc/.gitignore
deleted file mode 100644
index 549e00a..0000000
--- a/disruptor_nmc/.gitignore
+++ /dev/null
@@ -1,33 +0,0 @@
-HELP.md
-target/
-!.mvn/wrapper/maven-wrapper.jar
-!**/src/main/**/target/
-!**/src/test/**/target/
-
-### STS ###
-.apt_generated
-.classpath
-.factorypath
-.project
-.settings
-.springBeans
-.sts4-cache
-
-### IntelliJ IDEA ###
-.idea
-*.iws
-*.iml
-*.ipr
-
-### NetBeans ###
-/nbproject/private/
-/nbbuild/
-/dist/
-/nbdist/
-/.nb-gradle/
-build/
-!**/src/main/**/build/
-!**/src/test/**/build/
-
-### VS Code ###
-.vscode/
diff --git a/disruptor_nmc/.mvn/wrapper/maven-wrapper.jar b/disruptor_nmc/.mvn/wrapper/maven-wrapper.jar
deleted file mode 100644
index cb28b0e..0000000
Binary files a/disruptor_nmc/.mvn/wrapper/maven-wrapper.jar and /dev/null differ
diff --git a/disruptor_nmc/.mvn/wrapper/maven-wrapper.properties b/disruptor_nmc/.mvn/wrapper/maven-wrapper.properties
deleted file mode 100644
index 5f0536e..0000000
--- a/disruptor_nmc/.mvn/wrapper/maven-wrapper.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip
-wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
diff --git a/disruptor_nmc/mvnw b/disruptor_nmc/mvnw
deleted file mode 100755
index 66df285..0000000
--- a/disruptor_nmc/mvnw
+++ /dev/null
@@ -1,308 +0,0 @@
-#!/bin/sh
-# ----------------------------------------------------------------------------
-# 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
-#
-# https://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.
-# ----------------------------------------------------------------------------
-
-# ----------------------------------------------------------------------------
-# Apache Maven Wrapper startup batch script, version 3.2.0
-#
-# Required ENV vars:
-# ------------------
-# JAVA_HOME - location of a JDK home dir
-#
-# Optional ENV vars
-# -----------------
-# MAVEN_OPTS - parameters passed to the Java VM when running Maven
-# e.g. to debug Maven itself, use
-# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
-# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
-# ----------------------------------------------------------------------------
-
-if [ -z "$MAVEN_SKIP_RC" ] ; then
-
- if [ -f /usr/local/etc/mavenrc ] ; then
- . /usr/local/etc/mavenrc
- fi
-
- if [ -f /etc/mavenrc ] ; then
- . /etc/mavenrc
- fi
-
- if [ -f "$HOME/.mavenrc" ] ; then
- . "$HOME/.mavenrc"
- fi
-
-fi
-
-# OS specific support. $var _must_ be set to either true or false.
-cygwin=false;
-darwin=false;
-mingw=false
-case "$(uname)" in
- CYGWIN*) cygwin=true ;;
- MINGW*) mingw=true;;
- Darwin*) darwin=true
- # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
- # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
- if [ -z "$JAVA_HOME" ]; then
- if [ -x "/usr/libexec/java_home" ]; then
- JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME
- else
- JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
- fi
- fi
- ;;
-esac
-
-if [ -z "$JAVA_HOME" ] ; then
- if [ -r /etc/gentoo-release ] ; then
- JAVA_HOME=$(java-config --jre-home)
- fi
-fi
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME=$(cygpath --unix "$JAVA_HOME")
- [ -n "$CLASSPATH" ] &&
- CLASSPATH=$(cygpath --path --unix "$CLASSPATH")
-fi
-
-# For Mingw, ensure paths are in UNIX format before anything is touched
-if $mingw ; then
- [ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] &&
- JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)"
-fi
-
-if [ -z "$JAVA_HOME" ]; then
- javaExecutable="$(which javac)"
- if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then
- # readlink(1) is not available as standard on Solaris 10.
- readLink=$(which readlink)
- if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then
- if $darwin ; then
- javaHome="$(dirname "\"$javaExecutable\"")"
- javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac"
- else
- javaExecutable="$(readlink -f "\"$javaExecutable\"")"
- fi
- javaHome="$(dirname "\"$javaExecutable\"")"
- javaHome=$(expr "$javaHome" : '\(.*\)/bin')
- JAVA_HOME="$javaHome"
- export JAVA_HOME
- fi
- fi
-fi
-
-if [ -z "$JAVACMD" ] ; then
- if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- else
- JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)"
- fi
-fi
-
-if [ ! -x "$JAVACMD" ] ; then
- echo "Error: JAVA_HOME is not defined correctly." >&2
- echo " We cannot execute $JAVACMD" >&2
- exit 1
-fi
-
-if [ -z "$JAVA_HOME" ] ; then
- echo "Warning: JAVA_HOME environment variable is not set."
-fi
-
-# traverses directory structure from process work directory to filesystem root
-# first directory with .mvn subdirectory is considered project base directory
-find_maven_basedir() {
- if [ -z "$1" ]
- then
- echo "Path not specified to find_maven_basedir"
- return 1
- fi
-
- basedir="$1"
- wdir="$1"
- while [ "$wdir" != '/' ] ; do
- if [ -d "$wdir"/.mvn ] ; then
- basedir=$wdir
- break
- fi
- # workaround for JBEAP-8937 (on Solaris 10/Sparc)
- if [ -d "${wdir}" ]; then
- wdir=$(cd "$wdir/.." || exit 1; pwd)
- fi
- # end of workaround
- done
- printf '%s' "$(cd "$basedir" || exit 1; pwd)"
-}
-
-# concatenates all lines of a file
-concat_lines() {
- if [ -f "$1" ]; then
- # Remove \r in case we run on Windows within Git Bash
- # and check out the repository with auto CRLF management
- # enabled. Otherwise, we may read lines that are delimited with
- # \r\n and produce $'-Xarg\r' rather than -Xarg due to word
- # splitting rules.
- tr -s '\r\n' ' ' < "$1"
- fi
-}
-
-log() {
- if [ "$MVNW_VERBOSE" = true ]; then
- printf '%s\n' "$1"
- fi
-}
-
-BASE_DIR=$(find_maven_basedir "$(dirname "$0")")
-if [ -z "$BASE_DIR" ]; then
- exit 1;
-fi
-
-MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR
-log "$MAVEN_PROJECTBASEDIR"
-
-##########################################################################################
-# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
-# This allows using the maven wrapper in projects that prohibit checking in binary data.
-##########################################################################################
-wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar"
-if [ -r "$wrapperJarPath" ]; then
- log "Found $wrapperJarPath"
-else
- log "Couldn't find $wrapperJarPath, downloading it ..."
-
- if [ -n "$MVNW_REPOURL" ]; then
- wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
- else
- wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
- fi
- while IFS="=" read -r key value; do
- # Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' )
- safeValue=$(echo "$value" | tr -d '\r')
- case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;;
- esac
- done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
- log "Downloading from: $wrapperUrl"
-
- if $cygwin; then
- wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath")
- fi
-
- if command -v wget > /dev/null; then
- log "Found wget ... using wget"
- [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet"
- if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
- wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
- else
- wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
- fi
- elif command -v curl > /dev/null; then
- log "Found curl ... using curl"
- [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent"
- if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
- curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
- else
- curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
- fi
- else
- log "Falling back to using Java to download"
- javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java"
- javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class"
- # For Cygwin, switch paths to Windows format before running javac
- if $cygwin; then
- javaSource=$(cygpath --path --windows "$javaSource")
- javaClass=$(cygpath --path --windows "$javaClass")
- fi
- if [ -e "$javaSource" ]; then
- if [ ! -e "$javaClass" ]; then
- log " - Compiling MavenWrapperDownloader.java ..."
- ("$JAVA_HOME/bin/javac" "$javaSource")
- fi
- if [ -e "$javaClass" ]; then
- log " - Running MavenWrapperDownloader.java ..."
- ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath"
- fi
- fi
- fi
-fi
-##########################################################################################
-# End of extension
-##########################################################################################
-
-# If specified, validate the SHA-256 sum of the Maven wrapper jar file
-wrapperSha256Sum=""
-while IFS="=" read -r key value; do
- case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;;
- esac
-done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
-if [ -n "$wrapperSha256Sum" ]; then
- wrapperSha256Result=false
- if command -v sha256sum > /dev/null; then
- if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then
- wrapperSha256Result=true
- fi
- elif command -v shasum > /dev/null; then
- if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then
- wrapperSha256Result=true
- fi
- else
- echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available."
- echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties."
- exit 1
- fi
- if [ $wrapperSha256Result = false ]; then
- echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2
- echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2
- echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2
- exit 1
- fi
-fi
-
-MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin; then
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME")
- [ -n "$CLASSPATH" ] &&
- CLASSPATH=$(cygpath --path --windows "$CLASSPATH")
- [ -n "$MAVEN_PROJECTBASEDIR" ] &&
- MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR")
-fi
-
-# Provide a "standardized" way to retrieve the CLI args that will
-# work with both Windows and non-Windows executions.
-MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*"
-export MAVEN_CMD_LINE_ARGS
-
-WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
-
-# shellcheck disable=SC2086 # safe args
-exec "$JAVACMD" \
- $MAVEN_OPTS \
- $MAVEN_DEBUG_OPTS \
- -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
- "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
- ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
diff --git a/disruptor_nmc/mvnw.cmd b/disruptor_nmc/mvnw.cmd
deleted file mode 100644
index 95ba6f5..0000000
--- a/disruptor_nmc/mvnw.cmd
+++ /dev/null
@@ -1,205 +0,0 @@
-@REM ----------------------------------------------------------------------------
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements. See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership. The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License. You may obtain a copy of the License at
-@REM
-@REM https://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing,
-@REM software distributed under the License is distributed on an
-@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@REM KIND, either express or implied. See the License for the
-@REM specific language governing permissions and limitations
-@REM under the License.
-@REM ----------------------------------------------------------------------------
-
-@REM ----------------------------------------------------------------------------
-@REM Apache Maven Wrapper startup batch script, version 3.2.0
-@REM
-@REM Required ENV vars:
-@REM JAVA_HOME - location of a JDK home dir
-@REM
-@REM Optional ENV vars
-@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
-@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
-@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
-@REM e.g. to debug Maven itself, use
-@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
-@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
-@REM ----------------------------------------------------------------------------
-
-@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
-@echo off
-@REM set title of command window
-title %0
-@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
-@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
-
-@REM set %HOME% to equivalent of $HOME
-if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
-
-@REM Execute a user defined script before this one
-if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
-@REM check for pre script, once with legacy .bat ending and once with .cmd ending
-if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
-if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
-:skipRcPre
-
-@setlocal
-
-set ERROR_CODE=0
-
-@REM To isolate internal variables from possible post scripts, we use another setlocal
-@setlocal
-
-@REM ==== START VALIDATION ====
-if not "%JAVA_HOME%" == "" goto OkJHome
-
-echo.
-echo Error: JAVA_HOME not found in your environment. >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo.
-goto error
-
-:OkJHome
-if exist "%JAVA_HOME%\bin\java.exe" goto init
-
-echo.
-echo Error: JAVA_HOME is set to an invalid directory. >&2
-echo JAVA_HOME = "%JAVA_HOME%" >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo.
-goto error
-
-@REM ==== END VALIDATION ====
-
-:init
-
-@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
-@REM Fallback to current working directory if not found.
-
-set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
-IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
-
-set EXEC_DIR=%CD%
-set WDIR=%EXEC_DIR%
-:findBaseDir
-IF EXIST "%WDIR%"\.mvn goto baseDirFound
-cd ..
-IF "%WDIR%"=="%CD%" goto baseDirNotFound
-set WDIR=%CD%
-goto findBaseDir
-
-:baseDirFound
-set MAVEN_PROJECTBASEDIR=%WDIR%
-cd "%EXEC_DIR%"
-goto endDetectBaseDir
-
-:baseDirNotFound
-set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
-cd "%EXEC_DIR%"
-
-:endDetectBaseDir
-
-IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
-
-@setlocal EnableExtensions EnableDelayedExpansion
-for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
-@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
-
-:endReadAdditionalConfig
-
-SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
-set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
-set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
-
-set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
-
-FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
- IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
-)
-
-@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
-@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
-if exist %WRAPPER_JAR% (
- if "%MVNW_VERBOSE%" == "true" (
- echo Found %WRAPPER_JAR%
- )
-) else (
- if not "%MVNW_REPOURL%" == "" (
- SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
- )
- if "%MVNW_VERBOSE%" == "true" (
- echo Couldn't find %WRAPPER_JAR%, downloading it ...
- echo Downloading from: %WRAPPER_URL%
- )
-
- powershell -Command "&{"^
- "$webclient = new-object System.Net.WebClient;"^
- "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
- "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
- "}"^
- "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
- "}"
- if "%MVNW_VERBOSE%" == "true" (
- echo Finished downloading %WRAPPER_JAR%
- )
-)
-@REM End of extension
-
-@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file
-SET WRAPPER_SHA_256_SUM=""
-FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
- IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B
-)
-IF NOT %WRAPPER_SHA_256_SUM%=="" (
- powershell -Command "&{"^
- "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^
- "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^
- " Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^
- " Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^
- " Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^
- " exit 1;"^
- "}"^
- "}"
- if ERRORLEVEL 1 goto error
-)
-
-@REM Provide a "standardized" way to retrieve the CLI args that will
-@REM work with both Windows and non-Windows executions.
-set MAVEN_CMD_LINE_ARGS=%*
-
-%MAVEN_JAVA_EXE% ^
- %JVM_CONFIG_MAVEN_PROPS% ^
- %MAVEN_OPTS% ^
- %MAVEN_DEBUG_OPTS% ^
- -classpath %WRAPPER_JAR% ^
- "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
- %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
-if ERRORLEVEL 1 goto error
-goto end
-
-:error
-set ERROR_CODE=1
-
-:end
-@endlocal & set ERROR_CODE=%ERROR_CODE%
-
-if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
-@REM check for post script, once with legacy .bat ending and once with .cmd ending
-if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
-if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
-:skipRcPost
-
-@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
-if "%MAVEN_BATCH_PAUSE%"=="on" pause
-
-if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
-
-cmd /C exit /B %ERROR_CODE%
diff --git a/disruptor_nmc/pom.xml b/disruptor_nmc/pom.xml
deleted file mode 100644
index 83b3940..0000000
--- a/disruptor_nmc/pom.xml
+++ /dev/null
@@ -1,185 +0,0 @@
-
-
- 4.0.0
-
- org.springframework.boot
- spring-boot-starter-parent
- 2.5.3
-
-
- com.rehome
- disruptor_nmc
- war
- 1.0.0
- disruptor_nmc
- SpringBoot + Disruptor 实现特快高并发处理,支撑每秒 600 万订单无压力!
-
- 1.8
- 2020.0.3
-
-
-
- org.springframework.boot
- spring-boot-starter-data-jpa
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
- org.mybatis.spring.boot
- mybatis-spring-boot-starter
- 2.1.4
-
-
- javax.validation
- validation-api
- 2.0.1.Final
-
-
- org.springframework.boot
- spring-boot-starter-validation
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- org.eclipse.paho
- org.eclipse.paho.client.mqttv3
- 1.2.0
-
-
- com.google.code.gson
- gson
- 2.8.2
-
-
- com.squareup.okhttp3
- okhttp
- 3.6.0
-
-
- org.apache.commons
- commons-lang3
- 3.9
-
-
- org.jetbrains
- annotations
- 19.0.0
-
-
-
- org.projectlombok
- lombok
- 1.18.20
- true
-
-
-
- org.apache.logging.log4j
- log4j-api
- 2.17.1
-
-
-
- org.apache.logging.log4j
- log4j-core
- 2.17.1
-
-
- com.github.xiaoymin
- swagger-bootstrap-ui
- 1.9.6
-
-
- commons-io
- commons-io
- 2.4
-
-
-
- mysql
- mysql-connector-java
- 8.0.26
- runtime
-
-
-
- com.oracle
- ojdbc6
- 11.2.0.1.0
-
-
-
- com.microsoft.sqlserver
- mssql-jdbc
- 11.2.0.jre8
-
-
- io.swagger
- swagger-annotations
- 1.5.20
-
-
- com.alibaba
- fastjson
- 1.2.47
-
-
- org.bouncycastle
- bcprov-jdk15on
- 1.60
- compile
-
-
- org.bouncycastle
- bcpkix-jdk15on
- 1.60
- compile
-
-
- commons-codec
- commons-codec
- 1.11
- compile
-
-
- com.lmax
- disruptor
- 3.4.4
-
-
- com.liuhuiyu
- spring-util
- 2021.1.0
-
-
- com.liuhuiyu
- util
- 2022.1.0
-
-
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
- true
-
-
-
-
-
-
diff --git a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/DisruptorNmcApplication.java b/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/DisruptorNmcApplication.java
deleted file mode 100644
index 452a64a..0000000
--- a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/DisruptorNmcApplication.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package com.rehome.disruptor_nmc;
-
-import com.rehome.disruptor_nmc.service.DisruptorMqService;
-import com.rehome.disruptor_nmc.service.TemperatureService;
-import org.springframework.beans.BeansException;
-import org.springframework.boot.CommandLineRunner;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.builder.SpringApplicationBuilder;
-import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
-import org.springframework.scheduling.annotation.EnableScheduling;
-import org.springframework.web.bind.annotation.RequestMapping;
-import javax.annotation.Resource;
-import java.util.Map;
-
-@EnableJpaAuditing
-@EnableScheduling
-@SpringBootApplication
-public class DisruptorNmcApplication extends SpringBootServletInitializer implements CommandLineRunner, ApplicationContextAware {
-
- /**
- * 获取Spring框架的上下文
- */
- private ApplicationContext applicationContext;
- /**
- 后台接口自动导入
- */
- @Resource
- private DisruptorMqService disruptorMqService;
-
- public static void main(String[] args) {
- SpringApplication.run(DisruptorNmcApplication.class, args);
- }
-
- /**
- * @date 2021-05-18 09:20
- * @description: 容器配置,springboot打war包布署必须添加这个配置 为了打包springboot项目
- * @Param: SpringApplicationBuilder
- */
- @Override
- protected SpringApplicationBuilder configure(
- SpringApplicationBuilder builder) {
- return builder.sources(DisruptorNmcApplication.class);
- }
-
-
- @Override
- public void run(String... args) {
- //在这里可以调用applicationContext了
- Map controllers = applicationContext.getBeansWithAnnotation(RequestMapping.class);
- for (Map.Entry entry : controllers.entrySet()) {
- System.out.println("------------------------");
- System.out.println(entry.getKey());//demo1Controller
- }
- try {
- if (disruptorMqService != null) {
- System.out.println("------------------------");
- System.out.println("DisruptorMqService is not empty");
- //guangzhuo server temperature mqtt
-// MqttRSAClient client = new MqttRSAClient();
-// client.start(disruptorMqService);
-
- //hk aliyun temperature mqtt
-// MqttHkRSAClient clientHk = new MqttHkRSAClient();
-// clientHk.start(disruptorMqService);
- //hk aliyun app_push mqtt
- MqttHkAppPushRSAClient clientAppPush = new MqttHkAppPushRSAClient();
- clientAppPush.start(disruptorMqService);
- } else {
- System.out.println("DisruptorMqService is empty");
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-
- @Override
- public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
- this.applicationContext = applicationContext;
- }
-
-
-}
diff --git a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/MqttHkAppPushRSAClient.java b/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/MqttHkAppPushRSAClient.java
deleted file mode 100644
index 572675e..0000000
--- a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/MqttHkAppPushRSAClient.java
+++ /dev/null
@@ -1,149 +0,0 @@
-package com.rehome.disruptor_nmc;
-
-
-
-import com.rehome.disruptor_nmc.service.DisruptorMqService;
-import com.rehome.disruptor_nmc.utils.MqttSSLSocketFactory;
-import com.rehome.disruptor_nmc.utils.UUIDUtil;
-import org.eclipse.paho.client.mqttv3.*;
-import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
-import javax.net.ssl.SSLSocketFactory;
-import java.io.InputStream;
-import java.util.Timer;
-import java.util.TimerTask;
-
-
-public class MqttHkAppPushRSAClient {
- /**
- * 代理服务器ip地址
- */
- public static final String MQTT_BROKER_HOST = "ssl://47.242.184.139:8883";
-
- /**
- * 客户端唯一标识
- */
- public static String MQTT_CLIENT_ID = "AppServer_disruptor_nmc_server_03";
-
- /**
- *帐号
- */
- public static String USERNAME = "admin";
- /**
- * 密码
- */
- public static String PASSWORD = "publish452131wW452131wW$";
- /**
- * 订阅标识
- */
- public static String TOPIC_FILTER = "app_push";
-
- private volatile static MqttClient mqttClient;
- private static MqttConnectOptions options;
- private static int qos = 2;
-
- //定时器
- private Timer timer;
-
- public MqttHkAppPushRSAClient(){
- try {
- MQTT_CLIENT_ID = UUIDUtil.getUUID();
- // host为主机名,clientid即连接MQTT的客户端ID,一般以客户端唯一标识符表示,
- // MemoryPersistence设置clientid的保存形式,默认为以内存保存
- mqttClient = new MqttClient(MQTT_BROKER_HOST, MQTT_CLIENT_ID, new MemoryPersistence());
- // 配置参数信息
- options = new MqttConnectOptions();
- // 设置是否清空session,这里如果设置为false表示服务器会保留客户端的连接记录,
- // 这里设置为true表示每次连接到服务器都以新的身份连接
- options.setCleanSession(false);
- // 设置用户名
- options.setUserName(USERNAME);
- // 设置密码
- options.setPassword(PASSWORD.toCharArray());
- // 设置超时时间 单位为秒
- options.setConnectionTimeout(10);
- // 设置会话心跳时间 单位为秒 服务器会每隔1.5*20秒的时间向客户端发送个消息判断客户端是否在线,但这个方法并没有重连的机制
- options.setKeepAliveInterval(20);
- //断线重连
- options.setAutomaticReconnect(true);
- //mqtt服务器端单双向加密
- InputStream caCrtFile = this.getClass().getResourceAsStream("/sslHk/my_root_ca.crt");
- InputStream crtFile = this.getClass().getResourceAsStream("/sslHk/client.crt");
- InputStream keyFile = this.getClass().getResourceAsStream("/sslHk/client.key");
- String password = "";
- SSLSocketFactory socketFactory = MqttSSLSocketFactory.getTwoDirSocketFactory(caCrtFile,crtFile,keyFile,password);
- options.setSocketFactory(socketFactory);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- public void start(DisruptorMqService disruptorMqService) {
- try {
- // 连接
- mqttClient.connect(options);
- // 订阅
- mqttClient.subscribe(TOPIC_FILTER,qos);
- // 设置回调
- mqttClient.setCallback(new MqttCallbackExtended(){
-
- @Override
- public void connectionLost(Throwable throwable) {
- System.out.println("connectionLost");
- try {
- mqttClient.reconnect();
- } catch (MqttException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void messageArrived(String s, MqttMessage mqttMessage) {
- String strData = new String(mqttMessage.getPayload());
- System.out.println("topic:"+s);
- System.out.println("Qos:"+mqttMessage.getQos());
- System.out.println("message RSA:"+strData);
- //disruptorMqService.pushTemperatureToMq(strData,s);
- }
-
- @Override
- public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
- System.out.println("deliveryComplete---------"+ iMqttDeliveryToken.isComplete());
- }
-
- @Override
- public void connectComplete(boolean b, String s) {
- //连接成功后调用
- try {
- mqttClient.subscribe(TOPIC_FILTER,qos);//具体订阅代码
- } catch (MqttException e) {
- e.printStackTrace();
- }
- }
- });
-
- timer = new Timer();
- timer.schedule(new TimerTask() {
- public void run() {
- System.out.println("-------设定要指定任务--------");
- try {
- //判断拦截状态,这里注意一下,如果没有这个判断,是非常坑的
- if (!mqttClient.isConnected()) {
- System.out.println("***** 没有连接到服务器 *****");
- System.out.println("***** client to connect *****");
- // 重新连接
- mqttClient.connect(options);
- }
- if (mqttClient.isConnected()) {//连接成功,跳出连接
- System.out.println("***** connect success *****");
- }
- } catch (MqttException e1) {
- e1.printStackTrace();
- }
- }
- }, 10000,10000);
- // 设定指定的时间time,此处为10000毫秒
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
-
diff --git a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/MqttHkRSAClient.java b/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/MqttHkRSAClient.java
deleted file mode 100644
index 1d7c6bc..0000000
--- a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/MqttHkRSAClient.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package com.rehome.disruptor_nmc;
-
-
-import com.rehome.disruptor_nmc.service.DisruptorMqService;
-import com.rehome.disruptor_nmc.utils.MqttSSLSocketFactory;
-import com.rehome.disruptor_nmc.utils.UUIDUtil;
-import org.eclipse.paho.client.mqttv3.*;
-import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
-import javax.net.ssl.SSLSocketFactory;
-import java.io.InputStream;
-import java.util.Timer;
-import java.util.TimerTask;
-
-
-public class MqttHkRSAClient {
- /**
- * 代理服务器ip地址
- */
- public static final String MQTT_BROKER_HOST = "ssl://47.242.184.139:8883";
-
- /**
- * 客户端唯一标识
- */
- public static String MQTT_CLIENT_ID = "AppServer_disruptor_nmc_server_02";
-
- /**
- *帐号
- */
- public static String USERNAME = "admin";
- /**
- * 密码
- */
- public static String PASSWORD = "publish452131wW452131wW$";
- /**
- * 订阅标识
- */
- public static String TOPIC_FILTER = "WifiSHT/+/SHT20";
-
- private volatile static MqttClient mqttClient;
- private static MqttConnectOptions options;
- private static int qos = 2;
-
- //定时器
- private Timer timer;
-
- public MqttHkRSAClient(){
- try {
- MQTT_CLIENT_ID = UUIDUtil.getUUID();
- // host为主机名,clientid即连接MQTT的客户端ID,一般以客户端唯一标识符表示,
- // MemoryPersistence设置clientid的保存形式,默认为以内存保存
- mqttClient = new MqttClient(MQTT_BROKER_HOST, MQTT_CLIENT_ID, new MemoryPersistence());
- // 配置参数信息
- options = new MqttConnectOptions();
- // 设置是否清空session,这里如果设置为false表示服务器会保留客户端的连接记录,
- // 这里设置为true表示每次连接到服务器都以新的身份连接
- options.setCleanSession(false);
- // 设置用户名
- options.setUserName(USERNAME);
- // 设置密码
- options.setPassword(PASSWORD.toCharArray());
- // 设置超时时间 单位为秒
- options.setConnectionTimeout(10);
- // 设置会话心跳时间 单位为秒 服务器会每隔1.5*20秒的时间向客户端发送个消息判断客户端是否在线,但这个方法并没有重连的机制
- options.setKeepAliveInterval(20);
- //断线重连
- options.setAutomaticReconnect(true);
- //mqtt服务器端单双向加密
- InputStream caCrtFile = this.getClass().getResourceAsStream("/sslHk/my_root_ca.crt");
- InputStream crtFile = this.getClass().getResourceAsStream("/sslHk/client.crt");
- InputStream keyFile = this.getClass().getResourceAsStream("/sslHk/client.key");
- String password = "";
- SSLSocketFactory socketFactory = MqttSSLSocketFactory.getTwoDirSocketFactory(caCrtFile,crtFile,keyFile,password);
- options.setSocketFactory(socketFactory);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- public void start(DisruptorMqService disruptorMqService) {
- try {
- // 连接
- mqttClient.connect(options);
- // 订阅
- mqttClient.subscribe(TOPIC_FILTER,qos);
- // 设置回调
- mqttClient.setCallback(new MqttCallbackExtended(){
-
- @Override
- public void connectionLost(Throwable throwable) {
- System.out.println("connectionLost");
- try {
- mqttClient.reconnect();
- } catch (MqttException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void messageArrived(String s, MqttMessage mqttMessage) {
- String strData = new String(mqttMessage.getPayload());
- System.out.println("topic:"+s);
- System.out.println("Qos:"+mqttMessage.getQos());
- System.out.println("message RSA:"+strData);
- disruptorMqService.pushTemperatureToMq(strData,s);
- }
-
- @Override
- public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
- System.out.println("deliveryComplete---------"+ iMqttDeliveryToken.isComplete());
- }
-
- @Override
- public void connectComplete(boolean b, String s) {
- //连接成功后调用
- try {
- mqttClient.subscribe(TOPIC_FILTER,qos);//具体订阅代码
- } catch (MqttException e) {
- e.printStackTrace();
- }
- }
- });
-
- timer = new Timer();
- timer.schedule(new TimerTask() {
- public void run() {
- System.out.println("-------设定要指定任务--------");
- try {
- //判断拦截状态,这里注意一下,如果没有这个判断,是非常坑的
- if (!mqttClient.isConnected()) {
- System.out.println("***** 没有连接到服务器 *****");
- System.out.println("***** client to connect *****");
- // 重新连接
- mqttClient.connect(options);
- }
- if (mqttClient.isConnected()) {//连接成功,跳出连接
- System.out.println("***** connect success *****");
- }
- } catch (MqttException e1) {
- e1.printStackTrace();
- }
- }
- }, 10000,10000);
- // 设定指定的时间time,此处为10000毫秒
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
\ No newline at end of file
diff --git a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/MqttRSAClient.java b/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/MqttRSAClient.java
deleted file mode 100644
index d384fac..0000000
--- a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/MqttRSAClient.java
+++ /dev/null
@@ -1,148 +0,0 @@
-package com.rehome.disruptor_nmc;
-
-
-import com.rehome.disruptor_nmc.service.DisruptorMqService;
-import com.rehome.disruptor_nmc.service.TemperatureService;
-import com.rehome.disruptor_nmc.utils.MqttSSLSocketFactory;
-import com.rehome.disruptor_nmc.utils.UUIDUtil;
-import org.eclipse.paho.client.mqttv3.*;
-import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
-import javax.net.ssl.SSLSocketFactory;
-import java.io.InputStream;
-import java.util.Timer;
-import java.util.TimerTask;
-
-
-public class MqttRSAClient {
- /**
- * 代理服务器ip地址
- */
- public static final String MQTT_BROKER_HOST = "ssl://119.91.158.116:8883";
-
- /**
- * 客户端唯一标识
- */
- public static String MQTT_CLIENT_ID = "AppServer_disruptor_nmc_server_01";
-
- /**
- *帐号
- */
- public static String USERNAME = "admin";
- /**
- * 密码
- */
- public static String PASSWORD = "publish452131wW452131wW$";
- /**
- * 订阅标识
- */
- public static String TOPIC_FILTER = "WifiSHT/+/SHT20";
-
- private volatile static MqttClient mqttClient;
- private static MqttConnectOptions options;
- private static int qos = 2;
-
- //定时器
- private Timer timer;
-
- public MqttRSAClient(){
- try {
- MQTT_CLIENT_ID = UUIDUtil.getUUID();
- // host为主机名,clientid即连接MQTT的客户端ID,一般以客户端唯一标识符表示,
- // MemoryPersistence设置clientid的保存形式,默认为以内存保存
- mqttClient = new MqttClient(MQTT_BROKER_HOST, MQTT_CLIENT_ID, new MemoryPersistence());
- // 配置参数信息
- options = new MqttConnectOptions();
- // 设置是否清空session,这里如果设置为false表示服务器会保留客户端的连接记录,
- // 这里设置为true表示每次连接到服务器都以新的身份连接
- options.setCleanSession(false);
- // 设置用户名
- options.setUserName(USERNAME);
- // 设置密码
- options.setPassword(PASSWORD.toCharArray());
- // 设置超时时间 单位为秒
- options.setConnectionTimeout(10);
- // 设置会话心跳时间 单位为秒 服务器会每隔1.5*20秒的时间向客户端发送个消息判断客户端是否在线,但这个方法并没有重连的机制
- options.setKeepAliveInterval(20);
- //断线重连
- options.setAutomaticReconnect(true);
- //mqtt服务器端单双向加密
- InputStream caCrtFile = this.getClass().getResourceAsStream("/ssl/my_root_ca.crt");
- InputStream crtFile = this.getClass().getResourceAsStream("/ssl/client.crt");
- InputStream keyFile = this.getClass().getResourceAsStream("/ssl/client.key");
- String password = "";
- SSLSocketFactory socketFactory = MqttSSLSocketFactory.getTwoDirSocketFactory(caCrtFile,crtFile,keyFile,password);
- options.setSocketFactory(socketFactory);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- public void start(DisruptorMqService disruptorMqService) {
- try {
- // 连接
- mqttClient.connect(options);
- // 订阅
- mqttClient.subscribe(TOPIC_FILTER,qos);
- // 设置回调
- mqttClient.setCallback(new MqttCallbackExtended(){
-
- @Override
- public void connectionLost(Throwable throwable) {
- System.out.println("connectionLost");
- try {
- mqttClient.reconnect();
- } catch (MqttException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void messageArrived(String s, MqttMessage mqttMessage) {
- String strData = new String(mqttMessage.getPayload());
- System.out.println("topic:"+s);
- System.out.println("Qos:"+mqttMessage.getQos());
- System.out.println("message RSA:"+strData);
- disruptorMqService.pushTemperatureToMq(strData,s);
- }
-
- @Override
- public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
- System.out.println("deliveryComplete---------"+ iMqttDeliveryToken.isComplete());
- }
-
- @Override
- public void connectComplete(boolean b, String s) {
- //连接成功后调用
- try {
- mqttClient.subscribe(TOPIC_FILTER,qos);//具体订阅代码
- } catch (MqttException e) {
- e.printStackTrace();
- }
- }
- });
-
- timer = new Timer();
- timer.schedule(new TimerTask() {
- public void run() {
- System.out.println("-------设定要指定任务--------");
- try {
- //判断拦截状态,这里注意一下,如果没有这个判断,是非常坑的
- if (!mqttClient.isConnected()) {
- System.out.println("***** 没有连接到服务器 *****");
- System.out.println("***** client to connect *****");
- // 重新连接
- mqttClient.connect(options);
- }
- if (mqttClient.isConnected()) {//连接成功,跳出连接
- System.out.println("***** connect success *****");
- }
- } catch (MqttException e1) {
- e1.printStackTrace();
- }
- }
- }, 10000,10000);
- // 设定指定的时间time,此处为10000毫秒
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
diff --git a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/RSAAndroid.java b/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/RSAAndroid.java
deleted file mode 100644
index d1f41d8..0000000
--- a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/RSAAndroid.java
+++ /dev/null
@@ -1,527 +0,0 @@
-package com.rehome.disruptor_nmc;
-
-
-/**
- * @ Author : huangwenfei
- * @ Date : Created in 2021/8/11 10:44 下午
- * @ Version : $1.0.0.0
- * @ Description:
- */
-
-import org.apache.commons.codec.binary.Base64;
-
-import javax.crypto.Cipher;
-import java.nio.charset.StandardCharsets;
-import java.security.*;
-import java.security.interfaces.RSAPrivateKey;
-import java.security.interfaces.RSAPublicKey;
-import java.security.spec.PKCS8EncodedKeySpec;
-import java.security.spec.X509EncodedKeySpec;
-import java.util.ArrayList;
-import java.util.List;
-
-
-public class RSAAndroid {
- private static String TAG = "RSAAndroid";
- public static final String RSA = "RSA";// 非对称加密密钥算法
- //public static final String ECB_PKCS1_PADDING = "RSA/ECB/PKCS1Padding";//加密填充方式
- public static final String ECB_PKCS1_PADDING = "RSA";//加密填充方式 RSA/None/PKCS1Padding
- public static final int DEFAULT_KEY_SIZE = 2048;//秘钥默认长度
- public static final byte[] DEFAULT_SPLIT = "#PART#".getBytes(); // 当要加密的内容超过bufferSize,则采用partSplit进行分块加密
- public static final int DEFAULT_BUFFERSIZE = (DEFAULT_KEY_SIZE / 8) - 11;// 当前秘钥支持加密的最大字节数
- public static String publicRsaKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmMLyJw1CAl25lnDgEeYZvOps+1pSi93Q39djEniGNo5uUKVEkqDIayTli2zreX10HqT2jTtDN9APtwuEhWazP/VgOXoWsztbtZtSwJGM6Eg0R9zDCbKyQt5Qhg3jkTrXrvrGn7j/ZP56VNWELv/i5dsRCTccr1MeIyxjOC2pojCOsrTN4HZzgBj+GEUKPRLcKOiPfOsoP7HgkAua82vTOIgWpqIp+1PIfcjjCqzOsSv5PQnGP75+flIXtz75OKo/9hX9zl5JHNcH3SC6nS8Czii9E292XIsBtKdQijvNMn+YcmKFo6mZOUXHdO506NoKkxRny5fbKiPf/oqTA7Zx5QIDAQAB";
- public static String privateRsaKey = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCYwvInDUICXbmWcOAR5hm86mz7WlKL3dDf12MSeIY2jm5QpUSSoMhrJOWLbOt5fXQepPaNO0M30A+3C4SFZrM/9WA5ehazO1u1m1LAkYzoSDRH3MMJsrJC3lCGDeOROteu+safuP9k/npU1YQu/+Ll2xEJNxyvUx4jLGM4LamiMI6ytM3gdnOAGP4YRQo9Etwo6I986yg/seCQC5rza9M4iBamoin7U8h9yOMKrM6xK/k9CcY/vn5+Uhe3Pvk4qj/2Ff3OXkkc1wfdILqdLwLOKL0Tb3ZciwG0p1CKO80yf5hyYoWjqZk5Rcd07nTo2gqTFGfLl9sqI9/+ipMDtnHlAgMBAAECggEATJd5yCC6lusdMRO5FOBUyUaUi9X2i1AU+RZKAynQySvSnbavUgExW58tRCHBUrGW9gJp59ft1N8J8hHhSO18NDY4H7laBlVdnwmYjRqtFo2VQO6sD4G8JRDION5f2iIxn/b2fYDI9H8vILfJRbNgtTSILyGlzTYUZzhLKxCh+8IsN96Nic8wa5COd1vZZmdhf2y8TG8clFWmozaScNSAATx7y+8XLVWjjWiIRZ6xQvx0uQPUParc9KihXXTKR2pA22yPIdz+U4MGD4kC0eczlcFKZ/dYv9e7OIGgnJfT0idSCu7nYb1pxJ1LxD9fS6IScNTF5dSe0OIL98e+XdyoAQKBgQDRep+5cW4iAKrEMH+djmcXAkoMiYtNVtnu0efLE8dP6vjYytQi368X9SdcASbfrQ31eEZmr/xQnlUF8oyHGkI38YS8dpAHzQcrkP3BljbbzB/3gJZaUdghGsDrK0xAJIzzmFKQpeKnGtr23vxUgaGrNsCYvQ0eQ7+5056KXS4r5QKBgQC6r8xtRSaje6L4WIydjWvYywsmRO0Of0aJLMDA/Wt2MWhHfh7ba9oI1cKGN80ap7xB2a9lQLgpv+C53wNtE5SpvjxsikAj96nUMMhGy9ojXrUith6HQhiINETz6Shnznd+AyrXP6KI/RpfA5nkDB5nrJxODwtYLP467IL7Cv7OAQKBgQCl4KxKdH/5fP28jYsAgJsxpSZt9xzQCU5Zxu396ZOSvUaApVyGoQpNtluMh3z48lhzYOKevgzW6gn5w69z7F8zXZT2iAxVoQ1kelP2z7RxKJrHqpNkwhqbXEwX7RlcUZUr8BqxYCqymJl7k+fMIzqaEalBSbLxnEReKi0I8/Bz4QKBgHK4b0ZCtVDHPEmimJ6E9l4dv/c/afF7swu+zaCK2ouiJvOwBCRQbYb6XPR/u/GCXASXUdpF4CX/vIhcDE3uN2/r8FO+zVWM7vbvF1OyF5WesG7pPW9e5ZZlkG3WvLa1wOZV6fCmMSo/ZwI2Q05JSDHrd43cXttLotrw1jiQ9C4BAoGBAKi4SOoOVQ5J5HQCDkBwPbG1AOLHFinzfoDl26GF/8Hy7fmmd1JiRTFldQp/A9VTAABz3sVYmMB92HSIaJhuDMoYJNI2Cf/cZifsv7vUL8cbLn+lPsKsebiuB0m0g4P2qLwLfegfNGEgA7lA5HIz3SELqbdp3iuqJeQl1fsJqD74";
-
-
- public static byte[] decryptBASE64(String key) throws Exception {
- return Base64.decodeBase64(key);
- }
-
- public static String encryptBASE64(byte[] key) throws Exception {
- return Base64.encodeBase64String(key);
- }
-
- /**
- * 随机生成RSA密钥对
- *
- * @param keyLength 密钥长度,范围:512~2048
- * 一般1024
- * @return
- */
- public static KeyPair generateRSAKeyPair(int keyLength) {
- try {
- KeyPairGenerator kpg = KeyPairGenerator.getInstance(RSA);
- kpg.initialize(keyLength);
- return kpg.genKeyPair();
- } catch (NoSuchAlgorithmException e) {
- e.printStackTrace();
- return null;
- }
- }
-
- /**
- * 用公钥对字符串进行加密
- *
- * @param data 原文
- */
- public static byte[] encryptByPublicKey(byte[] data, byte[] publicKey) throws Exception {
- // 得到公钥
- byte[] decoded = Base64.decodeBase64(publicKey);
- RSAPublicKey keyPublic = (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decoded));
- // 加密数据
- Cipher cp = Cipher.getInstance(ECB_PKCS1_PADDING);
- cp.init(Cipher.ENCRYPT_MODE, keyPublic);
- return cp.doFinal(data);
- }
-
- /**
- * 私钥加密
- *
- * @param data 待加密数据
- * @param privateKey 密钥
- * @return byte[] 加密数据
- */
- public static byte[] encryptByPrivateKey(byte[] data, byte[] privateKey) throws Exception {
- // 得到私钥
- byte[] decoded = Base64.decodeBase64(privateKey);
- RSAPrivateKey keyPrivate = (RSAPrivateKey) KeyFactory.getInstance("RSA").generatePrivate(new PKCS8EncodedKeySpec(decoded));
- // 数据加密
- Cipher cipher = Cipher.getInstance(ECB_PKCS1_PADDING);
- cipher.init(Cipher.ENCRYPT_MODE, keyPrivate);
- return cipher.doFinal(data);
- }
-
- /**
- * 公钥解密
- *
- * @param data 待解密数据
- * @param publicKey 密钥
- * @return byte[] 解密数据
- */
- public static byte[] decryptByPublicKey(byte[] data, byte[] publicKey) throws Exception {
- // 得到公钥
- byte[] decoded = Base64.decodeBase64(publicKey);
- RSAPublicKey keyPublic = (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decoded));
- // 数据解密
- Cipher cipher = Cipher.getInstance(ECB_PKCS1_PADDING);
- cipher.init(Cipher.DECRYPT_MODE, keyPublic);
- return cipher.doFinal(data);
- }
-
- /**
- * 使用私钥进行解密
- */
- public static byte[] decryptByPrivateKey(byte[] encrypted, byte[] privateKey) throws Exception {
- // 得到私钥
- byte[] decoded = Base64.decodeBase64(privateKey);
- RSAPrivateKey keyPrivate = (RSAPrivateKey) KeyFactory.getInstance("RSA").generatePrivate(new PKCS8EncodedKeySpec(decoded));
-
- // 解密数据
- Cipher cp = Cipher.getInstance(ECB_PKCS1_PADDING);
- cp.init(Cipher.DECRYPT_MODE, keyPrivate);
- byte[] arr = cp.doFinal(encrypted);
- return arr;
- }
-
- /**
- * 用公钥对字符串进行分段加密
- */
- public static byte[] encryptByPublicKeyForSpilt(byte[] data, byte[] publicKey) throws Exception {
- int dataLen = data.length;
- if (dataLen <= DEFAULT_BUFFERSIZE) {
- return encryptByPublicKey(data, publicKey);
- }
- List allBytes = new ArrayList(2048);
- int bufIndex = 0;
- int subDataLoop = 0;
- byte[] buf = new byte[DEFAULT_BUFFERSIZE];
- for (int i = 0; i < dataLen; i++) {
- buf[bufIndex] = data[i];
- if (++bufIndex == DEFAULT_BUFFERSIZE || i == dataLen - 1) {
- subDataLoop++;
- if (subDataLoop != 1) {
- for (byte b : DEFAULT_SPLIT) {
- allBytes.add(b);
- }
- }
- byte[] encryptBytes = encryptByPublicKey(buf, publicKey);
- for (byte b : encryptBytes) {
- allBytes.add(b);
- }
- bufIndex = 0;
- if (i == dataLen - 1) {
- buf = null;
- } else {
- buf = new byte[Math.min(DEFAULT_BUFFERSIZE, dataLen - i - 1)];
- }
- }
- }
- byte[] bytes = new byte[allBytes.size()];
- {
- int i = 0;
- for (Byte b : allBytes) {
- bytes[i++] = b.byteValue();
- }
- }
- return bytes;
- }
-
-
-
- /**
- * 使用私钥分段加密
- *
- * @param data 要加密的原始数据
- * @param privateKey 秘钥
- */
- public static byte[] encryptByPrivateKeyForSpilt(byte[] data, byte[] privateKey) throws Exception {
- int dataLen = data.length;
- if (dataLen <= DEFAULT_BUFFERSIZE) {
- return encryptByPrivateKey(data, privateKey);
- }
- List allBytes = new ArrayList(2048);
- int bufIndex = 0;
- int subDataLoop = 0;
- byte[] buf = new byte[DEFAULT_BUFFERSIZE];
- for (int i = 0; i < dataLen; i++) {
- buf[bufIndex] = data[i];
- if (++bufIndex == DEFAULT_BUFFERSIZE || i == dataLen - 1) {
- subDataLoop++;
- if (subDataLoop != 1) {
- for (byte b : DEFAULT_SPLIT) {
- allBytes.add(b);
- }
- }
- byte[] encryptBytes = encryptByPrivateKey(buf, privateKey);
- for (byte b : encryptBytes) {
- allBytes.add(b);
- }
- bufIndex = 0;
- if (i == dataLen - 1) {
- buf = null;
- } else {
- buf = new byte[Math.min(DEFAULT_BUFFERSIZE, dataLen - i - 1)];
- }
- }
- }
- byte[] bytes = new byte[allBytes.size()];
- {
- int i = 0;
- for (Byte b : allBytes) {
- bytes[i++] = b.byteValue();
- }
- }
- return bytes;
- }
-
- /**
- * 公钥分段解密
- *
- * @param encrypted 待解密数据
- * @param publicKey 密钥
- */
- public static byte[] decryptByPublicKeyForSpilt(byte[] encrypted, byte[] publicKey) throws Exception {
- int splitLen = DEFAULT_SPLIT.length;
- if (splitLen <= 0) {
- return decryptByPublicKey(encrypted, publicKey);
- }
- int dataLen = encrypted.length;
- List allBytes = new ArrayList(1024);
- int latestStartIndex = 0;
- for (int i = 0; i < dataLen; i++) {
- byte bt = encrypted[i];
- boolean isMatchSplit = false;
- if (i == dataLen - 1) {
- // 到data的最后了
- byte[] part = new byte[dataLen - latestStartIndex];
- System.arraycopy(encrypted, latestStartIndex, part, 0, part.length);
- byte[] decryptPart = decryptByPublicKey(part, publicKey);
- for (byte b : decryptPart) {
- allBytes.add(b);
- }
- latestStartIndex = i + splitLen;
- i = latestStartIndex - 1;
- } else if (bt == DEFAULT_SPLIT[0]) {
- // 这个是以split[0]开头
- if (splitLen > 1) {
- if (i + splitLen < dataLen) {
- // 没有超出data的范围
- for (int j = 1; j < splitLen; j++) {
- if (DEFAULT_SPLIT[j] != encrypted[i + j]) {
- break;
- }
- if (j == splitLen - 1) {
- // 验证到split的最后一位,都没有break,则表明已经确认是split段
- isMatchSplit = true;
- }
- }
- }
- } else {
- // split只有一位,则已经匹配了
- isMatchSplit = true;
- }
- }
- if (isMatchSplit) {
- byte[] part = new byte[i - latestStartIndex];
- System.arraycopy(encrypted, latestStartIndex, part, 0, part.length);
- byte[] decryptPart = decryptByPublicKey(part, publicKey);
- for (byte b : decryptPart) {
- allBytes.add(b);
- }
- latestStartIndex = i + splitLen;
- i = latestStartIndex - 1;
- }
- }
- byte[] bytes = new byte[allBytes.size()];
- {
- int i = 0;
- for (Byte b : allBytes) {
- bytes[i++] = b.byteValue();
- }
- }
- return bytes;
- }
-
- /**
- * 使用私钥分段解密
- */
- public static byte[] decryptByPrivateKeyForSpilt(byte[] encrypted, byte[] privateKey) throws Exception {
- int splitLen = DEFAULT_SPLIT.length;
- if (splitLen <= 0) {
- return decryptByPrivateKey(encrypted, privateKey);
- }
- int dataLen = encrypted.length;
- List allBytes = new ArrayList(1024);
- int latestStartIndex = 0;
- for (int i = 0; i < dataLen; i++) {
- byte bt = encrypted[i];
- boolean isMatchSplit = false;
- if (i == dataLen - 1) {
- // 到data的最后了
- byte[] part = new byte[dataLen - latestStartIndex];
- System.arraycopy(encrypted, latestStartIndex, part, 0, part.length);
- byte[] decryptPart = decryptByPrivateKey(part, privateKey);
- for (byte b : decryptPart) {
- allBytes.add(b);
- }
- latestStartIndex = i + splitLen;
- i = latestStartIndex - 1;
- } else if (bt == DEFAULT_SPLIT[0]) {
- // 这个是以split[0]开头
- if (splitLen > 1) {
- if (i + splitLen < dataLen) {
- // 没有超出data的范围
- for (int j = 1; j < splitLen; j++) {
- if (DEFAULT_SPLIT[j] != encrypted[i + j]) {
- break;
- }
- if (j == splitLen - 1) {
- // 验证到split的最后一位,都没有break,则表明已经确认是split段
- isMatchSplit = true;
- }
- }
- }
- } else {
- // split只有一位,则已经匹配了
- isMatchSplit = true;
- }
- }
- if (isMatchSplit) {
- byte[] part = new byte[i - latestStartIndex];
- System.arraycopy(encrypted, latestStartIndex, part, 0, part.length);
- byte[] decryptPart = decryptByPrivateKey(part, privateKey);
- for (byte b : decryptPart) {
- allBytes.add(b);
- }
- latestStartIndex = i + splitLen;
- i = latestStartIndex - 1;
- }
- }
- byte[] bytes = new byte[allBytes.size()];
- {
- int i = 0;
- for (Byte b : allBytes) {
- bytes[i++] = b.byteValue();
- }
- }
- return bytes;
- }
-
- /**
- * 用公钥对字符串进行分段加密
- */
- public static String encryptByPublicKeyForSpiltStr(String data, String publicKey) throws Exception {
- byte[] encryptBytes = encryptByPublicKeyForSpilt(data.getBytes(StandardCharsets.UTF_8), publicKey.getBytes());
- return encryptBASE64(encryptBytes);
- }
-
- /**
- * 使用私钥分段加密
- *
- * @param data 要加密的原始数据
- * @param privateKey 秘钥
- */
- public static String encryptByPrivateKeyForSpiltStr(String data, String privateKey) throws Exception {
- byte[] encryptBytes = encryptByPrivateKeyForSpilt(data.getBytes(StandardCharsets.UTF_8), privateKey.getBytes());
- return encryptBASE64(encryptBytes);
- }
-
- /**
- * 公钥分段解密
- *
- * @param encrypted 待解密数据
- * @param publicKey 密钥
- */
- public static String decryptByPublicKeyForSpiltStr(String encrypted, String publicKey) throws Exception {
- byte[] decryptBytes = decryptByPublicKeyForSpilt(decryptBASE64(encrypted), publicKey.getBytes());
- return new String(decryptBytes,StandardCharsets.UTF_8);
- }
-
- /**
- * 使用私钥分段解密
- */
- public static String decryptByPrivateKeyForSpiltStr(String encrypted, String privateKey) throws Exception {
- byte[] decryptBytes = decryptByPrivateKeyForSpilt(decryptBASE64(encrypted), privateKey.getBytes());
- return new String(decryptBytes,StandardCharsets.UTF_8);
- }
-
- public static void testEncrypt1(String content) {
- //生成秘钥对
- KeyPair keyPair = RSAAndroid.generateRSAKeyPair(RSAAndroid.DEFAULT_KEY_SIZE);
- //公钥
- PublicKey publicKey = keyPair.getPublic();
- //私钥
- PrivateKey privateKey = keyPair.getPrivate();
-
- long start;
- long end;
- byte[] encryptBytes = new byte[0];
- byte[] decryptBytes = new byte[0];
- String encryStr, decryStr;
-
- try {
-
- System.out.println("公钥:" + encryptBASE64(RSAAndroid.publicRsaKey.getBytes()));
- //公钥加密
- start = System.currentTimeMillis();
-
- encryptBytes = RSAAndroid.encryptByPublicKeyForSpilt(content.getBytes(StandardCharsets.UTF_8), RSAAndroid.publicRsaKey.getBytes());
- System.out.println("testEncrypt: 公钥加密 encryptBytes:" + encryptBytes);
-
- end = System.currentTimeMillis();
- System.out.println("公钥加密耗时 cost time---->" + (end - start));
- //encryStr = BASE64Encoder.encode(encryptBytes);
- encryStr = encryptBASE64(encryptBytes);
-// Log.e(TAG, "加密后json数据 --1-->" + encryStr);
- System.out.println("加密后json数据长度 --1-->" + encryStr.length());
- System.out.println("testEncrypt: encryStr:" + encryStr);
- //私钥解密
- System.out.println("私钥:" + encryptBASE64(RSAAndroid.privateRsaKey.getBytes()));
- start = System.currentTimeMillis();
- decryptBytes = RSAAndroid.decryptByPrivateKeyForSpilt(decryptBASE64(encryStr), RSAAndroid.privateRsaKey.getBytes());
- decryStr = new String(decryptBytes);
- System.out.println("testEncrypt: 私钥解密 decryStr:" + decryStr);
- end = System.currentTimeMillis();
- System.out.println("私钥解密耗时 cost time---->" + (end - start));
- System.out.println("解密后json数据 --1-->" + decryStr);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- public static void testEncrypt2(String content) {
- //生成秘钥对
- KeyPair keyPair = RSAAndroid.generateRSAKeyPair(RSAAndroid.DEFAULT_KEY_SIZE);
- //公钥
- PublicKey publicKey = keyPair.getPublic();
- //私钥
- PrivateKey privateKey = keyPair.getPrivate();
-
- long start;
- long end;
- byte[] encryptBytes = new byte[0];
- byte[] decryptBytes = new byte[0];
- String encryStr, decryStr;
-
- try {
-
- //私钥加密
- start = System.currentTimeMillis();
- encryptBytes = RSAAndroid.encryptByPrivateKeyForSpilt(content.getBytes(StandardCharsets.UTF_8), RSAAndroid.privateRsaKey.getBytes());
- end = System.currentTimeMillis();
- System.out.println("私钥加密密耗时 cost time---->" + (end - start));
- encryStr = encryptBASE64(encryptBytes);
-
-// Log.e(TAG, "加密后json数据 --2-->" + encryStr);
- System.out.println("加密后json数据长度 --2-->" + encryStr.length());
- System.out.println("testEncrypt: 私钥加密密 encryStr:" + encryStr);
- //公钥解密
- start = System.currentTimeMillis();
- decryptBytes = RSAAndroid.decryptByPublicKeyForSpilt(decryptBASE64(encryStr), RSAAndroid.publicRsaKey.getBytes());
-
- decryStr = new String(decryptBytes);
- System.out.println("testEncrypt: 公钥解密 decryStr:" + decryStr);
- end = System.currentTimeMillis();
- System.out.println("公钥解密耗时 cost time---->" + (end - start));
- System.out.println("解密后json数据 --2-->" + decryStr);
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public static void testEncrypt3(String content) {
- long start;
- long end;
- String encryStr, decryStr;
- try {
- //公钥加密
- System.out.println("公钥:" + RSAAndroid.publicRsaKey);
- start = System.currentTimeMillis();
- encryStr = RSAAndroid.encryptByPublicKeyForSpiltStr(content, RSAAndroid.publicRsaKey);
- end = System.currentTimeMillis();
- System.out.println("公钥加密耗时 cost time---->" + (end - start));
- System.out.println("加密后json数据长度 --1-->" + encryStr.length());
- System.out.println("testEncrypt: 公钥加密 encryStr:" + encryStr);
- //私钥解密
- System.out.println("私钥:" + RSAAndroid.privateRsaKey);
- start = System.currentTimeMillis();
- encryStr = "X6Ad0LpiBP7ze/cEgwGkYS53zG5ozY1Nrk2HzrrGlWqFZdyrmYihc1Fo3pjxxfOJi60zkZXguPt197vdtf2NHjtBCamvGt8DYhvfGUFP0YSod11GckQQaUslUkwPjQKTGJ46Kdy7Y2gMKK7EdEabEmTPl/XIT9fDFX/nMWgAutcQ15Gq5FRwWQH7sSVNF5bjrxxBs7Q/JwsCsU+xl0LraifUf+1O6NzCHc4ll7dmWq6EGORjaSVYka8ItuI4hhVWffcrOhY1vDqjFkY+Mzac9ppgk1nc5StMMNGyPC4OYsLkqZa5h8acK8YhSi7dpj58Lo/yJWqMmewiGDSskrcFXCNQQVJUI10H9WmD3b//98jW6cq3awLqmpoZmjuN3fm8vx1KPOCEZs2GlM7/wCEUMabV7O5EsTtRf+6pqHYTPzZfxt2lXEEJviktjguG1WI71nwg+1XyIx5tn818XiYvs0L02hi3sWpQkk/NJ4QaE3LziuCMrgDU/GcFzYLybU627yAPPPLjB9wVZGefwUdWjMtY5AzPMBa9eNjsMaHAGe2zbnopafuouwsjH+uEZd2rzT3Uacb7+pNjl94XiB/0Xhwl1n5bi6HbT3aY2jC6YbKqCp5XQaLCbuefaRVCLC6pOHmNX6NKni98/bYKQ6XfhDoA56gJAEVsAaj/a6vpzVIMsej5zDI=";
- decryStr = RSAAndroid.decryptByPrivateKeyForSpiltStr(encryStr, RSAAndroid.privateRsaKey);
- end = System.currentTimeMillis();
- System.out.println("私钥解密耗时 cost time---->" + (end - start));
- System.out.println("解密后json数据长度 --1-->" + decryStr.length());
- System.out.println("testEncrypt: 私钥解密 decryStr:" + decryStr);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- public static void testEncrypt4(String content) {
- long start;
- long end;
- String encryStr, decryStr;
- try {
- System.out.println("公钥:" + RSAAndroid.publicRsaKey);
- //私钥加密
- start = System.currentTimeMillis();
- encryStr = RSAAndroid.encryptByPrivateKeyForSpiltStr(content, RSAAndroid.privateRsaKey);
- end = System.currentTimeMillis();
- System.out.println("私钥加密密耗时 cost time---->" + (end - start));
- System.out.println("加密后json数据长度 --2-->" + encryStr.length());
- System.out.println("testEncrypt: 私钥加密 encryStr:" + encryStr);
- //公钥解密
- System.out.println("私钥:" + RSAAndroid.privateRsaKey);
- start = System.currentTimeMillis();
- decryStr = RSAAndroid.decryptByPublicKeyForSpiltStr(encryStr, RSAAndroid.publicRsaKey);
- end = System.currentTimeMillis();
- System.out.println("公钥解密耗时 cost time---->" + (end - start));
- System.out.println("解密后json数据 --2-->" + decryStr);
- System.out.println("testEncrypt: 公钥解密 decryStr:" + decryStr);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public static void main(String[] args) {
- RSAAndroid.testEncrypt3("8月8日晚,东京国立竞技场的奥运圣火熄灭,场内电子屏上打出了“ARIGATO”(日语“谢谢”的罗马字)。57年前的那一夜,东京奥运会闭幕式大屏上留下的是“SAYONARA”(日语“再见”罗马字)。从告别到感谢,本届奥运会对日本而言,原本是一场赌上国运的体育盛事,而现实却朝着与理想相反的方向一路狂奔。8月8日晚,东京国立竞技场的奥运圣火熄灭,场内电子屏上打出了“ARIGATO”(日语“谢谢”的罗马字)。57年前的那一夜,东京奥运会闭幕式大屏上留下的是“SAYONARA”(日语“再见”罗马字)。从告别到感谢,本届奥运会对日本而言,原本是一场赌上国运的体育盛事,而现实却朝着与理想相反的方向一路狂奔。8月8日晚,东京国立竞技场的奥运圣火熄灭,场内电子屏上打出了“ARIGATO”(日语“谢谢”的罗马字)。57年前的那一夜,东京奥运会闭幕式大屏上留下的是“SAYONARA”(日语“再见”罗马字)。从告别到感谢,本届奥运会对日本而言,原本是一场赌上国运的体育盛事,而现实却朝着与理想相反的方向一路狂奔。8月8日晚,东京国立竞技场的奥运圣火熄灭,场内电子屏上打出了“ARIGATO”(日语“谢谢”的罗马字)。57年前的那一夜,东京奥运会闭幕式大屏上留下的是“SAYONARA”(日语“再见”罗马字)。从告别到感谢,本届奥运会对日本而言,原本是一场赌上国运的体育盛事,而现实却朝着与理想相反的方向一路狂奔。8月8日晚,东京国立竞技场的奥运圣火熄灭,场内电子屏上打出了“ARIGATO”(日语“谢谢”的罗马字)。57年前的那一夜,东京奥运会闭幕式大屏上留下的是“SAYONARA”(日语“再见”罗马字)。从告别到感谢,本届奥运会对日本而言,原本是一场赌上国运的体育盛事,而现实却朝着与理想相反的方向一路狂奔。8月8日晚,东京国立竞技场的奥运圣火熄灭,场内电子屏上打出了“ARIGATO”(日语“谢谢”的罗马字)。57年前的那一夜,东京奥运会闭幕式大屏上留下的是“SAYONARA”(日语“再见”罗马字)。从告别到感谢,本届奥运会对日本而言,原本是一场赌上国运的体育盛事,而现实却朝着与理想相反的方向一路狂奔。8月8日晚,东京国立竞技场的奥运圣火熄灭,场内电子屏上打出了“ARIGATO”(日语“谢谢”的罗马字)。57年前的那一夜,东京奥运会闭幕式大屏上留下的是“SAYONARA”(日语“再见”罗马字)。从告别到感谢,本届奥运会对日本而言,原本是一场赌上国运的体育盛事,而现实却朝着与理想相反的方向一路狂奔。8月8日晚,东京国立竞技场的奥运圣火熄灭,场内电子屏上打出了“ARIGATO”(日语“谢谢”的罗马字)。57年前的那一夜,东京奥运会闭幕式大屏上留下的是“SAYONARA”(日语“再见”罗马字)。从告别到感谢,本届奥运会对日本而言,原本是一场赌上国运的体育盛事,而现实却朝着与理想相反的方向一路狂奔。8月8日晚,东京国立竞技场的奥运圣火熄灭,场内电子屏上打出了“ARIGATO”(日语“谢谢”的罗马字)。57年前的那一夜,东京奥运会闭幕式大屏上留下的是“SAYONARA”(日语“再见”罗马字)。从告别到感谢,本届奥运会对日本而言,原本是一场赌上国运的体育盛事,而现实却朝着与理想相反的方向一路狂奔。8月8日晚,东京国立竞技场的奥运圣火熄灭,场内电子屏上打出了“ARIGATO”(日语“谢谢”的罗马字)。57年前的那一夜,东京奥运会闭幕式大屏上留下的是“SAYONARA”(日语“再见”罗马字)。从告别到感谢,本届奥运会对日本而言,原本是一场赌上国运的体育盛事,而现实却朝着与理想相反的方向一路狂奔。8月8日晚,东京国立竞技场的奥运圣火熄灭,场内电子屏上打出了“ARIGATO”(日语“谢谢”的罗马字)。57年前的那一夜,东京奥运会闭幕式大屏上留下的是“SAYONARA”(日语“再见”罗马字)。从告别到感谢,本届奥运会对日本而言,原本是一场赌上国运的体育盛事,而现实却朝着与理想相反的方向一路狂奔。");
- }
-}
\ No newline at end of file
diff --git a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/dao/NmcCityRepository.java b/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/dao/NmcCityRepository.java
deleted file mode 100644
index f383e4e..0000000
--- a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/dao/NmcCityRepository.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.rehome.disruptor_nmc.dao;
-
-
-import com.rehome.disruptor_nmc.entity.NmcCity;
-import org.springframework.data.jpa.repository.JpaRepository;
-
-
-/**
- * 参数一 T :当前需要映射的实体
- * 参数二 ID :当前映射的实体中的OID的类型
- */
-public interface NmcCityRepository extends JpaRepository {
-
- //方法名称必须要遵循驼峰式命名规则,findBy(关键字)+属性名称(首字母大写)+查询条件(首字母大写)
- NmcCity findByCode(String code);
-}
diff --git a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/dao/NmcForecastWeatherRepository.java b/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/dao/NmcForecastWeatherRepository.java
deleted file mode 100644
index 868951c..0000000
--- a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/dao/NmcForecastWeatherRepository.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.rehome.disruptor_nmc.dao;
-
-
-
-import com.rehome.disruptor_nmc.entity.NmcForecastWeather;
-import org.springframework.data.jpa.repository.JpaRepository;
-import java.util.List;
-
-
-/**
- * 参数一 T :当前需要映射的实体
- * 参数二 ID :当前映射的实体中的OID的类型
- */
-public interface NmcForecastWeatherRepository extends JpaRepository {
-
- //方法名称必须要遵循驼峰式命名规则,findBy(关键字)+属性名称(首字母大写)+查询条件(首字母大写)
- List findByWeatherDateOrderByIdDesc(String weatherDate);
-
-}
-
diff --git a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/dao/NmcNowWeatherRepository.java b/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/dao/NmcNowWeatherRepository.java
deleted file mode 100644
index 9925d84..0000000
--- a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/dao/NmcNowWeatherRepository.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.rehome.disruptor_nmc.dao;
-
-
-import com.rehome.disruptor_nmc.entity.NmcNowWeather;
-import org.springframework.data.jpa.repository.JpaRepository;
-
-import java.util.List;
-
-
-/**
- * 参数一 T :当前需要映射的实体
- * 参数二 ID :当前映射的实体中的OID的类型
- */
-public interface NmcNowWeatherRepository extends JpaRepository {
-
- //方法名称必须要遵循驼峰式命名规则,findBy(关键字)+属性名称(首字母大写)+查询条件(首字母大写)
- List findByCodeAndWeatherDateOrderByIdDesc(String code, String weatherDate);
-}
-
diff --git a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/dao/NmcProvinceRepository.java b/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/dao/NmcProvinceRepository.java
deleted file mode 100644
index 29e4dd8..0000000
--- a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/dao/NmcProvinceRepository.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.rehome.disruptor_nmc.dao;
-
-
-import com.rehome.disruptor_nmc.entity.NmcProvince;
-import org.springframework.data.jpa.repository.JpaRepository;
-
-
-/**
- * 参数一 T :当前需要映射的实体
- * 参数二 ID :当前映射的实体中的OID的类型
- */
-public interface NmcProvinceRepository extends JpaRepository {
-
- //方法名称必须要遵循驼峰式命名规则,findBy(关键字)+属性名称(首字母大写)+查询条件(首字母大写)
- NmcProvince findByCode(String code);
-}
diff --git a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/dao/TemperatureRepository.java b/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/dao/TemperatureRepository.java
deleted file mode 100644
index f00ab6b..0000000
--- a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/dao/TemperatureRepository.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.rehome.disruptor_nmc.dao;
-
-
-import com.rehome.disruptor_nmc.entity.Temperature;
-import org.springframework.data.jpa.repository.JpaRepository;
-
-
-/**
- * 参数一 T :当前需要映射的实体
- * 参数二 ID :当前映射的实体中的OID的类型
- *
- */
-public interface TemperatureRepository extends JpaRepository {
-
- //方法名称必须要遵循驼峰式命名规则,findBy(关键字)+属性名称(首字母大写)+查询条件(首字母大写)
- Temperature findByDataDate(String dataDate);
- Temperature findByDataHour(String dataHour);
- Temperature findByDataMinute(String dataMinute);
-}
\ No newline at end of file
diff --git a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/dto/NmcBaseDto.java b/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/dto/NmcBaseDto.java
deleted file mode 100644
index bfc8323..0000000
--- a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/dto/NmcBaseDto.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.rehome.disruptor_nmc.dto;
-
-
-import com.liuhuiyu.util.map.MapUtil;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import java.util.Map;
-
-/**
- * @author HuangWenFei
- * @version v1.0.0.0
- * Created DateTime 2022-05-01 16:22
- */
-@ApiModel(value = "NmcBaseDto", description = "接收数据")
-public class NmcBaseDto {
- @ApiModelProperty("API状态码,具体含义请参考状态码 0请求成功")
- private int code;
- @ApiModelProperty("当前API的最近更新时间")
- private String msg;
-
- /**
- * 根据 map 还原 NmcBaseDto
- *
- * @param map 映射map
- * @return com.rehome.jpahefengweather.dto.NmcBaseDto
- * @author HuangWenFei
- * Created DateTime 2022-04-19 10:02
- */
- public static NmcBaseDto ofSelfMap(Map map) {
- return MapUtil.fromMap(map, NmcBaseDto.class);
- }
-
- public int getCode() {
- return code;
- }
-
- public void setCode(int code) {
- this.code = code;
- }
-
- public String getMsg() {
- return msg;
- }
-
- public void setMsg(String msg) {
- this.msg = msg;
- }
-}
diff --git a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/entity/NmcCity.java b/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/entity/NmcCity.java
deleted file mode 100644
index c37e07b..0000000
--- a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/entity/NmcCity.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.rehome.disruptor_nmc.entity;
-
-import lombok.Data;
-import org.hibernate.annotations.Proxy;
-import org.springframework.data.jpa.domain.support.AuditingEntityListener;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.util.Date;
-
-@EntityListeners(AuditingEntityListener.class)
-@Proxy(lazy = false)
-@Data
-@Entity
-public class NmcCity implements Serializable {
- @Id
- private String code;
-
- private String province;
-
- private String city;
-
- private String url;
-
- @Temporal(TemporalType.TIMESTAMP)
- private Date createDate;
-
- @Temporal(TemporalType.TIMESTAMP)
- private Date lastUpdateDate;
-}
diff --git a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/entity/NmcForecastWeather.java b/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/entity/NmcForecastWeather.java
deleted file mode 100644
index 3f6fc68..0000000
--- a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/entity/NmcForecastWeather.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.rehome.disruptor_nmc.entity;
-
-
-import lombok.Data;
-import org.hibernate.annotations.Proxy;
-import org.springframework.data.jpa.domain.support.AuditingEntityListener;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.util.Date;
-
-@EntityListeners(AuditingEntityListener.class)
-@Proxy(lazy = false)
-@Data
-@Entity
-public class NmcForecastWeather implements Serializable {
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private Long id;
-
- //存放长文本
- @Lob
- @Basic(fetch = FetchType.LAZY)
- private String weather;
-
- private String weatherDate;
-
- private String code;
-
- @Temporal(TemporalType.TIMESTAMP)
- private Date createDate;
-
- @Temporal(TemporalType.TIMESTAMP)
- private Date lastUpdateDate;
-}
diff --git a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/entity/NmcNowWeather.java b/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/entity/NmcNowWeather.java
deleted file mode 100644
index ee178cc..0000000
--- a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/entity/NmcNowWeather.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.rehome.disruptor_nmc.entity;
-
-import lombok.Data;
-import org.hibernate.annotations.GenericGenerator;
-import org.hibernate.annotations.Proxy;
-import org.springframework.data.jpa.domain.support.AuditingEntityListener;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.util.Date;
-
-@EntityListeners(AuditingEntityListener.class)
-@Proxy(lazy = false)
-@Data
-@Entity
-@Table(indexes = {@Index(name = "idx_weatherDate", columnList = "weatherDate"),
- @Index(name = "idx_code", columnList = "code"),
- @Index(name = "idx_createDate", columnList = "createDate"),
- @Index(name = "idx_lastUpdateDate", columnList = "lastUpdateDate"),
- @Index(name = "idx_weather_date_code_nmc", columnList = "weatherDate"),
- @Index(name = "idx_weather_date_code_nmc", columnList = "code")})
-//@GenericGenerator(name = "NmcNowWeather-uuid", strategy = "uuid")
-public class NmcNowWeather implements Serializable {
- public static final int COLUMN_ID_MAX_LENGTH = 32;
- public static final int COLUMN_CNAME_MAX_LENGTH = 16;
-
-// @Id
-// @GenericGenerator(name = "NmcNowWeather-uuid", strategy = "uuid")
-// @GeneratedValue(generator = "NmcNowWeather-uuid")
-// @Column(length = 32)
-
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private Long id;
-
- //存放长文本
- @Lob
- @Basic(fetch = FetchType.LAZY)
- private String weather;
-
- private String weatherDate;
-
- private String code;
-
- @Temporal(TemporalType.TIMESTAMP)
- private Date createDate;
-
- @Temporal(TemporalType.TIMESTAMP)
- private Date lastUpdateDate;
-}
\ No newline at end of file
diff --git a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/entity/NmcProvince.java b/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/entity/NmcProvince.java
deleted file mode 100644
index b5e3218..0000000
--- a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/entity/NmcProvince.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.rehome.disruptor_nmc.entity;
-
-import lombok.Data;
-import org.hibernate.annotations.Proxy;
-import org.springframework.data.jpa.domain.support.AuditingEntityListener;
-import javax.persistence.*;
-import java.io.Serializable;
-import java.util.Date;
-
-@EntityListeners(AuditingEntityListener.class)
-@Proxy(lazy = false)
-@Data
-@Entity
-public class NmcProvince implements Serializable {
- @Id
- private String code;
-
- private String name;
-
- private String url;
-
- @Temporal(TemporalType.TIMESTAMP)
- private Date createDate;
-
- @Temporal(TemporalType.TIMESTAMP)
- private Date lastUpdateDate;
-}
\ No newline at end of file
diff --git a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/entity/Temperature.java b/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/entity/Temperature.java
deleted file mode 100644
index 074235e..0000000
--- a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/entity/Temperature.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.rehome.disruptor_nmc.entity;
-
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import org.hibernate.annotations.Proxy;
-import org.springframework.data.jpa.domain.support.AuditingEntityListener;
-import javax.persistence.*;
-import java.io.Serializable;
-import java.util.Date;
-
-@EntityListeners(AuditingEntityListener.class)
-@Proxy(lazy = false)
-@Data
-@Entity
-//普通索引,不指定索引名,表自动创建索引名
-//@Table(indexes = {@Index(columnList = "dataDate"),@Index(columnList = "locationDesc")})
-//普通索引,指定索引名,创建单个索引
-//在这个例子中,Temperature实体类通过@Table注解的indexes属性定义了一个名为idx_dataDate的索引,它覆盖了dataDate字段。这意味着在数据库层面,针对dataDate字段的查询将会利用这个索引,从而提高查询效率。
-//@Table(indexes = {@Index(name = "idx_dataDate", columnList = "dataDate")})
-//同时创建多个普通索引,注意每个索引名都不同
-//@Table(indexes = {@Index(name = "idx_dataDate", columnList = "dataDate"),@Index(name = "idx_locationDesc", columnList = "locationDesc")})
-//@Table(indexes = {@Index(name = "idx_dataDate", columnList = "dataDate"),@Index(name = "idx_locationDesc", columnList = "locationDesc"),@Index(name = "idx_dataHour", columnList = "dataHour"),@Index(name = "idx_dataMinute", columnList = "dataMinute")})
-//创建组合索引,注意每个索引名都相同
-//@Table(indexes = {@Index(name = "data_date_location_desc", columnList = "dataDate"),@Index(name = "data_date_location_desc", columnList = "locationDesc")})
-//同时创建普通索引和组合索引,注意普通索引每个索引名都不同,注意组合索引每个索引名都相同
-@Table(indexes = {@Index(name = "idx_dataDate", columnList = "dataDate"),@Index(name = "idx_locationDesc", columnList = "locationDesc"),@Index(name = "idx_dataHour", columnList = "dataHour"),@Index(name = "idx_dataMinute", columnList = "dataMinute"),@Index(name = "data_date_location_desc", columnList = "dataDate"),@Index(name = "data_date_location_desc", columnList = "locationDesc")})
-public class Temperature implements Serializable {
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @ApiModelProperty(value = "主键")
- private Long id;
-
- @ApiModelProperty(value = "温度")
- private Double temperature;
-
- @ApiModelProperty(value = "湿度")
- private Double humidity;
-
- @ApiModelProperty(value = "日期")
- @Column(length=20)
- private String dataDate;
-
- @ApiModelProperty(value = "时")
- @Column(length=20)
- private String dataHour;
-
- @ApiModelProperty(value = "分")
- @Column(length=20)
- private String dataMinute;
-
- @ApiModelProperty(value = "主题")
- @Column(length=60)
- private String topic;
-
- @ApiModelProperty(value = "位置描述")
- @Column(length=80)
- private String locationDesc;
-
- @ApiModelProperty(value = "时间")
- @Temporal(TemporalType.TIMESTAMP)
- private Date createDate;
-
-}
diff --git a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/mq/BeanManager.java b/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/mq/BeanManager.java
deleted file mode 100644
index f59c433..0000000
--- a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/mq/BeanManager.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.rehome.disruptor_nmc.mq;
-
-import org.springframework.beans.BeansException;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-import org.springframework.stereotype.Component;
-
-/**
- * 获取实例化对象
- */
-@Component
-public class BeanManager implements ApplicationContextAware {
-
-
-
- private static ApplicationContext applicationContext = null;
-
- @Override
- public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
-
-
- this.applicationContext = applicationContext;
- }
-
- public static ApplicationContext getApplicationContext() {
-
- return applicationContext; }
-
- public static Object getBean(String name) {
-
-
- return applicationContext.getBean(name);
- }
-
- public static T getBean(Class clazz) {
-
-
- return applicationContext.getBean(clazz);
- }
-}
diff --git a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/mq/MQManager.java b/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/mq/MQManager.java
deleted file mode 100644
index 737ecab..0000000
--- a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/mq/MQManager.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.rehome.disruptor_nmc.mq;
-
-import com.lmax.disruptor.BlockingWaitStrategy;
-import com.lmax.disruptor.RingBuffer;
-import com.lmax.disruptor.dsl.Disruptor;
-import com.lmax.disruptor.dsl.ProducerType;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-@Configuration
-public class MQManager {
-
-
- @Bean("messageModel")
- public RingBuffer messageModelRingBuffer() {
-
-
- //定义用于事件处理的线程池, Disruptor通过java.util.concurrent.ExecutorSerivce提供的线程来触发consumer的事件处理
- ExecutorService executor = Executors.newFixedThreadPool(2);
-
- //指定事件工厂
- NmcWeatherEventFactory factory = new NmcWeatherEventFactory();
-
- //指定ringbuffer字节大小,必须为2的N次方(能将求模运算转为位运算提高效率),否则将影响效率
- int bufferSize = 1024 * 256;
-
- //单线程模式,获取额外的性能
- Disruptor disruptor = new Disruptor<>(factory, bufferSize, executor,
- ProducerType.SINGLE, new BlockingWaitStrategy());
-
- //设置事件业务处理器---消费者
- disruptor.handleEventsWith(new NmcWeatherEventHandler());
-
- // 启动disruptor线程
- disruptor.start();
-
- //获取ringbuffer环,用于接取生产者生产的事件
- RingBuffer ringBuffer = disruptor.getRingBuffer();
-
- return ringBuffer;
- }
-}
\ No newline at end of file
diff --git a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/mq/MessageModel.java b/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/mq/MessageModel.java
deleted file mode 100644
index 23bc2b4..0000000
--- a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/mq/MessageModel.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.rehome.disruptor_nmc.mq;
-
-import com.rehome.disruptor_nmc.entity.NmcNowWeather;
-import lombok.Data;
-
-@Data
-public class MessageModel {
- private NmcNowWeather message;
-
- private String temperatureAndHumidityData;
-
- private String topic;
-
- private String type;
-
-}
diff --git a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/mq/NmcWeatherEventFactory.java b/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/mq/NmcWeatherEventFactory.java
deleted file mode 100644
index e5b9940..0000000
--- a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/mq/NmcWeatherEventFactory.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.rehome.disruptor_nmc.mq;
-
-import com.lmax.disruptor.EventFactory;
-
-public class NmcWeatherEventFactory implements EventFactory {
- @Override
- public MessageModel newInstance() {
- return new MessageModel();
- }
-}
diff --git a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/mq/NmcWeatherEventHandler.java b/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/mq/NmcWeatherEventHandler.java
deleted file mode 100644
index 8699e6d..0000000
--- a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/mq/NmcWeatherEventHandler.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.rehome.disruptor_nmc.mq;
-
-import com.liuhuiyu.spring_util.SpringUtil;
-import com.lmax.disruptor.EventHandler;
-import com.rehome.disruptor_nmc.service.NmcWeatherService;
-import com.rehome.disruptor_nmc.service.TemperatureService;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
-
-
-@Slf4j
-public class NmcWeatherEventHandler implements EventHandler {
-
- @Override
- public void onEvent(MessageModel event, long sequence, boolean endOfBatch) {
-
- try {
- //这里停止1000ms是为了确定消费消息是异步的
- log.info("消费者处理消息开始");
- if (event != null) {
- log.info("消费者消费的信息是:{}", event);
- if("mqttTemperature".equals(event.getType())){
- TemperatureService temperatureService = SpringUtil.getBean(TemperatureService.class);
- temperatureService.saveTemperature(event.getTemperatureAndHumidityData(),event.getTopic());
- }
- if("NmcWeather".equals(event.getType())){
- NmcWeatherService nmcWeatherService = SpringUtil.getBean(NmcWeatherService.class);
- nmcWeatherService.saveNowWeather(event.getMessage());
- }
- }
- } catch (Exception e) {
- log.info("消费者处理消息失败");
- }
- log.info("消费者处理消息结束");
- }
-}
-
-//http://www.nmc.cn/
\ No newline at end of file
diff --git a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/response/GlobalExceptionHandler.java b/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/response/GlobalExceptionHandler.java
deleted file mode 100644
index 4fd335f..0000000
--- a/disruptor_nmc/src/main/java/com/rehome/disruptor_nmc/response/GlobalExceptionHandler.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package com.rehome.disruptor_nmc.response;
-
-import org.springframework.validation.BindException;
-import org.springframework.validation.FieldError;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.RestControllerAdvice;
-
-import java.util.Optional;
-
-@RestControllerAdvice
-public class GlobalExceptionHandler {
- @ExceptionHandler(BindException.class)
- public Result handleValidationException(BindException ex) {
- Result result = Result.failedByParamValidated();
- for (FieldError error : ex.getBindingResult().getFieldErrors()) {
- System.out.println(error.getField());
- System.out.println(error.getDefaultMessage());
- String baseErrorStr = result.getMessage();
- if(error.getField()!=null){
- baseErrorStr=baseErrorStr+","+error.getField();
- result.setMessage(baseErrorStr);
- }
- if(error.getDefaultMessage()!=null){
- baseErrorStr=baseErrorStr+":"+error.getDefaultMessage();
- result.setMessage(baseErrorStr);
- }
- }
- return result;
- }
-}
-
-
-//@RestControllerAdvice
-//public class GlobalExceptionHandler {
-// @ExceptionHandler(BindException.class)
-// public R handleValidationException(BindException ex) {
-// R result = R.error();
-// for (FieldError error : ex.getBindingResult().getFieldErrors()) {
-// result.data(error.getField(), error.getDefaultMessage());
-// }
-// Optional