Search in sources :

Example 1 with MutableHolder

use of org.spf4j.base.MutableHolder in project spf4j by zolyfarkas.

the class TSDBTailerTest method main.

public static void main(final String[] parameters) throws IOException {
    final MutableHolder<Integer> counter = new MutableHolder<>(0);
    TimeSeriesDatabase tsdb = new TimeSeriesDatabase(new File(parameters[0]));
    tsdb.tail(10, 0, new TSDataHandler() {

        private int count = 0;

        @Override
        public void newTable(final String tableName, final String[] columnNames) {
            LOG.info("New Table: {} columns: {}", tableName, columnNames);
        }

        @Override
        public void newData(final String tableName, final TimeSeries data) {
            LOG.debug("Table {} - {}", tableName, data);
            counter.setValue(counter.getValue() + data.getTimeStamps().length);
        }

        @Override
        public boolean finish() {
            return count++ > 400;
        }
    });
    System.exit(counter.getValue());
}
Also used : MutableHolder(org.spf4j.base.MutableHolder) TimeSeries(org.spf4j.tsdb2.TimeSeries) File(java.io.File)

Aggregations

File (java.io.File)1 MutableHolder (org.spf4j.base.MutableHolder)1 TimeSeries (org.spf4j.tsdb2.TimeSeries)1