@@ -154,4 +154,13 @@ public class XceiverClientManager {
throw new IOException("Exception getting XceiverClient.", e);
}
+
+ /**
+ * Close and remove all the cached clients.
+ */
+ public void close() {
+ //closing is done through RemovalListener
+ clientCache.invalidateAll();
+ clientCache.cleanUp();
+ }
@@ -177,6 +177,7 @@ public final class ObjectStoreHandler implements Closeable {
@Override
public void close() {
LOG.info("Closing ObjectStoreHandler.");
+ storageHandler.close();
if (this.storageContainerLocationClient != null) {
this.storageContainerLocationClient.close();
@@ -273,4 +273,9 @@ public interface StorageHandler {
* @throws IOException
*/
ListKeys listKeys(ListArgs args) throws IOException, OzoneException;
+ * Closes all the opened resources.
+ void close();
@@ -353,4 +353,9 @@ public class LocalStorageHandler implements StorageHandler {
+ @Override
+ //No resource to close, do nothing.
@@ -509,4 +509,14 @@ public final class DistributedStorageHandler implements StorageHandler {
sdf.setTimeZone(TimeZone.getTimeZone(OzoneConsts.OZONE_TIME_ZONE));
return sdf.format(date);
+ * Closes DistributedStorageHandler.
+ if(xceiverClientManager != null) {
+ xceiverClientManager.close();