1313 */
1414public class StandardSessionManager implements WxSessionManager , InternalSessionManager {
1515
16- protected static final StringManager sm =
17- StringManager .getManager (Constants .Package );
16+ protected static final StringManager SM = StringManager .getManager (Constants .PACKAGE );
1817 /**
1918 * The descriptive name of this Manager implementation (for logging).
2019 */
@@ -82,7 +81,7 @@ public WxSession getSession(String sessionId) {
8281 public WxSession getSession (String sessionId , boolean create ) {
8382 if (sessionId == null ) {
8483 throw new IllegalStateException
85- (sm .getString ("sessionManagerImpl.getSession.ise" ));
84+ (SM .getString ("sessionManagerImpl.getSession.ise" ));
8685 }
8786
8887 InternalSession session = findSession (sessionId );
@@ -124,25 +123,24 @@ public void remove(InternalSession session, boolean update) {
124123
125124 @ Override
126125 public InternalSession findSession (String id ) {
127-
128- if (id == null )
126+ if (id == null ) {
129127 return (null );
128+ }
130129 return this .sessions .get (id );
131-
132130 }
133131
134132 @ Override
135133 public InternalSession createSession (String sessionId ) {
136134 if (sessionId == null ) {
137135 throw new IllegalStateException
138- (sm .getString ("sessionManagerImpl.createSession.ise" ));
136+ (SM .getString ("sessionManagerImpl.createSession.ise" ));
139137 }
140138
141139 if ((this .maxActiveSessions >= 0 ) &&
142140 (getActiveSessions () >= this .maxActiveSessions )) {
143141 this .rejectedSessions ++;
144142 throw new TooManyActiveSessionsException (
145- sm .getString ("sessionManagerImpl.createSession.tmase" ),
143+ SM .getString ("sessionManagerImpl.createSession.tmase" ),
146144 this .maxActiveSessions );
147145 }
148146
@@ -230,8 +228,9 @@ public InternalSession[] findSessions() {
230228 @ Override
231229 public void backgroundProcess () {
232230 this .count = (this .count + 1 ) % this .processExpiresFrequency ;
233- if (this .count == 0 )
231+ if (this .count == 0 ) {
234232 processExpires ();
233+ }
235234 }
236235
237236 /**
@@ -243,16 +242,18 @@ public void processExpires() {
243242 InternalSession sessions [] = findSessions ();
244243 int expireHere = 0 ;
245244
246- if (this .log .isDebugEnabled ())
245+ if (this .log .isDebugEnabled ()) {
247246 this .log .debug ("Start expire sessions {} at {} sessioncount {}" , getName (), timeNow , sessions .length );
248- for (int i = 0 ; i < sessions .length ; i ++) {
249- if (sessions [i ] != null && !sessions [i ].isValid ()) {
247+ }
248+ for (InternalSession session : sessions ) {
249+ if (session != null && !session .isValid ()) {
250250 expireHere ++;
251251 }
252252 }
253253 long timeEnd = System .currentTimeMillis ();
254- if (this .log .isDebugEnabled ())
254+ if (this .log .isDebugEnabled ()) {
255255 this .log .debug ("End expire sessions {} processingTime {} expired sessions: {}" , getName (), timeEnd - timeNow , expireHere );
256+ }
256257 this .processingTime += (timeEnd - timeNow );
257258
258259 }
0 commit comments