List of usage examples for com.amazonaws.http IdleConnectionReaper shutdown
public static synchronized boolean shutdown()
From source file:org.elasticsearch.cloud.aws.AwsEc2ServiceImpl.java
License:Apache License
@Override protected void doClose() throws ElasticsearchException { if (client != null) { client.shutdown();//from w w w. j a v a2 s. c o m } // Ensure that IdleConnectionReaper is shutdown IdleConnectionReaper.shutdown(); }
From source file:org.elasticsearch.cloud.aws.InternalAwsS3Service.java
License:Apache License
@Override protected void doClose() throws ElasticsearchException { for (AmazonS3Client client : clients.values()) { client.shutdown();//from w w w .j av a 2 s . com } // Ensure that IdleConnectionReaper is shutdown IdleConnectionReaper.shutdown(); }
From source file:org.elasticsearch.discovery.ec2.AwsEc2ServiceImpl.java
License:Apache License
@Override public void close() throws IOException { if (client != null) { client.shutdown();//from w w w. j a v a 2 s .c om } // Ensure that IdleConnectionReaper is shutdown IdleConnectionReaper.shutdown(); }
From source file:org.elasticsearch.repositories.s3.InternalAwsS3Service.java
License:Apache License
@Override protected void doClose() throws ElasticsearchException { for (AmazonS3Client client : clientsCache.values()) { client.shutdown();//w w w . j ava 2s .c om } // Ensure that IdleConnectionReaper is shutdown IdleConnectionReaper.shutdown(); }
From source file:org.elasticsearch.repositories.s3.S3Service.java
License:Apache License
protected synchronized void releaseCachedClients() { // the clients will shutdown when they will not be used anymore for (final AmazonS3Reference clientReference : clientsCache.values()) { clientReference.decRef();//from www. ja v a2 s. c o m } // clear previously cached clients, they will be build lazily clientsCache = emptyMap(); // shutdown IdleConnectionReaper background thread // it will be restarted on new client usage IdleConnectionReaper.shutdown(); }
From source file:org.wallride.web.support.WebListenerHandler.java
License:Apache License
@Override public void contextDestroyed(ServletContextEvent event) { // // stop CacheManger // try { // JndiTemplate jndiTemplate = new JndiTemplate(); // DefaultCacheManager cacheManager = (DefaultCacheManager) jndiTemplate.lookup("cacheManager"); // cacheManager.stop(); // jndiTemplate.unbind("cacheManager"); // }// ww w . j av a2 s .c o m // catch (NamingException e) { // e.printStackTrace(); // } // // // clear drivers // Enumeration<Driver> drivers = DriverManager.getDrivers(); // Driver driver = null; // while(drivers.hasMoreElements()) { // try { // driver = drivers.nextElement(); // DriverManager.deregisterDriver(driver); // } // catch (SQLException e) { // e.printStackTrace(); // } // } try { // http://stackoverflow.com/questions/18069042/spring-mvc-webapp-schedule-java-sdk-http-connection-reaper-failed-to-stop IdleConnectionReaper.shutdown(); // MySQL driver leaves around a thread. This static method cleans it up. AbandonedConnectionCleanupThread.shutdown(); } catch (InterruptedException e) { e.printStackTrace(); } ClassLoader cl = Thread.currentThread().getContextClassLoader(); Enumeration<Driver> drivers = DriverManager.getDrivers(); while (drivers.hasMoreElements()) { Driver driver = drivers.nextElement(); if (driver.getClass().getClassLoader() == cl) { try { logger.info("Deregistering JDBC driver {}", driver); DriverManager.deregisterDriver(driver); } catch (SQLException ex) { logger.error("Error deregistering JDBC driver {}", driver, ex); } } else { logger.trace("Not deregistering JDBC driver {} as it does not belong to this webapp's ClassLoader", driver); } } }