File tree Expand file tree Collapse file tree 1 file changed +14
-9
lines changed
sensorhub-core/src/main/java/org/sensorhub/impl/service Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -44,15 +44,18 @@ public abstract class AbstractHttpServiceModule<ConfigType extends ModuleConfig>
4444 @ Override
4545 public void start () throws SensorHubException
4646 {
47- httpServer = getParentHub ().getModuleRegistry ().getModuleByType (IHttpServer .class );
48- if (httpServer == null )
49- throw new SensorHubException ("HTTP server module is not loaded" );
47+ if (canStart ())
48+ {
49+ httpServer = getParentHub ().getModuleRegistry ().getModuleByType (IHttpServer .class );
50+ if (httpServer == null )
51+ throw new SensorHubException ("HTTP server module is not loaded" );
5052
51- // subscribe to server lifecycle events
52- httpServer .registerListener (this );
53+ // subscribe to server lifecycle events
54+ httpServer .registerListener (this );
5355
54- // we actually start in the handleEvent() method when
55- // a STARTED event is received from HTTP server
56+ // we actually start in the handleEvent() method when
57+ // a STARTED event is received from HTTP server
58+ }
5659 }
5760
5861
@@ -81,7 +84,8 @@ public void handleEvent(Event e)
8184 {
8285 try
8386 {
84- super .start ();
87+ doStart ();
88+ setState (ModuleState .STARTED );
8589 }
8690 catch (Exception ex )
8791 {
@@ -94,7 +98,8 @@ else if (newState == ModuleState.STOPPED)
9498 {
9599 try
96100 {
97- stop ();
101+ doStop ();
102+ setState (ModuleState .STOPPED );
98103 }
99104 catch (SensorHubException ex )
100105 {
You can’t perform that action at this time.
0 commit comments