Skip to content

Commit 6a8a7b4

Browse files
authored
Fix Findbugs errors (#212)
`Findbugs` issues found during #210 - fix [errors](https://github.com/hazelcast/hazelcast-wm/actions/runs/18138331537/job/51622684517#step:8:395) using `volatile` - disabled Jenkins [WM-pr-builder](https://jenkins.hazelcast.com/job/WM-pr-builder/) as we have GH one. I checked and mirrored config. Tomasz thinks Josef might have started the migration but didn't have a chance to complete
1 parent 6b42f0f commit 6a8a7b4

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

.github/workflows/pr-builder.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: PR builder is just a magic
1+
name: PR builder
22

33
on:
44
pull_request_target:
@@ -42,7 +42,7 @@ jobs:
4242

4343
- name: Build
4444
run: |
45-
mvn clean install -DskipTests -B -U
45+
mvn clean install -DskipTests -B -P checkstyle -U
4646
4747
- name: Findbugs
4848
run: |

src/main/java/com/hazelcast/web/HazelcastHttpSession.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class HazelcastHttpSession implements HttpSession {
4747
private final boolean stickySession;
4848
private final boolean deferredWrite;
4949
// true when session is fetched from local cache
50-
private boolean keepRemoteActive = true;
50+
private volatile boolean keepRemoteActive = true;
5151
// only true if session is created first time in the cluster
5252
private volatile boolean clusterWideNew;
5353
private final Set<String> transientAttributes;
@@ -94,7 +94,7 @@ public void setAttribute(final String name, final Object value) {
9494
if (!deferredWrite && !transientEntry) {
9595
try {
9696
webFilter.getClusteredSessionService().setAttribute(id, name, value);
97-
keepRemoteActive = false;
97+
setKeepRemoteActive(false);
9898
entry.setDirty(false);
9999
} catch (HazelcastSerializationException e) {
100100
LOGGER.warning("Failed to serialize attribute [" + name + "]:" + e.getMessage(), e);
@@ -110,7 +110,7 @@ public Object getAttribute(final String name) {
110110
if (cacheEntry == null || cacheEntry.isReload()) {
111111
try {
112112
value = webFilter.getClusteredSessionService().getAttribute(id, name);
113-
keepRemoteActive = false;
113+
setKeepRemoteActive(false);
114114
cacheEntry = new LocalCacheEntry(transientAttributes.contains(name), value);
115115
cacheEntry.setReload(false);
116116
localCache.put(name, cacheEntry);
@@ -194,7 +194,7 @@ public void removeAttribute(final String name) {
194194
if (!deferredWrite) {
195195
try {
196196
webFilter.getClusteredSessionService().deleteAttribute(id, name);
197-
keepRemoteActive = false;
197+
setKeepRemoteActive(false);
198198
if (entry != null) {
199199
entry.setDirty(false);
200200
}
@@ -250,7 +250,7 @@ private void buildLocalCache() {
250250
Set<Map.Entry<String, Object>> entrySet = null;
251251
try {
252252
entrySet = webFilter.getClusteredSessionService().getAttributes(id);
253-
keepRemoteActive = false;
253+
setKeepRemoteActive(false);
254254
} catch (Exception e) {
255255
return;
256256
}
@@ -287,7 +287,7 @@ void sessionDeferredWrite() {
287287

288288
try {
289289
webFilter.getClusteredSessionService().updateAttributes(id, updates);
290-
keepRemoteActive = false;
290+
setKeepRemoteActive(false);
291291
} catch (HazelcastSerializationException e) {
292292
LOGGER.warning("Failed to serialize session with ID [" + id + "]:" + e.getMessage(), e);
293293
} catch (Exception e) {
@@ -302,7 +302,7 @@ private Set<String> selectKeys() {
302302
Set<String> attributeNames = null;
303303
try {
304304
attributeNames = webFilter.getClusteredSessionService().getAttributeNames(id);
305-
keepRemoteActive = false;
305+
setKeepRemoteActive(false);
306306
} catch (Exception ignored) {
307307
for (Map.Entry<String, LocalCacheEntry> entry : localCache.entrySet()) {
308308
if (!entry.getValue().isRemoved() && entry.getValue().getValue() != null) {
@@ -354,7 +354,7 @@ public void updateReloadFlag() {
354354
public void keepRemoteActive() {
355355
try {
356356
webFilter.getClusteredSessionService().getSessionAsync(id);
357-
keepRemoteActive = false;
357+
setKeepRemoteActive(false);
358358
} catch (Exception e) {
359359
LOGGER.warning("Failed to reset the idle-time on cluster for the session with ID [" + id + "]:"
360360
+ e.getMessage(), e);

src/main/java/com/hazelcast/web/LocalCacheEntry.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
public class LocalCacheEntry {
2525

2626
private volatile boolean reload;
27-
private boolean removed;
27+
private volatile boolean removed;
2828
private Object value;
2929
private volatile boolean dirty;
3030
private final boolean transientEntry;

0 commit comments

Comments
 (0)