[*] 异步执行
This commit is contained in:
@@ -2,6 +2,9 @@ package com.acgist.taoyao.signal.protocol;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
|
||||
import com.acgist.taoyao.boot.config.Constant;
|
||||
import com.acgist.taoyao.boot.model.Message;
|
||||
import com.acgist.taoyao.boot.model.MessageCodeException;
|
||||
@@ -16,6 +19,9 @@ import com.acgist.taoyao.signal.client.ClientType;
|
||||
*/
|
||||
public abstract class ProtocolControlAdapter extends ProtocolClientAdapter {
|
||||
|
||||
@Autowired
|
||||
protected TaskExecutor taskExecutor;
|
||||
|
||||
protected ProtocolControlAdapter(String name, String signal) {
|
||||
super(name, signal);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
|
||||
import com.acgist.taoyao.boot.annotation.Description;
|
||||
import com.acgist.taoyao.boot.annotation.Protocol;
|
||||
@@ -60,11 +59,14 @@ public class ControlServerRecordProtocol extends ProtocolControlAdapter implemen
|
||||
this.ffmpegProperties = ffmpegProperties;
|
||||
}
|
||||
|
||||
@Async
|
||||
// @Async
|
||||
@Override
|
||||
public void onApplicationEvent(RecorderCloseEvent event) {
|
||||
final Recorder recorder = event.getRecorder();
|
||||
this.stop(recorder.getRoom(), recorder.getClientWrapper());
|
||||
// 没有提供接口不能使用注解异步执行
|
||||
this.taskExecutor.execute(() -> {
|
||||
final Recorder recorder = event.getRecorder();
|
||||
this.stop(recorder.getRoom(), recorder.getClientWrapper());
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user