use of io.fabric8.kubernetes.client.utils.Serialization in project fabric8 by jboss-fuse.
the class ClientInvokerImpl method getMethodData.
private MethodData getMethodData(Method method) throws IOException {
MethodData rc = null;
synchronized (method_cache) {
rc = method_cache.get(method);
}
if (rc == null) {
StringBuilder sb = new StringBuilder();
sb.append(method.getName());
sb.append(",");
Class<?>[] types = method.getParameterTypes();
for (int i = 0; i < types.length; i++) {
if (i != 0) {
sb.append(",");
}
sb.append(encodeClassName(types[i]));
}
Buffer signature = new UTF8Buffer(sb.toString()).buffer();
Serialization annotation = method.getAnnotation(Serialization.class);
SerializationStrategy serializationStrategy;
if (annotation != null) {
serializationStrategy = serializationStrategies.get(annotation.value());
if (serializationStrategy == null) {
throw new RuntimeException("Could not find the serialization strategy named: " + annotation.value());
}
} else {
serializationStrategy = ObjectSerializationStrategy.INSTANCE;
}
final InvocationStrategy strategy;
if (AsyncInvocationStrategy.isAsyncMethod(method)) {
strategy = AsyncInvocationStrategy.INSTANCE;
} else {
strategy = BlockingInvocationStrategy.INSTANCE;
}
rc = new MethodData(strategy, serializationStrategy, signature);
synchronized (method_cache) {
method_cache.put(method, rc);
}
}
return rc;
}
Aggregations