HDFS-12050. Ozone: StorageHandler: Implementation of close for releasing resources during shutdown. Contributed by Nandakumar.
This commit is contained in:
parent
4c683936e7
commit
ba647764f3
|
@ -154,4 +154,13 @@ public class XceiverClientManager {
|
||||||
throw new IOException("Exception getting XceiverClient.", e);
|
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
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
LOG.info("Closing ObjectStoreHandler.");
|
LOG.info("Closing ObjectStoreHandler.");
|
||||||
|
storageHandler.close();
|
||||||
if (this.storageContainerLocationClient != null) {
|
if (this.storageContainerLocationClient != null) {
|
||||||
this.storageContainerLocationClient.close();
|
this.storageContainerLocationClient.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,4 +273,9 @@ public interface StorageHandler {
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
ListKeys listKeys(ListArgs args) throws IOException, OzoneException;
|
ListKeys listKeys(ListArgs args) throws IOException, OzoneException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes all the opened resources.
|
||||||
|
*/
|
||||||
|
void close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -353,4 +353,9 @@ public class LocalStorageHandler implements StorageHandler {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close() {
|
||||||
|
//No resource to close, do nothing.
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -509,4 +509,14 @@ public final class DistributedStorageHandler implements StorageHandler {
|
||||||
sdf.setTimeZone(TimeZone.getTimeZone(OzoneConsts.OZONE_TIME_ZONE));
|
sdf.setTimeZone(TimeZone.getTimeZone(OzoneConsts.OZONE_TIME_ZONE));
|
||||||
return sdf.format(date);
|
return sdf.format(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes DistributedStorageHandler.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void close() {
|
||||||
|
if(xceiverClientManager != null) {
|
||||||
|
xceiverClientManager.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue