Preconditions.checkArgument(!services.isEmpty(), "services is empty");
// NOTE: ImmutableMap enforces that we don't have duplicate method names
ImmutableMap.Builder<String, ThriftMethodProcessor> processorBuilder = ImmutableMap.builder();
for (Object service : services) {
ThriftServiceMetadata serviceMetadata = new ThriftServiceMetadata(service.getClass(), codecManager.getCatalog());
for (ThriftMethodMetadata methodMetadata : serviceMetadata.getMethods().values()) {
ThriftMethodProcessor methodProcessor = new ThriftMethodProcessor(service,
serviceMetadata.getName(), methodMetadata, codecManager);
processorBuilder.put(methodMetadata.getName(), methodProcessor);
}
}
methods = processorBuilder.build();
this.eventHandlers = ImmutableList.copyOf(eventHandlers);