17
17
18
18
/**
19
19
* Each subscriber method has a thread mode, which determines in which thread the method is to be called by EventBus.
20
- * EventBus takes care of threading independently from the posting thread.
21
- *
20
+ * EventBus takes care of threading independently of the posting thread.
21
+ *
22
22
* @see EventBus#register(Object)
23
- * @author Markus
24
23
*/
25
24
public enum ThreadMode {
26
25
/**
27
- * Subscriber will be called directly in the same thread, which is posting the event. This is the default . Event delivery
28
- * implies the least overhead because it avoids thread switching completely. Thus this is the recommended mode for
26
+ * This is the default. Subscriber will be called directly in the same thread, which is posting the event. Event delivery
27
+ * implies the least overhead because it avoids thread switching completely. Thus, this is the recommended mode for
29
28
* simple tasks that are known to complete in a very short time without requiring the main thread. Event handlers
30
29
* using this mode must return quickly to avoid blocking the posting thread, which may be the main thread.
31
30
*/
@@ -35,29 +34,34 @@ public enum ThreadMode {
35
34
* On Android, subscriber will be called in Android's main thread (UI thread). If the posting thread is
36
35
* the main thread, subscriber methods will be called directly, blocking the posting thread. Otherwise the event
37
36
* is queued for delivery (non-blocking). Subscribers using this mode must return quickly to avoid blocking the main thread.
37
+ * <p>
38
38
* If not on Android, behaves the same as {@link #POSTING}.
39
39
*/
40
40
MAIN ,
41
41
42
42
/**
43
43
* On Android, subscriber will be called in Android's main thread (UI thread). Different from {@link #MAIN},
44
44
* the event will always be queued for delivery. This ensures that the post call is non-blocking.
45
+ * <p>
46
+ * If not on Android, behaves the same as {@link #POSTING}.
45
47
*/
46
48
MAIN_ORDERED ,
47
49
48
50
/**
49
51
* On Android, subscriber will be called in a background thread. If posting thread is not the main thread, subscriber methods
50
52
* will be called directly in the posting thread. If the posting thread is the main thread, EventBus uses a single
51
53
* background thread, that will deliver all its events sequentially. Subscribers using this mode should try to
52
- * return quickly to avoid blocking the background thread. If not on Android, always uses a background thread.
54
+ * return quickly to avoid blocking the background thread.
55
+ * <p>
56
+ * If not on Android, always uses a background thread.
53
57
*/
54
58
BACKGROUND ,
55
59
56
60
/**
57
- * Subscriber will be called in a separate thread. This is always independent from the posting thread and the
61
+ * Subscriber will be called in a separate thread. This is always independent of the posting thread and the
58
62
* main thread. Posting events never wait for subscriber methods using this mode. Subscriber methods should
59
63
* use this mode if their execution might take some time, e.g. for network access. Avoid triggering a large number
60
- * of long running asynchronous subscriber methods at the same time to limit the number of concurrent threads. EventBus
64
+ * of long- running asynchronous subscriber methods at the same time to limit the number of concurrent threads. EventBus
61
65
* uses a thread pool to efficiently reuse threads from completed asynchronous subscriber notifications.
62
66
*/
63
67
ASYNC
0 commit comments