}
public ConsumerConnection create(Distribution distribution, ProgressLoggerFactory progressLoggerFactory, ConnectionParameters connectionParameters, BuildCancellationToken cancellationToken) {
LOGGER.debug("Using tooling provider from {}", distribution.getDisplayName());
ClassLoader classLoader = createImplementationClassLoader(distribution, progressLoggerFactory, connectionParameters.getGradleUserHomeDir(), cancellationToken);
ServiceLocator serviceLocator = new ServiceLocator(classLoader);
try {
Factory<ConnectionVersion4> factory = serviceLocator.findFactory(ConnectionVersion4.class);
if (factory == null) {
return new NoToolingApiConnection(distribution);
}
// ConnectionVersion4 is a part of the protocol and cannot be easily changed.
ConnectionVersion4 connection = factory.create();