com.google.common.util.concurrent.ThreadFactoryBuilder Java Examples
The following examples show how to use
com.google.common.util.concurrent.ThreadFactoryBuilder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DbMessageStore.java From ballerina-message-broker with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") DbMessageStore(MessageDao messageDao, int bufferSize, int maxDbBatchSize) { ThreadFactory namedThreadFactory = new ThreadFactoryBuilder() .setNameFormat("DisruptorMessageStoreThread-%d").build(); disruptor = new Disruptor<>(DbOperation.getFactory(), bufferSize, namedThreadFactory, ProducerType.MULTI, new SleepingBlockingWaitStrategy()); disruptor.setDefaultExceptionHandler(new DbStoreExceptionHandler()); disruptor.handleEventsWith(new DbEventMatcher(bufferSize)) .then(new DbAccessHandler(messageDao, maxDbBatchSize)) .then(new FinalEventHandler()); disruptor.start(); this.messageDao = messageDao; }
Example #2
Source File: PollingPropertiesFileConfigurationProvider.java From mt-flume with Apache License 2.0 | 6 votes |
@Override public void start() { LOGGER.info("Configuration provider starting"); Preconditions.checkState(file != null, "The parameter file must not be null"); executorService = Executors.newSingleThreadScheduledExecutor( new ThreadFactoryBuilder().setNameFormat("conf-file-poller-%d") .build()); FileWatcherRunnable fileWatcherRunnable = new FileWatcherRunnable(file, counterGroup); executorService.scheduleWithFixedDelay(fileWatcherRunnable, 0, interval, TimeUnit.SECONDS); lifecycleState = LifecycleState.START; LOGGER.debug("Configuration provider started"); }
Example #3
Source File: XceiverServerRatis.java From hadoop-ozone with Apache License 2.0 | 6 votes |
private static List<ThreadPoolExecutor> createChunkExecutors( ConfigurationSource conf) { // TODO create single pool with N threads if using non-incremental chunks final int threadCountPerDisk = conf.getInt( OzoneConfigKeys.DFS_CONTAINER_RATIS_NUM_WRITE_CHUNK_THREADS_KEY, OzoneConfigKeys.DFS_CONTAINER_RATIS_NUM_WRITE_CHUNK_THREADS_DEFAULT); final int numberOfDisks = MutableVolumeSet.getDatanodeStorageDirs(conf).size(); ThreadPoolExecutor[] executors = new ThreadPoolExecutor[threadCountPerDisk * numberOfDisks]; for (int i = 0; i < executors.length; i++) { ThreadFactory threadFactory = new ThreadFactoryBuilder() .setDaemon(true) .setNameFormat("ChunkWriter-" + i + "-%d") .build(); BlockingQueue<Runnable> workQueue = new LinkedBlockingDeque<>(); executors[i] = new ThreadPoolExecutor(1, 1, 0, TimeUnit.SECONDS, workQueue, threadFactory); } return ImmutableList.copyOf(executors); }
Example #4
Source File: InMemoryMessageBus.java From arcusplatform with Apache License 2.0 | 6 votes |
public InMemoryMessageBus( String name, Serializer<T> serializer, Deserializer<T> deserializer ) { this( name, serializer, deserializer, Executors.newSingleThreadExecutor( new ThreadFactoryBuilder() .setDaemon(true) .setNameFormat(name + "-dispatcher") .build() ) ); }
Example #5
Source File: ThreadPoolQueuedSink.java From suro with Apache License 2.0 | 6 votes |
public ThreadPoolQueuedSink( int jobQueueSize, int corePoolSize, int maxPoolSize, long jobTimeout, String threadFactoryName) { jobQueue = new ArrayBlockingQueue<Runnable>(jobQueueSize == 0 ? 100 : jobQueueSize) { @Override public boolean offer(Runnable runnable) { try { put(runnable); // not to reject the task, slowing down } catch (InterruptedException e) { // do nothing } return true; } }; senders = new ThreadPoolExecutor( corePoolSize == 0 ? 3 : corePoolSize, maxPoolSize == 0 ? 10 : maxPoolSize, 10, TimeUnit.SECONDS, jobQueue, new ThreadFactoryBuilder().setNameFormat(threadFactoryName + "-Sender-%d").build()); this.jobTimeout = jobTimeout; }
Example #6
Source File: SamzaEventHubClientManager.java From samza with Apache License 2.0 | 6 votes |
@Override public void init() { String remoteHost = String.format(EVENTHUB_REMOTE_HOST_FORMAT, eventHubNamespace); LOG.info("Initializing SamzaEventHubClientManager for namespace: " + eventHubNamespace); try { ConnectionStringBuilder connectionStringBuilder = new ConnectionStringBuilder() .setNamespaceName(eventHubNamespace) .setEventHubName(entityPath) .setSasKeyName(sasKeyName) .setSasKey(sasKey); ThreadFactoryBuilder threadFactoryBuilder = new ThreadFactoryBuilder().setNameFormat("Samza EventHubClient Thread-%d").setDaemon(true); eventHubClientExecutor = Executors.newFixedThreadPool(numClientThreads, threadFactoryBuilder.build()); eventHubClient = EventHubClient.createSync(connectionStringBuilder.toString(), retryPolicy, eventHubClientExecutor); } catch (IOException | EventHubException e) { String msg = String.format("Creation of EventHub client failed for eventHub EntityPath: %s on remote host %s:%d", entityPath, remoteHost, ClientConstants.AMQPS_PORT); LOG.error(msg, e); throw new SamzaException(msg, e); } LOG.info("SamzaEventHubClientManager initialized for namespace: " + eventHubNamespace); }
Example #7
Source File: FsVolumeImpl.java From hadoop with Apache License 2.0 | 6 votes |
protected ThreadPoolExecutor initializeCacheExecutor(File parent) { if (storageType.isTransient()) { return null; } if (dataset.datanode == null) { // FsVolumeImpl is used in test. return null; } final int maxNumThreads = dataset.datanode.getConf().getInt( DFSConfigKeys.DFS_DATANODE_FSDATASETCACHE_MAX_THREADS_PER_VOLUME_KEY, DFSConfigKeys.DFS_DATANODE_FSDATASETCACHE_MAX_THREADS_PER_VOLUME_DEFAULT); ThreadFactory workerFactory = new ThreadFactoryBuilder() .setDaemon(true) .setNameFormat("FsVolumeImplWorker-" + parent.toString() + "-%d") .build(); ThreadPoolExecutor executor = new ThreadPoolExecutor( 1, maxNumThreads, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), workerFactory); executor.allowCoreThreadTimeOut(true); return executor; }
Example #8
Source File: ResourceLocalizationService.java From big-c with Apache License 2.0 | 6 votes |
public ResourceLocalizationService(Dispatcher dispatcher, ContainerExecutor exec, DeletionService delService, LocalDirsHandlerService dirsHandler, Context context) { super(ResourceLocalizationService.class.getName()); this.exec = exec; this.dispatcher = dispatcher; this.delService = delService; this.dirsHandler = dirsHandler; this.cacheCleanup = new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder() .setNameFormat("ResourceLocalizationService Cache Cleanup") .build()); this.stateStore = context.getNMStateStore(); this.nmContext = context; }
Example #9
Source File: AbstractFileMetricsReporter.java From Singularity with Apache License 2.0 | 6 votes |
public AbstractFileMetricsReporter( MetricRegistry registry, SingularityS3Configuration configuration, ObjectMapper metricsObjectMapper ) { this.registry = registry; this.configuration = configuration; this.metricsObjectMapper = metricsObjectMapper; this.fileReporterExecutor = Executors.newSingleThreadScheduledExecutor( new ThreadFactoryBuilder().setNameFormat("metrics-file-reporter").build() ); if (configuration.getMetricsFilePath().isPresent()) { startFileReporter(); } }
Example #10
Source File: ThreadSharingExecutor.java From twister2 with Apache License 2.0 | 6 votes |
public ThreadSharingExecutor(Config config, TWSChannel ch, ExecutionPlan plan, IExecutionHook hook) { this.config = config; this.channel = ch; this.numThreads = ExecutorContext.threadsPerContainer(config); Thread.UncaughtExceptionHandler hndler = new Thread.UncaughtExceptionHandler() { public void uncaughtException(Thread th, Throwable ex) { throw new RuntimeException(ex); } }; this.threads = Executors.newFixedThreadPool(numThreads, new ThreadFactoryBuilder() .setNameFormat("executor-%d") .setDaemon(true) .setUncaughtExceptionHandler(hndler) .build()); this.executionPlan = plan; this.executionHook = hook; }
Example #11
Source File: TableCacheImpl.java From hadoop-ozone with Apache License 2.0 | 6 votes |
public TableCacheImpl(CacheCleanupPolicy cleanupPolicy) { // As for full table cache only we need elements to be inserted in sorted // manner, so that list will be easy. For other we can go with Hash map. if (cleanupPolicy == CacheCleanupPolicy.NEVER) { cache = new ConcurrentSkipListMap<>(); } else { cache = new ConcurrentHashMap<>(); } epochEntries = new ConcurrentSkipListSet<>(); // Created a singleThreadExecutor, so one cleanup will be running at a // time. ThreadFactory build = new ThreadFactoryBuilder().setDaemon(true) .setNameFormat("PartialTableCache Cleanup Thread - %d").build(); executorService = Executors.newSingleThreadExecutor(build); this.cleanupPolicy = cleanupPolicy; }
Example #12
Source File: DefaultLogMonitor.java From singer with Apache License 2.0 | 6 votes |
/** * Constructor. * * @param monitorIntervalInSecs monitor interval in seconds. * @param singerConfig the SingerConfig. */ protected DefaultLogMonitor(int monitorIntervalInSecs, SingerConfig singerConfig) throws ConfigurationException { Preconditions.checkArgument(monitorIntervalInSecs > 0); this.monitorIntervalInSecs = monitorIntervalInSecs; this.processedLogStreams = Maps.newHashMap(); this.isStopped = true; this.scheduledFuture = null; this.logMonitorExecutor = Executors.newSingleThreadScheduledExecutor( new ThreadFactoryBuilder().setNameFormat("LogMonitor").build()); if (singerConfig.isSetSingerRestartConfig() && singerConfig.singerRestartConfig.restartDaily) { dailyRestart = true; setDailyRestartTime(singerConfig.singerRestartConfig); } }
Example #13
Source File: InMemorySCMStore.java From hadoop with Apache License 2.0 | 6 votes |
/** * The in-memory store bootstraps itself from the shared cache entries that * exist in HDFS. */ @Override protected void serviceInit(Configuration conf) throws Exception { this.startTime = System.currentTimeMillis(); this.initialDelayMin = getInitialDelay(conf); this.checkPeriodMin = getCheckPeriod(conf); this.stalenessMinutes = getStalenessPeriod(conf); bootstrap(conf); ThreadFactory tf = new ThreadFactoryBuilder().setNameFormat("InMemorySCMStore") .build(); scheduler = Executors.newSingleThreadScheduledExecutor(tf); super.serviceInit(conf); }
Example #14
Source File: OriginHealthStatusMonitorFactory.java From styx with Apache License 2.0 | 6 votes |
public OriginHealthStatusMonitor create(Id id, HealthCheckConfig healthCheckConfig, Supplier<OriginHealthCheckFunction> healthCheckFunction, HttpClient client) { if (healthCheckConfig == null || !healthCheckConfig.isEnabled()) { return new NoOriginHealthStatusMonitor(); } ScheduledExecutorService executorService = newScheduledThreadPool(1, new ThreadFactoryBuilder() .setNameFormat(format("STYX-ORIGINS-MONITOR-%s", requireNonNull(id))) .setDaemon(true) .build()); ScheduledOriginHealthStatusMonitor healthStatusMonitor = new ScheduledOriginHealthStatusMonitor( executorService, healthCheckFunction.get(), new Schedule(healthCheckConfig.intervalMillis(), MILLISECONDS), client); return new AnomalyExcludingOriginHealthStatusMonitor(healthStatusMonitor, healthCheckConfig.healthyThreshold(), healthCheckConfig.unhealthyThreshold()); }
Example #15
Source File: ShuffleManager.java From tez with Apache License 2.0 | 6 votes |
public void run() throws IOException { Preconditions.checkState(inputManager != null, "InputManager must be configured"); if (maxTimeToWaitForReportMillis > 0) { reporterExecutor = Executors.newSingleThreadExecutor( new ThreadFactoryBuilder().setDaemon(true) .setNameFormat("ShuffleRunner {" + srcNameTrimmed + "}") .build()); Future reporterFuture = reporterExecutor.submit(new ReporterCallable()); } ListenableFuture<Void> runShuffleFuture = schedulerExecutor.submit(schedulerCallable); Futures.addCallback(runShuffleFuture, new SchedulerFutureCallback(), GuavaShim.directExecutor()); // Shutdown this executor once this task, and the callback complete. schedulerExecutor.shutdown(); }
Example #16
Source File: ClientBuilder.java From hbc with Apache License 2.0 | 6 votes |
public ClientBuilder() { enableGZip = true; name = "hosebird-client-" + clientNum.getAndIncrement(); ThreadFactory threadFactory = new ThreadFactoryBuilder() .setDaemon(true) .setNameFormat("hosebird-client-io-thread-%d") .build(); executorService = Executors.newSingleThreadExecutor(threadFactory); ThreadFactory rateTrackerThreadFactory = new ThreadFactoryBuilder() .setDaemon(true) .setNameFormat("hosebird-client-rateTracker-thread-%d") .build(); ScheduledExecutorService scheduledExecutor = Executors.newScheduledThreadPool(1, rateTrackerThreadFactory); rateTracker = new BasicRateTracker(30000, 100, true, scheduledExecutor); reconnectionManager = new BasicReconnectionManager(5); socketTimeoutMillis = 60000; connectionTimeoutMillis = 4000; schemeRegistry = SchemeRegistryFactory.createDefault(); }
Example #17
Source File: GenomicsDBImport.java From gatk with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void initializeInputPreloadExecutorService() { if( vcfInitializerThreads > 1) { if( intervals.size() == 1) { final ThreadFactory threadFactory = new ThreadFactoryBuilder() .setNameFormat("readerInitializer-thread-%d") .setDaemon(true) .build(); this.inputPreloadExecutorService = Executors.newFixedThreadPool(vcfInitializerThreads, threadFactory); } else { logger.warn("GenomicsDBImport cannot use multiple VCF reader threads for initialization when the " + "number of intervals is greater than 1. Falling back to serial VCF reader initialization."); inputPreloadExecutorService = null; } } else { inputPreloadExecutorService = null; } }
Example #18
Source File: DefaultJobService.java From emodb with Apache License 2.0 | 5 votes |
@Override public void start() throws Exception { if (_concurrencyLevel == 0) { _log.info("Job processing has been disabled"); return; } _service = Executors.newScheduledThreadPool(_concurrencyLevel, new ThreadFactoryBuilder().setNameFormat("job-%d").build()); // Schedule one thread for each level of concurrency Runnable drainQueue = new Runnable() { @Override public void run() { // Continue running until the job queue is empty or this service is stopped or paused while (!_stopped && !_paused.get()) { boolean jobFound = runNextJob(); if (!jobFound) { return; } } } }; // Schedule the actions which will process jobs on the queue until the queue is empty. // Whenever the queue is completely drained it will then sleep for 5 seconds before checking again. for (int i=0; i < _concurrencyLevel; i++) { _service.scheduleWithFixedDelay(drainQueue, 5, 5, TimeUnit.SECONDS); } }
Example #19
Source File: SnapshotManager.java From gsc-core with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void add(IRevokingDB db) { RevokingDBWithCachingNewValue revokingDB = (RevokingDBWithCachingNewValue) db; dbs.add(revokingDB); flushServices.put(revokingDB.getDbName(), MoreExecutors.listeningDecorator( Executors.newSingleThreadExecutor( new ThreadFactoryBuilder().setNameFormat(revokingDB.getDbName()).build() ))); }
Example #20
Source File: NodeInfoHourCollection.java From redis-manager with Apache License 2.0 | 5 votes |
@Override public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) { coreSize = Runtime.getRuntime().availableProcessors(); threadPool = new ThreadPoolExecutor(coreSize, coreSize, 60L, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new ThreadFactoryBuilder().setNameFormat("collect-node-info-pool-thread-%d").build(), new ThreadPoolExecutor.AbortPolicy()); }
Example #21
Source File: OrderedScheduler.java From distributedlog with Apache License 2.0 | 5 votes |
private OrderedScheduler(String name, int corePoolSize, ThreadFactory threadFactory) { this.name = name; this.corePoolSize = corePoolSize; this.executors = new ScheduledExecutorService[corePoolSize]; for (int i = 0; i < corePoolSize; i++) { ThreadFactory tf = new ThreadFactoryBuilder() .setNameFormat(name + "-scheduler-" + i + "-%d") .setThreadFactory(threadFactory) .build(); executors[i] = Executors.newSingleThreadScheduledExecutor(tf); } this.random = new Random(System.currentTimeMillis()); }
Example #22
Source File: ThreadFactories.java From caravan with Apache License 2.0 | 5 votes |
public static ThreadFactory newDaemonThreadFactory(String nameFormat) { ThreadFactoryBuilder builder = new ThreadFactoryBuilder(); builder.setDaemon(true); if (!StringValues.isNullOrWhitespace(nameFormat)) builder.setNameFormat(nameFormat); return builder.build(); }
Example #23
Source File: ExecutorAutoConfiguration.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
/** * @return the executor for UI background processes. */ @Bean(name = "uiExecutor") @ConditionalOnMissingBean(name = "uiExecutor") public Executor uiExecutor() { final BlockingQueue<Runnable> blockingQueue = new ArrayBlockingQueue<>(20); final ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 20, 10000, TimeUnit.MILLISECONDS, blockingQueue, new ThreadFactoryBuilder().setNameFormat("ui-executor-pool-%d").build()); threadPoolExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); return new DelegatingSecurityContextExecutor(threadPoolExecutor); }
Example #24
Source File: CloudApiExecutorServiceConfiguration.java From cloudbreak with Apache License 2.0 | 5 votes |
@Bean ListeningScheduledExecutorService cloudApiListeningScheduledExecutorService() { return MoreExecutors .listeningDecorator(new MDCCleanerScheduledExecutor(executorServicePoolSize, new ThreadFactoryBuilder().setNameFormat("cloud-api-%d").build(), new CallerRunsPolicy())); }
Example #25
Source File: ImmediateJobSpecScheduler.java From incubator-gobblin with Apache License 2.0 | 5 votes |
public ImmediateJobSpecScheduler(Optional<Logger> log) { super(log); _jobRunnablesThreadFactory = (new ThreadFactoryBuilder()) .setDaemon(false) .setNameFormat(getLog().getName() + "-thread-%d") .setUncaughtExceptionHandler(new LoggingUncaughtExceptionHandler(Optional.of(getLog()))) .build(); }
Example #26
Source File: TSOClientRaw.java From phoenix-omid with Apache License 2.0 | 5 votes |
public TSOClientRaw(String host, int port) throws InterruptedException, ExecutionException { // Start client with Nb of active threads = 3 as maximum. ChannelFactory factory = new NioClientSocketChannelFactory( Executors.newCachedThreadPool( new ThreadFactoryBuilder().setNameFormat("tsoclient-boss-%d").build()), Executors.newCachedThreadPool( new ThreadFactoryBuilder().setNameFormat("tsoclient-worker-%d").build()), 3); // Create the bootstrap ClientBootstrap bootstrap = new ClientBootstrap(factory); InetSocketAddress addr = new InetSocketAddress(host, port); ChannelPipeline pipeline = bootstrap.getPipeline(); pipeline.addLast("lengthbaseddecoder", new LengthFieldBasedFrameDecoder(8 * 1024, 0, 4, 0, 4)); pipeline.addLast("lengthprepender", new LengthFieldPrepender(4)); pipeline.addLast("protobufdecoder", new ProtobufDecoder(TSOProto.Response.getDefaultInstance())); pipeline.addLast("protobufencoder", new ProtobufEncoder()); Handler handler = new Handler(); pipeline.addLast("handler", handler); bootstrap.setOption("tcpNoDelay", true); bootstrap.setOption("keepAlive", true); bootstrap.setOption("reuseAddress", true); bootstrap.setOption("connectTimeoutMillis", 100); ChannelFuture channelFuture = bootstrap.connect(addr).await(); channel = channelFuture.getChannel(); }
Example #27
Source File: SamzaRestService.java From samza with Apache License 2.0 | 5 votes |
/** * Command line interface to run the server. * * @param args arguments supported by {@link org.apache.samza.util.CommandLine}. * In particular, --config job.config.loader.properties.path and * --config job.config.loader.factory are used to read the Samza REST config file. * @throws Exception if the server could not be successfully started. */ public static void main(String[] args) throws Exception { ScheduledExecutorSchedulingProvider schedulingProvider = null; try { SamzaRestConfig config = parseConfig(args); ReadableMetricsRegistry metricsRegistry = new MetricsRegistryMap(); log.info("Creating new SamzaRestService with config: {}", config); MetricsConfig metricsConfig = new MetricsConfig(config); Map<String, MetricsReporter> metricsReporters = MetricsReporterLoader.getMetricsReporters(metricsConfig, Util.getLocalHost().getHostName()); SamzaRestService restService = new SamzaRestService(new Server(config.getPort()), metricsRegistry, metricsReporters, new ServletContextHandler(ServletContextHandler.SESSIONS)); // Add applications SamzaRestApplication samzaRestApplication = new SamzaRestApplication(config); ServletContainer container = new ServletContainer(samzaRestApplication); restService.addServlet(container, "/*"); // Schedule monitors to run ThreadFactory threadFactory = new ThreadFactoryBuilder().setDaemon(true) .setNameFormat("MonitorThread-%d") .build(); ScheduledExecutorService schedulingService = Executors.newScheduledThreadPool(1, threadFactory); schedulingProvider = new ScheduledExecutorSchedulingProvider(schedulingService); SamzaMonitorService monitorService = new SamzaMonitorService(config, metricsRegistry, schedulingProvider); monitorService.start(); restService.runBlocking(); monitorService.stop(); } catch (Throwable t) { log.error("Exception in main.", t); } finally { if (schedulingProvider != null) { schedulingProvider.stop(); } } }
Example #28
Source File: Catalog.java From tikv-client-lib-java with Apache License 2.0 | 5 votes |
public Catalog(Supplier<Snapshot> snapshotProvider, int refreshPeriod, TimeUnit periodUnit) { this.snapshotProvider = Objects.requireNonNull(snapshotProvider, "Snapshot Provider is null"); metaCache = new CatalogCache(new CatalogTransaction(snapshotProvider.get())); service = Executors.newSingleThreadScheduledExecutor(new ThreadFactoryBuilder().setDaemon(true).build()); service.scheduleAtFixedRate(this::reloadCache, refreshPeriod, refreshPeriod, periodUnit); }
Example #29
Source File: DurationWindowPolicy.java From twister2 with Apache License 2.0 | 5 votes |
public DurationWindowPolicy(long millis, IManager<T> mgr, IEvictionPolicy<T> policy) { this.duration = millis; this.manager = mgr; this.evictionPolicy = policy; ThreadFactory threadFactory = new ThreadFactoryBuilder() .setNameFormat("duration-trigger-policy-%d") .setDaemon(true) .build(); this.executor = Executors.newSingleThreadScheduledExecutor(threadFactory); }
Example #30
Source File: KsqlRestApplication.java From ksql-fork-with-deep-learning-function with Apache License 2.0 | 5 votes |
@Override protected void registerWebSocketEndpoints(ServerContainer container) { try { final ListeningScheduledExecutorService exec = MoreExecutors.listeningDecorator( Executors.newScheduledThreadPool( config.getInt(KsqlRestConfig.KSQL_WEBSOCKETS_NUM_THREADS), new ThreadFactoryBuilder() .setDaemon(true) .setNameFormat("websockets-query-thread-%d") .build() ) ); final ObjectMapper mapper = getJsonMapper(); final StatementParser statementParser = new StatementParser(ksqlEngine); container.addEndpoint( ServerEndpointConfig.Builder .create( WSQueryEndpoint.class, WSQueryEndpoint.class.getAnnotation(ServerEndpoint.class).value() ) .configurator(new Configurator() { @Override @SuppressWarnings("unchecked") public <T> T getEndpointInstance(Class<T> endpointClass) { return (T) new WSQueryEndpoint( mapper, statementParser, ksqlEngine, exec ); } }) .build() ); } catch (DeploymentException e) { log.error("Unable to create websockets endpoint", e); } }