/**\r
* This is a singleton -- there is only one LogfileLoader object in the server\r
*/\r
- private static LogfileLoader p;\r
+ private static LogfileLoader logfileLoader;\r
\r
/**\r
* Get the singleton LogfileLoader object, and start it if it is not running.\r
* @return the LogfileLoader\r
*/\r
public static synchronized LogfileLoader getLoader() {\r
- if (p == null)\r
- p = new LogfileLoader();\r
- if (!p.isAlive())\r
- p.start();\r
- return p;\r
+ if (logfileLoader == null)\r
+ logfileLoader = new LogfileLoader();\r
+ if (!logfileLoader.isAlive())\r
+ logfileLoader.start();\r
+ return logfileLoader;\r
}\r
\r
/**\r
* The PreparedStatement which is loaded by a <i>Loadable</i>.\r
*/\r
- public static final String INSERT_SQL = "insert into LOG_RECORDS values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";\r
+ public static final String INSERT_SQL = "insert into LOG_RECORDS values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";\r
/**\r
* Each server can assign this many IDs\r
*/\r
}\r
} catch (Exception e) {\r
logger.warn("PROV0020: Caught exception in LogfileLoader: " + e);\r
- e.printStackTrace();\r
}\r
}\r
}\r
\r
- private boolean pruneRecords() {\r
+ boolean pruneRecords() {\r
boolean did1 = false;\r
long count = countRecords();\r
long threshold = DEFAULT_LOG_RETENTION;\r
}\r
} catch (SQLException e) {\r
System.err.println(e);\r
- e.printStackTrace();\r
+ logger.error(e);\r
} finally {\r
db.release(conn);\r
}\r
return did1;\r
}\r
\r
- private long countRecords() {\r
+ long countRecords() {\r
long count = 0;\r
Connection conn = null;\r
try {\r
}\r
} catch (SQLException e) {\r
System.err.println(e);\r
- e.printStackTrace();\r
+ logger.error(e);\r
} finally {\r
db.release(conn);\r
}\r
return count;\r
}\r
\r
- private Map<Long, Long> getHistogram() {\r
+ Map<Long, Long> getHistogram() {\r
Map<Long, Long> map = new HashMap<Long, Long>();\r
Connection conn = null;\r
try {\r
}\r
} catch (SQLException e) {\r
System.err.println(e);\r
- e.printStackTrace();\r
+ logger.error(e);\r
} finally {\r
db.release(conn);\r
}\r
logger.debug(String.format("initializeNextid, next ID is %d (%x)", nextid, nextid));\r
} catch (SQLException e) {\r
System.err.println(e);\r
- e.printStackTrace();\r
+ logger.error(e);\r
} finally {\r
db.release(conn);\r
}\r
}\r
\r
@SuppressWarnings("resource")\r
- private int[] process(File f) {\r
+ int[] process(File f) {\r
int ok = 0, total = 0;\r
try {\r
Connection conn = db.getConnection();\r
} catch (SQLException e) {\r
logger.warn("PROV8003 Invalid value in record: " + line);\r
logger.debug(e);\r
- e.printStackTrace();\r
} catch (NumberFormatException e) {\r
logger.warn("PROV8004 Invalid number in record: " + line);\r
logger.debug(e);\r
- e.printStackTrace();\r
} catch (ParseException e) {\r
logger.warn("PROV8005 Invalid date in record: " + line);\r
logger.debug(e);\r
- e.printStackTrace();\r
} catch (Exception e) {\r
logger.warn("PROV8006 Invalid pattern in record: " + line);\r
logger.debug(e);\r
- e.printStackTrace();\r
}\r
total++;\r
}\r
return new int[]{ok, total};\r
}\r
\r
- private Loadable[] buildRecords(String line) throws ParseException {\r
+ Loadable[] buildRecords(String line) throws ParseException {\r
String[] pp = line.split("\\|");\r
if (pp != null && pp.length >= 7) {\r
String rtype = pp[1].toUpperCase();\r