@Override public boolean isRunning() { return this.httpClient.isRunning(); }
@Override public void stop() { try { if (this.httpClient.isRunning()) { this.httpClient.stop(); } } catch (Exception ex) { throw new SockJsException("Failed to stop JettyXhrTransport", ex); } }
@Override public void start() { try { if (!this.httpClient.isRunning()) { this.httpClient.start(); } } catch (Exception ex) { throw new SockJsException("Failed to start JettyXhrTransport", ex); } }
@Override public boolean isClosed() { return !httpClient.isRunning(); }
@Override public boolean isClosed() { return !httpClient.isRunning(); }
@Override public boolean isRunning() { return this.httpClient.isRunning(); }
@Override public boolean isRunning() { return this.httpClient.isRunning(); }
private void stopClient(HttpClient client) { if (client.isRunning()) { try { client.stop(); } catch (Exception ex) { logger.error("Could not stop http client", ex); } } } }
@Override protected void doStart() throws Exception { Objects.requireNonNull(httpClient, "Provided HttpClient is null"); super.doStart(); if (!httpClient.isRunning()) throw new IllegalStateException("HttpClient is not running (did you forget to start it?): " + httpClient); }
private void stopClient(HttpClient client) { if (client.isRunning()) { try { client.stop(); } catch (Exception ex) { logger.error("Could not stop http client", ex); } } } }
@Override public void start() { try { if (!this.httpClient.isRunning()) { this.httpClient.start(); } } catch (Exception ex) { throw new SockJsException("Failed to start JettyXhrTransport", ex); } }
@Override public void stop() { try { if (this.httpClient.isRunning()) { this.httpClient.stop(); } } catch (Exception ex) { throw new SockJsException("Failed to stop JettyXhrTransport", ex); } }
@Override public void stop() { try { if (this.httpClient.isRunning()) { this.httpClient.stop(); } } catch (Exception ex) { throw new SockJsException("Failed to stop JettyXhrTransport", ex); } }
@Override public void start() { try { if (!this.httpClient.isRunning()) { this.httpClient.start(); } } catch (Exception ex) { throw new SockJsException("Failed to start JettyXhrTransport", ex); } }
protected HttpDestination destinationFor(String scheme, String host, int port) { port = normalizePort(scheme, port); String address = address(scheme, host, port); HttpDestination destination = destinations.get(address); if (destination == null) { destination = new HttpDestination(this, scheme, host, port); if (isRunning()) { HttpDestination existing = destinations.putIfAbsent(address, destination); if (existing != null) destination = existing; else LOG.debug("Created {}", destination); if (!isRunning()) destinations.remove(address); } } return destination; }
protected HttpDestination destinationFor(String scheme, String host, int port) { port = normalizePort(scheme, port); String address = address(scheme, host, port); HttpDestination destination = destinations.get(address); if (destination == null) { destination = new HttpDestination(this, scheme, host, port); if (isRunning()) { HttpDestination existing = destinations.putIfAbsent(address, destination); if (existing != null) destination = existing; else LOG.debug("Created {}", destination); if (!isRunning()) destinations.remove(address); } } return destination; }
public void run() { while (isRunning()) { _timeoutQ.tick(System.currentTimeMillis()); _idleTimeoutQ.tick(_timeoutQ.getNow()); try { Thread.sleep(200); } catch (InterruptedException ignored) { } } } });
@Override public void onTimeoutExpired() { nextTimeout.set(Long.MAX_VALUE); long now = System.nanoTime(); long nextExpiresAt = Long.MAX_VALUE; // Check all queued exchanges for those that have expired // and to determine when the next check must be. for (HttpExchange exchange : exchanges) { HttpRequest request = exchange.getRequest(); long expiresAt = request.getTimeoutAt(); if (expiresAt == -1) continue; if (expiresAt <= now) request.abort(new TimeoutException("Total timeout " + request.getTimeout() + " ms elapsed")); else if (expiresAt < nextExpiresAt) nextExpiresAt = expiresAt; } if (nextExpiresAt < Long.MAX_VALUE && client.isRunning()) schedule(nextExpiresAt); }
public void release(Connection connection) { LOG.debug("{} released", connection); if (client.isRunning()) { boolean removed = activeConnections.remove(connection); if (removed) process(connection, false); else LOG.debug("{} explicit", connection); } else { LOG.debug("{} is stopped", client); remove(connection); connection.close(); } }
public void release(Connection connection) { LOG.debug("{} released", connection); if (client.isRunning()) { boolean removed = activeConnections.remove(connection); if (removed) process(connection, false); else LOG.debug("{} explicit", connection); } else { LOG.debug("{} is stopped", client); remove(connection); connection.close(); } }