Thank you for the answer. This code works fine in adapterStartup().
If, however, a fatal AdapterException from within scriptInvoke in an Operation Template is thrown, nothing happens (i.e. I only get an error and errorNotify doument). But I would like to have the adapter to shutdown also in these situations.
To simulate this, I have the following code:
a) in OperationTemplate.scriptInvoke(…):
…
MyAdapter adapter = (MyAdapter).access.getAdapter();
adapter.checkConnectionProblem(new Exception(“foo”));
…
b) in MyAdapter.adapterStartup(…):
…
if (false == adapterAccess.isConnectTest()) resourcePing();
c) in MyAdapter:
public void resourcePing() throws AdapterException{
try {
double ran = Math.random();
if (ran < 0.5d) throw new Exception(Double.toString(ran));
}
catch (Exception e) {
String text = "resourcePing(): Cannot connect to resource: " + e.toString();
AdapterException ae = new AdapterException(text);
ae.setFatal(true);
throw ae;
}
d) in MyAdapter:
public void checkConnectionProblem(Exception anException) throws AdapterException {
//parse Exception and if needed do ping
resourcePing();
}
So: if I get a fatal AdapterExeption in c) when called from b) the adapter shutsdown as desired. However, if a fatal AdapterException is thrown in c) when called from a) via d) then the adapter will not shutdown.
Any idea how I can bring the adapter down from within a OperationTemplate.scriptInvoke()?
Thanks in advance … Rick
PS: I want to use d) to first parse the Exception.toString() to find out, whether it probably has been a connection problem.
#webMethods#Integration-Server-and-ESB#Adapters-and-E-Standards