Skip to content

Commit

Permalink
Better generics and removed unused field
Browse files Browse the repository at this point in the history
  • Loading branch information
tinwelint committed Sep 4, 2017
1 parent 57ed5b0 commit 8eb8f7a
Showing 1 changed file with 7 additions and 8 deletions.
Expand Up @@ -60,8 +60,7 @@ public abstract class NativeSchemaNumberIndexPopulator<KEY extends SchemaNumberK
private final KEY treeKey; private final KEY treeKey;
private final VALUE treeValue; private final VALUE treeValue;
private final ConflictDetectingValueMerger<KEY,VALUE> conflictDetectingValueMerger; private final ConflictDetectingValueMerger<KEY,VALUE> conflictDetectingValueMerger;
private final NativeSchemaNumberIndexUpdater<KEY,VALUE> singleUpdater; private WorkSync<IndexUpdateApply<KEY,VALUE>,IndexUpdateWork<KEY,VALUE>> workSync;
private WorkSync<IndexUpdateApply,IndexUpdateWork> workSync;


private Writer<KEY,VALUE> singleTreeWriter; private Writer<KEY,VALUE> singleTreeWriter;
private byte[] failureBytes; private byte[] failureBytes;
Expand All @@ -73,7 +72,6 @@ public abstract class NativeSchemaNumberIndexPopulator<KEY extends SchemaNumberK
this.treeKey = layout.newKey(); this.treeKey = layout.newKey();
this.treeValue = layout.newValue(); this.treeValue = layout.newValue();
this.conflictDetectingValueMerger = new ConflictDetectingValueMerger<>(); this.conflictDetectingValueMerger = new ConflictDetectingValueMerger<>();
singleUpdater = new NativeSchemaNumberIndexUpdater<>( layout.newKey(), layout.newValue() );
} }


@Override @Override
Expand Down Expand Up @@ -185,7 +183,7 @@ private void applyWithWorkSync( Collection<? extends IndexEntryUpdate<?>> update
{ {
try try
{ {
workSync.apply( new IndexUpdateWork( updates ) ); workSync.apply( new IndexUpdateWork<>( updates ) );
} }
catch ( ExecutionException e ) catch ( ExecutionException e )
{ {
Expand Down Expand Up @@ -264,7 +262,8 @@ public void process( IndexEntryUpdate indexEntryUpdate ) throws Exception
} }
} }


private static class IndexUpdateWork implements Work<IndexUpdateApply,IndexUpdateWork> private static class IndexUpdateWork<KEY extends SchemaNumberKey, VALUE extends SchemaNumberValue>
implements Work<IndexUpdateApply<KEY,VALUE>,IndexUpdateWork<KEY,VALUE>>
{ {
private final Collection<? extends IndexEntryUpdate<?>> updates; private final Collection<? extends IndexEntryUpdate<?>> updates;


Expand All @@ -274,15 +273,15 @@ private static class IndexUpdateWork implements Work<IndexUpdateApply,IndexUpdat
} }


@Override @Override
public IndexUpdateWork combine( IndexUpdateWork work ) public IndexUpdateWork<KEY,VALUE> combine( IndexUpdateWork<KEY,VALUE> work )
{ {
ArrayList<IndexEntryUpdate<?>> combined = new ArrayList<>( updates ); ArrayList<IndexEntryUpdate<?>> combined = new ArrayList<>( updates );
combined.addAll( work.updates ); combined.addAll( work.updates );
return new IndexUpdateWork( combined ); return new IndexUpdateWork<>( combined );
} }


@Override @Override
public void apply( IndexUpdateApply indexUpdateApply ) throws Exception public void apply( IndexUpdateApply<KEY,VALUE> indexUpdateApply ) throws Exception
{ {
for ( IndexEntryUpdate<?> indexEntryUpdate : updates ) for ( IndexEntryUpdate<?> indexEntryUpdate : updates )
{ {
Expand Down

0 comments on commit 8eb8f7a

Please sign in to comment.