}
if(event.stopsMessageExchange()){
try{
observationsLock.writeLock().lock();
ObservableWebservice webservice = this.observations.remove(remoteEndpoint, token);
if(webservice != null){
log.info("Stopped observation of \"{}\" (remote endpoint: {}, token: {}) due to: {}",
new Object[]{webservice.getUriPath(), remoteEndpoint, token, event});
webservice.handleMessageTransferEvent(event);
}
}
finally {
observationsLock.writeLock().unlock();
}
}
else{
try{
observationsLock.readLock().lock();
ObservableWebservice webservice = this.observations.get(remoteEndpoint, token);
if(webservice != null){
webservice.handleMessageTransferEvent(event);
}
}
finally {
observationsLock.readLock().unlock();
}