Changeset 6713


Ignore:
Timestamp:
Feb 3, 2015, 11:35:58 AM (7 years ago)
Author:
Nicklas Nordborg
Message:

References #1914: Exception from DbCleaner?

Catch and log errors in DbCleaner to ensure that it continues to work after an error and there is a place to see the information.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.4-stable/src/core/net/sf/basedb/core/Application.java

    r6631 r6713  
    11521152      log.info("Cleaning database");
    11531153      // Stray any-to-any links
    1154       int numDeleted = AnyToAny.deleteStrayLinks(null);
    1155       log.info("Found " + numDeleted + " stray any-to-any links");
     1154      try
     1155      {
     1156        int numDeleted = AnyToAny.deleteStrayLinks(null);
     1157        log.info("Found " + numDeleted + " stray any-to-any links");
     1158      }
     1159      catch (RuntimeException ex)
     1160      {
     1161        log.error("Could not delete stray any-to-any links", ex);
     1162      }
    11561163     
    11571164      // Change history entries referencing deleted items
    1158       numDeleted = ChangeHistory.deleteStrayEntries(null);
    1159       log.info("Found " + numDeleted + " stray change history entries");
     1165      try
     1166      {
     1167        int numDeleted = ChangeHistory.deleteStrayEntries(null);
     1168        log.info("Found " + numDeleted + " stray change history entries");
     1169      }
     1170      catch (RuntimeException ex)
     1171      {
     1172        log.error("Could not delete stray change history entries", ex);
     1173      }
    11601174     
    11611175      // Empty annotation sets
    1162       numDeleted = AnnotationSet.deleteEmptyAnnotationSets(null);
    1163       log.info("Found " + numDeleted + " empty annotation sets");
     1176      try
     1177      {
     1178        int numDeleted = AnnotationSet.deleteEmptyAnnotationSets(null);
     1179        log.info("Found " + numDeleted + " empty annotation sets");
     1180      }
     1181      catch (RuntimeException ex)
     1182      {
     1183        log.error("Could not delete unused annotation sets", ex);
     1184      }
    11641185     
    11651186      // Item and project keys
    1166       numDeleted = ItemKey.deleteUnusedItemKeys();
    1167       log.info("Found " + numDeleted + " unused item keys");
    1168       numDeleted = ProjectKey.deleteUnusedProjectKeys();
    1169       log.info("Found " + numDeleted + " unused project keys");
     1187      try
     1188      {
     1189        int numDeleted = ItemKey.deleteUnusedItemKeys();
     1190        log.info("Found " + numDeleted + " unused item keys");
     1191      }
     1192      catch (RuntimeException ex)
     1193      {
     1194        log.error("Could not delete unused item keys", ex);
     1195      }
     1196     
     1197      try
     1198      {
     1199        int numDeleted = ProjectKey.deleteUnusedProjectKeys();
     1200        log.info("Found " + numDeleted + " unused project keys");
     1201      }
     1202      catch (RuntimeException ex)
     1203      {
     1204        log.error("Could not delete unused project keys", ex);
     1205      }
    11701206     
    11711207      log.info("Finished cleaning of database");
Note: See TracChangeset for help on using the changeset viewer.