projectwonder/wonder — pull request #327 by jbrook (2012-11-20 17:50:57+00:00)
Title: Allow a custom listener to be created for ERXStatisticsStore

When slow requests are detected it will now log on every request but skip printing the stack traces if that has already been done within the last 10 seconds. There is a new constructor that allows a custom listener to be created for EXRXStatisticsStore so that as well as its normal behaviour it's possible to add custom behaviour.

In our case we use the custom listener to notify an external system of slow requests so that we can graph their occurrences and automatically alert the operations team if we see any of them. E.g.:

```
ERXStatisticsStoreListener customStatsListener = new ERXStatisticsStoreListener() {

@Override
public void log(long requestTime, RequestDescription description) {
callForHelp(requestTime);
}

@Override
public void deadlock(int deadlocksCount) { /* DO NOTHING */ }

};

ERXStatisticsStore statisticsStore = new ERXStatisticsStore(customStatsListener);
```