[+] socket signal

This commit is contained in:
acgist
2023-02-12 21:16:08 +08:00
parent 61c93b2614
commit 78fa48c35c
14 changed files with 412 additions and 35 deletions

View File

@@ -52,6 +52,7 @@ import com.acgist.taoyao.boot.property.IdProperties;
import com.acgist.taoyao.boot.property.MediaProperties;
import com.acgist.taoyao.boot.property.ScriptProperties;
import com.acgist.taoyao.boot.property.SecurityProperties;
import com.acgist.taoyao.boot.property.SocketProperties;
import com.acgist.taoyao.boot.property.TaoyaoProperties;
import com.acgist.taoyao.boot.property.WebrtcProperties;
import com.acgist.taoyao.boot.service.IdService;
@@ -82,6 +83,7 @@ import lombok.extern.slf4j.Slf4j;
IdProperties.class,
MediaProperties.class,
ScriptProperties.class,
SocketProperties.class,
TaoyaoProperties.class,
WebrtcProperties.class,
SecurityProperties.class

View File

@@ -0,0 +1,52 @@
package com.acgist.taoyao.boot.property;
import org.springframework.boot.context.properties.ConfigurationProperties;
import lombok.Getter;
import lombok.Setter;
/**
* Socket信令配置
*
* @author acgist
*/
@Getter
@Setter
@ConfigurationProperties(prefix = "taoyao.socket")
public class SocketProperties {
/**
* 是否启用
*/
private Boolean enabled;
/**
* 监听地址
*/
private String host;
/**
* 监听端口
*/
private Integer port;
/**
* 线程队列长度
*/
private Integer queueSize;
/**
* 最小线程数量
*/
private Integer threadMin;
/**
* 最大线程数量
*/
private Integer threadMax;
/**
* 线程池的前缀
*/
private String threadNamePrefix;
/**
* 线程销毁时间
*/
private Integer keepAliveTime;
}

View File

@@ -26,16 +26,6 @@ public class TaoyaoProperties {
*/
@Schema(title = "项目名称", description = "项目名称")
private String name;
/**
* 超时时间
*/
@Schema(title = "超时时间", description = "超时时间")
private Long timeout;
/**
* 最大超时时间
*/
@Schema(title = "最大超时时间", description = "最大超时时间")
private Long maxTimeout;
/**
* 项目版本
*/
@@ -46,5 +36,15 @@ public class TaoyaoProperties {
*/
@Schema(title = "项目描述", description = "项目描述")
private String description;
/**
* 超时时间
*/
@Schema(title = "超时时间", description = "超时时间")
private Long timeout;
/**
* 最大超时时间
*/
@Schema(title = "最大超时时间", description = "最大超时时间")
private Long maxTimeout;
}

View File

@@ -0,0 +1,44 @@
package com.acgist.taoyao.boot.utils;
import java.io.Closeable;
import lombok.extern.slf4j.Slf4j;
/**
* 关闭资源工具
*
* @author acgist
*/
@Slf4j
public class CloseableUtils {
private CloseableUtils() {
}
/**
* 关闭资源
*
* @param closeable 资源
*/
public static final void close(Closeable closeable) {
try {
closeable.close();
} catch (Exception e) {
log.error("关闭资源异常", e);
}
}
/**
* 关闭资源
*
* @param closeable 资源
*/
public static final void close(AutoCloseable closeable) {
try {
closeable.close();
} catch (Exception e) {
log.error("关闭资源异常", e);
}
}
}