Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions server/src/main/java/io/druid/client/BatchServerInventoryView.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Interner;
import com.google.common.collect.Interners;
import com.google.common.collect.Iterables;
import com.google.common.collect.MapMaker;
import com.google.common.collect.Sets;
Expand All @@ -52,7 +48,6 @@
public class BatchServerInventoryView extends ServerInventoryView<Set<DataSegment>>
implements FilteredServerInventoryView
{
private static final Interner<DataSegment> DATA_SEGMENT_INTERNER = Interners.newWeakInterner();
private static final EmittingLogger log = new EmittingLogger(BatchServerInventoryView.class);

final private ConcurrentMap<String, Set<DataSegment>> zNodes = new MapMaker().makeMap();
Expand Down Expand Up @@ -193,17 +188,4 @@ protected void segmentCallbackRemoved(SegmentCallback callback)
{
segmentPredicates.remove(callback);
}

@Override
protected Set<DataSegment> internInventory(Set<DataSegment> sample)
{
return ImmutableSet.copyOf(FluentIterable.from(sample).transform(new Function<DataSegment, DataSegment>()
{
@Override
public DataSegment apply(DataSegment input)
{
return DATA_SEGMENT_INTERNER.intern(input);
}
}));
}
}
12 changes: 2 additions & 10 deletions server/src/main/java/io/druid/client/ServerInventoryView.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package io.druid.client;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Charsets;
Expand Down Expand Up @@ -100,7 +101,7 @@ public DruidServer deserializeContainer(byte[] bytes)
public InventoryType deserializeInventory(byte[] bytes)
{
try {
return internInventory(jsonMapper.<InventoryType>readValue(bytes, typeReference));
return jsonMapper.readValue(bytes, typeReference);
}
catch (IOException e) {
CharBuffer.wrap(StringUtils.fromUtf8(bytes).toCharArray());
Expand Down Expand Up @@ -193,15 +194,6 @@ public void stop() throws IOException
}
}

/**
* Optionally override to allow interning the inventory
* @param sample The inventory to intern
* @return An interned instance equal to sample
*/
protected InventoryType internInventory(InventoryType sample) {
return sample;
}

public boolean isStarted()
{
return started.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Interner;
import com.google.common.collect.Interners;
import com.google.common.collect.MapMaker;
import com.google.inject.Inject;
import com.metamx.common.Pair;
Expand All @@ -45,7 +43,6 @@
public class SingleServerInventoryView extends ServerInventoryView<DataSegment> implements FilteredServerInventoryView
{
private static final EmittingLogger log = new EmittingLogger(SingleServerInventoryView.class);
private static final Interner<DataSegment> DATA_SEGMENT_INTERNER = Interners.newWeakInterner();

final private ConcurrentMap<SegmentCallback, Predicate<Pair<DruidServerMetadata, DataSegment>>> segmentPredicates = new MapMaker()
.makeMap();
Expand Down Expand Up @@ -167,9 +164,4 @@ public CallbackAction segmentViewInitialized()
}
}

@Override
protected DataSegment internInventory(DataSegment sample)
{
return DATA_SEGMENT_INTERNER.intern(sample);
}
}