1
1
/*
2
- * Copyright 2014-2016 the original author or authors.
2
+ * Copyright 2014-2018 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -518,27 +518,29 @@ public void onMessage(Message message, byte[] pattern) {
518
518
519
519
RedisSession session = getSession (sessionId , true );
520
520
521
+ if (session == null ) {
522
+ logger .warn ("Unable to publish SessionDestroyedEvent for session "
523
+ + sessionId );
524
+ }
525
+
521
526
if (logger .isDebugEnabled ()) {
522
527
logger .debug ("Publishing SessionDestroyedEvent for session " + sessionId );
523
528
}
524
529
525
530
cleanupPrincipalIndex (session );
526
531
527
532
if (isDeleted ) {
528
- handleDeleted (sessionId , session );
533
+ handleDeleted (session );
529
534
}
530
535
else {
531
- handleExpired (sessionId , session );
536
+ handleExpired (session );
532
537
}
533
538
534
539
return ;
535
540
}
536
541
}
537
542
538
543
private void cleanupPrincipalIndex (RedisSession session ) {
539
- if (session == null ) {
540
- return ;
541
- }
542
544
String sessionId = session .getId ();
543
545
String principal = PRINCIPAL_NAME_RESOLVER .resolvePrincipal (session );
544
546
if (principal != null ) {
@@ -553,22 +555,12 @@ public void handleCreated(Map<Object, Object> loaded, String channel) {
553
555
publishEvent (new SessionCreatedEvent (this , session ));
554
556
}
555
557
556
- private void handleDeleted (String sessionId , RedisSession session ) {
557
- if (session == null ) {
558
- publishEvent (new SessionDeletedEvent (this , sessionId ));
559
- }
560
- else {
561
- publishEvent (new SessionDeletedEvent (this , session ));
562
- }
558
+ private void handleDeleted (RedisSession session ) {
559
+ publishEvent (new SessionDeletedEvent (this , session ));
563
560
}
564
561
565
- private void handleExpired (String sessionId , RedisSession session ) {
566
- if (session == null ) {
567
- publishEvent (new SessionExpiredEvent (this , sessionId ));
568
- }
569
- else {
570
- publishEvent (new SessionExpiredEvent (this , session ));
571
- }
562
+ private void handleExpired (RedisSession session ) {
563
+ publishEvent (new SessionExpiredEvent (this , session ));
572
564
}
573
565
574
566
private void publishEvent (ApplicationEvent event ) {
0 commit comments