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); } }
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.spi.SessionAttributeMarshaller#unmarshal(java.lang.Object) */ @Override public Object unmarshal(Object object) throws IOException, ClassNotFoundException { if ((object == null) || !(object instanceof SimpleCachableMarshalledValue)) return object; SimpleCachableMarshalledValue value = (SimpleCachableMarshalledValue) object; // Swap in/out the class loader for this web app. Needed only for unmarshalling. ContextClassLoaderSwitcher.SwitchContext switchContext = this.switcher.getSwitchContext(this.manager.getApplicationClassLoader()); try { value.setObjectStreamSource(this.source); return value.get(); } finally { switchContext.reset(); } } }