Skip to content

Commit

Permalink
fix timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmetmircik committed Apr 11, 2021
1 parent 776d62d commit ab040db
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 88 deletions.
Expand Up @@ -28,9 +28,9 @@
import com.hazelcast.spi.properties.HazelcastProperty;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
Expand Down Expand Up @@ -252,7 +252,7 @@ private boolean notInProcessableTimeWindow(T container, long now) {

private List<T> addContainerTo(List<T> containersToProcess, T container) {
if (containersToProcess == null) {
containersToProcess = new ArrayList<T>();
containersToProcess = new LinkedList<>();
}

containersToProcess.add(container);
Expand Down
Expand Up @@ -16,16 +16,16 @@

package com.hazelcast.internal.eviction;

import java.util.function.BiFunction;
import com.hazelcast.internal.nearcache.impl.invalidation.InvalidationQueue;
import com.hazelcast.internal.util.CollectionUtil;
import com.hazelcast.spi.impl.NodeEngine;
import com.hazelcast.spi.impl.operationservice.Operation;
import com.hazelcast.spi.impl.operationservice.OperationService;
import com.hazelcast.internal.util.CollectionUtil;

import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import java.util.Queue;
import java.util.function.BiFunction;

/**
* Helper class to create and send backup expiration operations.
Expand Down Expand Up @@ -59,7 +59,7 @@ static <S> ToBackupSender<S> newToBackupSender(String serviceName,
}

private static Collection<ExpiredKey> pollExpiredKeys(Queue<ExpiredKey> expiredKeys) {
Collection<ExpiredKey> polledKeys = new ArrayList<ExpiredKey>(expiredKeys.size());
Collection<ExpiredKey> polledKeys = new LinkedList<>();

do {
ExpiredKey expiredKey = expiredKeys.poll();
Expand Down
Expand Up @@ -27,11 +27,9 @@
import com.hazelcast.map.impl.record.Record;
import com.hazelcast.map.impl.recordstore.expiry.ExpirySystem;

import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import static com.hazelcast.config.InMemoryFormat.BINARY;
import static com.hazelcast.map.impl.OwnedEntryCostEstimatorFactory.createMapSizeEstimator;
Expand All @@ -43,7 +41,7 @@
*/
public class StorageImpl<R extends Record> implements Storage<Data, R> {

private final StorageSCHM<R> records;
private final ConcurrentHashMap<Data, R> records;
private final SerializationService serializationService;
private final InMemoryFormat inMemoryFormat;

Expand All @@ -54,7 +52,8 @@ public class StorageImpl<R extends Record> implements Storage<Data, R> {
SerializationService serializationService) {
this.entryCostEstimator = createMapSizeEstimator(inMemoryFormat);
this.inMemoryFormat = inMemoryFormat;
this.records = new StorageSCHM<>(serializationService, expirySystem);
// this.records = new StorageSCHM<>(serializationService, expirySystem);
this.records = new ConcurrentHashMap<>();
this.serializationService = serializationService;
}

Expand All @@ -67,7 +66,7 @@ public void clear(boolean isDuringShutdown) {

@Override
public Iterator<Map.Entry<Data, R>> mutationTolerantIterator() {
return records.cachedEntrySet().iterator();
return records.entrySet().iterator();
}

@Override
Expand Down Expand Up @@ -143,27 +142,29 @@ public void setEntryCostEstimator(EntryCostEstimator entryCostEstimator) {

@Override
public Iterable getRandomSamples(int sampleCount) {
return records.getRandomSamples(sampleCount);
return null;//records.getRandomSamples(sampleCount);
}

@Override
public MapKeysWithCursor fetchKeys(IterationPointer[] pointers, int size) {
List<Data> keys = new ArrayList<>(size);
IterationPointer[] newPointers = records.fetchKeys(pointers, size, keys);
return new MapKeysWithCursor(keys, newPointers);
// List<Data> keys = new ArrayList<>(size);
// IterationPointer[] newPointers = records.fetchKeys(pointers, size, keys);
// return new MapKeysWithCursor(keys, newPointers);
return null;
}

@Override
public MapEntriesWithCursor fetchEntries(IterationPointer[] pointers, int size) {
List<Map.Entry<Data, R>> entries = new ArrayList<>(size);
IterationPointer[] newPointers = records.fetchEntries(pointers, size, entries);
List<Map.Entry<Data, Data>> entriesData = new ArrayList<>(entries.size());
for (Map.Entry<Data, R> entry : entries) {
R record = entry.getValue();
Data dataValue = serializationService.toData(record.getValue());
entriesData.add(new AbstractMap.SimpleEntry<>(entry.getKey(), dataValue));
}
return new MapEntriesWithCursor(entriesData, newPointers);
// List<Map.Entry<Data, R>> entries = new ArrayList<>(size);
// IterationPointer[] newPointers = records.fetchEntries(pointers, size, entries);
// List<Map.Entry<Data, Data>> entriesData = new ArrayList<>(entries.size());
// for (Map.Entry<Data, R> entry : entries) {
// R record = entry.getValue();
// Data dataValue = serializationService.toData(record.getValue());
// entriesData.add(new AbstractMap.SimpleEntry<>(entry.getKey(), dataValue));
// }
// return new MapEntriesWithCursor(entriesData, newPointers);
return null;
}

@Override
Expand Down

0 comments on commit ab040db

Please sign in to comment.