Added a Java version of the MetricsFilter