Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CityDoctor
CityDoctor2
Commits
58f0a808
Commit
58f0a808
authored
Nov 07, 2025
by
Luna Riegel
Browse files
Refactor: Add cleanup hook
parent
3da98b3e
Changes
1
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/database/DatabaseHandler.java
View file @
58f0a808
...
...
@@ -36,7 +36,6 @@ public class DatabaseHandler {
public
DatabaseHandler
(){
try
{
// Cleanup hook Runtime.getRuntime().addShutdownHook(new Thread(() -> {}));
String
jdbcurl
=
H2GISDBFactory
.
createDataSource
(
DB_NAME
,
true
,
";AUTO_SERVER=TRUE"
).
getConnection
().
getMetaData
().
getURL
();
HikariDataSource
ds
=
new
HikariDataSource
();
...
...
@@ -50,6 +49,8 @@ public class DatabaseHandler {
dataSource
=
new
DataSourceWrapper
(
ds
);
//Cleanup hook
Runtime
.
getRuntime
().
addShutdownHook
(
new
Thread
(
ds:
:
close
));
}
catch
(
Exception
e
)
{
logger
.
fatal
(
"FATAL ERROR: Creation of embedded database failed!"
);
logger
.
fatal
(
e
.
getMessage
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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