executorService.submit(new Runnable() {
@Override
public void run() {
final ErrorCollector collector = new ErrorCollector();
final ClientEndpointConfig config;
final Endpoint endpoint;
// incoming buffer size - max frame size possible to receive.
Integer tyrusIncomingBufferSize = Utils.getProperty(properties, ClientProperties.INCOMING_BUFFER_SIZE, Integer.class);
Integer wlsIncomingBufferSize = configuration == null ? null : Utils.getProperty(configuration.getUserProperties(), ClientContainer.WLS_INCOMING_BUFFER_SIZE, Integer.class);
final int incomingBufferSize;
if (tyrusIncomingBufferSize == null && wlsIncomingBufferSize == null) {
incomingBufferSize = TyrusClientEngine.DEFAULT_INCOMING_BUFFER_SIZE;
} else if (wlsIncomingBufferSize != null) {
incomingBufferSize = wlsIncomingBufferSize;
} else {
incomingBufferSize = tyrusIncomingBufferSize;
}
try {
if (o instanceof Endpoint) {
endpoint = (Endpoint) o;
config = configuration == null ? ClientEndpointConfig.Builder.create().build() : configuration;
} else if (o instanceof Class) {
if (Endpoint.class.isAssignableFrom((Class<?>) o)) {
//noinspection unchecked
endpoint = ReflectionHelper.getInstance(((Class<Endpoint>) o), collector);
config = configuration == null ? ClientEndpointConfig.Builder.create().build() : configuration;
} else if ((((Class<?>) o).getAnnotation(ClientEndpoint.class) != null)) {
endpoint = AnnotatedEndpoint.fromClass((Class) o, componentProvider, false, incomingBufferSize, collector, EndpointEventListener.NO_OP);
config = (ClientEndpointConfig) ((AnnotatedEndpoint) endpoint).getEndpointConfig();
} else {
collector.addException(new DeploymentException(String.format("Class %s in not Endpoint descendant and does not have @ClientEndpoint", ((Class<?>) o).getName())));
endpoint = null;
config = null;
}
} else {
endpoint = AnnotatedEndpoint.fromInstance(o, componentProvider, false, incomingBufferSize, collector);
config = (ClientEndpointConfig) ((AnnotatedEndpoint) endpoint).getEndpointConfig();
}
// fail fast when there is some issue with client endpoint.
if (!collector.isEmpty()) {
future.setFailure(collector.composeComprehensiveException());
return;
}
} catch (Exception e) {
future.setFailure(e);
return;