use of com.alipay.sofa.runtime.api.ServiceRuntimeException in project sofa-boot by alipay.
the class ServiceComponent method deactivate.
@Override
public void deactivate() throws ServiceRuntimeException {
Object target = service.getTarget();
if (target == null) {
throw new ServiceRuntimeException("Must contains the target object whiling registering Service.");
}
if (service.hasBinding()) {
Set<Binding> bindings = service.getBindings();
for (Binding binding : bindings) {
BindingAdapter<Binding> bindingAdapter = this.bindingAdapterFactory.getBindingAdapter(binding.getBindingType());
if (bindingAdapter == null) {
throw new ServiceRuntimeException("Can't find BindingAdapter of type " + binding.getBindingType() + " while deactivate service " + service + ".");
}
SofaLogger.info(" <<Pre un-out Binding [{0}] Begins - {1}.", binding.getBindingType(), service);
bindingAdapter.preUnoutBinding(service, binding, target, getContext());
SofaLogger.info(" <<Pre un-out Binding [{0}] Ends - {1}.", binding.getBindingType(), service);
}
}
super.deactivate();
}
Aggregations