Search in sources :

Example 1 with StatefulRedisClusterConnectionImpl

use of io.lettuce.core.cluster.StatefulRedisClusterConnectionImpl in project pinpoint by naver.

the class AttachEndPointInterceptor method after.

@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
    if (isDebug) {
        logger.afterInterceptor(target, args, result, throwable);
    }
    try {
        if (!validate(target, result)) {
            return;
        }
        final String endPoint = ((EndPointAccessor) target)._$PINPOINT$_getEndPoint();
        if (result instanceof CompletableFuture) {
            StatefulRedisClusterConnectionImpl statefulRedisClusterConnection = (StatefulRedisClusterConnectionImpl) ((CompletableFuture) result).get();
            ((EndPointAccessor) statefulRedisClusterConnection)._$PINPOINT$_setEndPoint(endPoint);
            return;
        }
        ((EndPointAccessor) result)._$PINPOINT$_setEndPoint(endPoint);
    } catch (Throwable t) {
        if (logger.isWarnEnabled()) {
            logger.warn("Failed to AFTER process. {}", t.getMessage(), t);
        }
    }
}
Also used : EndPointAccessor(com.navercorp.pinpoint.plugin.redis.lettuce.EndPointAccessor) CompletableFuture(java.util.concurrent.CompletableFuture) StatefulRedisClusterConnectionImpl(io.lettuce.core.cluster.StatefulRedisClusterConnectionImpl)

Aggregations

EndPointAccessor (com.navercorp.pinpoint.plugin.redis.lettuce.EndPointAccessor)1 StatefulRedisClusterConnectionImpl (io.lettuce.core.cluster.StatefulRedisClusterConnectionImpl)1 CompletableFuture (java.util.concurrent.CompletableFuture)1