Search in sources :

Example 1 with TurboFailover

use of rpc.turbo.annotation.TurboFailover in project turbo-rpc by hank-whu.

the class TurboClientStarter method postProcessAfterInitialization.

@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
    if (bean == null) {
        return bean;
    }
    if (bean instanceof TurboClientAware) {
        ((TurboClientAware) bean).setTurboClient(turboClient);
    }
    Class<?> clazz = bean.getClass();
    TurboFailover turboFailover = clazz.getAnnotation(TurboFailover.class);
    if (turboFailover == null) {
        return bean;
    }
    if (logger.isInfoEnabled()) {
        logger.info("扫描到Failover实例,重置TurboFailover: " + clazz.getName() + turboFailover);
    }
    turboClient.setFailover(turboFailover.service(), bean);
    return bean;
}
Also used : TurboFailover(rpc.turbo.annotation.TurboFailover)

Aggregations

TurboFailover (rpc.turbo.annotation.TurboFailover)1