diff --git a/Hazelcast.Net/Hazelcast.Client.Connection/ClientConnectionManager.cs b/Hazelcast.Net/Hazelcast.Client.Connection/ClientConnectionManager.cs index a33f67c621..9bbcbfadd7 100644 --- a/Hazelcast.Net/Hazelcast.Client.Connection/ClientConnectionManager.cs +++ b/Hazelcast.Net/Hazelcast.Client.Connection/ClientConnectionManager.cs @@ -82,12 +82,6 @@ public ClientConnectionManager(HazelcastClient client) } _socketInterceptor = null; - var timeout = EnvironmentUtil.ReadEnvironmentVar("hazelcast.client.invocation.timeout.seconds"); - if (timeout > 0) - { - ThreadUtil.TaskOperationTimeOutMilliseconds = timeout.Value*1000; - } - _heartbeatTimeout = EnvironmentUtil.ReadEnvironmentVar("hazelcast.client.heartbeat.timeout") ?? _heartbeatTimeout; _heartbeatInterval = EnvironmentUtil.ReadEnvironmentVar("hazelcast.client.heartbeat.interval") ?? diff --git a/Hazelcast.Net/Hazelcast.Client.Spi/ClientInvocationService.cs b/Hazelcast.Net/Hazelcast.Client.Spi/ClientInvocationService.cs index 6071729926..3029efabaf 100644 --- a/Hazelcast.Net/Hazelcast.Client.Spi/ClientInvocationService.cs +++ b/Hazelcast.Net/Hazelcast.Client.Spi/ClientInvocationService.cs @@ -269,10 +269,17 @@ private void HandleInvocationException(ClientInvocation invocation, Exception ex } } //Fail with exception - if (!invocation.Future.IsComplete) + try { invocation.Future.Exception = exception; } + catch (InvalidOperationException e) + { + if (Logger.IsFinestEnabled()) + { + Logger.Finest("Invocation already completed:", e); + } + } } catch (Exception ex) { @@ -530,7 +537,17 @@ private void HandleResponseMessage(IClientMessage response) } else { - invocation.Future.Result = response; + try + { + invocation.Future.Result = response; + } + catch (InvalidOperationException e) + { + if (Logger.IsFinestEnabled()) + { + Logger.Finest("Invocation already completed:", e); + } + } } } else diff --git a/Hazelcast.Net/Hazelcast.Util/ThreadUtil.cs b/Hazelcast.Net/Hazelcast.Util/ThreadUtil.cs index 1db4d2fae1..7e9599502e 100644 --- a/Hazelcast.Net/Hazelcast.Util/ThreadUtil.cs +++ b/Hazelcast.Net/Hazelcast.Util/ThreadUtil.cs @@ -24,28 +24,31 @@ namespace Hazelcast.Util { internal sealed class ThreadUtil { - public static int TaskOperationTimeOutMilliseconds = 250*1000; - public static IList GetResult(IEnumerable> futures) { return futures.Select(future => GetResult(future)).ToList(); } - public static IClientMessage GetResult(IFuture future, int? timeout = null) + public static IClientMessage GetResult(IFuture future) + { + return future.GetResult(Timeout.Infinite); + } + + public static IClientMessage GetResult(IFuture future, int timeout) { - return future.GetResult(timeout ?? TaskOperationTimeOutMilliseconds); + return future.GetResult(timeout); } public static IClientMessage GetResult(Task task) { - return GetResult(task, TaskOperationTimeOutMilliseconds); + return GetResult(task, Timeout.Infinite); } public static IClientMessage GetResult(Task task, int timeout) { try { - var responseReady = task.Wait(TimeSpan.FromMilliseconds(TaskOperationTimeOutMilliseconds)); + var responseReady = task.Wait(timeout); if (!responseReady) { throw new TimeoutException("Operation time-out! No response received from the server."); diff --git a/Hazelcast.Test/Hazelcast.Client.Test/ClientLongRunningTest.cs b/Hazelcast.Test/Hazelcast.Client.Test/ClientLongRunningTest.cs new file mode 100644 index 0000000000..5a7c667743 --- /dev/null +++ b/Hazelcast.Test/Hazelcast.Client.Test/ClientLongRunningTest.cs @@ -0,0 +1,65 @@ +// Copyright (c) 2008-2017, Hazelcast, Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using Hazelcast.Core; +using Hazelcast.Test; +using NUnit.Framework; + +namespace Hazelcast.Client.Test +{ + [TestFixture] + [Category("enterprise")] + public class ClientLongRunningTest : SingleMemberBaseTest + { + private static IMap map; + + [SetUp] + public void Init() + { + map = Client.GetMap(TestSupport.RandomString()); + FillMap(); + } + + [TearDown] + public static void Destroy() + { + map.Clear(); + } + + protected override string GetServerConfig() + { + return Resources.hazelcast_delay; + } + + private void FillMap() + { + for (var i = 0; i < 10; i++) + { + map.Put("key" + i, "value" + i); + } + } + + [Test] + public void TestLongRunning() + { + var starTicks = DateTime.Now.Ticks; + var collection = map.Values(Predicates.Sql("this == 'value5'")); + + var timeSpan = new TimeSpan(DateTime.Now.Ticks - starTicks); + Assert.IsNotEmpty(collection); + Assert.GreaterOrEqual(timeSpan.TotalSeconds, 300); + } + } +} \ No newline at end of file diff --git a/Hazelcast.Test/Hazelcast.Client.Test/SingleMemberBaseTest.cs b/Hazelcast.Test/Hazelcast.Client.Test/SingleMemberBaseTest.cs index 137fa9999e..f9ea916b39 100644 --- a/Hazelcast.Test/Hazelcast.Client.Test/SingleMemberBaseTest.cs +++ b/Hazelcast.Test/Hazelcast.Client.Test/SingleMemberBaseTest.cs @@ -28,7 +28,7 @@ public class SingleMemberBaseTest : HazelcastTestSupport public void SetupCluster() { RemoteController = CreateRemoteController(); - var cluster = CreateCluster(RemoteController); + var cluster = CreateCluster(RemoteController, GetServerConfig()); RemoteController.startMember(cluster.Id); Client = CreateClient(); } @@ -39,5 +39,10 @@ public void ShutdownRemoteController() HazelcastClient.ShutdownAll(); StopRemoteController(RemoteController); } + + protected virtual string GetServerConfig() + { + return Resources.hazelcast; + } } } \ No newline at end of file diff --git a/Hazelcast.Test/Hazelcast.Test.csproj b/Hazelcast.Test/Hazelcast.Test.csproj index fe71bf5927..1ea78c60f2 100644 --- a/Hazelcast.Test/Hazelcast.Test.csproj +++ b/Hazelcast.Test/Hazelcast.Test.csproj @@ -79,6 +79,7 @@ + @@ -259,6 +260,9 @@ + + + $(OutputPath)nunit-result.xml diff --git a/Hazelcast.Test/Properties/Resources.Designer.cs b/Hazelcast.Test/Properties/Resources.Designer.cs index 63e9d56e23..2b20fb5619 100644 --- a/Hazelcast.Test/Properties/Resources.Designer.cs +++ b/Hazelcast.Test/Properties/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34003 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -11,6 +11,14 @@ namespace Hazelcast.Test { using System; + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] @@ -24,6 +32,9 @@ internal class Resources { internal Resources() { } + /// + /// Returns the cached ResourceManager instance used by this class. + /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { @@ -35,6 +46,10 @@ internal class Resources { } } + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { @@ -45,18 +60,85 @@ internal class Resources { } } + /// + /// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8"?> + ///<!-- + /// ~ Copyright (c) 2008-2013, Hazelcast, Inc. All Rights Reserved. + /// ~ + /// ~ Licensed under the Apache License, Version 2.0 (the "License"); + /// ~ you may not use this file except in compliance with the License. + /// ~ You may obtain a copy of the License at + /// ~ + /// ~ http://www.apache.org/licenses/LICENSE-2.0 + /// ~ + /// ~ Unless required by applicable law or agreed to in writing, software + /// ~ distributed under the License is distributed on an "AS IS" BASIS, + /// ~ WITHOUT WARRANTI [rest of string was truncated]";. + /// internal static string hazelcast { get { return ResourceManager.GetString("hazelcast", resourceCulture); } } + /// + /// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8"?> + /// + ///<!-- + /// ~ Copyright (c) 2008-2013, Hazelcast, Inc. All Rights Reserved. + /// ~ + /// ~ Licensed under the Apache License, Version 2.0 (the "License"); + /// ~ you may not use this file except in compliance with the License. + /// ~ You may obtain a copy of the License at + /// ~ + /// ~ http://www.apache.org/licenses/LICENSE-2.0 + /// ~ + /// ~ Unless required by applicable law or agreed to in writing, software + /// ~ distributed under the License is distributed on an "AS IS" BASIS, + /// ~ WITHOUT WARRANT [rest of string was truncated]";. + /// internal static string hazelcast_config_full { get { return ResourceManager.GetString("hazelcast_config_full", resourceCulture); } } - + + /// + /// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8"?> + ///<!-- + /// ~ Copyright (c) 2008-2013, Hazelcast, Inc. All Rights Reserved. + /// ~ + /// ~ Licensed under the Apache License, Version 2.0 (the "License"); + /// ~ you may not use this file except in compliance with the License. + /// ~ You may obtain a copy of the License at + /// ~ + /// ~ http://www.apache.org/licenses/LICENSE-2.0 + /// ~ + /// ~ Unless required by applicable law or agreed to in writing, software + /// ~ distributed under the License is distributed on an "AS IS" BASIS, + /// ~ WITHOUT WARRANTI [rest of string was truncated]";. + /// + internal static string hazelcast_delay { + get { + return ResourceManager.GetString("hazelcast_delay", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8"?> + ///<!-- + /// ~ Copyright (c) 2008-2013, Hazelcast, Inc. All Rights Reserved. + /// ~ + /// ~ Licensed under the Apache License, Version 2.0 (the "License"); + /// ~ you may not use this file except in compliance with the License. + /// ~ You may obtain a copy of the License at + /// ~ + /// ~ http://www.apache.org/licenses/LICENSE-2.0 + /// ~ + /// ~ Unless required by applicable law or agreed to in writing, software + /// ~ distributed under the License is distributed on an "AS IS" BASIS, + /// ~ WITHOUT WARRANTI [rest of string was truncated]";. + /// internal static string hazelcast_ssl { get { return ResourceManager.GetString("hazelcast_ssl", resourceCulture); diff --git a/Hazelcast.Test/Properties/Resources.resx b/Hazelcast.Test/Properties/Resources.resx index e8c4884f1e..e7d788b83f 100644 --- a/Hazelcast.Test/Properties/Resources.resx +++ b/Hazelcast.Test/Properties/Resources.resx @@ -124,7 +124,10 @@ ..\Resources\hazelcast-client-full.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + ..\Resources\hazelcast-delay.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + - ..\Resources\hazelcast-ssl.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\hazelcast-ssl.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1 \ No newline at end of file diff --git a/Hazelcast.Test/Resources/hazelcast-client-full.xml b/Hazelcast.Test/Resources/hazelcast-client-full.xml index d290e8e100..7259ae164a 100644 --- a/Hazelcast.Test/Resources/hazelcast-client-full.xml +++ b/Hazelcast.Test/Resources/hazelcast-client-full.xml @@ -16,7 +16,7 @@ ~ limitations under the License. --> - diff --git a/Hazelcast.Test/Resources/hazelcast-delay.xml b/Hazelcast.Test/Resources/hazelcast-delay.xml new file mode 100644 index 0000000000..298605973f --- /dev/null +++ b/Hazelcast.Test/Resources/hazelcast-delay.xml @@ -0,0 +1,55 @@ + + + + + + dev + dev-pass + + http://localhost:8080/mancenter + + 5701 + + + 0 + + + + 224.7.7.7 + 54327 + + + 127.0.0.1 + + + 127.0.0.1 + + + + + + + + + + + \ No newline at end of file diff --git a/Hazelcast.Test/Resources/hazelcast-ssl.xml b/Hazelcast.Test/Resources/hazelcast-ssl.xml index 186ba4fd73..d3e01fb2d4 100644 --- a/Hazelcast.Test/Resources/hazelcast-ssl.xml +++ b/Hazelcast.Test/Resources/hazelcast-ssl.xml @@ -15,10 +15,10 @@ ~ limitations under the License. --> - - + dev dev-pass diff --git a/Hazelcast.Test/Resources/hazelcast.xml b/Hazelcast.Test/Resources/hazelcast.xml index d65961534d..dc635494ea 100644 --- a/Hazelcast.Test/Resources/hazelcast.xml +++ b/Hazelcast.Test/Resources/hazelcast.xml @@ -15,7 +15,7 @@ ~ limitations under the License. --> - diff --git a/start-rc.sh b/start-rc.sh index 65f9acf40d..313fbdd0cb 100644 --- a/start-rc.sh +++ b/start-rc.sh @@ -1,26 +1,62 @@ #!/bin/sh -HAZELCAST_TEST_VERSION="3.8.1-SNAPSHOT" -HAZELCAST_VERSION="3.8.1-SNAPSHOT" -HAZELCAST_ENTERPRISE_VERSION="3.8.1-SNAPSHOT" +HZ_VERSION="3.8" -HAZELCAST_RC_VERSION="0.2-SNAPSHOT" +HAZELCAST_TEST_VERSION=${HZ_VERSION} +HAZELCAST_VERSION=${HZ_VERSION} +HAZELCAST_ENTERPRISE_VERSION=${HZ_VERSION} +HAZELCAST_RC_VERSION="0.3-SNAPSHOT" SNAPSHOT_REPO="https://oss.sonatype.org/content/repositories/snapshots" RELEASE_REPO="http://repo1.maven.apache.org/maven2" -ENTERPRISE_REPO="https://repository-hazelcast-l337.forge.cloudbees.com/release/" +ENTERPRISE_RELEASE_REPO="https://repository-hazelcast-l337.forge.cloudbees.com/release/" ENTERPRISE_SNAPSHOT_REPO="https://repository-hazelcast-l337.forge.cloudbees.com/snapshot/" -mvn dependency:get -DrepoUrl=${SNAPSHOT_REPO} -Dartifact=com.hazelcast:hazelcast-remote-controller:${HAZELCAST_RC_VERSION} -Ddest=hazelcast-remote-controller-${HAZELCAST_RC_VERSION}.jar -mvn dependency:get -DrepoUrl=${SNAPSHOT_REPO} -Dartifact=com.hazelcast:hazelcast:${HAZELCAST_VERSION} -Ddest=hazelcast-${HAZELCAST_VERSION}.jar -mvn dependency:get -DrepoUrl=${SNAPSHOT_REPO} -Dartifact=com.hazelcast:hazelcast:${HAZELCAST_TEST_VERSION}:jar:tests -Ddest=hazelcast-${HAZELCAST_TEST_VERSION}-tests.jar -CLASSPATH="hazelcast-remote-controller-${HAZELCAST_RC_VERSION}.jar:hazelcast-${HAZELCAST_VERSION}.jar:hazelcast-${HAZELCAST_TEST_VERSION}-tests.jar:test/javaclasses" +if [[ ${HZ_VERSION} == *-SNAPSHOT ]] +then + REPO=${SNAPSHOT_REPO} + ENTERPRISE_REPO=${ENTERPRISE_SNAPSHOT_REPO} +else + REPO=${RELEASE_REPO} + ENTERPRISE_REPO=${ENTERPRISE_RELEASE_REPO} +fi + +echo "Downloading: remote-controller jar com.hazelcast:hazelcast-remote-controller:${HAZELCAST_RC_VERSION}" +mvn -q dependency:get -DrepoUrl=${SNAPSHOT_REPO} -Dartifact=com.hazelcast:hazelcast-remote-controller:${HAZELCAST_RC_VERSION} -Ddest=hazelcast-remote-controller-${HAZELCAST_RC_VERSION}.jar +if [ $? -ne 0 ]; then + echo "Failed download remote-controller jar com.hazelcast:hazelcast-remote-controller:${HAZELCAST_RC_VERSION}" + exit 1 +fi + + +echo "Downloading: hazelcast test jar com.hazelcast:hazelcast:${HAZELCAST_TEST_VERSION}:jar:tests" +mvn -q dependency:get -DrepoUrl=${REPO} -Dartifact=com.hazelcast:hazelcast:${HAZELCAST_TEST_VERSION}:jar:tests -Ddest=hazelcast-${HAZELCAST_TEST_VERSION}-tests.jar +if [ $? -ne 0 ]; then + echo "Failed download hazelcast test jar com.hazelcast:hazelcast:${HAZELCAST_TEST_VERSION}:jar:tests" + exit 1 +fi + +CLASSPATH="hazelcast-remote-controller-${HAZELCAST_RC_VERSION}.jar:hazelcast-${HAZELCAST_TEST_VERSION}-tests.jar:test/javaclasses" if [ -n "${HAZELCAST_ENTERPRISE_KEY}" ]; then - mvn dependency:get -DrepoUrl=${ENTERPRISE_SNAPSHOT_REPO} -Dartifact=com.hazelcast:hazelcast-enterprise:${HAZELCAST_ENTERPRISE_VERSION} -Ddest=hazelcast-enterprise-${HAZELCAST_ENTERPRISE_VERSION}.jar + echo "Downloading: hazelcast enterprise jar com.hazelcast:hazelcast-enterprise:${HAZELCAST_ENTERPRISE_VERSION}" + mvn -q dependency:get -DrepoUrl=${ENTERPRISE_REPO} -Dartifact=com.hazelcast:hazelcast-enterprise:${HAZELCAST_ENTERPRISE_VERSION} -Ddest=hazelcast-enterprise-${HAZELCAST_ENTERPRISE_VERSION}.jar + if [ $? -ne 0 ]; then + echo "Failed download hazelcast enterprise jar com.hazelcast:hazelcast-enterprise:${HAZELCAST_ENTERPRISE_VERSION}" + exit 1 + fi + CLASSPATH="hazelcast-enterprise-${HAZELCAST_ENTERPRISE_VERSION}.jar:"${CLASSPATH} echo "Starting Remote Controller ... enterprise ..." else + echo "Downloading: hazelcast jar com.hazelcast:hazelcast:${HAZELCAST_VERSION}" + mvn -q dependency:get -DrepoUrl=${REPO} -Dartifact=com.hazelcast:hazelcast:${HAZELCAST_VERSION} -Ddest=hazelcast-${HAZELCAST_VERSION}.jar + if [ $? -ne 0 ]; then + echo "Failed download hazelcast jar com.hazelcast:hazelcast:${HAZELCAST_VERSION}" + exit 1 + fi + + CLASSPATH="hazelcast-${HAZELCAST_VERSION}.jar:"${CLASSPATH} echo "Starting Remote Controller ... oss ..." fi