final long startBackup = System.currentTimeMillis();
final Map<String, Object> attributes = _session.getAttributesFiltered();
final byte[] attributesData = serializeAttributes( _session, attributes );
final int hashCode = Arrays.hashCode( attributesData );
final BackupResult result;
if ( _session.getDataHashCode() != hashCode
|| _force
|| _session.authenticationChanged() ) {
_session.setLastBackupTime( System.currentTimeMillis() );
final byte[] data = _transcoderService.serialize( _session, attributesData );
result = doBackupSession( _session, data, attributesData );
if ( result.isSuccess() ) {
_session.setDataHashCode( hashCode );
}
} else {
result = new BackupResult( BackupResultStatus.SKIPPED );
}
switch ( result.getStatus() ) {
case FAILURE:
_statistics.requestWithBackupFailure();
_session.backupFailed();
break;
case SKIPPED:
_statistics.requestWithoutSessionModification();
_session.storeThisAccessedTimeFromLastBackupCheck();
break;
case SUCCESS:
_statistics.registerSince( BACKUP, startBackup );
_session.storeThisAccessedTimeFromLastBackupCheck();
_session.backupFinished();
break;
}
if ( _log.isDebugEnabled() ) {
_log.debug( "Finished for session id " + _session.getId() +
", returning status " + result.getStatus() );
}
return result;
} finally {