"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "clustering/web/hotrod/src/main/java/org/wildfly/clustering/web/hotrod/session/HotRodSessionManager.java" between
wildfly-21.0.0.Final-src.zip and wildfly-21.0.1.Final-src.zip

About: WildFly is an application server with a standards-compliant, fast and lightweight implementation of the Java Enterprise Edition 7 Platform specifications (formerly known as JBoss community version). Sources.

HotRodSessionManager.java  (wildfly-21.0.0.Final-src):HotRodSessionManager.java  (wildfly-21.0.1.Final-src)
skipping to change at line 28 skipping to change at line 28
* License along with this software; if not, write to the Free * License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/ */
package org.wildfly.clustering.web.hotrod.session; package org.wildfly.clustering.web.hotrod.session;
import java.time.Duration; import java.time.Duration;
import java.util.Collections; import java.util.Collections;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.function.Consumer;
import org.wildfly.clustering.Registrar; import org.wildfly.clustering.Registrar;
import org.wildfly.clustering.Registration; import org.wildfly.clustering.Registration;
import org.wildfly.clustering.ee.Batcher; import org.wildfly.clustering.ee.Batcher;
import org.wildfly.clustering.ee.Scheduler; import org.wildfly.clustering.ee.Scheduler;
import org.wildfly.clustering.ee.cache.tx.TransactionBatch; import org.wildfly.clustering.ee.cache.tx.TransactionBatch;
import org.wildfly.clustering.web.IdentifierFactory; import org.wildfly.clustering.web.IdentifierFactory;
import org.wildfly.clustering.web.cache.session.SessionFactory; import org.wildfly.clustering.web.cache.session.SessionFactory;
import org.wildfly.clustering.web.cache.session.SimpleImmutableSession; import org.wildfly.clustering.web.cache.session.SimpleImmutableSession;
import org.wildfly.clustering.web.cache.session.ValidSession; import org.wildfly.clustering.web.cache.session.ValidSession;
skipping to change at line 62 skipping to change at line 63
*/ */
public class HotRodSessionManager<SC, MV, AV, LC> implements SessionManager<LC, TransactionBatch> { public class HotRodSessionManager<SC, MV, AV, LC> implements SessionManager<LC, TransactionBatch> {
private final Registrar<SessionExpirationListener> expirationRegistrar; private final Registrar<SessionExpirationListener> expirationRegistrar;
private final SessionExpirationListener expirationListener; private final SessionExpirationListener expirationListener;
private final Scheduler<String, ImmutableSessionMetaData> expirationSchedule r; private final Scheduler<String, ImmutableSessionMetaData> expirationSchedule r;
private final SessionFactory<SC, MV, AV, LC> factory; private final SessionFactory<SC, MV, AV, LC> factory;
private final IdentifierFactory<String> identifierFactory; private final IdentifierFactory<String> identifierFactory;
private final SC context; private final SC context;
private final Batcher<TransactionBatch> batcher; private final Batcher<TransactionBatch> batcher;
private final Duration stopTimeout; private final Duration stopTimeout;
private final Consumer<ImmutableSession> closeTask;
private volatile Duration defaultMaxInactiveInterval = Duration.ofMinutes(30 L); private volatile Duration defaultMaxInactiveInterval = Duration.ofMinutes(30 L);
private volatile Registration expirationRegistration; private volatile Registration expirationRegistration;
public HotRodSessionManager(SessionFactory<SC, MV, AV, LC> factory, HotRodSe ssionManagerConfiguration<SC> configuration) { public HotRodSessionManager(SessionFactory<SC, MV, AV, LC> factory, HotRodSe ssionManagerConfiguration<SC> configuration) {
this.factory = factory; this.factory = factory;
this.expirationRegistrar = configuration.getExpirationRegistrar(); this.expirationRegistrar = configuration.getExpirationRegistrar();
this.expirationListener = configuration.getExpirationListener(); this.expirationListener = configuration.getExpirationListener();
this.expirationScheduler = configuration.getExpirationScheduler(); this.expirationScheduler = configuration.getExpirationScheduler();
this.context = configuration.getServletContext(); this.context = configuration.getServletContext();
this.identifierFactory = configuration.getIdentifierFactory(); this.identifierFactory = configuration.getIdentifierFactory();
this.batcher = configuration.getBatcher(); this.batcher = configuration.getBatcher();
this.stopTimeout = configuration.getStopTimeout(); this.stopTimeout = configuration.getStopTimeout();
this.closeTask = new Consumer<ImmutableSession>() {
@Override
public void accept(ImmutableSession session) {
if (session.isValid()) {
configuration.getExpirationScheduler().schedule(session.getI
d(), session.getMetaData());
}
}
};
} }
@Override @Override
public void start() { public void start() {
this.expirationRegistration = this.expirationRegistrar.register(this.exp irationListener); this.expirationRegistration = this.expirationRegistrar.register(this.exp irationListener);
} }
@Override @Override
public void stop() { public void stop() {
this.expirationRegistration.close(); this.expirationRegistration.close();
skipping to change at line 127 skipping to change at line 137
return null; return null;
} }
ImmutableSession session = this.factory.createImmutableSession(id, entry ); ImmutableSession session = this.factory.createImmutableSession(id, entry );
if (session.getMetaData().isExpired()) { if (session.getMetaData().isExpired()) {
Logger.ROOT_LOGGER.tracef("Session %s was found, but has expired", i d); Logger.ROOT_LOGGER.tracef("Session %s was found, but has expired", i d);
this.expirationListener.sessionExpired(session); this.expirationListener.sessionExpired(session);
this.factory.remove(id); this.factory.remove(id);
return null; return null;
} }
this.expirationScheduler.cancel(id); this.expirationScheduler.cancel(id);
return new ValidSession<>(this.factory.createSession(id, entry, this.con text), this.expirationScheduler); return new ValidSession<>(this.factory.createSession(id, entry, this.con text), this.closeTask);
} }
@Override @Override
public Session<LC> createSession(String id) { public Session<LC> createSession(String id) {
Map.Entry<MV, AV> entry = this.factory.createValue(id, null); Map.Entry<MV, AV> entry = this.factory.createValue(id, null);
if (entry == null) return null; if (entry == null) return null;
Session<LC> session = this.factory.createSession(id, entry, this.context ); Session<LC> session = this.factory.createSession(id, entry, this.context );
session.getMetaData().setMaxInactiveInterval(this.defaultMaxInactiveInte rval); session.getMetaData().setMaxInactiveInterval(this.defaultMaxInactiveInte rval);
return new ValidSession<>(session, this.expirationScheduler); return new ValidSession<>(session, this.closeTask);
} }
@Override @Override
public ImmutableSession viewSession(String id) { public ImmutableSession viewSession(String id) {
Map.Entry<MV, AV> entry = this.factory.findValue(id); Map.Entry<MV, AV> entry = this.factory.findValue(id);
return (entry != null) ? new SimpleImmutableSession(this.factory.createI mmutableSession(id, entry)) : null; return (entry != null) ? new SimpleImmutableSession(this.factory.createI mmutableSession(id, entry)) : null;
} }
@Override @Override
public Set<String> getActiveSessions() { public Set<String> getActiveSessions() {
 End of changes. 5 change blocks. 
2 lines changed or deleted 13 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)