});
healthStatEventReceiver.addEventListener(new MemberAverageLoadAverageEventListener() {
@Override
protected void onEvent(org.apache.stratos.messaging.event.Event event) {
MemberAverageLoadAverageEvent e = (MemberAverageLoadAverageEvent) event;
LoadAverage loadAverage = findLoadAverage(e.getMemberId());
if(loadAverage != null) {
Float floatValue = e.getValue();
loadAverage.setAverage(floatValue);
if (log.isDebugEnabled()) {
log.debug(String.format("Member avg of load avg event: [member] %s [value] %s", e.getMemberId()
, floatValue));
}
}
}
});
healthStatEventReceiver.addEventListener(new MemberAverageMemoryConsumptionEventListener() {
@Override
protected void onEvent(org.apache.stratos.messaging.event.Event event) {
MemberAverageMemoryConsumptionEvent e = (MemberAverageMemoryConsumptionEvent) event;
MemoryConsumption memoryConsumption = findMemoryConsumption(e.getMemberId());
if(memoryConsumption != null) {
Float floatValue = e.getValue();
memoryConsumption.setAverage(floatValue);
if (log.isDebugEnabled()) {
log.debug(String.format("Member avg Memory Consumption event: [member] %s [value] %s", e.getMemberId(),
floatValue));
}
}
}
});
healthStatEventReceiver.addEventListener(new MemberFaultEventListener() {
@Override
protected void onEvent(org.apache.stratos.messaging.event.Event event) {
MemberFaultEvent e = (MemberFaultEvent) event;
String clusterId = e.getClusterId();
String memberId = e.getMemberId();
if (memberId == null || memberId.isEmpty()) {
if(log.isErrorEnabled()) {
log.error("Member id not found in received message");
}
} else {
if (log.isDebugEnabled()) {
log.debug(String.format("Member fault event: [member] %s ", e.getMemberId()));
}
handleMemberFaultEvent(clusterId, memberId);
}
}
});
healthStatEventReceiver.addEventListener(new MemberGradientOfLoadAverageEventListener() {
@Override
protected void onEvent(org.apache.stratos.messaging.event.Event event) {
MemberGradientOfLoadAverageEvent e = (MemberGradientOfLoadAverageEvent) event;
LoadAverage loadAverage = findLoadAverage(e.getMemberId());
if(loadAverage != null) {
Float floatValue = e.getValue();
loadAverage.setGradient(floatValue);
if (log.isDebugEnabled()) {
log.debug(String.format("Member grad of load avg event: [member] %s [value] %s", e.getMemberId(),
floatValue));
}
}
}
});
healthStatEventReceiver.addEventListener(new MemberGradientOfMemoryConsumptionEventListener() {
@Override
protected void onEvent(org.apache.stratos.messaging.event.Event event) {
MemberGradientOfMemoryConsumptionEvent e = (MemberGradientOfMemoryConsumptionEvent) event;
MemoryConsumption memoryConsumption = findMemoryConsumption(e.getMemberId());
if(memoryConsumption != null) {
Float floatValue = e.getValue();
memoryConsumption.setGradient(floatValue);
if (log.isDebugEnabled()) {
log.debug(String.format("Member grad of Memory Consumption event: [member] %s [value] %s", e.getMemberId(),
floatValue));
}
}
}
});
healthStatEventReceiver.addEventListener(new MemberSecondDerivativeOfLoadAverageEventListener() {
@Override
protected void onEvent(org.apache.stratos.messaging.event.Event event) {
MemberSecondDerivativeOfLoadAverageEvent e = (MemberSecondDerivativeOfLoadAverageEvent) event;
LoadAverage loadAverage = findLoadAverage(e.getMemberId());
if(loadAverage != null) {
Float floatValue = e.getValue();
loadAverage.setSecondDerivative(floatValue);
if (log.isDebugEnabled()) {
log.debug(String.format("Member Second Derivation of load avg event: [member] %s [value] %s", e.getMemberId()
, floatValue));
}