Bug fix and improved logging for Sync Client
Former-commit-id: 35e5f30d32f5b2e486ef9ffccf73e71426ddecd1
This commit is contained in:
parent
71da8fba9a
commit
8d3ac0d340
2 changed files with 3 additions and 1 deletions
|
|
@ -45,7 +45,7 @@ public class HalContext {
|
||||||
try {
|
try {
|
||||||
// Read conf
|
// Read conf
|
||||||
fileConf = new Properties(defaultFileConf);
|
fileConf = new Properties(defaultFileConf);
|
||||||
if (FileUtil.find(CONF_FILE).exists()) {
|
if (FileUtil.find(CONF_FILE) != null) {
|
||||||
FileReader in = new FileReader(CONF_FILE);
|
FileReader in = new FileReader(CONF_FILE);
|
||||||
fileConf.load(in);
|
fileConf.load(in);
|
||||||
in.close();
|
in.close();
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@ public class DataSynchronizationDaemon extends ThreadedTCPNetworkServer implemen
|
||||||
PreparedStatement stmt = HalContext.getDB().getPreparedStatement("SELECT * FROM sensor_data_aggr WHERE sensor_id == ? AND sequence_id > ?");
|
PreparedStatement stmt = HalContext.getDB().getPreparedStatement("SELECT * FROM sensor_data_aggr WHERE sensor_id == ? AND sequence_id > ?");
|
||||||
stmt.setLong(1, req.sensorId);
|
stmt.setLong(1, req.sensorId);
|
||||||
stmt.setLong(2, req.offsetSequenceId);
|
stmt.setLong(2, req.offsetSequenceId);
|
||||||
|
logger.fine("Client requesting: sensorId: "+req.sensorId+", offset: "+req.offsetSequenceId);
|
||||||
SensorDataListDTO list = DBConnection.exec(stmt, new SQLResultHandler<SensorDataListDTO>() {
|
SensorDataListDTO list = DBConnection.exec(stmt, new SQLResultHandler<SensorDataListDTO>() {
|
||||||
@Override
|
@Override
|
||||||
public SensorDataListDTO handleQueryResult(Statement stmt, ResultSet result) throws SQLException {
|
public SensorDataListDTO handleQueryResult(Statement stmt, ResultSet result) throws SQLException {
|
||||||
|
|
@ -88,6 +89,7 @@ public class DataSynchronizationDaemon extends ThreadedTCPNetworkServer implemen
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
logger.fine("Sending "+ list.size() +" sensor data items to client");
|
||||||
out.writeObject(list);
|
out.writeObject(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue