@Test public void testAFewLines() { accessLogSampler.log(createLogEntry(200, "/search/foo")); accessLogSampler.log(createLogEntry(500, "/search/bar")); accessLogSampler.log(createLogEntry(500, "bar")); accessLogSampler.log(createLogEntry(200, "/search/what")); assertThat(uris, contains("/search/foo", "/search/what")); }
@Override public void log(AccessLogEntry accessLogEntry) { if (accessLogEntry.getStatusCode() != 200) { return; } String uriString = accessLogEntry.getRawPath(); if (! uriString.startsWith("/search")) { return; } final long count = accessLineCounter.incrementAndGet(); if (count >= CircularArrayAccessLogKeeper.SIZE && count % CircularArrayAccessLogKeeper.SIZE != 0) { return; } circularArrayAccessLogKeeper.addUri(uriString); }
AccessLogSampler implements AccessLogInterface { @Override public void log(AccessLogEntry accessLogEntry) { if (accessLogEntry.getStatusCode() != 200) { return; } String uriString = accessLogEntry.getRawPath(); if (! uriString.startsWith("/search")) { return; } final long count = accessLineCounter.incrementAndGet(); if (count >= CircularArrayAccessLogKeeper.SIZE && count % CircularArrayAccessLogKeeper.SIZE != 0) { return; } circularArrayAccessLogKeeper.addUri(uriString); } }
AccessLogSampler implements AccessLogInterface { @Override public void log(AccessLogEntry accessLogEntry) { if (accessLogEntry.getStatusCode() != 200) { return; } String uriString = accessLogEntry.getRawPath(); if (! uriString.startsWith("/search")) { return; } final long count = accessLineCounter.incrementAndGet(); if (count >= CircularArrayAccessLogKeeper.SIZE && count % CircularArrayAccessLogKeeper.SIZE != 0) { return; } circularArrayAccessLogKeeper.addUri(uriString); } AccessLogSampler(CircularArrayAccessLogKeeper circularArrayAccessLogKeeper); }
AccessLogSampler implements AccessLogInterface { @Override public void log(AccessLogEntry accessLogEntry) { if (accessLogEntry.getStatusCode() != 200) { return; } String uriString = accessLogEntry.getRawPath(); if (! uriString.startsWith("/search")) { return; } final long count = accessLineCounter.incrementAndGet(); if (count >= CircularArrayAccessLogKeeper.SIZE && count % CircularArrayAccessLogKeeper.SIZE != 0) { return; } circularArrayAccessLogKeeper.addUri(uriString); } AccessLogSampler(CircularArrayAccessLogKeeper circularArrayAccessLogKeeper); @Override void log(AccessLogEntry accessLogEntry); }
AccessLogSampler implements AccessLogInterface { @Override public void log(AccessLogEntry accessLogEntry) { if (accessLogEntry.getStatusCode() != 200) { return; } String uriString = accessLogEntry.getRawPath(); if (! uriString.startsWith("/search")) { return; } final long count = accessLineCounter.incrementAndGet(); if (count >= CircularArrayAccessLogKeeper.SIZE && count % CircularArrayAccessLogKeeper.SIZE != 0) { return; } circularArrayAccessLogKeeper.addUri(uriString); } AccessLogSampler(CircularArrayAccessLogKeeper circularArrayAccessLogKeeper); @Override void log(AccessLogEntry accessLogEntry);  }