Search in sources :

Example 1 with DeltaSessionInterface

use of org.apache.geode.modules.session.catalina.DeltaSessionInterface in project geode by apache.

the class DeltaSessionAttributeEventBatch method apply.

public void apply(Cache cache) {
    Region<String, DeltaSessionInterface> region = getRegion(cache);
    DeltaSessionInterface session = region.get(this.key);
    if (session == null) {
        StringBuilder builder = new StringBuilder();
        builder.append("Session ").append(this.key).append(" was not found while attempting to apply ").append(this);
        cache.getLogger().warning(builder.toString());
    } else {
        session.applyAttributeEvents(region, this.eventQueue);
        if (cache.getLogger().fineEnabled()) {
            StringBuilder builder = new StringBuilder();
            builder.append("Applied ").append(this);
            cache.getLogger().fine(builder.toString());
        }
    }
}
Also used : DeltaSessionInterface(org.apache.geode.modules.session.catalina.DeltaSessionInterface)

Example 2 with DeltaSessionInterface

use of org.apache.geode.modules.session.catalina.DeltaSessionInterface in project geode by apache.

the class SessionExpirationCacheListener method afterDestroy.

public void afterDestroy(EntryEvent<String, HttpSession> event) {
    // A Session expired. If it was destroyed by GemFire expiration, process it.
    // If it was destroyed via Session.invalidate, ignore it since it has
    // already been processed.
    DeltaSessionInterface session = null;
    if (event.getOperation() == Operation.EXPIRE_DESTROY) {
        session = (DeltaSessionInterface) event.getOldValue();
    } else {
        /*
       * This comes into play when we're dealing with an empty client proxy. We need the actual
       * destroyed object to come back from the server so that any associated listeners can fire
       * correctly. Having the destroyed object come back as the callback arg depends on setting the
       * property gemfire.EXPIRE_SENDS_ENTRY_AS_CALLBACK.
       */
        Object callback = event.getCallbackArgument();
        if (callback != null && callback instanceof DeltaSessionInterface) {
            session = (DeltaSessionInterface) callback;
            ManagerBase m = ContextMapper.getContext(session.getContextName());
            if (m != null) {
                session.setOwner(m);
            }
        }
    }
    if (session != null) {
        session.processExpired();
    }
}
Also used : DeltaSessionInterface(org.apache.geode.modules.session.catalina.DeltaSessionInterface) ManagerBase(org.apache.catalina.session.ManagerBase)

Aggregations

DeltaSessionInterface (org.apache.geode.modules.session.catalina.DeltaSessionInterface)2 ManagerBase (org.apache.catalina.session.ManagerBase)1