@ThreadSafe public class ChildMemoryManager extends DelegatingMemoryManager { private final Object sync = new Object();
@ThreadSafe public class HttpRequestNoRetryHandler extends DefaultHttpRequestRetryHandler { public static final HttpRequestNoRetryHandler Singleton = new HttpRequestNoRetryHandler(); private HttpRequestNoRetryHandler() {} @Override public boolean retryRequest( final IOException exception, int executionCount, final HttpContext context) { return false; } }
@ThreadSafe @SuppressWarnings("UnusedDeclaration") public class Pgsql extends SQL { public Pgsql(String path, BoardSettings info) throws BoardInitException { String dbName = info.getDatabase(); String dbHost = info.getHost(); String dbUsername = info.getUsername(); String dbPassword = info.getPassword(); String connStr = String.format("jdbc:postgresql://%s/%s?user=%s&password=%s", dbHost, dbName, dbUsername, dbPassword); this.charset = "UTF8"; this.tableCheckQuery = "SELECT * FROM pg_tables WHERE tablename = ?"; this.init(connStr, path, info); } }
@ThreadSafe public class SdkHttpRequestRetryHandler extends DefaultHttpRequestRetryHandler { public static final SdkHttpRequestRetryHandler Singleton = new SdkHttpRequestRetryHandler(); private SdkHttpRequestRetryHandler() {} @Override public boolean retryRequest( final IOException exception, int executionCount, final HttpContext context) { boolean retry = super.retryRequest(exception, executionCount, context); if (retry) { KscRequestMetrics awsRequestMetrics = (KscRequestMetrics) context .getAttribute(KscRequestMetrics.class.getSimpleName()); if (awsRequestMetrics != null) { awsRequestMetrics.incrementCounter(Field.HttpClientRetryCount); } } return retry; } }
/** * @since 4.3 */ @ThreadSafe class CPool extends AbstractConnPool<HttpRoute, ManagedHttpClientConnection, CPoolEntry> { private static final AtomicLong COUNTER = new AtomicLong(); private final long timeToLive; private final TimeUnit tunit; public CPool( final ConnFactory<HttpRoute, ManagedHttpClientConnection> connFactory, final int defaultMaxPerRoute, final int maxTotal, final long timeToLive, final TimeUnit tunit) { super(connFactory, defaultMaxPerRoute, maxTotal); this.timeToLive = timeToLive; this.tunit = tunit; } @Override protected CPoolEntry createEntry(final HttpRoute route, final ManagedHttpClientConnection conn) { final String id = Long.toString(COUNTER.getAndIncrement()); return new CPoolEntry(id, route, conn, this.timeToLive, this.tunit); } }
/** * RequestDateHC4 interceptor is responsible for adding <code>Date</code> header * to the outgoing requests This interceptor is optional for client side * protocol processors. * * @since 4.0 */ @ThreadSafe public class RequestDateHC4 implements HttpRequestInterceptor { private static final HttpDateGenerator DATE_GENERATOR = new HttpDateGenerator(); public RequestDateHC4() { super(); } public void process(final HttpRequest request, final HttpContext context) throws HttpException, IOException { Args.notNull(request, "HTTP request"); if ((request instanceof HttpEntityEnclosingRequest) && !request.containsHeader(HTTP.DATE_HEADER)) { final String httpdate = DATE_GENERATOR.getCurrentDate(); request.setHeader(HTTP.DATE_HEADER, httpdate); } } }
/** * RequestDate interceptor is responsible for adding <code>Date</code> header * to the outgoing requests This interceptor is optional for client side * protocol processors. * * @since 4.0 */ @ThreadSafe public class RequestDate implements HttpRequestInterceptor { private static final HttpDateGenerator DATE_GENERATOR = new HttpDateGenerator(); public RequestDate() { super(); } public void process(final HttpRequest request, final HttpContext context) throws HttpException, IOException { Args.notNull(request, "HTTP request"); if ((request instanceof HttpEntityEnclosingRequest) && !request.containsHeader(HTTP.DATE_HEADER)) { final String httpdate = DATE_GENERATOR.getCurrentDate(); request.setHeader(HTTP.DATE_HEADER, httpdate); } } }
/** * @since 4.3 */ @ThreadSafe class CPool extends AbstractConnPool<HttpRoute, ManagedHttpClientConnection, CPoolEntry> { private static final AtomicLong COUNTER = new AtomicLong(); private final Log log = LogFactory.getLog(CPool.class); private final long timeToLive; private final TimeUnit tunit; public CPool( final ConnFactory<HttpRoute, ManagedHttpClientConnection> connFactory, final int defaultMaxPerRoute, final int maxTotal, final long timeToLive, final TimeUnit tunit) { super(connFactory, defaultMaxPerRoute, maxTotal); this.timeToLive = timeToLive; this.tunit = tunit; } @Override protected CPoolEntry createEntry(final HttpRoute route, final ManagedHttpClientConnection conn) { final String id = Long.toString(COUNTER.getAndIncrement()); return new CPoolEntry(this.log, id, route, conn, this.timeToLive, this.tunit); } }
/** * Generic registry of items keyed by low-case string ID. * * @since 4.3 */ @ThreadSafe public final class Registry<I> implements Lookup<I> { private final Map<String, I> map; Registry(final Map<String, I> map) { super(); this.map = new ConcurrentHashMap<String, I>(map); } @Override public I lookup(final String key) { if (key == null) { return null; } return map.get(key.toLowerCase(Locale.ROOT)); } @Override public String toString() { return map.toString(); } }
/** * RequestDate interceptor is responsible for adding {@code Date} header * to the outgoing requests This interceptor is optional for client side * protocol processors. * * @since 4.0 */ @ThreadSafe public class RequestDate implements HttpRequestInterceptor { private static final HttpDateGenerator DATE_GENERATOR = new HttpDateGenerator(); public RequestDate() { super(); } @Override public void process(final HttpRequest request, final HttpContext context) throws HttpException, IOException { Args.notNull(request, "HTTP request"); if ((request instanceof HttpEntityEnclosingRequest) && !request.containsHeader(HTTP.DATE_HEADER)) { final String httpdate = DATE_GENERATOR.getCurrentDate(); request.setHeader(HTTP.DATE_HEADER, httpdate); } } }
/** * Generic registry of items keyed by low-case string ID. * * @since 4.3 */ @ThreadSafe public final class Registry<I> implements Lookup<I> { private final Map<String, I> map; Registry(final Map<String, I> map) { super(); this.map = new ConcurrentHashMap<String, I>(map); } @Override public I lookup(final String key) { if (key == null) { return null; } return map.get(key.toLowerCase(Locale.ROOT)); } @Override public String toString() { return map.toString(); } }
/** * A very basic {@link PoolEntry} implementation that represents an entry * in a pool of blocking {@link HttpClientConnection}s identified by * an {@link HttpHost} instance. * * @see HttpHost * @since 4.2 */ @ThreadSafe public class BasicPoolEntry extends PoolEntry<HttpHost, HttpClientConnection> { public BasicPoolEntry(final String id, final HttpHost route, final HttpClientConnection conn) { super(id, route, conn); } @Override public void close() { try { this.getConnection().close(); } catch (final IOException ignore) { } } @Override public boolean isClosed() { return !this.getConnection().isOpen(); } }
/** * ResponseDate is responsible for adding {@code Date} header to the * outgoing responses. This interceptor is recommended for server side protocol * processors. * * @since 4.0 */ @ThreadSafe public class ResponseDate implements HttpResponseInterceptor { private static final HttpDateGenerator DATE_GENERATOR = new HttpDateGenerator(); public ResponseDate() { super(); } @Override public void process(final HttpResponse response, final HttpContext context) throws HttpException, IOException { Args.notNull(response, "HTTP response"); final int status = response.getStatusLine().getStatusCode(); if ((status >= HttpStatus.SC_OK) && !response.containsHeader(HTTP.DATE_HEADER)) { final String httpdate = DATE_GENERATOR.getCurrentDate(); response.setHeader(HTTP.DATE_HEADER, httpdate); } } }
/** * Generic registry of items keyed by low-case string ID. * * @since 4.3 */ @ThreadSafe public final class Registry<I> implements Lookup<I> { private final Map<String, I> map; Registry(final Map<String, I> map) { super(); this.map = new ConcurrentHashMap<String, I>(map); } public I lookup(final String key) { if (key == null) { return null; } return map.get(key.toLowerCase(Locale.US)); } @Override public String toString() { return map.toString(); } }
/** * Generic registry of items keyed by low-case string ID. * * @since 4.3 */ @ThreadSafe public final class Registry<I> implements Lookup<I> { private final Map<String, I> map; Registry(final Map<String, I> map) { super(); this.map = new ConcurrentHashMap<String, I>(map); } public I lookup(final String key) { if (key == null) { return null; } return map.get(key.toLowerCase(Locale.ENGLISH)); } @Override public String toString() { return map.toString(); } }
/** * Standard {@link org.apache.http.cookie.CookieSpec} implementation that enforces a more relaxed * interpretation of the HTTP state management specification (RFC 6265, section 5) * for interoperability with existing servers that do not conform to the well behaved profile * (RFC 6265, section 4). * * @since 4.4 */ @ThreadSafe public class RFC6265LaxSpec extends RFC6265CookieSpecBase { public RFC6265LaxSpec() { super(new BasicPathHandler(), new BasicDomainHandler(), new LaxMaxAgeHandler(), new BasicSecureHandler(), new LaxExpiresHandler()); } RFC6265LaxSpec(final CommonCookieAttributeHandler... handlers) { super(handlers); } @Override public String toString() { return "rfc6265-lax"; } }
/** * Standard {@link org.apache.http.cookie.CookieSpec} implementation that enforces a more relaxed * interpretation of the HTTP state management specification (RFC 6265, section 5) * for interoperability with existing servers that do not conform to the well behaved profile * (RFC 6265, section 4). * * @since 4.4 */ @ThreadSafe public class RFC6265LaxSpec extends RFC6265CookieSpecBase { public RFC6265LaxSpec() { super(new BasicPathHandler(), new BasicDomainHandler(), new LaxMaxAgeHandler(), new BasicSecureHandler(), new LaxExpiresHandler()); } RFC6265LaxSpec(final CommonCookieAttributeHandler... handlers) { super(handlers); } @Override public String toString() { return "rfc6265-lax"; } }
/** * RequestDate interceptor is responsible for adding {@code Date} header * to the outgoing requests This interceptor is optional for client side * protocol processors. * * @since 4.0 */ @ThreadSafe public class RequestDate implements HttpRequestInterceptor { private static final HttpDateGenerator DATE_GENERATOR = new HttpDateGenerator(); public RequestDate() { super(); } @Override public void process(final HttpRequest request, final HttpContext context) throws HttpException, IOException { Args.notNull(request, "HTTP request"); if ((request instanceof HttpEntityEnclosingRequest) && !request.containsHeader(HTTP.DATE_HEADER)) { final String httpdate = DATE_GENERATOR.getCurrentDate(); request.setHeader(HTTP.DATE_HEADER, httpdate); } } }
/** * Generic registry of items keyed by low-case string ID. * * @since 4.3 */ @ThreadSafe public final class Registry<I> implements Lookup<I> { private final Map<String, I> map; Registry(final Map<String, I> map) { super(); this.map = new ConcurrentHashMap<String, I>(map); } @Override public I lookup(final String key) { if (key == null) { return null; } return map.get(key.toLowerCase(Locale.ROOT)); } @Override public String toString() { return map.toString(); } }
/** * ResponseDate is responsible for adding {@code Date} header to the * outgoing responses. This interceptor is recommended for server side protocol * processors. * * @since 4.0 */ @ThreadSafe public class ResponseDate implements HttpResponseInterceptor { private static final HttpDateGenerator DATE_GENERATOR = new HttpDateGenerator(); public ResponseDate() { super(); } @Override public void process(final HttpResponse response, final HttpContext context) throws HttpException, IOException { Args.notNull(response, "HTTP response"); final int status = response.getStatusLine().getStatusCode(); if ((status >= HttpStatus.SC_OK) && !response.containsHeader(HTTP.DATE_HEADER)) { final String httpdate = DATE_GENERATOR.getCurrentDate(); response.setHeader(HTTP.DATE_HEADER, httpdate); } } }