Examples of DistributableSessionMetadata


Examples of org.jboss.as.clustering.web.DistributableSessionMetadata

                case TIMESTAMP: {
                    this.test(entry, new Long(1), new Object());
                    break;
                }
                case METADATA: {
                    this.test(entry, new DistributableSessionMetadata(), new Object());
                    break;
                }
                case ATTRIBUTES: {
                    this.test(entry, new Object(), null);
                    break;
View Full Code Here

Examples of org.jboss.as.clustering.web.DistributableSessionMetadata

        CacheInvoker.Operation<String, Map<Object, Object>, Void> operation = capturedOperation.getValue();

        int version = 10;
        long timestamp = System.currentTimeMillis();
        DistributableSessionMetadata metadata = new DistributableSessionMetadata();

//        when(this.sessionCache.startBatch()).thenReturn(true);
        when(data.getVersion()).thenReturn(version);
        when(map.put(Byte.valueOf((byte) SessionMapEntry.VERSION.ordinal()), version)).thenReturn(null);
        when(data.getTimestamp()).thenReturn(timestamp);
View Full Code Here

Examples of org.jboss.as.clustering.web.DistributableSessionMetadata

        Map<Object, Object> map = mock(Map.class);
        Map<String, Object> attributes = Collections.emptyMap();
        Integer version = Integer.valueOf(10);
        Long timestamp = Long.valueOf(System.currentTimeMillis());
        DistributableSessionMetadata metadata = new DistributableSessionMetadata();
        CacheInvoker.Operation<String, Map<Object, Object>, IncomingDistributableSessionData> operation = capturedOperation.getValue();

        when(this.cache.get(sessionId)).thenReturn(map);
        when(map.get(Byte.valueOf((byte) SessionMapEntry.VERSION.ordinal()))).thenReturn(version);
        when(map.get(Byte.valueOf((byte) SessionMapEntry.TIMESTAMP.ordinal()))).thenReturn(timestamp);
View Full Code Here

Examples of org.jboss.as.clustering.web.DistributableSessionMetadata

        @SuppressWarnings("unchecked")
        Map<Object, Object> map = mock(Map.class);

        Integer version = Integer.valueOf(10);
        Long timestamp = Long.valueOf(System.currentTimeMillis());
        DistributableSessionMetadata metadata = new DistributableSessionMetadata();

        when(event.isPre()).thenReturn(false);
        when(event.isOriginLocal()).thenReturn(false);
        when(event.getCache()).thenReturn(this.cache);
        when(this.cache.getAdvancedCache()).thenReturn(this.cache);
View Full Code Here

Examples of org.jboss.as.clustering.web.DistributableSessionMetadata

            for (Map.Entry<String, String> entry : sessions.entrySet()) {
                String realId = entry.getKey();
                String owner = entry.getValue();

                long ts = -1;
                DistributableSessionMetadata md = null;
                try {
                    IncomingDistributableSessionData sessionData = this.distributedCacheManager.getSessionData(realId, owner, false);
                    if (sessionData == null) {
                        log.debugf("Metadata unavailable for unloaded session %s", realId);
                        continue;
                    }
                    ts = sessionData.getTimestamp();
                    md = sessionData.getMetadata();
                } catch (Exception e) {
                    // most likely a lock conflict if the session is being updated remotely;
                    // ignore it and use default values for timestamp and maxInactive
                    log.debug("Problem reading metadata for session " + realId + " -- " + e.toString(), e);
                }

                long lastMod = ts == -1 ? System.currentTimeMillis() : ts;
                int maxLife = md == null ? getMaxInactiveInterval() : md.getMaxInactiveInterval();

                OwnedSessionUpdate osu = new OwnedSessionUpdate(owner, lastMod, maxLife, false);
                unloadedSessions.put(realId, osu);
            }
View Full Code Here

Examples of org.jboss.as.clustering.web.DistributableSessionMetadata

        long ts = sessionData.getTimestamp();
        this.lastAccessedTime = this.thisAccessedTime = ts;
        this.timestamp.set(ts);

        DistributableSessionMetadata md = sessionData.getMetadata();
        // TODO -- get rid of these field and delegate to metadata
        this.id = md.getId();
        this.creationTime = md.getCreationTime();
        this.maxInactiveInterval = md.getMaxInactiveInterval();
        this.isNew = md.isNew();
        this.isValid = md.isValid();
        this.metadata = md;

        // Get our id without any jvmRoute appended
        parseRealId(id);
View Full Code Here

Examples of org.jboss.as.clustering.web.DistributableSessionMetadata

                // If requested session is no longer in the cache; return null
                if (map == null) return null;

                Integer version = SessionMapEntry.VERSION.get(map);
                Long timestamp = SessionMapEntry.TIMESTAMP.get(map);
                DistributableSessionMetadata metadata = SessionMapEntry.METADATA.get(map);
                IncomingDistributableSessionDataImpl result = new IncomingDistributableSessionDataImpl(version, timestamp, metadata);

                if (includeAttributes) {
                    try {
                        result.setSessionAttributes(DistributedCacheManager.this.attributeStorage.load(map));
View Full Code Here

Examples of org.jboss.as.clustering.web.DistributableSessionMetadata

        try {
            Map<Object, Object> map = event.getValue();
            if (!map.isEmpty()) {
                Integer version = SessionMapEntry.VERSION.get(map);
                Long timestamp = SessionMapEntry.TIMESTAMP.get(map);
                DistributableSessionMetadata metadata = SessionMapEntry.METADATA.get(map);

                if ((version != null) && (timestamp != null) && (metadata != null)) {
                    boolean updated = this.manager.sessionChangedInDistributedCache(sessionId, null, version.intValue(), timestamp.longValue(), metadata);

                    if (!updated) {
View Full Code Here

Examples of org.jboss.as.clustering.web.DistributableSessionMetadata

            for (Map.Entry<String, String> entry : sessions.entrySet()) {
                String realId = entry.getKey();
                String owner = entry.getValue();

                long ts = -1;
                DistributableSessionMetadata md = null;
                try {
                    IncomingDistributableSessionData sessionData = this.distributedCacheManager.getSessionData(realId, owner, false);
                    if (sessionData == null) {
                        log.debug("Metadata unavailable for unloaded session " + realId);
                        continue;
                    }
                    ts = sessionData.getTimestamp();
                    md = sessionData.getMetadata();
                } catch (Exception e) {
                    // most likely a lock conflict if the session is being updated remotely;
                    // ignore it and use default values for timstamp and maxInactive
                    log.debug("Problem reading metadata for session " + realId + " -- " + e.toString(), e);
                }

                long lastMod = ts == -1 ? System.currentTimeMillis() : ts;
                int maxLife = md == null ? getMaxInactiveInterval() : md.getMaxInactiveInterval();

                OwnedSessionUpdate osu = new OwnedSessionUpdate(owner, lastMod, maxLife, false);
                unloadedSessions.put(realId, osu);
            }
View Full Code Here

Examples of org.jboss.as.clustering.web.DistributableSessionMetadata

        long ts = sessionData.getTimestamp();
        this.lastAccessedTime = this.thisAccessedTime = ts;
        this.timestamp.set(ts);

        DistributableSessionMetadata md = sessionData.getMetadata();
        // TODO -- get rid of these field and delegate to metadata
        this.id = md.getId();
        this.creationTime = md.getCreationTime();
        this.maxInactiveInterval = md.getMaxInactiveInterval();
        this.isNew = md.isNew();
        this.isValid = md.isValid();
        this.metadata = md;

        // Get our id without any jvmRoute appended
        parseRealId(id);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.