Annotation Interface Async
Async Processing Annotation
异步处理注解
Marks an event handler method for asynchronous execution.
标记事件处理方法为异步执行。
Features | 主要功能:
- Non-blocking event handling - 非阻塞事件处理
- Virtual thread execution (JDK 25+) - 虚拟线程执行
- Suitable for IO-bound operations - 适合IO密集型操作
Usage Examples | 使用示例:
@Subscribe
@Async
public void onOrderCreated(OrderCreatedEvent event) {
// This runs in a virtual thread
sendNotificationEmail(event);
updateAnalytics(event);
}
Note | 注意:
Async handlers run independently and exceptions won't affect other handlers.
异步处理器独立运行,异常不会影响其他处理器。
Security | 安全性:
- Thread-safe: Yes (immutable) - 线程安全: 是(不可变)
- Since:
- JDK 25, opencode-base-event V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also: