Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
c56fbf8c
Commit
c56fbf8c
authored
Jun 12, 2019
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow Archives to be closed so they can release resources
Closes gh-17126
parent
4748626f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
Archive.java
...java/org/springframework/boot/loader/archive/Archive.java
+11
-1
JarFileArchive.java
...g/springframework/boot/loader/archive/JarFileArchive.java
+5
-0
No files found.
spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/Archive.java
View file @
c56fbf8c
...
...
@@ -30,7 +30,7 @@ import org.springframework.boot.loader.Launcher;
* @author Phillip Webb
* @see JarFileArchive
*/
public
interface
Archive
extends
Iterable
<
Archive
.
Entry
>
{
public
interface
Archive
extends
Iterable
<
Archive
.
Entry
>
,
AutoCloseable
{
/**
* Returns a URL that can be used to load the archive.
...
...
@@ -54,6 +54,16 @@ public interface Archive extends Iterable<Archive.Entry> {
*/
List
<
Archive
>
getNestedArchives
(
EntryFilter
filter
)
throws
IOException
;
/**
* Closes the {@code Archive}, releasing any open resources.
* @throws Exception if an error occurs during close processing
* @since 2.2.0
*/
@Override
default
void
close
()
throws
Exception
{
}
/**
* Represents a single entry in the archive.
*/
...
...
spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/JarFileArchive.java
View file @
c56fbf8c
...
...
@@ -94,6 +94,11 @@ public class JarFileArchive implements Archive {
return
new
EntryIterator
(
this
.
jarFile
.
entries
());
}
@Override
public
void
close
()
throws
IOException
{
this
.
jarFile
.
close
();
}
protected
Archive
getNestedArchive
(
Entry
entry
)
throws
IOException
{
JarEntry
jarEntry
=
((
JarFileEntry
)
entry
).
getJarEntry
();
if
(
jarEntry
.
getComment
().
startsWith
(
UNPACK_MARKER
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment