More bugfixes
Former-commit-id: 4d29b4d813ee2e9dba063afeb081742e9537125a
This commit is contained in:
parent
fa9223c653
commit
61c88ed4ca
6 changed files with 14 additions and 12 deletions
|
|
@ -104,7 +104,7 @@ public class PCDataSynchronizationClient implements HalDaemon {
|
|||
|
||||
} catch (NoRouteToHostException|UnknownHostException|ConnectException e) {
|
||||
logger.warning("Unable to connect to "+ user.getHostname()+":"+user.getPort() +", "+ e.getMessage());
|
||||
} catch (ClassNotFoundException|IOException e) {
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.SEVERE, null, e);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ public class PCDataSynchronizationDaemon extends ThreadedTCPNetworkServer implem
|
|||
in.close();
|
||||
s.close();
|
||||
|
||||
} catch (ClassNotFoundException|IOException|SQLException e) {
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.SEVERE, null, e);
|
||||
}
|
||||
logger.fine("User disconnected: "+ s.getInetAddress().getHostName());
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@ public class SensorDataAggregatorDaemon implements HalDaemon {
|
|||
}
|
||||
|
||||
public void aggregateSensor(Sensor sensor) {
|
||||
//if(sensor instanceof PowerConsumptionSensor){
|
||||
logger.fine("The sensor is of type: " + PowerConsumptionSensor.class.getSimpleName());
|
||||
//if(sensor.getSensorData() instanceof PowerConsumptionSensor){
|
||||
logger.fine("The sensor is of type: " + sensor.getSensorData().getClass().getName());
|
||||
logger.fine("aggregating raw data to five minute periods");
|
||||
aggregateRawData(sensor, TimeUtility.FIVE_MINUTES_IN_MS, 5);
|
||||
logger.fine("aggregating five minute periods into hour periods");
|
||||
|
|
@ -52,7 +52,7 @@ public class SensorDataAggregatorDaemon implements HalDaemon {
|
|||
logger.fine("aggregating one hour periods into one day periods");
|
||||
aggrigateAggregatedData(sensor, TimeUtility.HOUR_IN_MS, TimeUtility.DAY_IN_MS);
|
||||
//}else{
|
||||
// logger.fine("The sensor type is not supported by the aggregation daemon. Ignoring");
|
||||
// logger.fine("The sensor type("+ sensor.getSensorData().getClass().getName() +") is not supported by the aggregation daemon. Ignoring");
|
||||
//}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class SensorDataCleanupDaemon implements HalDaemon {
|
|||
|
||||
public void cleanupSensor(Sensor sensor) {
|
||||
//if(sensor instanceof PowerConsumptionSensor){
|
||||
logger.fine("The sensor is of type: " + PowerConsumptionSensor.class.getSimpleName());
|
||||
logger.fine("The sensor is of type: " + sensor.getSensorData().getClass().getName());
|
||||
if(sensor.getUser().isExternal()){
|
||||
cleanupExternalSensorData(sensor.getId(), TimeUtility.FIVE_MINUTES_IN_MS, TimeUtility.DAY_IN_MS);
|
||||
cleanupExternalSensorData(sensor.getId(), TimeUtility.DAY_IN_MS, TimeUtility.WEEK_IN_MS);
|
||||
|
|
@ -58,6 +58,7 @@ public class SensorDataCleanupDaemon implements HalDaemon {
|
|||
|
||||
/**
|
||||
* Will clear periods only if it has been aggregated and are too old.
|
||||
*
|
||||
* @param sensorId
|
||||
* @Param referencePeriodlength Will only clear periods older than the newest period of this length.
|
||||
* @Param clearPeriodlength Will clear periods with this length
|
||||
|
|
@ -94,6 +95,7 @@ public class SensorDataCleanupDaemon implements HalDaemon {
|
|||
|
||||
/**
|
||||
* Will clear periods if they are too old.
|
||||
*
|
||||
* @param sensorId
|
||||
* @Param clearPeriodlength Will clear periods with this length
|
||||
* @param olderThan Data must be older than this many ms to be cleared from the DB
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public class Event extends DBBean{
|
|||
updateConfig();
|
||||
}
|
||||
public HalEvent getEventData(){
|
||||
if(config !=null && eventData == null) {
|
||||
if(eventData == null) {
|
||||
try {
|
||||
Class c = Class.forName(type);
|
||||
eventData = (HalEvent) c.newInstance();
|
||||
|
|
@ -101,7 +101,7 @@ public class Event extends DBBean{
|
|||
return config;
|
||||
}
|
||||
public void setConfig(String config) {
|
||||
if( ! this.config.equals(config)) {
|
||||
if(this.config == null || !this.config.equals(config)) {
|
||||
this.config = config;
|
||||
this.eventData = null; // invalidate current sensor data object
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ public class Sensor extends DBBean{
|
|||
return config;
|
||||
}
|
||||
public void setConfig(String config) {
|
||||
if( ! this.config.equals(config)) {
|
||||
if(this.config == null || !this.config.equals(config)) {
|
||||
this.config = config;
|
||||
this.sensorData = null; // invalidate current sensor data object
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue