Skip to content

Commit

Permalink
Fix QueryBounceTest timeouts: move instace.getMap from constructor to…
Browse files Browse the repository at this point in the history
… QueryRunnable execution
  • Loading branch information
vbekiaris committed Apr 5, 2017
1 parent fa42cf3 commit 5c4ca03
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions hazelcast/src/test/java/com/hazelcast/map/QueryBounceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,23 @@ private void populateMap(IMap<String, SampleObjects.Employee> map) {
}
}

// Thread-safe querying runnable
public static class QueryRunnable implements Runnable {

private final IMap map;
private final HazelcastInstance hazelcastInstance;
// query age min-max range, min is randomized, max = min+1000
private final Random random = new Random();
private final int numberOfResults = 1000;
private IMap map;

public QueryRunnable(HazelcastInstance hz) {
this.map = hz.getMap(TEST_MAP_NAME);
public QueryRunnable(HazelcastInstance hazelcastInstance) {
this.hazelcastInstance = hazelcastInstance;
}

@Override
public void run() {
if (map == null) {
map = hazelcastInstance.getMap(TEST_MAP_NAME);
}
int min, max;
min = random.nextInt(COUNT_ENTRIES - numberOfResults);
max = min + numberOfResults;
Expand Down

0 comments on commit 5c4ca03

Please sign in to comment.