use of org.bedework.sysevents.events.MillisecsEvent in project bw-calendar-engine by Bedework.
the class DataValues method update.
/**
* @param ev
*/
public void update(final SysEvent ev) {
SysCode sc = ev.getSysCode();
if (ev instanceof TimedEvent) {
TimedEvent te = (TimedEvent) ev;
String lbl = te.getLabel();
DataAvg dv = timedValuesMap.get(lbl);
if (dv == null) {
dv = new DataAvg(lbl, ev.getSysCode());
timedValuesMap.put(lbl, dv);
}
dv.inc(te.getMillis());
return;
}
if (ev instanceof MillisecsEvent) {
DataAvg dv = dvMap.get(sc);
if (dv != null) {
dv.inc(((MillisecsEvent) ev).getMillis());
}
return;
}
if (sc == SysCode.STATS) {
StatsEvent se = (StatsEvent) ev;
String sname = se.getName();
DataAvg da = statMap.get(sname);
if (da == null) {
da = new DataAvg(sname, sc);
statMap.put(sname, da);
}
StatType st = StatsEvent.getStatType(sname);
if (st != StatType.lnum) {
da.inc(1);
} else if (se.getLongValue() != null) {
da.inc(se.getLongValue());
}
return;
}
}
use of org.bedework.sysevents.events.MillisecsEvent in project bw-calendar-engine by Bedework.
the class JmsNotificationsHandlerImpl method post.
@Override
public void post(final SysEventBase ev) throws NotificationException {
if (debug) {
debug(ev.toString());
}
long start = System.currentTimeMillis();
send: {
if (ev instanceof MillisecsEvent) {
monitor.post(ev);
if ((ev instanceof TimedEvent) || (ev instanceof HttpEvent)) {
break send;
}
}
syslog.post(ev);
boolean changeEvent = false;
for (final Attribute attr : ev.getMessageAttributes()) {
if (!"changeEvent".equals(attr.name)) {
continue;
}
changeEvent = Boolean.valueOf(attr.value);
break;
}
if (changeEvent) {
changes.post(ev);
}
if (ev instanceof EntityQueuedEvent) {
final EntityQueuedEvent eqe = (EntityQueuedEvent) ev;
if (((EntityQueuedEvent) ev).getInBox()) {
scheduleIn.post(ev);
} else {
scheduleOut.post(ev);
break send;
}
}
if (ev instanceof ScheduleUpdateEvent) {
scheduleIn.post(ev);
}
}
// send
sends++;
sendTime += System.currentTimeMillis() - start;
if ((sends % 100) == 0) {
debug("Sends: " + sends + " avg: " + sendTime / sends);
}
}
Aggregations