Posts the given event to the event bus.
(Object event)
| 260 | |
| 261 | /** Posts the given event to the event bus. */ |
| 262 | public void post(Object event) { |
| 263 | PostingThreadState postingState = currentPostingThreadState.get(); |
| 264 | List<Object> eventQueue = postingState.eventQueue; |
| 265 | eventQueue.add(event); |
| 266 | |
| 267 | if (!postingState.isPosting) { |
| 268 | postingState.isMainThread = isMainThread(); |
| 269 | postingState.isPosting = true; |
| 270 | if (postingState.canceled) { |
| 271 | throw new EventBusException("Internal error. Abort state was not reset"); |
| 272 | } |
| 273 | try { |
| 274 | while (!eventQueue.isEmpty()) { |
| 275 | postSingleEvent(eventQueue.remove(0), postingState); |
| 276 | } |
| 277 | } finally { |
| 278 | postingState.isPosting = false; |
| 279 | postingState.isMainThread = false; |
| 280 | } |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | /** |
| 285 | * Called from a subscriber's event handling method, further event delivery will be canceled. Subsequent |