[~] @NonNull

This commit is contained in:
acgist
2025-04-21 09:33:53 +08:00
parent 40149bc496
commit 811a57a27b
26 changed files with 57 additions and 29 deletions

View File

@@ -2,6 +2,7 @@ package com.acgist.taoyao.boot.configuration;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.lang.NonNull;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@@ -23,7 +24,7 @@ public class WebMvcConfigurerAutoConfiguration implements WebMvcConfigurer {
private final ApplicationContext applicationContext;
@Override
public void addInterceptors(InterceptorRegistry registry) {
public void addInterceptors(@NonNull InterceptorRegistry registry) {
this.applicationContext.getBeansOfType(InterceptorAdapter.class).entrySet().stream()
.sorted((a, z) -> a.getValue().compareTo(z.getValue()))
.forEach(entry -> {

View File

@@ -6,6 +6,7 @@ import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.lang.NonNull;
import org.springframework.util.AntPathMatcher;
import com.acgist.taoyao.boot.config.SecurityProperties;
@@ -63,7 +64,7 @@ public class SecurityInterceptor extends InterceptorAdapter {
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
public boolean preHandle(@NonNull HttpServletRequest request, @NonNull HttpServletResponse response, @NonNull Object handler) throws Exception {
if(this.permit(request) || this.authorization(request)) {
return true;
}

View File

@@ -1,5 +1,8 @@
package com.acgist.taoyao.interceptor;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
import com.acgist.taoyao.boot.config.TaoyaoProperties;
import com.acgist.taoyao.boot.interceptor.InterceptorAdapter;
@@ -43,13 +46,13 @@ public class SlowInterceptor extends InterceptorAdapter {
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
public boolean preHandle(@NonNull HttpServletRequest request, @NonNull HttpServletResponse response, @NonNull Object handler) throws Exception {
this.local.set(System.currentTimeMillis());
return true;
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception e) throws Exception {
public void afterCompletion(@NonNull HttpServletRequest request, @NonNull HttpServletResponse response, @NonNull Object handler, @Nullable Exception e) throws Exception {
final long duration = System.currentTimeMillis() - this.local.get();
if(duration > this.taoyaoProperties.getTimeout()) {
log.info("请求执行时间过慢:{} - {}", request.getRequestURI(), duration);

View File

@@ -2,6 +2,7 @@ package com.acgist.taoyao.listener;
import org.springframework.boot.context.event.ApplicationStartingEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull;
import lombok.extern.slf4j.Slf4j;
@@ -17,7 +18,7 @@ import lombok.extern.slf4j.Slf4j;
public class QnjrcmzListener implements ApplicationListener<ApplicationStartingEvent> {
@Override
public void onApplicationEvent(ApplicationStartingEvent event) {
public void onApplicationEvent(@NonNull ApplicationStartingEvent event) {
synchronized (QnjrcmzListener.class) {
log.debug("配置忽略证书域名校验");
// 配置JDK HTTPClient域名校验问题

View File

@@ -2,6 +2,7 @@ package com.acgist.taoyao.listener;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull;
import com.acgist.taoyao.boot.annotation.Listener;
import com.acgist.taoyao.boot.config.TaoyaoProperties;
@@ -19,7 +20,7 @@ import lombok.extern.slf4j.Slf4j;
public class ThyjxcfListener implements ApplicationListener<ApplicationReadyEvent> {
@Override
public void onApplicationEvent(ApplicationReadyEvent event) {
public void onApplicationEvent(@NonNull ApplicationReadyEvent event) {
synchronized (ThyjxcfListener.class) {
final TaoyaoProperties taoyaoProperties = event.getApplicationContext().getBean(TaoyaoProperties.class);
log.info("项目启动成功:{}", taoyaoProperties.getName());

View File

@@ -6,6 +6,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import org.springframework.lang.NonNull;
import org.springframework.test.context.TestContext;
import org.springframework.test.context.TestExecutionListener;
@@ -20,13 +21,13 @@ import lombok.extern.slf4j.Slf4j;
public class CostedTestTestExecutionListener implements TestExecutionListener {
@Override
public void afterTestMethod(TestContext testContext) throws Exception {
public void afterTestMethod(@NonNull TestContext testContext) throws Exception {
final CostedTest costedTest = testContext.getTestMethod().getDeclaredAnnotation(CostedTest.class);
if(costedTest == null) {
return;
}
final int count = costedTest.count();
final int thread = costedTest.thread();
final int count = costedTest.count();
final int thread = costedTest.thread();
final long timeout = costedTest.timeout();
final TimeUnit timeUnit = costedTest.timeUnit();
final long aTime = System.currentTimeMillis();

View File

@@ -3,6 +3,7 @@ package com.acgist.taoyao.signal.protocol.client;
import java.util.Map;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull;
import org.springframework.scheduling.annotation.Async;
import com.acgist.taoyao.boot.annotation.Description;
@@ -44,7 +45,7 @@ public class ClientCloseProtocol extends ProtocolClientAdapter implements Applic
@Async
@Override
public void onApplicationEvent(ClientCloseEvent event) {
public void onApplicationEvent(@NonNull ClientCloseEvent event) {
this.close(event.getClient());
}

View File

@@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.Map;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull;
import org.springframework.scheduling.annotation.Async;
import com.acgist.taoyao.boot.annotation.Description;
@@ -52,7 +53,7 @@ public class ClientConfigProtocol extends ProtocolClientAdapter implements Appli
@Async
@Override
public void onApplicationEvent(ClientConfigEvent event) {
public void onApplicationEvent(@NonNull ClientConfigEvent event) {
final Client client = event.getClient();
final ClientType clientType = client.getClientType();
client.push(this.build(clientType));

View File

@@ -3,6 +3,7 @@ package com.acgist.taoyao.signal.protocol.client;
import java.util.Map;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull;
import org.springframework.scheduling.annotation.Async;
import com.acgist.taoyao.boot.annotation.Description;
@@ -38,7 +39,7 @@ public class ClientOfflineProtocol extends ProtocolClientAdapter implements Appl
@Async
@Override
public void onApplicationEvent(ClientOfflineEvent event) {
public void onApplicationEvent(@NonNull ClientOfflineEvent event) {
final String clientId = event.getClientId();
this.clientManager.broadcast(clientId, this.build(
Map.of(Constant.CLIENT_ID, clientId)

View File

@@ -1,6 +1,7 @@
package com.acgist.taoyao.signal.protocol.client;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull;
import org.springframework.scheduling.annotation.Async;
import com.acgist.taoyao.boot.annotation.Description;
@@ -49,7 +50,7 @@ public class ClientOnlineProtocol extends ProtocolClientAdapter implements Appli
@Async
@Override
public void onApplicationEvent(ClientOnlineEvent event) {
public void onApplicationEvent(@NonNull ClientOnlineEvent event) {
final Client client = event.getClient();
final String clientId = event.getClientId();
this.clientManager.broadcast(

View File

@@ -4,6 +4,7 @@ import java.util.HashMap;
import java.util.Map;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull;
import org.springframework.scheduling.annotation.Async;
import com.acgist.taoyao.boot.annotation.Description;
@@ -61,7 +62,7 @@ public class ControlServerRecordProtocol extends ProtocolControlAdapter implemen
@Async
@Override
public void onApplicationEvent(RecorderCloseEvent event) {
public void onApplicationEvent(@NonNull RecorderCloseEvent event) {
final Recorder recorder = event.getRecorder();
this.stop(recorder.getRoom(), recorder.getClientWrapper());
}

View File

@@ -4,6 +4,7 @@ import java.util.HashMap;
import java.util.Map;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull;
import org.springframework.scheduling.annotation.Async;
import com.acgist.taoyao.boot.annotation.Description;
@@ -72,7 +73,7 @@ public class MediaConsumeProtocol extends ProtocolRoomAdapter implements Applica
@Async
@Override
public void onApplicationEvent(MediaConsumeEvent event) {
public void onApplicationEvent(@NonNull MediaConsumeEvent event) {
final Room room = event.getRoom();
if(event.getProducer() != null) {
// 生产媒体:其他终端消费

View File

@@ -3,6 +3,7 @@ package com.acgist.taoyao.signal.protocol.media;
import java.util.Map;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull;
import org.springframework.scheduling.annotation.Async;
import com.acgist.taoyao.boot.annotation.Description;
@@ -50,7 +51,7 @@ public class MediaConsumerCloseProtocol extends ProtocolRoomAdapter implements A
@Async
@Override
public void onApplicationEvent(MediaConsumerCloseEvent event) {
public void onApplicationEvent(@NonNull MediaConsumerCloseEvent event) {
final Room room = event.getRoom();
final Client mediaClient = event.getMediaClient();
final Map<String, Object> body = Map.of(

View File

@@ -3,6 +3,7 @@ package com.acgist.taoyao.signal.protocol.media;
import java.util.Map;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull;
import org.springframework.scheduling.annotation.Async;
import com.acgist.taoyao.boot.annotation.Description;
@@ -48,7 +49,7 @@ public class MediaConsumerPauseProtocol extends ProtocolRoomAdapter implements A
@Async
@Override
public void onApplicationEvent(MediaConsumerPauseEvent event) {
public void onApplicationEvent(@NonNull MediaConsumerPauseEvent event) {
final Room room = event.getRoom();
final Client mediaClient = event.getMediaClient();
final Map<String, Object> body = Map.of(

View File

@@ -3,6 +3,7 @@ package com.acgist.taoyao.signal.protocol.media;
import java.util.Map;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull;
import org.springframework.scheduling.annotation.Async;
import com.acgist.taoyao.boot.annotation.Description;
@@ -48,7 +49,7 @@ public class MediaConsumerResumeProtocol extends ProtocolRoomAdapter implements
@Async
@Override
public void onApplicationEvent(MediaConsumerResumeEvent event) {
public void onApplicationEvent(@NonNull MediaConsumerResumeEvent event) {
final Room room = event.getRoom();
final Client mediaClient = event.getMediaClient();
final Map<String, Object> body = Map.of(

View File

@@ -3,6 +3,7 @@ package com.acgist.taoyao.signal.protocol.media;
import java.util.Map;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull;
import org.springframework.scheduling.annotation.Async;
import com.acgist.taoyao.boot.annotation.Description;
@@ -50,7 +51,7 @@ public class MediaDataConsumerCloseProtocol extends ProtocolRoomAdapter implemen
@Async
@Override
public void onApplicationEvent(MediaDataConsumerCloseEvent event) {
public void onApplicationEvent(@NonNull MediaDataConsumerCloseEvent event) {
final Room room = event.getRoom();
final Client mediaClient = event.getMediaClient();
final Map<String, Object> body = Map.of(

View File

@@ -3,6 +3,7 @@ package com.acgist.taoyao.signal.protocol.media;
import java.util.Map;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull;
import org.springframework.scheduling.annotation.Async;
import com.acgist.taoyao.boot.annotation.Description;
@@ -50,7 +51,7 @@ public class MediaDataProducerCloseProtocol extends ProtocolRoomAdapter implemen
@Async
@Override
public void onApplicationEvent(MediaDataProducerCloseEvent event) {
public void onApplicationEvent(@NonNull MediaDataProducerCloseEvent event) {
final Room room = event.getRoom();
final Client mediaClient = event.getMediaClient();
final Map<String, Object> body = Map.of(

View File

@@ -3,6 +3,7 @@ package com.acgist.taoyao.signal.protocol.media;
import java.util.Map;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull;
import org.springframework.scheduling.annotation.Async;
import com.acgist.taoyao.boot.annotation.Description;
@@ -50,7 +51,7 @@ public class MediaProducerCloseProtocol extends ProtocolRoomAdapter implements A
@Async
@Override
public void onApplicationEvent(MediaProducerCloseEvent event) {
public void onApplicationEvent(@NonNull MediaProducerCloseEvent event) {
final Room room = event.getRoom();
final Client mediaClient = event.getMediaClient();
final Map<String, Object> body = Map.of(

View File

@@ -3,6 +3,7 @@ package com.acgist.taoyao.signal.protocol.media;
import java.util.Map;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull;
import com.acgist.taoyao.boot.annotation.Description;
import com.acgist.taoyao.boot.annotation.Protocol;
@@ -43,7 +44,7 @@ public class MediaProducerPauseProtocol extends ProtocolRoomAdapter implements A
}
@Override
public void onApplicationEvent(MediaProducerPauseEvent event) {
public void onApplicationEvent(@NonNull MediaProducerPauseEvent event) {
final Room room = event.getRoom();
final Client mediaClient = event.getMediaClient();
final Map<String, Object> body = Map.of(

View File

@@ -3,6 +3,7 @@ package com.acgist.taoyao.signal.protocol.media;
import java.util.Map;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull;
import com.acgist.taoyao.boot.annotation.Description;
import com.acgist.taoyao.boot.annotation.Protocol;
@@ -43,7 +44,7 @@ public class MediaProducerResumeProtocol extends ProtocolRoomAdapter implements
}
@Override
public void onApplicationEvent(MediaProducerResumeEvent event) {
public void onApplicationEvent(@NonNull MediaProducerResumeEvent event) {
final Room room = event.getRoom();
final Client mediaClient = event.getMediaClient();
final Map<String, Object> body = Map.of(

View File

@@ -3,6 +3,7 @@ package com.acgist.taoyao.signal.protocol.media;
import java.util.Map;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull;
import org.springframework.scheduling.annotation.Async;
import com.acgist.taoyao.boot.annotation.Description;
@@ -50,7 +51,7 @@ public class MediaTransportCloseProtocol extends ProtocolRoomAdapter implements
@Async
@Override
public void onApplicationEvent(TransportCloseEvent event) {
public void onApplicationEvent(@NonNull TransportCloseEvent event) {
final Room room = event.getRoom();
final Client mediaClient = event.getMediaClient();
final Map<String, Object> body = Map.of(

View File

@@ -3,6 +3,7 @@ package com.acgist.taoyao.signal.protocol.room;
import java.util.Map;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull;
import org.springframework.scheduling.annotation.Async;
import com.acgist.taoyao.boot.annotation.Description;
@@ -68,7 +69,7 @@ public class RoomClientListProtocol extends ProtocolRoomAdapter implements Appli
@Async
@Override
public void onApplicationEvent(RoomEnterEvent event) {
public void onApplicationEvent(@NonNull RoomEnterEvent event) {
final Room room = event.getRoom();
final Client client = event.getClient();
client.push(this.build(Map.of(

View File

@@ -3,6 +3,7 @@ package com.acgist.taoyao.signal.protocol.room;
import java.util.Map;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull;
import com.acgist.taoyao.boot.annotation.Description;
import com.acgist.taoyao.boot.annotation.Protocol;
@@ -37,7 +38,7 @@ public class RoomCloseProtocol extends ProtocolRoomAdapter implements Applicatio
}
@Override
public void onApplicationEvent(RoomCloseEvent event) {
public void onApplicationEvent(@NonNull RoomCloseEvent event) {
final Room room = event.getRoom();
final Client mediaClient = room.getMediaClient();
mediaClient.push(this.build(Map.of(

View File

@@ -3,6 +3,7 @@ package com.acgist.taoyao.signal.protocol.room;
import java.util.Map;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull;
import org.springframework.scheduling.annotation.Async;
import com.acgist.taoyao.boot.annotation.Description;
@@ -55,7 +56,7 @@ public class RoomCreateProtocol extends ProtocolClientAdapter implements Applica
@Async
@Override
public void onApplicationEvent(MediaServerRegisterEvent event) {
public void onApplicationEvent(@NonNull MediaServerRegisterEvent event) {
this.roomManager.recreate(event.getClient(), this.build());
}

View File

@@ -3,6 +3,7 @@ package com.acgist.taoyao.signal.protocol.room;
import java.util.Map;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull;
import org.springframework.scheduling.annotation.Async;
import com.acgist.taoyao.boot.annotation.Description;
@@ -50,7 +51,7 @@ public class RoomLeaveProtocol extends ProtocolRoomAdapter implements Applicatio
@Async
@Override
public void onApplicationEvent(RoomLeaveEvent event) {
public void onApplicationEvent(@NonNull RoomLeaveEvent event) {
final Room room = event.getRoom();
final Client client = event.getClient();
final Map<String, String> body = Map.of(

View File

@@ -3,6 +3,7 @@ package com.acgist.taoyao.signal.protocol.session;
import java.util.Map;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull;
import com.acgist.taoyao.boot.annotation.Description;
import com.acgist.taoyao.boot.annotation.Protocol;
@@ -40,7 +41,7 @@ public class SessionCloseProtocol extends ProtocolSessionAdapter implements Appl
}
@Override
public void onApplicationEvent(SessionCloseEvent event) {
public void onApplicationEvent(@NonNull SessionCloseEvent event) {
final Session session = event.getSession();
session.push(this.build(Map.of(
Constant.SESSION_ID,