/** * GC is attempting to destroy the object. * No one references this client anymore, so it can be torn down without worrying about user counts. * @throws Throwable */ @Override protected void finalize() throws Throwable { if (users.get() != 0) { LOG.warn("Closing client with non-zero user count: users=" + users.get() + " expired=" + expiredFromCache); } try { this.tearDown(); } finally { super.finalize(); } } }
/** * GC is attempting to destroy the object. * No one references this client anymore, so it can be torn down without worrying about user counts. * @throws Throwable */ @Override protected void finalize() throws Throwable { if (users.get() != 0) { LOG.warn("Closing client with non-zero user count: users=" + users.get() + " expired=" + expiredFromCache); } try { this.tearDown(); } finally { super.finalize(); } } }
/** * Attempt to tear down the client connection. * The connection will be closed if the following conditions hold: * 1. There are no active user holding the client. * 2. The client has been evicted from the cache. */ public synchronized void tearDownIfUnused() { if (users.get() != 0) { LOG.warn("Non-zero user count preventing client tear down: users=" + users.get() + " expired=" + expiredFromCache); } if (users.get() == 0 && expiredFromCache) { this.tearDown(); } }
/** * Tear down only if * 1. There are no active user * 2. It has expired from the cache */ public void tearDownIfUnused() { if (users.get() == 0 && expiredFromCache) { this.tearDown(); } }
/** * Tear down only if * 1. There are no active user * 2. It has expired from the cache */ public void tearDownIfUnused() { if (users.get() == 0 && expiredFromCache) { this.tearDown(); } }
/** * Decrement the user count and piggyback this to set expiry flag as well, then teardown(), if conditions are met. * This *MUST* be called by anyone who uses this client. */ @Override public synchronized void close() { release(); tearDownIfUnused(); }
/** * Last effort to clean up, may not even get called. * @throws Throwable */ @Override protected void finalize() throws Throwable { try { this.tearDown(); } finally { super.finalize(); } } }
/** * Decrement the user count and piggyback this to set expiry flag as well, then teardown(), if conditions are met. * This *MUST* be called by anyone who uses this client. */ @Override public void close() { release(); if (System.currentTimeMillis() >= expiryTime) setExpiredFromCache(); tearDownIfUnused(); }
/** * Last effort to clean up, may not even get called. * @throws Throwable */ @Override protected void finalize() throws Throwable { try { this.tearDown(); } finally { super.finalize(); } } }
/** * Last effort to clean up, may not even get called. * @throws Throwable */ @Override protected void finalize() throws Throwable { try { this.tearDown(); } finally { super.finalize(); } } }
/** * Tear down only if * 1. There are no active user * 2. It has expired from the cache */ public void tearDownIfUnused() { if (users.get() == 0 && expiredFromCache) { this.tearDown(); } }
/** * Decrement the user count and piggyback this to set expiry flag as well, then teardown(), if conditions are met. * This *MUST* be called by anyone who uses this client. */ @Override public void close() { release(); if (System.currentTimeMillis() >= expiryTime) setExpiredFromCache(); tearDownIfUnused(); }
/** * Decrement the user count and piggyback this to set expiry flag as well, then teardown(), if conditions are met. * This *MUST* be called by anyone who uses this client. */ @Override public void close() { release(); if (System.currentTimeMillis() >= expiryTime) setExpiredFromCache(); tearDownIfUnused(); }
(HiveClientCache.CacheableHiveMetaStoreClient) cache.get(metaServer.getHiveConf()); assertTrue(client.isOpen()); client.dropTable(DB_NAME, LONG_TABLE_NAME); } catch (Exception e) { client.dropDatabase(DB_NAME); } catch (Exception e) { client.createDatabase(new Database(DB_NAME, "", null, null)); client.createTable(tbl); fail("Exception was expected while creating table with long name"); } catch (Exception e) { assertFalse(client.isOpen()); metaServer.shutDown();
/** * Attempt to tear down the client connection. * The connection will be closed if the following conditions hold: * 1. There are no active user holding the client. * 2. The client has been evicted from the cache. */ public synchronized void tearDownIfUnused() { if (users.get() != 0) { LOG.warn("Non-zero user count preventing client tear down: users=" + users.get() + " expired=" + expiredFromCache); } if (users.get() == 0 && expiredFromCache) { this.tearDown(); } }
/** * Decrement the user count and piggyback this to set expiry flag as well, then teardown(), if conditions are met. * This *MUST* be called by anyone who uses this client. */ @Override public synchronized void close() { release(); tearDownIfUnused(); }