tclSwitchContext.reset();
switcher.setClassLoader(tcl_); session.expire(notify, localCall, localOnly, ClusteredSessionNotificationCause.INVALIDATE); switcher.reset();
/** * Retrieve a switch context for the classloader of a given class * * @deprecated using a class to determine the classloader is a * bad idea, it has the same problems as Class.forName() * @param clazz the class whose classloader should be set * as the context classloader * @return the switch context */ public SwitchContext getSwitchContext(final Class clazz) { return new SwitchContext(clazz.getClassLoader()); }
/** * {@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(); } } }
@Override protected void setStateInternal(InputStream is) throws IOException, ClassNotFoundException { ClassLoader cl = getStateTransferClassLoader(); SwitchContext switchContext = CoreGroupCommunicationService.this.classLoaderSwitcher.getSwitchContext(cl); try { MarshalledValueInputStream mvis = new MarshalledValueInputStream(is); this.state = (Serializable) mvis.readObject(); } finally { switchContext.reset(); } }
/** * Retrieve a switch context * * @return the switch context */ public SwitchContext getSwitchContext() { return new SwitchContext(); }
private SwitchContext(ClassLoader cl) { this(); setClassLoader(cl); }
/** * Retrieve a switch context and set the new context classloader * * @param cl the new classloader * @return the switch context */ public SwitchContext getSwitchContext(final ClassLoader cl) { return new SwitchContext(cl); }