Skip to content

Commit

Permalink
Merge branch 'maintenance-3.x' of github.com:hazelcast/hazelcast into…
Browse files Browse the repository at this point in the history
… maintenance-3.x
  • Loading branch information
sancar committed Aug 11, 2014
2 parents 1566782 + c03584a commit 025081d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.hazelcast.hibernate.entity.DummyEntity;
import com.hazelcast.hibernate.entity.DummyProperty;
import com.hazelcast.hibernate.instance.HazelcastAccessor;
import com.hazelcast.test.annotation.ProblematicTest;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
Expand All @@ -30,9 +29,12 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Properties;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
Expand Down Expand Up @@ -149,7 +151,6 @@ public void testEntity() {
}

@Test
@Category(ProblematicTest.class)
public void testQuery() {
final int entityCount = 10;
final int queryCount = 3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ public void testNetworkConfig() {
assertEquals("sample-tag-key", aws.getTagKey());
assertEquals("sample-tag-value", aws.getTagValue());

assertFalse("reuse-address", networkConfig.isReuseAddress());
assertTrue("reuse-address", networkConfig.isReuseAddress());
}

// @Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
salt="thesalt"
password="thepass"
iteration-count="19"/>
<hz:reuse-address>false</hz:reuse-address>
<hz:reuse-address>true</hz:reuse-address>
</hz:network>
<hz:partition-group enabled="true" group-type="CUSTOM">
<hz:member-group>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -716,14 +716,7 @@ private Object waitForResponse(long time, TimeUnit unit) {
long lastPollTime = 0;
pollCount++;
try {
//we should only wait if there is any timeout. We can't call wait with 0, because it is interpreted as infinite.
if (pollTimeoutMs > 0) {
synchronized (this) {
if (response == null || response == WAIT_RESPONSE) {
this.wait(pollTimeoutMs);
}
}
}
pollResponse(pollTimeoutMs);
lastPollTime = Clock.currentTimeMillis() - startMs;
timeoutMs = decrementTimeout(timeoutMs, lastPollTime);

Expand Down Expand Up @@ -764,6 +757,20 @@ private Object waitForResponse(long time, TimeUnit unit) {
return TIMEOUT_RESPONSE;
}

private void pollResponse(final long pollTimeoutMs) throws InterruptedException {
//we should only wait if there is any timeout. We can't call wait with 0, because it is interpreted as infinite.
if (pollTimeoutMs > 0) {
long currentTimeoutMs = pollTimeoutMs;
final long waitStart = Clock.currentTimeMillis();
synchronized (this) {
while (currentTimeoutMs > 0 && (response == null || response == WAIT_RESPONSE)) {
wait(currentTimeoutMs);
currentTimeoutMs = pollTimeoutMs - (Clock.currentTimeMillis() - waitStart);
}
}
}
}

private Object newOperationTimeoutException(int pollCount, long pollTimeoutMs) {
boolean hasResponse = potentialResponse != null;
int backupsExpected = expectedBackupCount;
Expand Down

0 comments on commit 025081d

Please sign in to comment.