@@ -162,15 +162,23 @@ static enum LockStatus {
162162 * {@link JavaSerializationTranscoderFactory}.
163163 */
164164 private String _transcoderFactoryClassName = JavaSerializationTranscoderFactory .class .getName ();
165-
165+
166166 /**
167167 * The class name of the factory for
168- * {@link net.spy.memcached.transcoders.Transcoder }s. Default class name is
169- * {@link JavaSerializationTranscoderFactory }.
168+ * {@link de.javakaffee.web.msm.ObjectIOFactory }s. Default class name is
169+ * {@link de.javakaffee.web.msm.DefaultObjectIOFactory }.
170170 */
171171 private String _objectIOFactoryClassName = DefaultObjectIOFactory .class .getName ();
172172
173- /**
173+ public String getObjectIOFactoryClassName () {
174+ return _objectIOFactoryClassName ;
175+ }
176+
177+ public void setObjectIOFactoryClassName (final String objectIOFactoryClassName ) {
178+ this ._objectIOFactoryClassName = objectIOFactoryClassName ;
179+ }
180+
181+ /**
174182 * Specifies, if iterating over collection elements shall be done on a copy
175183 * of the collection or on the collection itself.
176184 * <p>
@@ -305,8 +313,10 @@ public static interface SessionManager extends Manager {
305313 String getString (final String key , final Object ... args );
306314
307315 boolean isMaxInactiveIntervalSet ();
308- int getMaxInactiveInterval ();
309- void setMaxInactiveInterval (int interval );
316+ @ Override
317+ int getMaxInactiveInterval ();
318+ @ Override
319+ void setMaxInactiveInterval (int interval );
310320
311321 int getMaxActiveSessions ();
312322 void incrementSessionCounter ();
@@ -427,11 +437,12 @@ public void shutdown() {
427437 * @param storage the storage client to use, for normal operations this should be <code>null</code>.
428438 */
429439 void startInternal ( final StorageClient storage ) throws LifecycleException {
430- if (storage == null )
431- _storage = null ;
432- else
433- _storage = storage ;
434-
440+ if (storage == null ) {
441+ _storage = null ;
442+ } else {
443+ _storage = storage ;
444+ }
445+
435446 startInternal ();
436447 }
437448
@@ -506,7 +517,7 @@ protected MemcachedNodesManager createMemcachedNodesManager(final String memcach
506517 }
507518
508519 private TranscoderService createTranscoderService ( final Statistics statistics ) {
509- return new TranscoderService ( getTranscoderFactory ().createTranscoder ( _manager ), getObjectIOFactory ().createObjectIOStrategy () );
520+ return new TranscoderService ( getTranscoderFactory ().createTranscoder ( _manager ), getObjectIOFactory ().createObjectIOStrategy ( _manager ) );
510521 }
511522
512523 protected TranscoderFactory getTranscoderFactory () {
@@ -519,7 +530,7 @@ protected TranscoderFactory getTranscoderFactory() {
519530 }
520531 return _transcoderFactory ;
521532 }
522-
533+
523534 protected ObjectIOFactory getObjectIOFactory () {
524535 if ( _objectIOFactory == null ) {
525536 try {
@@ -553,7 +564,7 @@ private TranscoderFactory createTranscoderFactory() throws InstantiationExceptio
553564 }
554565 return transcoderFactory ;
555566 }
556-
567+
557568 private ObjectIOFactory createObjectIOFactory () throws InstantiationException , IllegalAccessException , ClassNotFoundException {
558569 _log .info ( "Creating objectIO factory " + _objectIOFactoryClassName );
559570 final Class <? extends ObjectIOFactory > objectIOFactoryClass = loadFactoryClass (_objectIOFactoryClassName , _manager .getContainerClassLoader (), ObjectIOFactory .class );
@@ -562,7 +573,7 @@ private ObjectIOFactory createObjectIOFactory() throws InstantiationException, I
562573 }
563574
564575
565- private <T > Class <? extends T > loadFactoryClass (String className , ClassLoader classLoader , Class <T > factoryInterface ) throws ClassNotFoundException {
576+ private <T > Class <? extends T > loadFactoryClass (final String className , final ClassLoader classLoader , final Class <T > factoryInterface ) throws ClassNotFoundException {
566577 Class <? extends T > factoryClass ;
567578 try {
568579 _log .debug ( "Loading transcoder factory class " + className + " using classloader " + classLoader );
@@ -751,7 +762,7 @@ public MemcachedBackupSession createSession( String sessionId ) {
751762 if ( _log .isDebugEnabled () ) {
752763 _log .debug ( "Remove session id " + session .getId () + " from _invalidSessionsCache, marking new session valid" );
753764 }
754- _invalidSessionsCache .remove (session .getId ());
765+ _invalidSessionsCache .remove (session .getId ());
755766 }
756767 return session ;
757768
@@ -998,15 +1009,17 @@ private MemcachedBackupSession loadBackupSession(final String requestedSessionId
9981009 try {
9991010 final SessionValidityInfo validityInfo = _lockingStrategy .loadBackupSessionValidityInfo ( requestedSessionId );
10001011 if ( validityInfo == null || !validityInfo .isValid () ) {
1001- if (_log .isDebugEnabled ())
1002- _log .debug ( "No validity info (or no valid one) found for sessionId " + requestedSessionId );
1012+ if (_log .isDebugEnabled ()) {
1013+ _log .debug ( "No validity info (or no valid one) found for sessionId " + requestedSessionId );
1014+ }
10031015 return null ;
10041016 }
10051017
10061018 final byte [] obj = _storage .get ( getSessionIdFormat ().createBackupKey ( requestedSessionId ) );
10071019 if ( obj == null ) {
1008- if (_log .isDebugEnabled ())
1009- _log .debug ( "No backup found for sessionId " + requestedSessionId );
1020+ if (_log .isDebugEnabled ()) {
1021+ _log .debug ( "No backup found for sessionId " + requestedSessionId );
1022+ }
10101023 return null ;
10111024 }
10121025
@@ -1036,14 +1049,16 @@ public void requestFinished(final String sessionId, final String requestId) {
10361049 if (!_sticky ) {
10371050 final MemcachedBackupSession msmSession = _manager .getSessionInternal ( sessionId );
10381051 if ( msmSession == null ) {
1039- if (_log .isDebugEnabled ())
1040- _log .debug ( "No session found in session map for " + sessionId );
1052+ if (_log .isDebugEnabled ()) {
1053+ _log .debug ( "No session found in session map for " + sessionId );
1054+ }
10411055 return ;
10421056 }
10431057
10441058 if ( !msmSession .isValidInternal () ) {
1045- if (_log .isDebugEnabled ())
1046- _log .debug ( "Non valid session found in session map for " + sessionId );
1059+ if (_log .isDebugEnabled ()) {
1060+ _log .debug ( "Non valid session found in session map for " + sessionId );
1061+ }
10471062 return ;
10481063 }
10491064
@@ -1052,8 +1067,9 @@ public void requestFinished(final String sessionId, final String requestId) {
10521067 // we must not remove it as this would case session data loss
10531068 // for the other request
10541069 if ( msmSession .releaseReference () > 0 ) {
1055- if (_log .isDebugEnabled ())
1056- _log .debug ( "Session " + sessionId + " is still used by another request, skipping backup and (optional) lock handling/release." );
1070+ if (_log .isDebugEnabled ()) {
1071+ _log .debug ( "Session " + sessionId + " is still used by another request, skipping backup and (optional) lock handling/release." );
1072+ }
10571073 return ;
10581074 }
10591075 msmSession .passivate ();
@@ -1090,8 +1106,9 @@ public Future<BackupResult> backupSession( final String sessionId, final boolean
10901106
10911107 final MemcachedBackupSession msmSession = _manager .getSessionInternal ( sessionId );
10921108 if ( msmSession == null ) {
1093- if (_log .isDebugEnabled ())
1094- _log .debug ( "No session found in session map for " + sessionId );
1109+ if (_log .isDebugEnabled ()) {
1110+ _log .debug ( "No session found in session map for " + sessionId );
1111+ }
10951112 if ( !_sticky ) {
10961113 // Issue 116/137: Only notify the lockingStrategy if the session was loaded and has not been removed/invalidated
10971114 if (!_invalidSessionsCache .containsKey (sessionId )) {
@@ -1102,8 +1119,9 @@ public Future<BackupResult> backupSession( final String sessionId, final boolean
11021119 }
11031120
11041121 if ( !msmSession .isValidInternal () ) {
1105- if (_log .isDebugEnabled ())
1106- _log .debug ( "Non valid session found in session map for " + sessionId );
1122+ if (_log .isDebugEnabled ()) {
1123+ _log .debug ( "Non valid session found in session map for " + sessionId );
1124+ }
11071125 return new SimpleFuture <BackupResult >( BackupResult .SKIPPED );
11081126 }
11091127
@@ -1113,16 +1131,17 @@ public Future<BackupResult> backupSession( final String sessionId, final boolean
11131131 // we must not remove it as this would case session data loss
11141132 // for the other request
11151133 if ( msmSession .releaseReference () > 0 ) {
1116- if (_log .isDebugEnabled ())
1117- _log .debug ( "Session " + sessionId + " is still used by another request, skipping backup and (optional) lock handling/release." );
1134+ if (_log .isDebugEnabled ()) {
1135+ _log .debug ( "Session " + sessionId + " is still used by another request, skipping backup and (optional) lock handling/release." );
1136+ }
11181137 return new SimpleFuture <BackupResult >( BackupResult .SKIPPED );
11191138 }
11201139 msmSession .passivate ();
11211140 _manager .removeInternal ( msmSession , false );
11221141 }
11231142 }
11241143
1125- final boolean force = sessionIdChanged || msmSession .isSessionIdChanged () || !_sticky && ( msmSession .getSecondsSinceLastBackup () >= msmSession .getMaxInactiveInterval () );
1144+ final boolean force = sessionIdChanged || msmSession .isSessionIdChanged () || !_sticky && msmSession .getSecondsSinceLastBackup () >= msmSession .getMaxInactiveInterval ();
11261145 final Future <BackupResult > result = _backupSessionService .backupSession ( msmSession , force );
11271146
11281147 if ( !_sticky ) {
@@ -1256,7 +1275,7 @@ public void setMemcachedNodes( final String memcachedNodes ) {
12561275 public String getMemcachedNodes () {
12571276 return _memcachedNodes ;
12581277 }
1259-
1278+
12601279 private MemcachedNodesManager reloadMemcachedConfig ( final String memcachedNodes , final String failoverNodes ) {
12611280
12621281 /* first create all dependent services
@@ -1666,7 +1685,7 @@ protected void updateExpirationInMemcached() {
16661685 public void setSessionBackupAsync ( final boolean sessionBackupAsync ) {
16671686 final boolean oldSessionBackupAsync = _sessionBackupAsync ;
16681687 _sessionBackupAsync = sessionBackupAsync ;
1669- if ( ( oldSessionBackupAsync != sessionBackupAsync ) && _manager .isInitialized () ) {
1688+ if ( oldSessionBackupAsync != sessionBackupAsync && _manager .isInitialized () ) {
16701689 _log .info ( "SessionBackupAsync was changed to " + sessionBackupAsync + ", creating new BackupSessionService with new configuration." );
16711690 _backupSessionService = new BackupSessionService ( _transcoderService , _sessionBackupAsync , _sessionBackupTimeout ,
16721691 _backupThreadCount , _storage , _memcachedNodesManager , _statistics );
0 commit comments