Skip to content

Command resource cleanup after command execution#120

Merged
marcuslinke merged 1 commit intodocker-java:masterfrom
signalfx:master
Jan 7, 2015
Merged

Command resource cleanup after command execution#120
marcuslinke merged 1 commit intodocker-java:masterfrom
signalfx:master

Conversation

@tedoc2000
Copy link
Copy Markdown
Contributor

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

@marcuslinke
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

Okay updated..

@marcuslinke marcuslinke merged commit f0e78bd into docker-java:master Jan 7, 2015
@marcuslinke
Copy link
Copy Markdown
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants