@Override public ServiceInvoker<?> getServiceInstance(RemotingMessage request) throws ServiceException { String messageType = request.getClass().getName(); String destinationId = request.getDestination(); GraniteContext context = GraniteContext.getCurrentInstance(); Destination destination = ((ServicesConfig)context.getServicesConfig()).findDestinationById(messageType, destinationId); if (destination == null) throw new ServiceException("No matching destination: " + destinationId); destination.addRemoveListener(this); Map<String, Object> cache = getCache(destination); String key = SimpleServiceInvoker.class.getName() + '.' + destination.getId(); if (invalidKeys.contains(key)) { cache.remove(key); invalidKeys.remove(key); } SimpleServiceInvoker service = (SimpleServiceInvoker)cache.get(key); if (service == null) { service = new SimpleServiceInvoker(destination, this); cache.put(key, service); } return service; }
@Override public ServiceInvoker<?> getServiceInstance(RemotingMessage request) throws ServiceException { String messageType = request.getClass().getName(); String destinationId = request.getDestination(); GraniteContext context = GraniteContext.getCurrentInstance(); Destination destination = context.getServicesConfig().findDestinationById(messageType, destinationId); if (destination == null) throw new ServiceException("No matching destination: " + destinationId); destination.addRemoveListener(this); Map<String, Object> cache = getCache(destination); String key = SimpleServiceInvoker.class.getName() + '.' + destination.getId(); if (invalidKeys.contains(key)) { cache.remove(key); invalidKeys.remove(key); } SimpleServiceInvoker service = (SimpleServiceInvoker)cache.get(key); if (service == null) { service = new SimpleServiceInvoker(destination, this); cache.put(key, service); } return service; }