public void removeFromCache(String destinationId) { GraniteContext context = GraniteContext.getCurrentInstance(); String key = getUniqueKey(destinationId); // Synchronize on unique key. synchronized (key) { context.getApplicationMap().remove(key); Map<String, Object> sessionMap = context.getSessionMap(false); if (sessionMap != null) context.getSessionMap().remove(key); } }
@Override public ServiceInvoker<?> getServiceInstance(RemotingMessage request) throws ServiceException { String messageType = request.getClass().getName(); String destinationId = request.getDestination(); GraniteContext context = GraniteContext.getCurrentInstance(); Map<String, Object> cache = context.getSessionMap(); Destination destination = ((ServicesConfig)context.getServicesConfig()).findDestinationById(messageType, destinationId); String key = TideServiceInvoker.class.getName() + '.' + destinationId; return getServiceInvoker(cache, destination, key); }
private Map<String, Object> getCache(Destination destination) throws ServiceException { GraniteContext context = GraniteManager.getCurrentInstance(); String scope = destination.getProperties().get("scope"); Map<String, Object> cache = null; if (scope == null || "request".equals(scope)) cache = context.getRequestMap(); else if ("session".equals(scope)) cache = context.getSessionMap(); else if ("application".equals(scope)) cache = Collections.synchronizedMap(context.getApplicationMap()); else throw new ServiceException("Illegal scope in destination: " + destination); return cache; } }
private Map<String, Object> getCache(Destination destination) throws ServiceException { GraniteContext context = GraniteContext.getCurrentInstance(); String scope = destination.getProperties().get("scope"); Map<String, Object> cache = null; if (scope == null || "request".equals(scope)) cache = context.getRequestMap(); else if ("session".equals(scope)) cache = context.getSessionMap(); else if ("application".equals(scope)) cache = Collections.synchronizedMap(context.getApplicationMap()); else throw new ServiceException("Illegal scope in destination: " + destination); return cache; } }
private Map<String, Object> getCache(Destination destination) throws ServiceException { GraniteContext context = GraniteContext.getCurrentInstance(); String scope = destination.getProperties().get("scope"); Map<String, Object> cache = null; if (scope == null || "request".equals(scope)) cache = context.getRequestMap(); else if ("session".equals(scope)) cache = context.getSessionMap(); else if ("application".equals(scope)) cache = Collections.synchronizedMap(context.getApplicationMap()); else throw new ServiceException("Illegal scope in destination: " + destination); return cache; } }
Map<String, Object> sessionMap = context.getSessionMap(false); if (sessionMap != null) invoker = (EjbServiceInvoker)sessionMap.get(key); context.getSessionMap(true) : context.getApplicationMap();