Given two services:
@ThriftService
public interface ServiceOne {
@ThriftMethod
boolean send(String message);
}
@ThriftService
public interface ServiceTwo {
@ThriftMethod
boolean send(String message);
}
DriftServer will throw an exception complains that ""Multiple methods named 'send' are annotated with @ThriftMethod in the given services"".
It seems that difference services can't have a method with the same name?
Relative code (io/airlift/drift/server/DriftServerMethodInvoker.java:58):
package io.airlift.drift.server;
class DriftServerMethodInvoker implements ServerMethodInvoker {
...
public DriftServerMethodInvoker(
ThriftCodecManager codecManager,
Collection<DriftService> services,
List<MethodInvocationFilter> filters,
MethodInvocationStatsFactory methodInvocationStatsFactory)
{
Map<String, ServiceMethod> processorMap = new HashMap<>();
ImmutableMap.Builder<String, MethodInvocationStat> stats = ImmutableMap.builder();
for (DriftService service : services) {
ThriftServiceMetadata serviceMetadata = new ThriftServiceMetadata(service.getService().getClass(), codecManager.getCatalog());
for (ThriftMethodMetadata thriftMethodMetadata : serviceMetadata.getMethods().values()) {
if (processorMap.containsKey(thriftMethodMetadata.getName())) {
throw new IllegalArgumentException(format("Multiple methods named '%s' are annotated with @ThriftMethod in the given services", thriftMethodMetadata.getName()));
--------------------^ HERE
}
ServiceMethod serviceMethod = new ServiceMethod(codecManager, service.getService(), thriftMethodMetadata, filters);
processorMap.put(thriftMethodMetadata.getName(), serviceMethod);
if (service.isStatsEnabled()) {
stats.put(thriftMethodMetadata.getName(), methodInvocationStatsFactory.getStat(serviceMetadata, service.getQualifier(), serviceMethod.getMethodMetadata()));
}
}
}
...
}
`
Given two services:
DriftServer will throw an exception complains that ""Multiple methods named 'send' are annotated with @ThriftMethod in the given services"".
It seems that difference services can't have a method with the same name?
Relative code (io/airlift/drift/server/DriftServerMethodInvoker.java:58):