HDDS-377. Make the ScmClient closable and stop the started threads. Contributed by Elek Marton.
This commit is contained in:
parent
84973d1049
commit
6eecd251d8
|
@ -257,6 +257,15 @@ public class ContainerOperationClient implements ScmClient {
|
||||||
factor, nodePool);
|
factor, nodePool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close() {
|
||||||
|
try {
|
||||||
|
xceiverClientManager.close();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
LOG.error("Can't close " + this.getClass().getSimpleName(), ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes an existing container.
|
* Deletes an existing container.
|
||||||
*
|
*
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos
|
||||||
.ContainerData;
|
.ContainerData;
|
||||||
import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
|
import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
|
||||||
|
|
||||||
|
import java.io.Closeable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -39,7 +40,7 @@ import java.util.List;
|
||||||
* this interface will likely be removed.
|
* this interface will likely be removed.
|
||||||
*/
|
*/
|
||||||
@InterfaceStability.Unstable
|
@InterfaceStability.Unstable
|
||||||
public interface ScmClient {
|
public interface ScmClient extends Closeable {
|
||||||
/**
|
/**
|
||||||
* Creates a Container on SCM and returns the pipeline.
|
* Creates a Container on SCM and returns the pipeline.
|
||||||
* @return ContainerInfo
|
* @return ContainerInfo
|
||||||
|
@ -61,7 +62,8 @@ public interface ScmClient {
|
||||||
* @return ContainerWithPipeline
|
* @return ContainerWithPipeline
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
ContainerWithPipeline getContainerWithPipeline(long containerId) throws IOException;
|
ContainerWithPipeline getContainerWithPipeline(long containerId)
|
||||||
|
throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close a container.
|
* Close a container.
|
||||||
|
@ -87,7 +89,8 @@ public interface ScmClient {
|
||||||
* @param force - true to forcibly delete the container.
|
* @param force - true to forcibly delete the container.
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
void deleteContainer(long containerId, Pipeline pipeline, boolean force) throws IOException;
|
void deleteContainer(long containerId, Pipeline pipeline, boolean force)
|
||||||
|
throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes an existing container.
|
* Deletes an existing container.
|
||||||
|
|
Loading…
Reference in New Issue