コード例 #1
0
 @Override
 public <R extends Service> void stopService(ServiceBinding<R> binding) {
   final Service service = binding.getService();
   if (Stoppable.class.isInstance(service)) {
     try {
       ((Stoppable) service).stop();
     } catch (Exception e) {
       LOG.unableToStopService(service.getClass(), e.toString());
     }
   }
 }
コード例 #2
0
 public void destroy() {
   ListIterator<Service> serviceIterator = serviceList.listIterator(serviceList.size());
   while (serviceIterator.hasPrevious()) {
     final Service service = serviceIterator.previous();
     if (Stoppable.class.isInstance(service)) {
       try {
         ((Stoppable) service).stop();
       } catch (Exception e) {
         LOG.unableToStopService(service.getClass(), e.toString());
       }
     }
   }
   serviceList.clear();
   serviceList = null;
   serviceBindingMap.clear();
   serviceBindingMap = null;
 }