win 0211
commit
0dfac544ce
|
@ -0,0 +1,33 @@
|
|||
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/
|
Binary file not shown.
|
@ -0,0 +1,18 @@
|
|||
# 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.
|
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip
|
||||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="euc-kr"?>
|
||||
<Root Updated="2015-02-05 12:39:27">
|
||||
|
||||
<!-- CAT-11 -->
|
||||
<UdpSocket>
|
||||
<Connection ID="0" Tag="1" USE="true" Name="udp_recv_test_2284" PIP="127.0.0.1" SIP="127.0.0.1" PORT="55304"/>
|
||||
<Option LineMode="TURE" InOut="recv" McastGrp="+239.192.201.7"/>
|
||||
<Reconnect ReconnUSE="TRUE" Interval="600"/>
|
||||
</UdpSocket>
|
||||
|
||||
<!-- CAT-10 -->
|
||||
<UdpSocket>
|
||||
<Connection ID="1" Tag="2" USE="true" Name="udp_rec239.11.12.5v_test_3384" PIP="127.0.0.1" SIP="127.0.0.1" PORT="52114"/>
|
||||
<Option LineMode="TURE" InOut="recv" McastGrp="+239.11.12.5"/>
|
||||
<Reconnect ReconnUSE="TRUE" Interval="600"/>
|
||||
</UdpSocket>
|
||||
|
||||
|
||||
</Root>
|
Binary file not shown.
|
@ -0,0 +1,188 @@
|
|||
@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 Maven Start Up Batch script
|
||||
@REM
|
||||
@REM Required ENV vars:
|
||||
@REM JAVA_HOME - location of a JDK home dir
|
||||
@REM
|
||||
@REM Optional ENV vars
|
||||
@REM M2_HOME - location of maven2's installed home dir
|
||||
@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 DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||
|
||||
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||
IF "%%A"=="wrapperUrl" SET DOWNLOAD_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 DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||
)
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
||||
echo Downloading from: %DOWNLOAD_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('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
|
||||
"}"
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Finished downloading %WRAPPER_JAR%
|
||||
)
|
||||
)
|
||||
@REM End of extension
|
||||
|
||||
@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%
|
|
@ -0,0 +1,106 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.7.16</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>kr.gmtc.gw</groupId>
|
||||
<!-- <artifactId>socket</artifactId> -->
|
||||
<artifactId>standstatus</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>EyeGW_StandStatus</name>
|
||||
<description>Demo project for Spring Boot</description>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>local-repository</id>
|
||||
<name>local-repository</name>
|
||||
<url>file:${project.basedir}/lib</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>kr.gmt.so</groupId>
|
||||
<artifactId>state-spring-boot-starter</artifactId>
|
||||
<version>1.0.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.30</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- IPWorks -->
|
||||
<dependency>
|
||||
<groupId>ipworks.local</groupId>
|
||||
<artifactId>ipworks-local-1.0.0</artifactId>
|
||||
<scope>system</scope>
|
||||
<version>1.0.0</version>
|
||||
<systemPath>${basedir}/lib/ipworks/local/1.0.0/ipworks-local-1.0.0.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<!-- data format -->
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>EyeGW_StandStatus</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,113 @@
|
|||
package kr.gmtc.gw.comp.thread;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import kr.gmtc.gw.comp.thread.handler.CustomThreadOnTerminate;
|
||||
import kr.gmtc.gw.comp.thread.handler.CustomThreadWork;
|
||||
|
||||
public class CustomThread extends Thread{
|
||||
|
||||
/* 대기시간 없음 */
|
||||
public static final long NO_SLEEP = 0;
|
||||
/* 1밀리 초 */
|
||||
public static final long SLEEP_MILLI_SEC = 1;
|
||||
/* 1초 */
|
||||
public static final long SLEEP_SECOND = 1000;
|
||||
/* 30초 */
|
||||
public static final long SLEEP_HALF_MINIUTE = 30000;
|
||||
/* 1분 */
|
||||
public static final long SLEEP_MINIUTE = 60000;
|
||||
|
||||
public final String controllClassName;
|
||||
public final long repeatMiliSec;
|
||||
public final CustomThreadWork definedWork;
|
||||
public final CustomThreadOnTerminate definedTerminate;
|
||||
public final Logger logger;
|
||||
private boolean running;
|
||||
|
||||
/**
|
||||
* 인터럽트를 받을 시 스레드가 종료됨.<br>
|
||||
* {@link Thread#sleep(long)} 기반으로 재실행 간격을 설정하므로 정확한 실행시간을 보장하지 않음.<br>
|
||||
* 정확한 실행시간 보장이 필요 할 경우 sleep 간격을 짧게 설정하고 호출위치에서 시간확인<br>
|
||||
* 정상적인 종료는 {@link #gracefulStop()}으로 종료함
|
||||
* @param threadName 스레드 이름
|
||||
* @param controllClass 스레드 관리 클래스, 일반적으로 this 사용
|
||||
* @param repeatMiliSec Sleep 시간(밀리 초), 0이하의 경우 대기시간 없음
|
||||
* @param definedWork 반복할 작업
|
||||
* @param definedTerminate 스레드가 인터럽트에 의해 종료될 경우 할 작업
|
||||
* @param autoStart 생성즉시 실행
|
||||
*/
|
||||
|
||||
public CustomThread(String threadName, Object controllClass, long repeatMiliSec,
|
||||
CustomThreadWork definedWork, CustomThreadOnTerminate definedTerminate, boolean autoStart) {
|
||||
|
||||
if (definedWork == null) {
|
||||
throw new IllegalArgumentException("[CustomThread] - definedWork is null.");
|
||||
}
|
||||
|
||||
this.definedWork = definedWork;
|
||||
this.definedTerminate = definedTerminate;
|
||||
this.controllClassName = controllClass == null ? "" : controllClass.getClass().getSimpleName();
|
||||
this.repeatMiliSec = repeatMiliSec > 0 ? repeatMiliSec : 0;
|
||||
this.logger = LoggerFactory.getLogger(CustomThread.class);
|
||||
this.running = false;
|
||||
|
||||
setName(threadName);
|
||||
setDaemon(true);
|
||||
if (autoStart) {
|
||||
this.start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
logger.info("[CustomThread] Started.");
|
||||
while ( this.running && !this.isInterrupted()) {
|
||||
try {
|
||||
try {
|
||||
this.definedWork.work();
|
||||
} finally {
|
||||
if (this.repeatMiliSec > 0) {
|
||||
Thread.sleep(this.repeatMiliSec);
|
||||
}
|
||||
}
|
||||
} catch(InterruptedException e) { // 인터럽트 수신시 종료
|
||||
logger.error("[CustomThread] Interrupted. "+ e.toString());
|
||||
Thread.currentThread().interrupt();
|
||||
break;
|
||||
} catch(Exception e) { // 처리되지 않은 예외 로깅, 예외에 의한 무한루프에 주의
|
||||
logger.error("[CustomThread] Unknown Exception Occur. " + e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
if(this.definedTerminate != null) {
|
||||
this.definedTerminate.onTerminate();
|
||||
}
|
||||
|
||||
logger.error("[CustomThread] Stoped.");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
return "CustomThread [controllClass=" + this.controllClassName + ", threadName=" + getName() +
|
||||
", runnig=" + this.running + ", alive=" + isAlive()+ ", repeatMiliSec=" + this.repeatMiliSec +
|
||||
", definedTerminate=" + (this.definedTerminate == null ? "no" : "yes") + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void start() {
|
||||
this.running = true;
|
||||
super.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* 스레드 정상종료, 진행중인 작업 완료 후 종료됨.
|
||||
*/
|
||||
public void gracefulStop() {
|
||||
this.running = false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package kr.gmtc.gw.comp.thread.handler;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface CustomThreadOnTerminate {
|
||||
public void onTerminate();
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package kr.gmtc.gw.comp.thread.handler;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface CustomThreadWork {
|
||||
public void work() throws Exception;
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package kr.gmtc.gw.standstatus;
|
||||
|
||||
import java.time.ZoneId;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.ApplicationPidFileWriter;
|
||||
import org.springframework.boot.system.ApplicationHome;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@EnableScheduling
|
||||
@SpringBootApplication
|
||||
public class DevApplication {
|
||||
// implements CommandLineRunner
|
||||
// @Autowired
|
||||
// private ApplicationContext appContext;
|
||||
|
||||
public static void main(String[] args) {
|
||||
//SpringApplication.run(SocketApplication.class, args);
|
||||
ApplicationHome home = new ApplicationHome(DevApplication.class);
|
||||
String root = home.getDir().getPath();
|
||||
|
||||
System.setProperty("user.dir", root);
|
||||
|
||||
// TimeZone.setDefault(TimeZone.getTimeZone(ZoneId.of("UTC")));
|
||||
|
||||
Thread.currentThread().setName("JVM - Main");
|
||||
|
||||
SpringApplication springApplication = new SpringApplication(DevApplication.class);
|
||||
|
||||
springApplication.addListeners(new ApplicationPidFileWriter("./application.pid"));
|
||||
springApplication.run(args);
|
||||
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void run(String...args) throws Exception {
|
||||
|
||||
// String [] beans = appContext.getBeanDefinitionNames();
|
||||
// Arrays.sort(beans);
|
||||
// for(String bean : beans ){
|
||||
// System.out.println(bean);
|
||||
// }
|
||||
|
||||
|
||||
// }
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package kr.gmtc.gw.standstatus.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
@Configuration("ServiceConfig")
|
||||
public class ServiceConfig {
|
||||
|
||||
@Value("${root}")
|
||||
private String root;
|
||||
|
||||
@PostConstruct
|
||||
private void initialize() {
|
||||
}
|
||||
|
||||
@Bean(name = "packetQ")
|
||||
public Queue<String> packetQ(){
|
||||
return new LinkedBlockingQueue<String>();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package kr.gmtc.gw.standstatus.controller;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.event.ContextClosedEvent;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import kr.gmt.so.state.StateManager;
|
||||
import kr.gmt.so.state.callback.IState;
|
||||
import kr.gmt.so.state.model.SystemType;
|
||||
|
||||
@Component("controller")
|
||||
public class MainController implements ApplicationListener<ContextClosedEvent> {
|
||||
|
||||
@Autowired
|
||||
private StateManager sm;
|
||||
|
||||
public Logger logger;
|
||||
|
||||
public MainController(StateManager sm){
|
||||
|
||||
this.logger = LoggerFactory.getLogger(MainController.class);
|
||||
|
||||
this.sm = sm;
|
||||
|
||||
sm.updateState();
|
||||
|
||||
// sm.isActive();
|
||||
|
||||
// sm.isActive("DT0201", SystemType.Primary);
|
||||
|
||||
// sm.setCallback(new IState() {
|
||||
// @Override
|
||||
// public void onState(String ID, String Type, String State, boolean isActive) {
|
||||
// logger.info("[STATE] {},{},{},{}", ID, Type, State, isActive);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
@Scheduled(fixedRate = 1000 * 10) // 10초에 1번
|
||||
public void testSchduler() {
|
||||
|
||||
if(sm.isActive()){
|
||||
logger.info("************************** Active **************************");
|
||||
}
|
||||
|
||||
sm.updateState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ContextClosedEvent event) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'onApplicationEvent'");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
{"properties": [
|
||||
{
|
||||
"name": "root",
|
||||
"type": "java.lang.String",
|
||||
"description": "A description for 'root'"
|
||||
},
|
||||
{
|
||||
"name": "asde.filepath1",
|
||||
"type": "java.lang.String",
|
||||
"description": "A description for 'asde.filepath1'"
|
||||
},
|
||||
{
|
||||
"name": "asde.filepath2",
|
||||
"type": "java.lang.String",
|
||||
"description": "A description for 'asde.filepath2'"
|
||||
},
|
||||
{
|
||||
"name": "asde.service",
|
||||
"type": "java.lang.String",
|
||||
"description": "A description for 'asde.service'"
|
||||
},
|
||||
{
|
||||
"name": "asde.service.queueCount",
|
||||
"type": "java.lang.String",
|
||||
"description": "A description for 'asde.queueCount'"
|
||||
},
|
||||
{
|
||||
"name": "asde.service.clearQ.max-count",
|
||||
"type": "java.lang.String",
|
||||
"description": "A description for 'asde.clearQ.max-count'"
|
||||
},
|
||||
{
|
||||
"name": "asde.service.clearQ.diff-time",
|
||||
"type": "java.lang.String",
|
||||
"description": "A description for 'asde.clearQ.diff-time'"
|
||||
},
|
||||
{
|
||||
"name": "asde.service.clearQ.clearTime",
|
||||
"type": "java.lang.String",
|
||||
"description": "A description for 'asde.clearQ.clearTime'"
|
||||
}
|
||||
]}
|
|
@ -0,0 +1,54 @@
|
|||
spring:
|
||||
profiles:
|
||||
active: default
|
||||
group:
|
||||
default:
|
||||
- winTest
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: default
|
||||
|
||||
server:
|
||||
port: 18082
|
||||
tomcat:
|
||||
# accept-count: 0
|
||||
# threads:
|
||||
# max: 1 # 1이상인경우 Queue데이터 rest서비스할때 비정상 처리될 수 있음.
|
||||
# keep-alive-timeout: 0 # Default: connectionTimeout = 60000(60s), 0이상인경우 비정상 처리됨
|
||||
# max-keep-alive-requests: 0 # Default: 100, 0이상인경우 rest 서비스 속도 느려짐
|
||||
# # max-connections: 3 # Default: 8192
|
||||
accesslog:
|
||||
directory: ${root}/wasLog/
|
||||
enabled: true
|
||||
file-date-format: .yyyy-MM-dd
|
||||
max-days: 14
|
||||
pattern: '%h %l %u %t "%r" %s %b %D'
|
||||
prefix: was_access
|
||||
rotate: true
|
||||
suffix: .log
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: real
|
||||
|
||||
root: /home/gmt/app/EyeGW_AsdeRecv
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: winTest
|
||||
|
||||
root: D:\Workspace\Odroid_repository\EyeGW_CompDev
|
||||
|
||||
state:
|
||||
# 공통코드 CT001의 코드 6자리
|
||||
id: DT0201
|
||||
# 1:Primary, 2:Secondary
|
||||
type: Secondary
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" >
|
||||
|
||||
<property name="PATH_SEPARATOR" value="/"/>
|
||||
|
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
|
||||
|
||||
<!-- 로그 파일이 저장될 경로 -->
|
||||
<property name="LOG_PATH" value=".${PATH_SEPARATOR}logs"/>
|
||||
|
||||
|
||||
<!-- 로그 파일 이름 -->
|
||||
<property name="LOG_FILE_NAME" value="trace"/>
|
||||
|
||||
<!-- 로그 출력 패턴 -->
|
||||
<property name="LOG_PATTERN" value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] %highlight([%.-1level]) %clr([%-40.40(%class{0}.%method)]){cyan} %msg%n"/>
|
||||
<property name="FILE_LOG_PATTERN" value="[%d{yyyy-MM-dd HH:mm:ss.SSS}][%.-1level][%-40.40(%class{0}.%method)] %msg%n"/>
|
||||
<!--
|
||||
<property name="LOG_PATTERN" value="[%d{yyyy-MM-dd HH:mm:ss.SSS}][%.-1level][%class{0}.%method] %msg%n"/>
|
||||
<property name="LOG_PATTERN" value="[%d{yyyy-MM-dd HH:mm:ss.SSS}][%.-1level]%msg%n"/>
|
||||
-->
|
||||
|
||||
<!-- 로그 레벨 -->
|
||||
<!--
|
||||
1) ERROR : 오류 메시지 표시
|
||||
2) WARN : 경고성 메시지 표시
|
||||
3) INFO : 정보성 메시지 표시
|
||||
4) DEBUG : 디버깅하기 위한 메시지 표시
|
||||
5) TRACE : Debug보다 훨씬 상세한 메시지 표시
|
||||
-->
|
||||
<property name="LOG_LEVEL" value="INFO"/>
|
||||
|
||||
<!-- CONSOLE에 로그 출력 세팅 -->
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<!-- <layout class="kr.gmt.gw.logger.GMTPatternLayout"> -->
|
||||
<layout class="ch.qos.logback.classic.PatternLayout">
|
||||
<pattern>${LOG_PATTERN}</pattern>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- File에 로그 출력 세팅 -->
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
|
||||
<!-- 로그파일은 Info부터 저장한다!! -->
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>INFO</level>
|
||||
</filter>
|
||||
|
||||
<!-- 파일 경로 설정 -->
|
||||
<file>${LOG_PATH}${PATH_SEPARATOR}${LOG_FILE_NAME}.log</file>
|
||||
|
||||
<!-- 출력패턴 설정-->
|
||||
<layout class="ch.qos.logback.classic.PatternLayout">
|
||||
<pattern>${FILE_LOG_PATTERN}</pattern>
|
||||
</layout>
|
||||
|
||||
<!-- Rolling 정책 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- .gz,.zip 등을 넣으면 자동 일자별 로그파일 압축 -->
|
||||
<fileNamePattern>${LOG_PATH}${PATH_SEPARATOR}%d{yyyyMM,aux}${PATH_SEPARATOR}%d{yyyyMMdd}.log</fileNamePattern>
|
||||
<!-- 로그파일 최대 보관주기, fileNamePattern 에 따라 일별, 월별, 년별-->
|
||||
<maxHistory>10</maxHistory>
|
||||
<!-- 아카이브 최대 용량 maxHistory 이후에 적용됨 -->
|
||||
<totalSizeCap>100mb</totalSizeCap>
|
||||
<!-- 시작시 정책 적용 여부 -->
|
||||
<CleanHistoryOnStart>true</CleanHistoryOnStart>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
<!-- 비동기 파일(FILE)
|
||||
includeCallerData: fasle, 비동기 로깅에서도 Method Name 및 Line Number 등 위치 정보를 출력하게 해주는 옵션
|
||||
queueSize: 기본값은 256, Log4j2와 동일하게 1024로 설정
|
||||
neverBlock: false(기본값)면 로그 발생시 Queue에 넣을 공간이 없으면 빈 공간이 생길 때 까지 블락킹 상태로 기다리며, 로그를 유실하지 않는다.
|
||||
discardingThreshold: Queue에 남은 용량이 {해당 설정값 n}%이하가 되면, WARN 미만 로그가 유실되기 시작한다.
|
||||
- 기본 값은 20이며, Queue 남은 용량이 20%이하가 되면 로그 유실이 발생한다.
|
||||
- 0으로 세팅하면 Queue에 쌓인 로그를 드랍하지 않는다.
|
||||
-->
|
||||
<appender name="FILE-ASYNC" class="ch.qos.logback.classic.AsyncAppender">
|
||||
<appender-ref ref="FILE" />
|
||||
<includeCallerData>false</includeCallerData>
|
||||
<discardingThreshold>0</discardingThreshold>
|
||||
<queueSize>1024</queueSize>
|
||||
<neverBlock>true</neverBlock>
|
||||
</appender>
|
||||
|
||||
|
||||
|
||||
<!-- 로그 전역 세팅 -->
|
||||
<root level="${LOG_LEVEL}">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="FILE"/>
|
||||
</root>
|
||||
|
||||
<!-- <logger name="kr.gmtc.gw" level="TRACE">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="FILE"/>
|
||||
</logger> -->
|
||||
|
||||
<!-- <logger name="kr.gmtc.comp.status" level="TRACE">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="FILE"/>
|
||||
</logger> -->
|
||||
|
||||
</configuration>
|
Loading…
Reference in New Issue