private <T> Object getCoderInstance(Session session, CoderWrapper<T> wrapper) { final Object coder = wrapper.getCoder(); if (coder == null) { ErrorCollector collector = new ErrorCollector(); final Object coderInstance = this.componentProvider .getCoderInstance(wrapper.getCoderClass(), session, getEndpointConfig(), collector); if (!collector.isEmpty()) { final DeploymentException deploymentException = collector.composeComprehensiveException(); LOGGER.log(Level.WARNING, deploymentException.getMessage(), deploymentException); return null; } return coderInstance; } return coder; }
private ClientManager(String containerProviderClassName, WebSocketContainer webSocketContainer) { final ErrorCollector collector = new ErrorCollector(); componentProvider = ComponentProviderService.createClient(); Class engineProviderClazz; engineProviderClazz = ReflectionHelper.classForNameWithException(containerProviderClassName); } catch (ClassNotFoundException e) { collector.addException(e); throw new RuntimeException(collector.composeComprehensiveException()); if (!collector.isEmpty()) { throw new RuntimeException(collector.composeComprehensiveException());
private void logDeploymentException(DeploymentException de) { collector.addException(de); } }
collector.addException(de); if (!collector.isEmpty()) { this.stop(); throw collector.composeComprehensiveException();
/** * Create new {@link TyrusServerConfiguration}. * * @param classes classes to be included in this application instance. Can contain any combination of * annotated endpoints (see {@link ServerEndpoint}). Cannot be {@code null}. * @param serverEndpointConfigs List of instances of {@link ServerEndpointConfig} to be deployed. * @throws IllegalArgumentException when any of the arguments is {@code null}. */ public TyrusServerConfiguration(Set<Class<?>> classes, Set<ServerEndpointConfig> serverEndpointConfigs) { this(classes, Collections.<Class<?>>emptySet(), serverEndpointConfigs, new ErrorCollector()); }
private void logDeploymentException(DeploymentException de) { collector.addException(de); } }
collector.addException(de); if (!collector.isEmpty()) { this.stop(); throw collector.composeComprehensiveException();
/** * Create new {@link TyrusServerConfiguration}. * * @param classes classes to be included in this application instance. Can contain any combination of * annotated endpoints (see {@link ServerEndpoint}). Cannot be {@code null}. * @param serverEndpointConfigs List of instances of {@link ServerEndpointConfig} to be deployed. * @throws IllegalArgumentException when any of the arguments is {@code null}. */ public TyrusServerConfiguration(Set<Class<?>> classes, Set<ServerEndpointConfig> serverEndpointConfigs) { this(classes, Collections.<Class<?>>emptySet(), serverEndpointConfigs, new ErrorCollector()); }
private <T> Object getCoderInstance(Session session, CoderWrapper<T> wrapper) { final Object coder = wrapper.getCoder(); if (coder == null) { ErrorCollector collector = new ErrorCollector(); final Object coderInstance = this.componentProvider .getCoderInstance(wrapper.getCoderClass(), session, getEndpointConfig(), collector); if (!collector.isEmpty()) { final DeploymentException deploymentException = collector.composeComprehensiveException(); LOGGER.log(Level.WARNING, deploymentException.getMessage(), deploymentException); return null; } return coderInstance; } return coder; }
private ClientManager(String containerProviderClassName, WebSocketContainer webSocketContainer) { final ErrorCollector collector = new ErrorCollector(); componentProvider = ComponentProviderService.createClient(); Class engineProviderClazz; engineProviderClazz = ReflectionHelper.classForNameWithException(containerProviderClassName); } catch (ClassNotFoundException e) { collector.addException(e); throw new RuntimeException(collector.composeComprehensiveException()); if (!collector.isEmpty()) { throw new RuntimeException(collector.composeComprehensiveException());
/** * Creates an instance of {@link Class} c using {@link Class#newInstance()}. Exceptions are logged to {@link * ErrorCollector}. * * @param c {@link Class} whose instance is going to be created * @param collector {@link ErrorCollector} which collects the {@link Exception}s. * @param <T> type. * @return new instance of {@link Class}. */ public static <T> T getInstance(Class<T> c, ErrorCollector collector) { T instance = null; try { instance = getInstance(c); } catch (Exception e) { collector.addException(new DeploymentException(LocalizationMessages.CLASS_NOT_INSTANTIATED(c.getName()), e)); } return instance; }
/** * Create new {@link TyrusServerContainer} using already created {@link ServerApplicationConfig} instance. * * @param serverApplicationConfig provided application config. */ public TyrusServerContainer(ServerApplicationConfig serverApplicationConfig) { this.collector = new ErrorCollector(); this.classes = new HashSet<Class<?>>(); this.dynamicallyAddedClasses = new HashSet<Class<?>>(); this.dynamicallyAddedEndpointConfigs = new HashSet<ServerEndpointConfig>(); this.serverApplicationConfig = serverApplicationConfig; }
private Object callMethod(Method method, ParameterExtractor[] extractors, Session session, boolean callOnError, Object... params) { ErrorCollector collector = new ErrorCollector(); Object[] paramValues = new Object[extractors.length]; if (!collector.isEmpty()) { Throwable t = collector.composeComprehensiveException(); LOGGER.log(Level.FINE, t.getMessage(), t); if (!collector.isEmpty()) { throw collector.composeComprehensiveException();
@Override public void run() { final ErrorCollector collector = new ErrorCollector(); final ClientEndpointConfig config; final Endpoint endpoint; 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()))); if (!collector.isEmpty()) { future.setFailure(collector.composeComprehensiveException()); return;
collector.addException( new DeploymentException(LocalizationMessages.COMPONENT_PROVIDER_THREW_EXCEPTION(c.getName()), e));
/** * Create new {@link TyrusServerContainer} using already created {@link ServerApplicationConfig} instance. * * @param serverApplicationConfig provided application config. */ public TyrusServerContainer(ServerApplicationConfig serverApplicationConfig) { this.collector = new ErrorCollector(); this.classes = new HashSet<Class<?>>(); this.dynamicallyAddedClasses = new HashSet<Class<?>>(); this.dynamicallyAddedEndpointConfigs = new HashSet<ServerEndpointConfig>(); this.serverApplicationConfig = serverApplicationConfig; }
private Object callMethod(Method method, ParameterExtractor[] extractors, Session session, boolean callOnError, Object... params) { ErrorCollector collector = new ErrorCollector(); Object[] paramValues = new Object[extractors.length]; if (!collector.isEmpty()) { Throwable t = collector.composeComprehensiveException(); LOGGER.log(Level.FINE, t.getMessage(), t); if (!collector.isEmpty()) { throw collector.composeComprehensiveException();
@Override public void run() { final ErrorCollector collector = new ErrorCollector(); final ClientEndpointConfig config; final Endpoint endpoint; 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()))); if (!collector.isEmpty()) { future.setFailure(collector.composeComprehensiveException()); return;
/** * Creates an instance of {@link Class} c using {@link Class#newInstance()}. Exceptions are logged to {@link * ErrorCollector}. * * @param c {@link Class} whose instance is going to be created * @param collector {@link ErrorCollector} which collects the {@link Exception}s. * @param <T> type. * @return new instance of {@link Class}. */ public static <T> T getInstance(Class<T> c, ErrorCollector collector) { T instance = null; try { instance = getInstance(c); } catch (Exception e) { collector.addException(new DeploymentException(LocalizationMessages.CLASS_NOT_INSTANTIATED(c.getName()), e)); } return instance; }
/** * Create new {@link TyrusServerContainer}. * * @param classes classes to be included in this application instance. Can contain any combination of annotated * endpoints (see {@link javax.websocket.server.ServerEndpoint}) or {@link javax.websocket.Endpoint} * descendants. */ public TyrusServerContainer(Set<Class<?>> classes) { this.collector = new ErrorCollector(); this.classes = classes == null ? Collections.<Class<?>>emptySet() : new HashSet<Class<?>>(classes); this.dynamicallyAddedClasses = new HashSet<Class<?>>(); this.dynamicallyAddedEndpointConfigs = new HashSet<ServerEndpointConfig>(); this.serverApplicationConfig = null; }