Skip to content
This repository has been archived by the owner on May 12, 2020. It is now read-only.

stop postgresql on shutdown not working #139

Open
RinatMoravia opened this issue Aug 16, 2018 · 0 comments
Open

stop postgresql on shutdown not working #139

RinatMoravia opened this issue Aug 16, 2018 · 0 comments

Comments

@RinatMoravia
Copy link

Hi,

I add to my code:
Runtime.getRuntime.addShutdownHook(new Thread(() => {
postgres.stop()
}))

I want postgres to stop when app stops. It does not happen.

I can see that stop is running, I'm getting to forceDelete - my temp folder.
It fails to delete my temp folder so it's trying to force delete on exist by adding it to shutdownhook (isn't it too late now?).
Then I get an exception that says:

Exception in thread "Thread-8" java.lang.IllegalStateException: Shutdown in progress
	at java.lang.ApplicationShutdownHooks.add(ApplicationShutdownHooks.java:66)
	at java.lang.Runtime.addShutdownHook(Runtime.java:211)
	at de.flapdoodle.embed.process.io.file.FileCleaner.forceDeleteOnExit(FileCleaner.java:51)
	at de.flapdoodle.embed.process.io.file.Files.forceDelete(Files.java:128)
	at ru.yandex.qatools.embed.postgresql.PostgresProcess.deleteTempFiles(PostgresProcess.java:236)
	at ru.yandex.qatools.embed.postgresql.PostgresProcess.stopInternal(PostgresProcess.java:158)
	at de.flapdoodle.embed.process.runtime.AbstractProcess.stop(AbstractProcess.java:177)
	at ru.yandex.qatools.embed.postgresql.EmbeddedPostgres.stop(EmbeddedPostgres.java:216)
	at com.flir.mock.EmbeddedPostgresSQL.$anonfun$new$1(EmbeddedPostgresSQL.scala:16)
	at java.lang.Thread.run(Thread.java:748)

Process finished with exit code 0

Thanks,
Rinat

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant