I have a custom GeoEvent transport that is getting automatically restarted when the transport code sets the RunningState to ERROR or STOPPED. This results in the transport making successive passes through the code, when ideally the transport (and associated connector) should cease execution so the end user can resolve the error condition.
I have not been able to find any documentation related to "Heartbeat Thread". The only place I see mention of "Heartbeat Thread" is in the karaf.log file, which in turn is calling the Start() method of my transport. I'm wondering how to prevent that heartbeat from restarting the transport.
The following example illustrates the problem, here I have intentionally fed in bad authentication parameters (the transport interacts with a SOAP web service). RunningState is set to ERROR, where it should stay through the rest of execution, however it is restarted by that Heartbeat Thread. I have also tried stopping the transport after this example error, in that case the the stop() method is executed, but the transport is still restarted by the heartbeat.
Environment:
Windows Server 2012
ArcGIS Server 10.3.0 (10.3.4322)
GeoEvent Extension 10.3.0 (10.3.4322)
Karaf.log
2015-10-26 11:06:13,541 | ERROR | ansport Listener | TestInboundTransport | ort.inbound.TestInboundTransport 357 | 370 - com.test.arcgis.geoevent.transport.inbound.TestInboundTransport - 10.3.0 | Authentication to Test web services failed! Error: Access Denied.
2015-10-26 11:06:18,460 | INFO | Heartbeat Thread | TestInboundTransport | ort.inbound.TestInboundTransport 409 | 370 - com.test.arcgis.geoevent.transport.inbound.TestInboundTransport - 10.3.0 | Test Inbound Transport Service Starting
Code Snippets
.. The error entry…
if( ((AuthSoapHeader)holder.value).getError() != null)
{
log.error("Authentication to Test web services failed! Error: " + ((AuthSoapHeader)holder.value).getError());
//TODO: clean up and stop service
this.setRunningState(RunningState.ERROR);
//this.stop();
return null;
}
…
@SuppressWarnings("incomplete-switch")
public synchronized void start() throws RunningException
{
log.info("Test Inbound Transport Service Starting");
switch (getRunningState())
{
case STARTING:
case STARTED:
return; //added to prevent multiple thread starts
case STOPPING:
return;
}
//this.serviceStopping = false;
this.setRunningState(RunningState.STARTING);
this.thread = new Thread(null, this, "Test Inbound Transport Listener");
this.thread.start();
}
public synchronized void stop()
{
this.setRunningState(RunningState.STOPPING);
log.info("Test Inbound Transport Service Stopping");
cleanup();
this.setRunningState(RunningState.STOPPED);
super.stop();
}
private void cleanup()
{
if( this.byteBuffer != null)
{
this.byteBuffer.clear();
}
}