From 8280f22145db3b448f6ba07f42560f846df3f873 Mon Sep 17 00:00:00 2001 From: lvca Date: Mon, 10 Aug 2015 09:24:26 +0200 Subject: [PATCH] Upgraded to HZ 3.5.1 --- distributed/config/hazelcast.xml | 4 ++-- distributed/pom.xml | 2 +- .../server/hazelcast/ODistributedWorker.java | 19 +++++++++---------- .../OHazelcastDistributedDatabase.java | 2 +- .../src/test/resources/hazelcast-0.xml | 3 +-- .../src/test/resources/hazelcast-1.xml | 3 +-- .../src/test/resources/hazelcast-2.xml | 3 +-- .../src/test/resources/sharded-hazelcast.xml | 3 +-- 8 files changed, 17 insertions(+), 22 deletions(-) diff --git a/distributed/config/hazelcast.xml b/distributed/config/hazelcast.xml index a96a76ec11a..9893262d4cc 100755 --- a/distributed/config/hazelcast.xml +++ b/distributed/config/hazelcast.xml @@ -9,7 +9,7 @@ the specific language governing permissions and ~ limitations under the License. --> orientdb @@ -27,4 +27,4 @@ 16 - \ No newline at end of file + diff --git a/distributed/pom.xml b/distributed/pom.xml index aaeab583f31..8c8d76a2cb8 100644 --- a/distributed/pom.xml +++ b/distributed/pom.xml @@ -119,7 +119,7 @@ com.hazelcast hazelcast-all - 3.3.5 + 3.5.1 diff --git a/distributed/src/main/java/com/orientechnologies/orient/server/hazelcast/ODistributedWorker.java b/distributed/src/main/java/com/orientechnologies/orient/server/hazelcast/ODistributedWorker.java index 4dfcae98877..42364af96fe 100644 --- a/distributed/src/main/java/com/orientechnologies/orient/server/hazelcast/ODistributedWorker.java +++ b/distributed/src/main/java/com/orientechnologies/orient/server/hazelcast/ODistributedWorker.java @@ -19,6 +19,11 @@ */ package com.orientechnologies.orient.server.hazelcast; +import java.io.Serializable; +import java.util.Queue; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.TimeUnit; + import com.hazelcast.core.HazelcastInstanceNotActiveException; import com.hazelcast.core.IMap; import com.hazelcast.core.IQueue; @@ -36,7 +41,6 @@ import com.orientechnologies.orient.server.distributed.ODistributedAbstractPlugin; import com.orientechnologies.orient.server.distributed.ODistributedException; import com.orientechnologies.orient.server.distributed.ODistributedRequest; -import com.orientechnologies.orient.server.distributed.ODistributedResponse; import com.orientechnologies.orient.server.distributed.ODistributedServerLog; import com.orientechnologies.orient.server.distributed.ODistributedServerLog.DIRECTION; import com.orientechnologies.orient.server.distributed.task.OAbstractRemoteTask; @@ -48,11 +52,6 @@ import com.orientechnologies.orient.server.distributed.task.OTxTask; import com.orientechnologies.orient.server.distributed.task.OUpdateRecordTask; -import java.io.Serializable; -import java.util.Queue; -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.TimeUnit; - /** * Hazelcast implementation of distributed peer. There is one instance per database. Each node creates own instance to talk with * each others. @@ -67,7 +66,7 @@ public class ODistributedWorker extends Thread { protected final OHazelcastPlugin manager; protected final OHazelcastDistributedMessageService msgService; protected final String databaseName; - protected final IQueue requestQueue; + protected final IQueue requestQueue; protected Queue localQueue = new ArrayBlockingQueue( LOCAL_QUEUE_MAXSIZE); protected volatile ODatabaseDocumentTx database; @@ -247,7 +246,7 @@ protected ODistributedRequest readRequest() throws InterruptedException { protected ODistributedRequest nextMessage() throws InterruptedException { while (localQueue.isEmpty()) { // WAIT FOR THE FIRST MESSAGE - localQueue.offer(requestQueue.take()); + localQueue.offer((ODistributedRequest) requestQueue.take()); // READ MULTIPLE MSGS IN ONE SHOT BY USING LOCAL QUEUE TO IMPROVE PERFORMANCE requestQueue.drainTo(localQueue, LOCAL_QUEUE_MAXSIZE - 1); @@ -427,8 +426,8 @@ private void sendResponseBack(final ODistributedRequest iRequest, final OAbstrac try { // GET THE SENDER'S RESPONSE QUEUE - final IQueue queue = msgService.getQueue(OHazelcastDistributedMessageService - .getResponseQueueName(iRequest.getSenderNodeName())); + final IQueue queue = msgService.getQueue(OHazelcastDistributedMessageService.getResponseQueueName(iRequest + .getSenderNodeName())); if (!queue.offer(response, OGlobalConfiguration.DISTRIBUTED_QUEUE_TIMEOUT.getValueAsLong(), TimeUnit.MILLISECONDS)) throw new ODistributedException("Timeout on dispatching response to the thread queue " + iRequest.getSenderNodeName()); diff --git a/distributed/src/main/java/com/orientechnologies/orient/server/hazelcast/OHazelcastDistributedDatabase.java b/distributed/src/main/java/com/orientechnologies/orient/server/hazelcast/OHazelcastDistributedDatabase.java index 386a443ed16..a8107670df1 100644 --- a/distributed/src/main/java/com/orientechnologies/orient/server/hazelcast/OHazelcastDistributedDatabase.java +++ b/distributed/src/main/java/com/orientechnologies/orient/server/hazelcast/OHazelcastDistributedDatabase.java @@ -176,7 +176,7 @@ public ODistributedResponse send2Nodes(final ODistributedRequest iRequest, final // TODO: CAN I MOVE THIS OUTSIDE? msgService.registerRequest(iRequest.getId(), currentResponseMgr); - for (IQueue queue : reqQueues) { + for (IQueue queue : reqQueues) { if (queue != null) queue.offer(iRequest, timeout, TimeUnit.MILLISECONDS); } diff --git a/distributed/src/test/resources/hazelcast-0.xml b/distributed/src/test/resources/hazelcast-0.xml index 3247704f466..32d5aeb64fa 100755 --- a/distributed/src/test/resources/hazelcast-0.xml +++ b/distributed/src/test/resources/hazelcast-0.xml @@ -9,7 +9,7 @@ the specific language governing permissions and ~ limitations under the License. --> orientdb @@ -24,7 +24,6 @@ 1 - 1 127.0.0.1:2435 127.0.0.1:2436 diff --git a/distributed/src/test/resources/hazelcast-1.xml b/distributed/src/test/resources/hazelcast-1.xml index 2b2d0f4af8d..92c7942bd85 100755 --- a/distributed/src/test/resources/hazelcast-1.xml +++ b/distributed/src/test/resources/hazelcast-1.xml @@ -9,7 +9,7 @@ the specific language governing permissions and ~ limitations under the License. --> orientdb @@ -24,7 +24,6 @@ 1 - 1 127.0.0.1:2434 127.0.0.1:2436 diff --git a/distributed/src/test/resources/hazelcast-2.xml b/distributed/src/test/resources/hazelcast-2.xml index ee5fb62fa83..3a6c5ff93ad 100755 --- a/distributed/src/test/resources/hazelcast-2.xml +++ b/distributed/src/test/resources/hazelcast-2.xml @@ -9,7 +9,7 @@ the specific language governing permissions and ~ limitations under the License. --> orientdb @@ -24,7 +24,6 @@ 1 - 1 127.0.0.1:2434 127.0.0.1:2435 diff --git a/distributed/src/test/resources/sharded-hazelcast.xml b/distributed/src/test/resources/sharded-hazelcast.xml index f59f1f914db..9f8e784e531 100755 --- a/distributed/src/test/resources/sharded-hazelcast.xml +++ b/distributed/src/test/resources/sharded-hazelcast.xml @@ -9,7 +9,7 @@ the specific language governing permissions and ~ limitations under the License. --> orientdb @@ -23,7 +23,6 @@ 2434 - 1 127.0.0.1:2434 127.0.0.1:2435 127.0.0.1:2436