Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ProActive
scheduling
Commits
51f8ca32
Unverified
Commit
51f8ca32
authored
Jun 17, 2020
by
Fabien Viale
Committed by
GitHub
Jun 17, 2020
Browse files
Merge pull request #3772 from fviale/master
ZipUtils: do not perform compression in memory
parents
2c18b2b2
20eccc8d
Changes
2
Hide whitespace changes
Inline
Side-by-side
scheduler/scheduler-api/src/main/java/org/ow2/proactive/scheduler/common/util/ZipUtils.java
View file @
51f8ca32
...
...
@@ -73,26 +73,22 @@ public class ZipUtils extends FileUtils {
* @throws IOException if the zip file cannot be created.
*/
public
static
void
zip
(
String
[]
directoriesAndFiles
,
File
dest
,
CRC32
crc
)
throws
IOException
{
byte
[]
zipped
=
ZipUtils
.
zipDirectoriesAndFiles
(
directoriesAndFiles
,
crc
);
try
(
BufferedOutputStream
bos
=
new
BufferedOutputStream
(
new
FileOutputStream
(
dest
)))
{
bos
.
write
(
zipped
);
try
(
ZipOutputStream
zos
=
new
ZipOutputStream
(
new
BufferedOutputStream
(
new
FileOutputStream
(
dest
))))
{
ZipUtils
.
zipDirectoriesAndFiles
(
zos
,
directoriesAndFiles
,
crc
);
}
}
/**
* Create a zip file that contains all the directory listed in directories parameter.
* @param zos output stream destination
* @param directoriesAndFiles the list of directories and files to be zipped.
* @param crc the CRC32 of all zipentries. Can be null if no crc is needed.
* @throws IOException if the zip file cannot be created.
* @return the zip file as a byte[].
* @throws IOException if an error occurs during the compression
*/
public
static
byte
[]
zipDirectoriesAndFiles
(
String
[]
directoriesAndFiles
,
CRC32
crc
)
throws
IOException
{
// Fill in a byte array
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
();
public
static
void
zipDirectoriesAndFiles
(
ZipOutputStream
zos
,
String
[]
directoriesAndFiles
,
CRC32
crc
)
throws
IOException
{
// Create zip stream
ZipOutputStream
zos
=
new
ZipOutputStream
(
baos
);
zos
.
setLevel
(
COMP_LEVEL
);
// zip file is ready
...
...
@@ -100,10 +96,6 @@ public class ZipUtils extends FileUtils {
// Close the file output streams
zos
.
flush
();
zos
.
close
();
baos
.
flush
();
baos
.
close
();
return
baos
.
toByteArray
();
}
/**
...
...
scheduler/scheduler-server/src/main/java/org/ow2/proactive/scheduler/core/SchedulerBackupRunner.java
View file @
51f8ca32
...
...
@@ -104,6 +104,8 @@ public class SchedulerBackupRunner implements Runnable {
}
finally
{
scheduler
.
resume
();
}
LOGGER
.
info
(
"Backup terminated"
);
}
private
boolean
noTaskIsRunning
()
{
...
...
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