设备心跳调整 app新增增设备时绑定联网设备
This commit is contained in:
@@ -70,7 +70,7 @@ public class ThreadPoolConfig {
|
||||
if (!pool.awaitTermination(120, TimeUnit.SECONDS)) {
|
||||
pool.shutdownNow();
|
||||
if (!pool.awaitTermination(120, TimeUnit.SECONDS)) {
|
||||
log.info("Pool did not terminate");
|
||||
log.info("线程池未在指定时间内终止");
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException ie) {
|
||||
@@ -87,9 +87,8 @@ public class ThreadPoolConfig {
|
||||
* 打印线程异常信息
|
||||
*/
|
||||
public static void printException(Runnable r, Throwable t) {
|
||||
if (t == null && r instanceof Future<?>) {
|
||||
if (t == null && r instanceof Future<?> future) {
|
||||
try {
|
||||
Future<?> future = (Future<?>) r;
|
||||
if (future.isDone()) {
|
||||
future.get();
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package org.dromara.common.core.domain;
|
||||
|
||||
import org.dromara.common.core.constant.HttpStatus;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.dromara.common.core.constant.HttpStatus;
|
||||
import org.dromara.common.core.utils.MessageUtils;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
@@ -36,11 +37,11 @@ public class R<T> implements Serializable {
|
||||
private T data;
|
||||
|
||||
public static <T> R<T> ok() {
|
||||
return restResult(null, SUCCESS, "操作成功");
|
||||
return restResult(null, SUCCESS, message("operation.success", "操作成功"));
|
||||
}
|
||||
|
||||
public static <T> R<T> ok(T data) {
|
||||
return restResult(data, SUCCESS, "操作成功");
|
||||
return restResult(data, SUCCESS, message("operation.success", "操作成功"));
|
||||
}
|
||||
|
||||
public static <T> R<T> ok(String msg) {
|
||||
@@ -52,7 +53,7 @@ public class R<T> implements Serializable {
|
||||
}
|
||||
|
||||
public static <T> R<T> fail() {
|
||||
return restResult(null, FAIL, "操作失败");
|
||||
return restResult(null, FAIL, message("operation.fail", "操作失败"));
|
||||
}
|
||||
|
||||
public static <T> R<T> fail(String msg) {
|
||||
@@ -100,6 +101,15 @@ public class R<T> implements Serializable {
|
||||
return r;
|
||||
}
|
||||
|
||||
private static String message(String code, String defaultMessage) {
|
||||
try {
|
||||
String message = MessageUtils.message(code);
|
||||
return code.equals(message) ? defaultMessage : message;
|
||||
} catch (Exception e) {
|
||||
return defaultMessage;
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> Boolean isError(R<T> ret) {
|
||||
return !isSuccess(ret);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class RegionUtils {
|
||||
Config v6Config = null;
|
||||
InputStream v6XdbInputStream = ResourceUtil.getStreamSafe(DEFAULT_IPV6_XDB_PATH);
|
||||
if (v6XdbInputStream == null) {
|
||||
log.warn("未加载 IPv6 地址库:未在类路径下找到文件 {}。当前仅启用 IPv4 查询。如需启用 IPv6,请将 ip2region_v6.xdb 放置到 resources 目录", DEFAULT_IPV6_XDB_PATH);
|
||||
log.warn("未加载 IPv6 地址库:未在类路径下找到文件 {}。当前仅启用 IPv4 查询。如需启用 IPv6,请将 ip2region_v6.xdb 放置到资源目录", DEFAULT_IPV6_XDB_PATH);
|
||||
} else {
|
||||
v6Config = Config.custom()
|
||||
.setCachePolicy(Config.BufferCache)
|
||||
@@ -128,7 +128,7 @@ public class RegionUtils {
|
||||
try {
|
||||
ip2Region.close(10000);
|
||||
} catch (Exception e) {
|
||||
log.error("Ip2Region服务关闭异常", e);
|
||||
log.error("IP地址库服务关闭异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ public class RegionUtils {
|
||||
try {
|
||||
ip2Region.close(timeout.toMillis());
|
||||
} catch (Exception e) {
|
||||
log.error("Ip2Region服务关闭异常", e);
|
||||
log.error("IP地址库服务关闭异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user