/** */ public void onApplicationEvent(ApplicationEvent event) { if (event instanceof UserGroupUpdateEvent) { cache.updateEvent((UserGroupUpdateEvent) event); } else if (event instanceof DestroySessionMessage) { sessionProvider.executeCloseSession(((DestroySessionMessage) event).getSessionId()); } }
private void internalRemove(String uuid, String reason) { if (!sessions.containsKey(uuid)) { log.warn("Session not in cache: " + uuid); return; // EARLY EXIT! } log.info("Destroying session " + uuid + " due to : " + reason); // Announce to all callbacks. Set<SessionCallback> cbs = sessionCallbackMap.get(uuid); if (cbs != null) { for (SessionCallback cb : cbs) { try { cb.close(); } catch (Exception e) { final String msg = "SessionCallback %s throw exception for session %s"; log.warn(String.format(msg, cb, uuid), e); } } } // Announce to all listeners try { context.publishEvent(new DestroySessionMessage(this, uuid)); } catch (RuntimeException re) { final String msg = "Session listener threw an exception for session %s"; log.warn(String.format(msg, uuid), re); } ehmanager.removeCache("memory:" + uuid); ehmanager.removeCache("ondisk:" + uuid); sessions.remove(uuid); }
public void onApplicationEvent(InternalMessage event) { try { if (event instanceof UnregisterServantMessage) { UnregisterServantMessage msg = (UnregisterServantMessage) event; Ice.Current curr = msg.getCurrent(); ServantHolder holder = msg.getHolder(); // Using static method since we may not have a clientId // in order to look up the SessionI/ServiceFactoryI SessionI.unregisterServant(curr.id, adapter, holder); } else if (event instanceof FindServiceFactoryMessage) { FindServiceFactoryMessage msg = (FindServiceFactoryMessage) event; Ice.Identity id = msg.getIdentity(); if (id == null) { Ice.Current curr = msg.getCurrent(); id = getServiceFactoryIdentity(curr); } ServiceFactoryI sf = getServiceFactory(id); msg.setServiceFactory(id, sf); } else if (event instanceof DestroySessionMessage) { DestroySessionMessage msg = (DestroySessionMessage) event; reapSession(msg.getSessionId()); } else if (event instanceof ChangeSecurityContextEvent) { ChangeSecurityContextEvent csce = (ChangeSecurityContextEvent) event; checkStatefulServices(csce); } } catch (Throwable t) { throw new MessageException("SessionManagerI.onApplicationEvent", t); } }