in provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/TcpTransport.java [117:144]
public final void stop(final Runnable onCompleted) {
queue().execute(new Runnable() {
public void run() {
if (_serviceState instanceof STARTED) {
final STOPPING state = new STOPPING();
state.add(onCompleted);
_serviceState = state;
_stop(new Runnable() {
public void run() {
_serviceState = new STOPPED();
state.done();
}
});
} else if (_serviceState instanceof STOPPING) {
_serviceState.add(onCompleted);
} else if (_serviceState instanceof STOPPED) {
if (onCompleted != null) {
onCompleted.run();
}
} else {
if (onCompleted != null) {
onCompleted.run();
}
LOG.error("stop should not be called from state: {}", _serviceState);
}
}
});
}