From a667ff217dfa9755e66e8de9c221507518de59f1 Mon Sep 17 00:00:00 2001 From: John Blum Date: Thu, 1 Nov 2018 12:59:13 -0700 Subject: [PATCH] Format source code. --- ...actGemFireOperationsSessionRepository.java | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/spring-session-data-geode/src/main/java/org/springframework/session/data/gemfire/AbstractGemFireOperationsSessionRepository.java b/spring-session-data-geode/src/main/java/org/springframework/session/data/gemfire/AbstractGemFireOperationsSessionRepository.java index efb82dd..6d1f9b2 100644 --- a/spring-session-data-geode/src/main/java/org/springframework/session/data/gemfire/AbstractGemFireOperationsSessionRepository.java +++ b/spring-session-data-geode/src/main/java/org/springframework/session/data/gemfire/AbstractGemFireOperationsSessionRepository.java @@ -564,8 +564,8 @@ public abstract class AbstractGemFireOperationsSessionRepository extends CacheLi } @SuppressWarnings("unused") - public static class DeltaCapableGemFireSession extends GemFireSession - implements Delta { + public static class DeltaCapableGemFireSession + extends GemFireSession implements Delta { public DeltaCapableGemFireSession() { } @@ -615,6 +615,9 @@ public abstract class AbstractGemFireOperationsSessionRepository extends CacheLi protected static final String SPRING_SECURITY_CONTEXT = "SPRING_SECURITY_CONTEXT"; + private static final String GEMFIRE_SESSION_TO_STRING = + "{ @type = %1$s, id = %2$s, creationTime = %3$s, lastAccessedTime = %4$s, maxInactiveInterval = %5$s, principalName = %6$s }"; + private transient boolean delta = false; private Duration maxInactiveInterval = DEFAULT_MAX_INACTIVE_INTERVAL; @@ -844,10 +847,8 @@ public abstract class AbstractGemFireOperationsSessionRepository extends CacheLi @Override public synchronized String toString() { - return String.format("{ @type = %1$s, id = %2$s, creationTime = %3$s, lastAccessedTime = %4$s" - + ", maxInactiveInterval = %5$s, principalName = %6$s }", - getClass().getName(), getId(), getCreationTime(), getLastAccessedTime(), - getMaxInactiveInterval(), getPrincipalName()); + return String.format(GEMFIRE_SESSION_TO_STRING, getClass().getName(), getId(), + getCreationTime(), getLastAccessedTime(), getMaxInactiveInterval(), getPrincipalName()); } } @@ -927,6 +928,7 @@ public abstract class AbstractGemFireOperationsSessionRepository extends CacheLi synchronized (getLock()) { try { + int count = in.readInt(); Map deltas = new HashMap<>(count); @@ -983,7 +985,7 @@ public abstract class AbstractGemFireOperationsSessionRepository extends CacheLi } protected GemFireSessionAttributes(Object lock) { - this.lock = (lock != null ? lock : this); + this.lock = lock != null ? lock : this; } public static GemFireSessionAttributes create() { @@ -999,13 +1001,16 @@ public abstract class AbstractGemFireOperationsSessionRepository extends CacheLi } public Object setAttribute(String attributeName, Object attributeValue) { + synchronized (getLock()) { - return (attributeValue != null ? this.sessionAttributes.put(attributeName, attributeValue) - : removeAttribute(attributeName)); + return attributeValue != null + ? this.sessionAttributes.put(attributeName, attributeValue) + : removeAttribute(attributeName); } } public Object removeAttribute(String attributeName) { + synchronized (getLock()) { return this.sessionAttributes.remove(attributeName); } @@ -1013,12 +1018,14 @@ public abstract class AbstractGemFireOperationsSessionRepository extends CacheLi @SuppressWarnings("unchecked") public T getAttribute(String attributeName) { + synchronized (getLock()) { return (T) this.sessionAttributes.get(attributeName); } } public Set getAttributeNames() { + synchronized (getLock()) { return Collections.unmodifiableSet(new HashSet<>(this.sessionAttributes.keySet())); } @@ -1043,8 +1050,7 @@ public abstract class AbstractGemFireOperationsSessionRepository extends CacheLi }; } - public void clearDelta() { - } + public void clearDelta() { } public void from(Session session) {