/** * Sets the internal {@link #getEventBus EventBus} on any internal configured * {@link #getRealms Realms} that implement the {@link EventBusAware} interface. * <p/> * This method is called after setting an eventBus on this securityManager via the * {@link #setEventBus(org.apache.shiro.event.EventBus) setEventBus} method to allow it to be propagated * down to all the internal Realms that would need to use it. * <p/> * It is also called after setting one or more realms via the {@link #setRealm setRealm} or * {@link #setRealms setRealms} methods to allow these newly available realms to be given the EventBus * already in use. * * @since 1.3 */ protected void applyEventBusToRealms() { EventBus eventBus = getEventBus(); Collection<Realm> realms = getRealms(); if (eventBus != null && realms != null && !realms.isEmpty()) { for(Realm realm : realms) { if (realm instanceof EventBusAware) { ((EventBusAware)realm).setEventBus(eventBus); } } } }
/** * Sets the internal {@link #getEventBus EventBus} on any internal configured * {@link #getRealms Realms} that implement the {@link EventBusAware} interface. * <p/> * This method is called after setting an eventBus on this securityManager via the * {@link #setEventBus(org.apache.shiro.event.EventBus) setEventBus} method to allow it to be propagated * down to all the internal Realms that would need to use it. * <p/> * It is also called after setting one or more realms via the {@link #setRealm setRealm} or * {@link #setRealms setRealms} methods to allow these newly available realms to be given the EventBus * already in use. * * @since 1.3 */ protected void applyEventBusToRealms() { EventBus eventBus = getEventBus(); Collection<Realm> realms = getRealms(); if (eventBus != null && realms != null && !realms.isEmpty()) { for(Realm realm : realms) { if (realm instanceof EventBusAware) { ((EventBusAware)realm).setEventBus(eventBus); } } } }