Code example for EventBus

Methods: postregister

0
    * WARNING: Caller is responsible for also unsubscribing to avoid leaking memory. 
    * 
    * @param observer 
    */ 
   public void subscribe(Object observer) { 
      eventBus.register(observer);
      // Sends current state directly to listener when subscribing to sync up. 
      eventBus.post(new InstancerStateChange(state, state, self));
   } 
 
   public void unsubscribe(Object observer) { 
      eventBus.unregister(observer);
   } 
 
   protected void setState(Instancer.State state) {
      InstancerStateChange change = new InstancerStateChange(this.state, state, self);
      this.state = state;
      eventBus.post(change);
   } 
} 
Contextual code suggestions in your IDE  Get Codota for Java