모든 OS에서 ip 가져오도록 수정 (기존 방식은 windows에서만 사용 가능)
This commit is contained in:
parent
90415468d0
commit
58174df6e5
@ -1,6 +1,9 @@
|
|||||||
package kcc.kccadr.message;
|
package kcc.kccadr.message;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
|
import java.net.NetworkInterface;
|
||||||
|
import java.net.SocketException;
|
||||||
|
import java.util.Enumeration;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@ -52,15 +55,33 @@ public class SchedulerUtil {
|
|||||||
@Scheduled(cron = "0 0/10 * * * *")
|
@Scheduled(cron = "0 0/10 * * * *")
|
||||||
@SchedulerLock(name = "kakaoAtSendPrcs", lockAtMostForString = ONE_MIN, lockAtLeastForString = ONE_MIN)
|
@SchedulerLock(name = "kakaoAtSendPrcs", lockAtMostForString = ONE_MIN, lockAtLeastForString = ONE_MIN)
|
||||||
public void kakaoAtSendPrcs() throws Exception {
|
public void kakaoAtSendPrcs() throws Exception {
|
||||||
|
System.out.println("===========at scheduler run============");
|
||||||
String ip = null;
|
String hostAddr = null;
|
||||||
|
|
||||||
|
//모든 OS에서 서버 고정 IP를 가져오기
|
||||||
|
try {
|
||||||
|
Enumeration<NetworkInterface> nienum = NetworkInterface.getNetworkInterfaces();
|
||||||
|
while (nienum.hasMoreElements()) {
|
||||||
|
NetworkInterface ni = nienum.nextElement();
|
||||||
|
Enumeration<InetAddress> kk= ni.getInetAddresses();
|
||||||
|
while (kk.hasMoreElements()) {
|
||||||
|
InetAddress inetAddress = kk.nextElement();
|
||||||
|
if (!inetAddress.isLoopbackAddress() &&
|
||||||
|
!inetAddress.isLinkLocalAddress() &&
|
||||||
|
inetAddress.isSiteLocalAddress()) {
|
||||||
|
hostAddr = inetAddress.getHostAddress().toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SocketException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ip = InetAddress.getLocalHost().getHostAddress();
|
hostAddr = InetAddress.getLocalHost().getHostAddress();
|
||||||
|
|
||||||
System.out.println("===========at scheduler run============");
|
System.out.println("server ip ============" + hostAddr);
|
||||||
System.out.println("server ip ============" + ip);
|
if(hostAddr.equals(myLocalIp) || hostAddr.equals(devIp) || hostAddr.equals(dmzIp1) || hostAddr.equals(dmzIp2) ) {
|
||||||
if(ip.equals(myLocalIp) || ip.equals(devIp) || ip.equals(dmzIp1) || ip.equals(dmzIp2) ) {
|
|
||||||
//접속 서버 별 분기처리 필요
|
//접속 서버 별 분기처리 필요
|
||||||
|
|
||||||
List<KakaoAtSendVO> list = kakaoAtSendService.selectKakaoAtList();
|
List<KakaoAtSendVO> list = kakaoAtSendService.selectKakaoAtList();
|
||||||
@ -79,13 +100,14 @@ public class SchedulerUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
System.out.println("===========at scheduler finish============");
|
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println(e.getMessage());
|
System.out.println(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println("===========at scheduler finish============");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|||||||
@ -205,6 +205,6 @@ Globals.Kakao.Key=bf3de0d897afe0e4bef0775f7086f048
|
|||||||
|
|
||||||
# \uce74\uce74\uc624\uc54c\ub9bc\ud1a1(\ube44\uc988\ubfcc\ub9ac\uc624) API URL
|
# \uce74\uce74\uc624\uc54c\ub9bc\ud1a1(\ube44\uc988\ubfcc\ub9ac\uc624) API URL
|
||||||
#\uac1c\ubc1c\uc11c\ubc84
|
#\uac1c\ubc1c\uc11c\ubc84
|
||||||
#Globals.BizPpurio.siteUrl=https://dev-api.bizppurio.com
|
Globals.BizPpurio.siteUrl=https://dev-api.bizppurio.com
|
||||||
#\uc2e4\uc11c\ubc84
|
#\uc2e4\uc11c\ubc84
|
||||||
Globals.BizPpurio.siteUrl=https://api.bizppurio.com
|
#Globals.BizPpurio.siteUrl=https://api.bizppurio.com
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user