Skip to content

Commit

Permalink
Upgraded to HZ 3.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
lvca committed Aug 10, 2015
1 parent 446d745 commit 8280f22
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 22 deletions.
4 changes: 2 additions & 2 deletions distributed/config/hazelcast.xml
Expand Up @@ -9,7 +9,7 @@
the specific language governing permissions and ~ limitations under the License. --> the specific language governing permissions and ~ limitations under the License. -->


<hazelcast <hazelcast
xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.0.xsd" xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.3.xsd"
xmlns="http://www.hazelcast.com/schema/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> xmlns="http://www.hazelcast.com/schema/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<group> <group>
<name>orientdb</name> <name>orientdb</name>
Expand All @@ -27,4 +27,4 @@
<executor-service> <executor-service>
<pool-size>16</pool-size> <pool-size>16</pool-size>
</executor-service> </executor-service>
</hazelcast> </hazelcast>
2 changes: 1 addition & 1 deletion distributed/pom.xml
Expand Up @@ -119,7 +119,7 @@
<dependency> <dependency>
<groupId>com.hazelcast</groupId> <groupId>com.hazelcast</groupId>
<artifactId>hazelcast-all</artifactId> <artifactId>hazelcast-all</artifactId>
<version>3.3.5</version> <version>3.5.1</version>
</dependency> </dependency>
</dependencies> </dependencies>


Expand Down
Expand Up @@ -19,6 +19,11 @@
*/ */
package com.orientechnologies.orient.server.hazelcast; 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.HazelcastInstanceNotActiveException;
import com.hazelcast.core.IMap; import com.hazelcast.core.IMap;
import com.hazelcast.core.IQueue; import com.hazelcast.core.IQueue;
Expand All @@ -36,7 +41,6 @@
import com.orientechnologies.orient.server.distributed.ODistributedAbstractPlugin; import com.orientechnologies.orient.server.distributed.ODistributedAbstractPlugin;
import com.orientechnologies.orient.server.distributed.ODistributedException; import com.orientechnologies.orient.server.distributed.ODistributedException;
import com.orientechnologies.orient.server.distributed.ODistributedRequest; 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;
import com.orientechnologies.orient.server.distributed.ODistributedServerLog.DIRECTION; import com.orientechnologies.orient.server.distributed.ODistributedServerLog.DIRECTION;
import com.orientechnologies.orient.server.distributed.task.OAbstractRemoteTask; import com.orientechnologies.orient.server.distributed.task.OAbstractRemoteTask;
Expand All @@ -48,11 +52,6 @@
import com.orientechnologies.orient.server.distributed.task.OTxTask; import com.orientechnologies.orient.server.distributed.task.OTxTask;
import com.orientechnologies.orient.server.distributed.task.OUpdateRecordTask; 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 * Hazelcast implementation of distributed peer. There is one instance per database. Each node creates own instance to talk with
* each others. * each others.
Expand All @@ -67,7 +66,7 @@ public class ODistributedWorker extends Thread {
protected final OHazelcastPlugin manager; protected final OHazelcastPlugin manager;
protected final OHazelcastDistributedMessageService msgService; protected final OHazelcastDistributedMessageService msgService;
protected final String databaseName; protected final String databaseName;
protected final IQueue<ODistributedRequest> requestQueue; protected final IQueue requestQueue;
protected Queue<ODistributedRequest> localQueue = new ArrayBlockingQueue<ODistributedRequest>( protected Queue<ODistributedRequest> localQueue = new ArrayBlockingQueue<ODistributedRequest>(
LOCAL_QUEUE_MAXSIZE); LOCAL_QUEUE_MAXSIZE);
protected volatile ODatabaseDocumentTx database; protected volatile ODatabaseDocumentTx database;
Expand Down Expand Up @@ -247,7 +246,7 @@ protected ODistributedRequest readRequest() throws InterruptedException {
protected ODistributedRequest nextMessage() throws InterruptedException { protected ODistributedRequest nextMessage() throws InterruptedException {
while (localQueue.isEmpty()) { while (localQueue.isEmpty()) {
// WAIT FOR THE FIRST MESSAGE // 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 // READ MULTIPLE MSGS IN ONE SHOT BY USING LOCAL QUEUE TO IMPROVE PERFORMANCE
requestQueue.drainTo(localQueue, LOCAL_QUEUE_MAXSIZE - 1); requestQueue.drainTo(localQueue, LOCAL_QUEUE_MAXSIZE - 1);
Expand Down Expand Up @@ -427,8 +426,8 @@ private void sendResponseBack(final ODistributedRequest iRequest, final OAbstrac


try { try {
// GET THE SENDER'S RESPONSE QUEUE // GET THE SENDER'S RESPONSE QUEUE
final IQueue<ODistributedResponse> queue = msgService.getQueue(OHazelcastDistributedMessageService final IQueue queue = msgService.getQueue(OHazelcastDistributedMessageService.getResponseQueueName(iRequest
.getResponseQueueName(iRequest.getSenderNodeName())); .getSenderNodeName()));


if (!queue.offer(response, OGlobalConfiguration.DISTRIBUTED_QUEUE_TIMEOUT.getValueAsLong(), TimeUnit.MILLISECONDS)) if (!queue.offer(response, OGlobalConfiguration.DISTRIBUTED_QUEUE_TIMEOUT.getValueAsLong(), TimeUnit.MILLISECONDS))
throw new ODistributedException("Timeout on dispatching response to the thread queue " + iRequest.getSenderNodeName()); throw new ODistributedException("Timeout on dispatching response to the thread queue " + iRequest.getSenderNodeName());
Expand Down
Expand Up @@ -176,7 +176,7 @@ public ODistributedResponse send2Nodes(final ODistributedRequest iRequest, final
// TODO: CAN I MOVE THIS OUTSIDE? // TODO: CAN I MOVE THIS OUTSIDE?
msgService.registerRequest(iRequest.getId(), currentResponseMgr); msgService.registerRequest(iRequest.getId(), currentResponseMgr);


for (IQueue<ODistributedRequest> queue : reqQueues) { for (IQueue queue : reqQueues) {
if (queue != null) if (queue != null)
queue.offer(iRequest, timeout, TimeUnit.MILLISECONDS); queue.offer(iRequest, timeout, TimeUnit.MILLISECONDS);
} }
Expand Down
3 changes: 1 addition & 2 deletions distributed/src/test/resources/hazelcast-0.xml
Expand Up @@ -9,7 +9,7 @@
the specific language governing permissions and ~ limitations under the License. --> the specific language governing permissions and ~ limitations under the License. -->


<hazelcast <hazelcast
xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.0.xsd" xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.3.xsd"
xmlns="http://www.hazelcast.com/schema/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> xmlns="http://www.hazelcast.com/schema/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<group> <group>
<name>orientdb</name> <name>orientdb</name>
Expand All @@ -24,7 +24,6 @@
<multicast-timeout-seconds>1</multicast-timeout-seconds> <multicast-timeout-seconds>1</multicast-timeout-seconds>
</multicast> </multicast>
<tcp-ip enabled="true"> <tcp-ip enabled="true">
<connection-timeout-seconds>1</connection-timeout-seconds>
<member>127.0.0.1:2435</member> <member>127.0.0.1:2435</member>
<member>127.0.0.1:2436</member> <member>127.0.0.1:2436</member>
</tcp-ip> </tcp-ip>
Expand Down
3 changes: 1 addition & 2 deletions distributed/src/test/resources/hazelcast-1.xml
Expand Up @@ -9,7 +9,7 @@
the specific language governing permissions and ~ limitations under the License. --> the specific language governing permissions and ~ limitations under the License. -->


<hazelcast <hazelcast
xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.0.xsd" xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.3.xsd"
xmlns="http://www.hazelcast.com/schema/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> xmlns="http://www.hazelcast.com/schema/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<group> <group>
<name>orientdb</name> <name>orientdb</name>
Expand All @@ -24,7 +24,6 @@
<multicast-timeout-seconds>1</multicast-timeout-seconds> <multicast-timeout-seconds>1</multicast-timeout-seconds>
</multicast> </multicast>
<tcp-ip enabled="true"> <tcp-ip enabled="true">
<connection-timeout-seconds>1</connection-timeout-seconds>
<member>127.0.0.1:2434</member> <member>127.0.0.1:2434</member>
<member>127.0.0.1:2436</member> <member>127.0.0.1:2436</member>
</tcp-ip> </tcp-ip>
Expand Down
3 changes: 1 addition & 2 deletions distributed/src/test/resources/hazelcast-2.xml
Expand Up @@ -9,7 +9,7 @@
the specific language governing permissions and ~ limitations under the License. --> the specific language governing permissions and ~ limitations under the License. -->


<hazelcast <hazelcast
xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.0.xsd" xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.3.xsd"
xmlns="http://www.hazelcast.com/schema/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> xmlns="http://www.hazelcast.com/schema/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<group> <group>
<name>orientdb</name> <name>orientdb</name>
Expand All @@ -24,7 +24,6 @@
<multicast-timeout-seconds>1</multicast-timeout-seconds> <multicast-timeout-seconds>1</multicast-timeout-seconds>
</multicast> </multicast>
<tcp-ip enabled="true"> <tcp-ip enabled="true">
<connection-timeout-seconds>1</connection-timeout-seconds>
<member>127.0.0.1:2434</member> <member>127.0.0.1:2434</member>
<member>127.0.0.1:2435</member> <member>127.0.0.1:2435</member>
</tcp-ip> </tcp-ip>
Expand Down
3 changes: 1 addition & 2 deletions distributed/src/test/resources/sharded-hazelcast.xml
Expand Up @@ -9,7 +9,7 @@
the specific language governing permissions and ~ limitations under the License. --> the specific language governing permissions and ~ limitations under the License. -->


<hazelcast <hazelcast
xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.0.xsd" xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.3.xsd"
xmlns="http://www.hazelcast.com/schema/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> xmlns="http://www.hazelcast.com/schema/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<group> <group>
<name>orientdb</name> <name>orientdb</name>
Expand All @@ -23,7 +23,6 @@
<multicast-port>2434</multicast-port> <multicast-port>2434</multicast-port>
</multicast> </multicast>
<tcp-ip enabled="true"> <tcp-ip enabled="true">
<connection-timeout-seconds>1</connection-timeout-seconds>
<member>127.0.0.1:2434</member> <member>127.0.0.1:2434</member>
<member>127.0.0.1:2435</member> <member>127.0.0.1:2435</member>
<member>127.0.0.1:2436</member> <member>127.0.0.1:2436</member>
Expand Down

0 comments on commit 8280f22

Please sign in to comment.