/** * The shortcut to {@link #simpleClassName(Class) simpleClassName(o.getClass())}. */ public static String simpleClassName(Object o) { return o == null ? "null_object" : simpleClassName(o.getClass()); }
/** * The shortcut to {@link #simpleClassName(Class) simpleClassName(o.getClass())}. */ public static String simpleClassName(Object o) { return o == null ? "null_object" : simpleClassName(o.getClass()); }
public FailOverClusterInvoker(Dispatcher dispatcher, int retries) { checkArgument( dispatcher instanceof DefaultRoundDispatcher, Reflects.simpleClassName(dispatcher) + " is unsupported [FailOverClusterInvoker]" ); this.dispatcher = dispatcher; if (retries >= 0) { this.retries = retries; } else { this.retries = 2; } }
public static byte[] toByteArray(Output output) { if (output instanceof WriteSession) { return ((WriteSession) output).toByteArray(); } throw new IllegalArgumentException("Output [" + Reflects.simpleClassName(output) + "] must be a WriteSession's implementation"); }
public FailOverClusterInvoker(Dispatcher dispatcher, int retries) { checkArgument( dispatcher instanceof DefaultRoundDispatcher, Reflects.simpleClassName(dispatcher) + " is unsupported [FailOverClusterInvoker]" ); this.dispatcher = dispatcher; if (retries >= 0) { this.retries = retries; } else { this.retries = 2; } }
private static void reportTooManyInstances() { String resourceType = Reflects.simpleClassName(HashedWheelTimer.class); logger.error("You are creating too many {} instances. {} is a shared resource that must be " + "reused across the JVM, so that only a few instances are created.", resourceType, resourceType); }
private static void reportTooManyInstances() { String resourceType = Reflects.simpleClassName(HashedWheelTimer.class); logger.error("You are creating too many {} instances. {} is a shared resource that must be " + "reused across the JVM, so that only a few instances are created.", resourceType, resourceType); }
public static byte[] toByteArray(Output output) { if (output instanceof WriteSession) { return ((WriteSession) output).toByteArray(); } throw new IllegalArgumentException("Output [" + Reflects.simpleClassName(output) + "] must be a WriteSession's implementation"); }
@Override protected void encode(ChannelHandlerContext ctx, PayloadHolder msg, ByteBuf out) throws Exception { if (msg instanceof JRequestPayload) { doEncodeRequest((JRequestPayload) msg, out); } else if (msg instanceof JResponsePayload) { doEncodeResponse((JResponsePayload) msg, out); } else { throw new IllegalArgumentException(Reflects.simpleClassName(msg)); } }
protected ByteBuf encode(PayloadHolder msg) throws Exception { if (msg instanceof JRequestPayload) { return doEncodeRequest((JRequestPayload) msg); } else if (msg instanceof JResponsePayload) { return doEncodeResponse((JResponsePayload) msg); } else { throw new IllegalArgumentException(Reflects.simpleClassName(msg)); } }
@Override protected void encode(ChannelHandlerContext ctx, PayloadHolder msg, ByteBuf out) throws Exception { if (msg instanceof JRequestPayload) { doEncodeRequest((JRequestPayload) msg, out); } else if (msg instanceof JResponsePayload) { doEncodeResponse((JResponsePayload) msg, out); } else { throw new IllegalArgumentException(Reflects.simpleClassName(msg)); } }
protected ByteBuf encode(PayloadHolder msg) throws Exception { if (msg instanceof JRequestPayload) { return doEncodeRequest((JRequestPayload) msg); } else if (msg instanceof JResponsePayload) { return doEncodeResponse((JResponsePayload) msg); } else { throw new IllegalArgumentException(Reflects.simpleClassName(msg)); } }
@Override public String toString() { final long currentTime = System.nanoTime(); long remaining = deadline - currentTime + timer.startTime; StringBuilder buf = new StringBuilder(192) .append(Reflects.simpleClassName(this)) .append('(') .append("deadline: "); if (remaining > 0) { buf.append(remaining) .append(" ns later"); } else if (remaining < 0) { buf.append(-remaining) .append(" ns ago"); } else { buf.append("now"); } if (isCancelled()) { buf.append(", cancelled"); } return buf.append(", task: ") .append(task()) .append(')') .toString(); } }
@Override public String toString() { final long currentTime = System.nanoTime(); long remaining = deadline - currentTime + timer.startTime; StringBuilder buf = new StringBuilder(192) .append(Reflects.simpleClassName(this)) .append('(') .append("deadline: "); if (remaining > 0) { buf.append(remaining) .append(" ns later"); } else if (remaining < 0) { buf.append(-remaining) .append(" ns ago"); } else { buf.append("now"); } if (isCancelled()) { buf.append(", cancelled"); } return buf.append(", task: ") .append(task()) .append(')') .toString(); } }
@SuppressWarnings("all") private static void handleBeforeInvoke(ProviderInterceptor[] interceptors, Object provider, String methodName, Object[] args) { for (int i = 0; i < interceptors.length; i++) { try { interceptors[i].beforeInvoke(provider, methodName, args); } catch (Throwable t) { logger.error("Interceptor[{}#beforeInvoke]: {}.", Reflects.simpleClassName(interceptors[i]), stackTrace(t)); } } }
@SuppressWarnings("all") private static void handleBeforeInvoke(ProviderInterceptor[] interceptors, Object provider, String methodName, Object[] args) { for (int i = 0; i < interceptors.length; i++) { try { interceptors[i].beforeInvoke(provider, methodName, args); } catch (Throwable t) { logger.error("Interceptor[{}#beforeInvoke]: {}.", Reflects.simpleClassName(interceptors[i]), stackTrace(t)); } } }
@SuppressWarnings("all") private static void handleAfterInvoke(ProviderInterceptor[] interceptors, Object provider, String methodName, Object[] args, Object invokeResult, Throwable failCause) { for (int i = interceptors.length - 1; i >= 0; i--) { try { interceptors[i].afterInvoke(provider, methodName, args, invokeResult, failCause); } catch (Throwable t) { logger.error("Interceptor[{}#afterInvoke]: {}.", Reflects.simpleClassName(interceptors[i]), stackTrace(t)); } } }
@SuppressWarnings("all") private static void handleAfterInvoke(ProviderInterceptor[] interceptors, Object provider, String methodName, Object[] args, Object invokeResult, Throwable failCause) { for (int i = interceptors.length - 1; i >= 0; i--) { try { interceptors[i].afterInvoke(provider, methodName, args, invokeResult, failCause); } catch (Throwable t) { logger.error("Interceptor[{}#afterInvoke]: {}.", Reflects.simpleClassName(interceptors[i]), stackTrace(t)); } } }
/** * The shortcut to {@link #simpleClassName(Class) simpleClassName(o.getClass())}. */ public static String simpleClassName(Object o) { return o == null ? "null_object" : simpleClassName(o.getClass()); }
private static void reportTooManyInstances() { String resourceType = Reflects.simpleClassName(HashedWheelTimer.class); logger.error("You are creating too many {} instances. {} is a shared resource that must be " + "reused across the JVM, so that only a few instances are created.", resourceType, resourceType); }