Command resource cleanup after command execution by tedoc2000 · Pull Request #120 · docker-java/docker-java

Skip to content

Navigation Menu

Sign in

Appearance settings

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Conversation

@tedoc2000

Copy link

Contributor

It seems important to be able to do this.. Let me know if you want this to be the default.

@marcuslinke

Copy link

Contributor

@tedoc2000 Thanks for the hint and your contribution first. But maybe we should introduce a more generic concept of a resource cleanup after command execution instead? Something like close() that is called on the command object right after command execution. WDYT?

@tedoc2000

Copy link

Contributor Author

Sounds good.. Let me redo this pull request.

DockerCmd<T> now extends java.io.Closeable. This allows us to cleanup the
temporary tar file created when DockerClient.buildImageCmd(File)
is invoked.

Code would look like:

BuildImageCmd cmd = dockerClient.buildCmd(myDir);
try {
  // ..
  // cmd.exec();
  // ...
} finally {
  cmd.close();
}

@tedoc2000

Copy link

Contributor Author

Okay updated..

@marcuslinke marcuslinke merged commit f0e78bd into docker-java:master

Jan 7, 2015

@marcuslinke

Copy link

Contributor

@tedoc2000 Thanks for your effort!

@marcuslinke marcuslinke changed the title Add support for deleting temporary temp tar files Command resource cleanup after command execution

Jan 7, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@tedoc2000 @marcuslinke