in flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/common/handler/PulsarAdminInvocationHandler.java [65:87]
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
Class<?> returnType = method.getReturnType();
// No need to proxy the void return type.
// The non-interface type is not able to proxy.
if (returnType.equals(Void.TYPE) || !returnType.isInterface()) {
return method.invoke(admin, args);
}
String methodName = method.getName();
if (handlers.containsKey(methodName)) {
return handlers.get(methodName);
}
Object handler =
Proxy.newProxyInstance(
Thread.currentThread().getContextClassLoader(),
new Class[] {returnType},
new RequestHandler(method.invoke(admin, args)));
this.handlers.put(methodName, handler);
return handler;
}