use of com.sun.messaging.jmq.io.disk.VRFileWarning in project openmq by eclipse-ee4j.
the class FileTxLogImpl method init.
@Override
public void init(Properties props, boolean reset) throws Exception {
if (_logger == null) {
throw new IllegalStateException("No logger set");
}
super.init(props, reset);
if (props != null) {
Enumeration en = props.propertyNames();
String name = null;
String value = null;
while (en.hasMoreElements()) {
name = (String) en.nextElement();
value = props.getProperty(name);
_logger.log(Level.INFO, _jbr.getString(_jbr.I_FILETXNLOG_SET_PROP, name + "=" + value, _tmname));
setProperty(name, value);
}
}
if (_txlogdir == null) {
throw new IllegalStateException("Property txlogDir not set");
}
String fname = (txlogSuffix == null ? FILENAME_BASE : (FILENAME_BASE + "." + txlogSuffix));
if (reset) {
_logger.log(Level.INFO, _jbr.getString(_jbr.I_FILETXNLOG_INIT_WITH_RESET, fname));
if (_txlogdirParent != null) {
String fn = _txlogdirParent + File.separator + FILENAME_JMSBRIDGES;
File f = new File(fn);
if (f.exists()) {
if (!f.delete()) {
_logger.log(Level.WARNING, "Failed to delete file " + fn + " on reset");
File dfn = new File(_txlogdirParent, FILENAME_JMSBRIDGES + ".deleted");
if (!f.renameTo(dfn)) {
_logger.log(Level.WARNING, "Failed rename file " + fn + " to " + dfn + " after deletion failure");
}
}
}
}
} else {
_logger.log(Level.INFO, _jbr.getString(_jbr.I_FILETXNLOG_INIT, fname));
}
_backFile = new File(_txlogdir, fname);
if (useMmap) {
_gxidMap = new PHashMapMMF(_backFile, _logsize, 1024, false, reset, false, false);
((PHashMapMMF) _gxidMap).intClientData(_clientDataSize);
} else {
_gxidMap = new PHashMap(_backFile, _logsize, 1024, false, reset, false, false);
}
try {
_gxidMap.load(this);
if (_clientDataSize > 0) {
loadClientData();
}
} catch (PHashMapLoadException pe) {
_logger.log(Level.WARNING, "Exception in loading txlog " + _backFile, pe);
throw pe;
}
VRFileWarning w = _gxidMap.getWarning();
if (w != null) {
_logger.log(Level.WARNING, "Warning in loading txlog, possible loss of record", w);
}
_logger.log(Level.INFO, _jbr.getString(_jbr.I_FILETXNLOG_LOADED, _backFile, String.valueOf(_gxidMap.size())));
}
Aggregations