Skip to content

Commit

Permalink
fix for opened file lock after delete
Browse files Browse the repository at this point in the history
  • Loading branch information
kurzum committed Mar 23, 2020
1 parent 4adbecd commit 91166f4
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/main/scala/org/dbpedia/databus/derive/mojo/CloneGoal.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import scala.collection.JavaConverters._
import scala.collection.parallel.ForkJoinTaskSupport
import scala.concurrent.forkjoin.ForkJoinPool
import scala.language.postfixOps
import scala.sys.process
import scala.sys.process.Process

/** @author Marvin Hofer
Expand Down Expand Up @@ -249,16 +250,22 @@ class CloneGoal extends AbstractMojo {
if (rFilter.pattern.matcher(downFile.name).matches) {

System.err.println(s"[INFO] Parsing ${downFile.name}")
val finalFileOutputStream : java.io.OutputStream = finalFile.newOutputStream
val reportFileOutputStream : java.io.OutputStream = reportFile.newOutputStream

parseFile(
downFile,
finalFile.newOutputStream,
reportFile.newOutputStream,
finalFileOutputStream,
reportFileOutputStream,
parChunks,
chunkSize,
ReportFormat.TEXT,
removeWarnings = true
)

finalFileOutputStream.close()
reportFileOutputStream.close()

lbzip2File(finalFile)
lbzip2File(reportFile)

Expand All @@ -283,7 +290,7 @@ class CloneGoal extends AbstractMojo {
val sortMemory = "20%"
val sortParallel = "8"

val cmd = Seq(
val cmd: Seq[String] = Seq(
"bash",
"-c",
s"LC_ALL=C sort -S $sortMemory -u --parallel=$sortParallel ${file.pathAsString} " +
Expand All @@ -293,7 +300,11 @@ class CloneGoal extends AbstractMojo {

System.err.println(s"[INFO] ${cmd.mkString(" ")}")

Process(cmd).!
val process = Process(cmd).run()
val exitValue = process.exitValue()
process.destroy()


}

val pluginVersion = "1.3-SNAPSHOT"
Expand Down

0 comments on commit 91166f4

Please sign in to comment.