1
1
/*
2
- * Copyright 2002-2016 the original author or authors.
2
+ * Copyright 2002-2019 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
18
18
19
19
/**
20
20
* Interface that encapsulates event publication functionality.
21
- * Serves as super-interface for {@link ApplicationContext}.
21
+ *
22
+ * <p>Serves as a super-interface for {@link ApplicationContext}.
22
23
*
23
24
* @author Juergen Hoeller
24
25
* @author Stephane Nicoll
25
26
* @since 1.1.1
26
27
* @see ApplicationContext
27
28
* @see ApplicationEventPublisherAware
28
29
* @see org.springframework.context.ApplicationEvent
30
+ * @see org.springframework.context.event.ApplicationEventMulticaster
29
31
* @see org.springframework.context.event.EventPublicationInterceptor
30
32
*/
31
33
@ FunctionalInterface
@@ -34,9 +36,16 @@ public interface ApplicationEventPublisher {
34
36
/**
35
37
* Notify all <strong>matching</strong> listeners registered with this
36
38
* application of an application event. Events may be framework events
37
- * (such as RequestHandledEvent) or application-specific events.
39
+ * (such as ContextRefreshedEvent) or application-specific events.
40
+ * <p>Such an event publication step is effectively a hand-off to the
41
+ * multicaster and does not imply synchronous/asynchronous execution
42
+ * or even immediate execution at all. Event listeners are encouraged
43
+ * to be as efficient as possible, individually using asynchronous
44
+ * execution for longer-running and potentially blocking operations.
38
45
* @param event the event to publish
39
- * @see org.springframework.web.context.support.RequestHandledEvent
46
+ * @see #publishEvent(Object)
47
+ * @see org.springframework.context.event.ContextRefreshedEvent
48
+ * @see org.springframework.context.event.ContextClosedEvent
40
49
*/
41
50
default void publishEvent (ApplicationEvent event ) {
42
51
publishEvent ((Object ) event );
@@ -47,8 +56,14 @@ default void publishEvent(ApplicationEvent event) {
47
56
* application of an event.
48
57
* <p>If the specified {@code event} is not an {@link ApplicationEvent},
49
58
* it is wrapped in a {@link PayloadApplicationEvent}.
59
+ * <p>Such an event publication step is effectively a hand-off to the
60
+ * multicaster and does not imply synchronous/asynchronous execution
61
+ * or even immediate execution at all. Event listeners are encouraged
62
+ * to be as efficient as possible, individually using asynchronous
63
+ * execution for longer-running and potentially blocking operations.
50
64
* @param event the event to publish
51
65
* @since 4.2
66
+ * @see #publishEvent(ApplicationEvent)
52
67
* @see PayloadApplicationEvent
53
68
*/
54
69
void publishEvent (Object event );
0 commit comments