Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
isochrone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Institut für Informatik
dbis
dbis-isochrone
isochrone
Commits
778187e7
Commit
778187e7
authored
11 years ago
by
Nikolaus Krismer
Browse files
Options
Downloads
Patches
Plain Diff
added waiting thread for geoserver (now doing this in a separate
thread... see javadoc for more details)
parent
ce87d209
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/it/unibz/inf/isoga/web/StartupListener.java
+25
-5
25 additions, 5 deletions
src/main/java/it/unibz/inf/isoga/web/StartupListener.java
with
25 additions
and
5 deletions
src/main/java/it/unibz/inf/isoga/web/StartupListener.java
+
25
−
5
View file @
778187e7
...
...
@@ -13,6 +13,8 @@ import org.slf4j.LoggerFactory;
public
class
StartupListener
implements
ServletContextListener
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
StartupListener
.
class
.
getName
());
// Public methods
@Override
public
void
contextInitialized
(
final
ServletContextEvent
sce
)
{
LOGGER
.
info
(
"Initializing context"
);
...
...
@@ -24,15 +26,33 @@ public class StartupListener implements ServletContextListener {
// 4) Is the geoserver reachable?
// 5) Can we connect to the geoserver with given username/password?
final
ConfigWeb
config
=
ConfigurationContainer
.
getGlobalConfig
();
final
GeoserverHelper
gh
=
new
GeoserverHelper
(
config
);
gh
.
waitForGeoserver
();
gh
.
ensureEnvironment
();
gh
.
performCleanup
();
startGeoserverThread
();
}
@Override
public
void
contextDestroyed
(
final
ServletContextEvent
sce
)
{
}
// Private methods
/**
* Waits for geoserver and perform a cleanup.
* We do this in a separat thread so we do not get any problems if this webapp is hosted
* on the same servlet container as the geoserver (we have to do this, since there is no
* possibility to define an application startup order)
*/
private
void
startGeoserverThread
()
{
final
Thread
t
=
new
Thread
()
{
@Override
public
void
run
()
{
final
ConfigWeb
config
=
ConfigurationContainer
.
getGlobalConfig
();
final
GeoserverHelper
gh
=
new
GeoserverHelper
(
config
);
gh
.
waitForGeoserver
();
gh
.
ensureEnvironment
();
gh
.
performCleanup
();
}
};
t
.
start
();
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment