private EventSource(final WebTarget target, final String name, final long reconnectDelay, final boolean disableKeepAlive, final boolean open) { if (target == null) { throw new NullPointerException("Web target is 'null'."); } this.target = SseFeature.register(target); this.reconnectDelay = reconnectDelay; this.disableKeepAlive = disableKeepAlive; final String esName = (name == null) ? createDefaultName(target) : name; this.executor = new CloseableClientExecutor(Executors.newSingleThreadScheduledExecutor( new ThreadFactoryBuilder().setNameFormat(esName + "-%d") .setDaemon(true) .build())); if (open) { open(); } }
/** * Called whenever the OSGi framework starts our bundle */ @Override public void start(BundleContext bc) throws Exception { context = bc; String featureName = SseFeature.class.getName(); if (bc.getServiceReference(featureName) == null) { sseFeatureRegistration = bc.registerService(featureName, new SseFeature(), null); logger.debug("SSE API - SseFeature registered."); } if (!SseUtil.SERVLET3_SUPPORT) { blockingAsyncFeatureRegistration = bc.registerService(BlockingAsyncFeature.class.getName(), new BlockingAsyncFeature(), null); logger.debug("SSE API - SSE BlockingAsyncFeature registered."); } logger.debug("SSE API has been started."); }
/** * Called whenever the OSGi framework starts our bundle */ @Override public void start(BundleContext bc) throws Exception { context = bc; String featureName = SseFeature.class.getName(); if (bc.getServiceReference(featureName) == null) { sseFeatureRegistration = bc.registerService(featureName, new SseFeature(), null); logger.debug("SSE API - SseFeature registered."); } if (!SseUtil.SERVLET3_SUPPORT) { blockingAsyncFeatureRegistration = bc.registerService(BlockingAsyncFeature.class.getName(), new BlockingAsyncFeature(), null); logger.debug("SSE API - SSE BlockingAsyncFeature registered."); } logger.debug("SSE API has been started."); }
private EventSource(final WebTarget target, final String name, final long reconnectDelay, final boolean disableKeepAlive, final boolean open) { if (target == null) { throw new NullPointerException("Web target is 'null'."); } this.target = SseFeature.register(target); this.reconnectDelay = reconnectDelay; this.disableKeepAlive = disableKeepAlive; final String esName = (name == null) ? createDefaultName(target) : name; this.executor = Executors.newSingleThreadScheduledExecutor( new ThreadFactoryBuilder().setNameFormat(esName + "-%d").setDaemon(true).build()); if (open) { open(); } }
private EventSource(final WebTarget target, final String name, final long reconnectDelay, final boolean disableKeepAlive, final boolean open) { if (target == null) { throw new NullPointerException("Web target is 'null'."); } this.target = SseFeature.register(target); this.reconnectDelay = reconnectDelay; this.disableKeepAlive = disableKeepAlive; final String esName = (name == null) ? createDefaultName(target) : name; this.executor = Executors.newSingleThreadScheduledExecutor( new ThreadFactoryBuilder().setNameFormat(esName + "-%d").setDaemon(true).build()); if (open) { open(); } }
private EventSource(final WebTarget target, final String name, final long reconnectDelay, final boolean disableKeepAlive, final boolean open) { if (target == null) { throw new NullPointerException("Web target is 'null'."); } this.target = SseFeature.register(target); this.reconnectDelay = reconnectDelay; this.disableKeepAlive = disableKeepAlive; final String esName = (name == null) ? createDefaultName(target) : name; this.executor = Executors.newSingleThreadScheduledExecutor( new ThreadFactoryBuilder().setNameFormat(esName + "-%d").setDaemon(true).build()); if (open) { open(); } }