Nix Committers.supplierOf; Suppliers.ofInstance is good enough.

This commit is contained in:
Gian Merlino 2015-09-15 13:31:14 -07:00
parent 1e49092ce7
commit ad5ffdf483
2 changed files with 16 additions and 28 deletions

View File

@ -20,6 +20,7 @@
package io.druid.segment.realtime.plumber;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import io.druid.data.input.Committer;
import io.druid.data.input.Firehose;
import io.druid.data.input.FirehoseV2;
@ -43,22 +44,21 @@ public class Committers
public static Supplier<Committer> supplierFromRunnable(final Runnable runnable)
{
return supplierOf(
new Committer()
{
@Override
public Object getMetadata()
{
return null;
}
final Committer committer = new Committer()
{
@Override
public Object getMetadata()
{
return null;
}
@Override
public void run()
{
runnable.run();
}
}
);
@Override
public void run()
{
runnable.run();
}
};
return Suppliers.ofInstance(committer);
}
public static Supplier<Committer> supplierFromFirehose(final Firehose firehose)
@ -103,16 +103,4 @@ public class Committers
{
return NIL;
}
public static Supplier<Committer> supplierOf(final Committer committer)
{
return new Supplier<Committer>()
{
@Override
public Committer get()
{
return committer;
}
};
}
}

View File

@ -311,7 +311,7 @@ public class RealtimePlumberSchoolTest
EasyMock.expect(row.getTimestampFromEpoch()).andReturn(0L);
EasyMock.expect(row.getDimensions()).andReturn(new ArrayList<String>());
EasyMock.replay(row);
plumber.add(row, Committers.supplierOf(Committers.nil()));
plumber.add(row, Suppliers.ofInstance(Committers.nil()));
final CountDownLatch doneSignal = new CountDownLatch(1);