private void relinquishSessionOwnership(boolean remove) { SessionOwnershipSupport support = this.distributedCacheManager.getSessionOwnershipSupport(); if (support != null) { support.relinquishSessionOwnership(this.realId, remove); } }
/** * Accesses the underlying cache and creates the proxy * * @throws ClusteringNotSupportedException */ protected void initDistributedCacheManager() throws ClusteringNotSupportedException { proxy_ = distributedCacheManagerFactory.getDistributedCacheManager(this); }
/** * {@inheritDoc} */ public boolean isPassivationEnabled() { return (passivationMode_ && proxy_.isPassivationEnabled()); }
protected DistributableSessionMetadata getSessionMetadata() { this.metadata.setId(id); this.metadata.setCreationTime(creationTime); this.metadata.setMaxInactiveInterval(maxInactiveInterval); this.metadata.setNew(isNew); this.metadata.setValid(isValid); return this.metadata; }
/** * {@inheritDoc} * @see org.jboss.web.tomcat.service.session.distributedcache.ispn.SessionAttributeStorage#store(org.infinispan.atomic.AtomicMap, org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData) */ @Override public void store(Map<Object, Object> map, OutgoingAttributeGranularitySessionData sessionData) { Map<String, Object> modified = sessionData.getModifiedSessionAttributes(); if (modified != null) { for (Map.Entry<String, Object> entry: modified.entrySet()) { map.put(entry.getKey(), this.marshaller.marshal(entry.getValue())); } } Set<String> removed = sessionData.getRemovedSessionAttributes(); if (removed != null) { for (String attribute: removed) { map.remove(attribute); } } }
public void storeSipSessionData( OutgoingDistributableSipSessionData sipSessionData) { String sipApplicationSessionKey = sipSessionData.getSipApplicationSessionKey(); String sessionKey = sipSessionData.getSipSessionKey(); if (log_.isDebugEnabled()) { log_.debug("storeSipSessionData(): putting sip session " + sessionKey.toString()); } Fqn<String> fqn = getSipSessionFqn(jBossCacheService.combinedPath_, sipApplicationSessionKey, sessionKey); // Swap in/out the webapp classloader so we can deserialize // attributes whose classes are only available to the webapp ClassLoader prevTCL = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(manager.getApplicationClassLoader()); try { storeSipSessionMetaData(fqn, sipSessionData); ((DistributedCacheConvergedSipManager)jBossCacheService).storeSipSessionAttributes(Fqn.fromString(fqn.toString() + "/" + AbstractJBossCacheService.ATTRIBUTE_KEY), sipSessionData); } finally { Thread.currentThread().setContextClassLoader(prevTCL); } }
/** * {@inheritDoc} * @see org.jboss.web.tomcat.service.session.distributedcache.ispn.SessionAttributeStorage#store(org.infinispan.atomic.AtomicMap, org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData) */ @Override public void store(Map<Object, Object> map, OutgoingSessionGranularitySessionData sessionData) { Map<String, Object> attributes = sessionData.getSessionAttributes(); if (attributes != null) { SessionMapEntry.ATTRIBUTES.put(map, this.marshaller.marshal(attributes)); } }
public void storeSipApplicationSessionData(OutgoingDistributableSipApplicationSessionData sipApplicationSessionData) { String fqnId = sipApplicationSessionData.getSipApplicationSessionKey(); if (log_.isTraceEnabled()) { log_.trace("putSipSession(): putting sip session " + fqnId); } Fqn<String> fqn = getSipApplicationSessionFqn(jBossCacheService.combinedPath_, fqnId); Map<Object, Object> map = new HashMap<Object, Object>(); // Swap in/out the webapp classloader so we can deserialize // attributes whose classes are only available to the webapp ClassLoader prevTCL = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(manager.getApplicationClassLoader()); try { storeSipApplicationSessionMetaData(fqn, sipApplicationSessionData); ((DistributedCacheConvergedSipManager)jBossCacheService).storeSipApplicationSessionAttributes(Fqn.fromString(fqn.toString() + "/" + AbstractJBossCacheService.ATTRIBUTE_KEY), sipApplicationSessionData); } finally { Thread.currentThread().setContextClassLoader(prevTCL); } }
@Override public String locate(String sessionId) { return this.manager.getJvmRoute(); }
private boolean startBatchTransaction() throws ServletException { boolean started = false; try { if (this.tm != null && this.tm.isBatchInProgress() == false) { this.tm.startBatch(); started = true; } } catch (RuntimeException re) { throw re; } catch (Exception e) { throw new ServletException("Failed to initiate batch replication transaction", e); } return started; }
@CacheEntryActivated public void activated(CacheEntryActivatedEvent<String, Map<Object, Object>> event) { if (event.isPre()) return; this.manager.sessionActivated(); }
@Override public String locate(String sessionId) { return this.proxy_.locate(sessionId); }
private void addLocal(Collection<String> localIds, Collection<String> ids) { for (String id: ids) { if (this.proxy_.isLocal(id)) { localIds.add(id); } } }
private void handleForceSynchronousNotification(String type, String enableType, String disableType) { boolean enabled = type.equals(enableType); if (enabled || type.equals(disableType)) { if (this.proxy_ != null) { this.proxy_.setForceSynchronous(enabled); } } }
private static String maskId(OutgoingSessionGranularitySessionData sessionData) { String realId = (sessionData == null ? null : sessionData.getRealId()); return maskId(realId); }
/** * {@inheritDoc} * @see org.jboss.web.tomcat.service.session.distributedcache.ispn.SessionAttributeStorage#load(org.infinispan.atomic.AtomicMap) */ @SuppressWarnings("unchecked") @Override public Map<String, Object> load(Map<Object, Object> map) throws Exception { return (Map<String, Object>) this.marshaller.unmarshal(SessionMapEntry.ATTRIBUTES.get(map)); } }
/** * Remove myself from the <t>local</t> instance of the distributed cache. */ public void removeMyselfLocal() { getDistributedCacheManager().removeSessionLocal(getRealId()); }
/** * Remove myself from the distributed cache. */ public void removeMyself() { getDistributedCacheManager().removeSession(getRealId()); }
/** * {@inheritDoc} * @see org.jboss.web.tomcat.service.session.distributedcache.ispn.CacheSource#getCache(org.jboss.web.tomcat.service.session.distributedcache.spi.LocalDistributableSessionManager) */ @Override public <K, V> Cache<K, V> getCache(LocalDistributableSessionManager manager) { return this.registry.getCacheContainer().getCache(manager.getEngineName()); } }
@CacheEntryRemoved public void removed(CacheEntryRemovedEvent<String, Map<Object, Object>> event) { if (event.isPre() || event.isOriginLocal()) return; this.manager.notifyRemoteInvalidation(event.getKey()); }