You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by av...@apache.org on 2015/12/18 13:42:14 UTC
[01/13] ignite git commit: IGNITE-2193: .NET: Fixed SerivceTest.cs.
Repository: ignite
Updated Branches:
refs/heads/ignite-1.5.1-2 206e5a53c -> 0482316e4
IGNITE-2193: .NET: Fixed SerivceTest.cs.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/889b2689
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/889b2689
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/889b2689
Branch: refs/heads/ignite-1.5.1-2
Commit: 889b2689816a7185029eb7c992bf73f14600844c
Parents: 057ad5b
Author: Pavel Tupitsyn <pt...@gridgain.com>
Authored: Thu Dec 17 17:31:31 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Dec 17 17:31:31 2015 +0300
----------------------------------------------------------------------
.../Services/ServicesTest.cs | 23 +++++++++++++++-----
1 file changed, 17 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/889b2689/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs
index 33f255e..ffcdea8 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs
@@ -218,10 +218,10 @@ namespace Apache.Ignite.Core.Tests.Services
}
Services.Cancel(SvcName + 0);
- Services.Cancel(SvcName + 1);
+ AssertNoService(SvcName + 0);
- Assert.IsNull(Services.GetService<ITestIgniteService>(SvcName + 0));
- Assert.IsNull(Services.GetService<ITestIgniteService>(SvcName + 1));
+ Services.Cancel(SvcName + 1);
+ AssertNoService(SvcName + 1);
for (var i = 2; i < 10; i++)
Assert.IsNotNull(Services.GetService<ITestIgniteService>(SvcName + i));
@@ -229,7 +229,7 @@ namespace Apache.Ignite.Core.Tests.Services
Services.CancelAll();
for (var i = 0; i < 10; i++)
- Assert.IsNull(Services.GetService<ITestIgniteService>(SvcName + i));
+ AssertNoService(SvcName + i);
}
/// <summary>
@@ -477,8 +477,7 @@ namespace Apache.Ignite.Core.Tests.Services
Services.CancelAll();
// Cancellation failed, but service is removed.
- foreach (var grid in Grids)
- Assert.IsNull(grid.GetServices().GetService<ITestIgniteService>(SvcName));
+ AssertNoService();
}
[Test]
@@ -579,6 +578,18 @@ namespace Apache.Ignite.Core.Tests.Services
}
/// <summary>
+ /// Asserts that there is no service on any grid with given name.
+ /// </summary>
+ /// <param name="name">The name.</param>
+ private void AssertNoService(string name = SvcName)
+ {
+ foreach (var grid in Grids)
+ Assert.IsTrue(
+ TestUtils.WaitForCondition(() => grid.GetServices()
+ .GetService<ITestIgniteService>(name) == null, 5000));
+ }
+
+ /// <summary>
/// Gets the services.
/// </summary>
protected virtual IServices Services
[12/13] ignite git commit: IGNITE-2201 - Fixed affinity collocation
with AffinityKey and examples model
Posted by av...@apache.org.
IGNITE-2201 - Fixed affinity collocation with AffinityKey and examples model
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bda0b19c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bda0b19c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bda0b19c
Branch: refs/heads/ignite-1.5.1-2
Commit: bda0b19c7f4af8f51823ddeb2e23583a3217dd5a
Parents: d391daa
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Fri Dec 18 15:29:09 2015 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Dec 18 15:30:23 2015 +0300
----------------------------------------------------------------------
...ComputeClientBinaryTaskExecutionExample.java | 4 +-
.../CacheClientBinaryPutGetExample.java | 6 +-
.../datagrid/CacheClientBinaryQueryExample.java | 10 +--
.../examples/datagrid/CacheQueryExample.java | 4 +-
.../apache/ignite/examples/model/Address.java | 72 +++++++++++++++
.../apache/ignite/examples/model/Employee.java | 93 ++++++++++++++++++++
.../ignite/examples/model/EmployeeKey.java | 93 ++++++++++++++++++++
.../ignite/examples/model/Organization.java | 85 ++++++++++++++++--
.../ignite/examples/model/OrganizationType.java | 32 +++++++
.../apache/ignite/examples/model/Person.java | 2 +-
.../ignite/examples/model/binary/Address.java | 72 ---------------
.../ignite/examples/model/binary/Employee.java | 93 --------------------
.../examples/model/binary/EmployeeKey.java | 93 --------------------
.../examples/model/binary/Organization.java | 93 --------------------
.../examples/model/binary/OrganizationType.java | 32 -------
.../ignite/examples/model/package-info.java | 23 +++++
.../ignite/internal/binary/BinaryContext.java | 16 +++-
17 files changed, 417 insertions(+), 406 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bda0b19c/examples/src/main/java/org/apache/ignite/examples/binary/computegrid/ComputeClientBinaryTaskExecutionExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/binary/computegrid/ComputeClientBinaryTaskExecutionExample.java b/examples/src/main/java/org/apache/ignite/examples/binary/computegrid/ComputeClientBinaryTaskExecutionExample.java
index d839c96..aced78c 100644
--- a/examples/src/main/java/org/apache/ignite/examples/binary/computegrid/ComputeClientBinaryTaskExecutionExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/binary/computegrid/ComputeClientBinaryTaskExecutionExample.java
@@ -22,8 +22,8 @@ import java.util.Arrays;
import java.util.Collection;
import org.apache.ignite.Ignite;
import org.apache.ignite.Ignition;
-import org.apache.ignite.examples.model.binary.Address;
-import org.apache.ignite.examples.model.binary.Employee;
+import org.apache.ignite.examples.model.Address;
+import org.apache.ignite.examples.model.Employee;
import org.apache.ignite.binary.BinaryObject;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/bda0b19c/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryPutGetExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryPutGetExample.java b/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryPutGetExample.java
index b6fc455..f0f57af 100644
--- a/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryPutGetExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryPutGetExample.java
@@ -28,9 +28,9 @@ import org.apache.ignite.Ignition;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.examples.model.binary.Address;
-import org.apache.ignite.examples.model.binary.Organization;
-import org.apache.ignite.examples.model.binary.OrganizationType;
+import org.apache.ignite.examples.model.Address;
+import org.apache.ignite.examples.model.Organization;
+import org.apache.ignite.examples.model.OrganizationType;
import org.apache.ignite.binary.BinaryObject;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/bda0b19c/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java b/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java
index b05cbb5..11c00e9 100644
--- a/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java
@@ -34,11 +34,11 @@ import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.SqlQuery;
import org.apache.ignite.cache.query.TextQuery;
import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.examples.model.binary.Address;
-import org.apache.ignite.examples.model.binary.Employee;
-import org.apache.ignite.examples.model.binary.EmployeeKey;
-import org.apache.ignite.examples.model.binary.Organization;
-import org.apache.ignite.examples.model.binary.OrganizationType;
+import org.apache.ignite.examples.model.Address;
+import org.apache.ignite.examples.model.Employee;
+import org.apache.ignite.examples.model.EmployeeKey;
+import org.apache.ignite.examples.model.Organization;
+import org.apache.ignite.examples.model.OrganizationType;
import org.apache.ignite.binary.BinaryObject;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/bda0b19c/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java
index ace7395..98af93c 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java
@@ -273,8 +273,8 @@ public class CacheQueryExample {
Organization org1 = new Organization("ApacheIgnite");
Organization org2 = new Organization("Other");
- orgCache.put(org1.id, org1);
- orgCache.put(org2.id, org2);
+ orgCache.put(org1.id(), org1);
+ orgCache.put(org2.id(), org2);
IgniteCache<AffinityKey<Long>, Person> personCache = Ignition.ignite().cache(PERSON_CACHE);
http://git-wip-us.apache.org/repos/asf/ignite/blob/bda0b19c/examples/src/main/java/org/apache/ignite/examples/model/Address.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/Address.java b/examples/src/main/java/org/apache/ignite/examples/model/Address.java
new file mode 100644
index 0000000..184de4a
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/model/Address.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+package org.apache.ignite.examples.model;
+
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.Binarylizable;
+import org.apache.ignite.binary.BinaryReader;
+import org.apache.ignite.binary.BinaryWriter;
+
+/**
+ * Employee address.
+ * <p>
+ * This class implements {@link org.apache.ignite.binary.Binarylizable} only for example purposes,
+ * in order to show how to customize serialization and deserialization of
+ * binary objects.
+ */
+public class Address implements Binarylizable {
+ /** Street. */
+ private String street;
+
+ /** ZIP code. */
+ private int zip;
+
+ /**
+ * Required for binary deserialization.
+ */
+ public Address() {
+ // No-op.
+ }
+
+ /**
+ * @param street Street.
+ * @param zip ZIP code.
+ */
+ public Address(String street, int zip) {
+ this.street = street;
+ this.zip = zip;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
+ writer.writeString("street", street);
+ writer.writeInt("zip", zip);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
+ street = reader.readString("street");
+ zip = reader.readInt("zip");
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return "Address [street=" + street +
+ ", zip=" + zip + ']';
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bda0b19c/examples/src/main/java/org/apache/ignite/examples/model/Employee.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/Employee.java b/examples/src/main/java/org/apache/ignite/examples/model/Employee.java
new file mode 100644
index 0000000..a59ffce
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/model/Employee.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+package org.apache.ignite.examples.model;
+
+import java.util.Collection;
+
+/**
+ * This class represents employee object.
+ */
+public class Employee {
+ /** Name. */
+ private String name;
+
+ /** Salary. */
+ private long salary;
+
+ /** Address. */
+ private Address addr;
+
+ /** Departments. */
+ private Collection<String> departments;
+
+ /**
+ * Required for binary deserialization.
+ */
+ public Employee() {
+ // No-op.
+ }
+
+ /**
+ * @param name Name.
+ * @param salary Salary.
+ * @param addr Address.
+ * @param departments Departments.
+ */
+ public Employee(String name, long salary, Address addr, Collection<String> departments) {
+ this.name = name;
+ this.salary = salary;
+ this.addr = addr;
+ this.departments = departments;
+ }
+
+ /**
+ * @return Name.
+ */
+ public String name() {
+ return name;
+ }
+
+ /**
+ * @return Salary.
+ */
+ public long salary() {
+ return salary;
+ }
+
+ /**
+ * @return Address.
+ */
+ public Address address() {
+ return addr;
+ }
+
+ /**
+ * @return Departments.
+ */
+ public Collection<String> departments() {
+ return departments;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return "Employee [name=" + name +
+ ", salary=" + salary +
+ ", address=" + addr +
+ ", departments=" + departments + ']';
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bda0b19c/examples/src/main/java/org/apache/ignite/examples/model/EmployeeKey.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/EmployeeKey.java b/examples/src/main/java/org/apache/ignite/examples/model/EmployeeKey.java
new file mode 100644
index 0000000..55e7967
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/model/EmployeeKey.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+package org.apache.ignite.examples.model;
+
+import org.apache.ignite.cache.affinity.AffinityKeyMapped;
+
+/**
+ * This class represents key for employee object.
+ * <p>
+ * Used in query example to collocate employees
+ * with their organizations.
+ */
+public class EmployeeKey {
+ /** ID. */
+ private int id;
+
+ /** Organization ID. */
+ @AffinityKeyMapped
+ private int organizationId;
+
+ /**
+ * Required for binary deserialization.
+ */
+ public EmployeeKey() {
+ // No-op.
+ }
+
+ /**
+ * @param id ID.
+ * @param organizationId Organization ID.
+ */
+ public EmployeeKey(int id, int organizationId) {
+ this.id = id;
+ this.organizationId = organizationId;
+ }
+
+ /**
+ * @return ID.
+ */
+ public int id() {
+ return id;
+ }
+
+ /**
+ * @return Organization ID.
+ */
+ public int organizationId() {
+ return organizationId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ EmployeeKey key = (EmployeeKey)o;
+
+ return id == key.id && organizationId == key.organizationId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ int res = id;
+
+ res = 31 * res + organizationId;
+
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return "EmployeeKey [id=" + id +
+ ", organizationId=" + organizationId + ']';
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bda0b19c/examples/src/main/java/org/apache/ignite/examples/model/Organization.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/Organization.java b/examples/src/main/java/org/apache/ignite/examples/model/Organization.java
index 2500584..70d4eee 100644
--- a/examples/src/main/java/org/apache/ignite/examples/model/Organization.java
+++ b/examples/src/main/java/org/apache/ignite/examples/model/Organization.java
@@ -17,28 +17,42 @@
package org.apache.ignite.examples.model;
-import java.io.Serializable;
+import java.sql.Timestamp;
import java.util.concurrent.atomic.AtomicLong;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
/**
- * Organization class.
+ * This class represents organization object.
*/
-public class Organization implements Serializable {
+public class Organization {
/** */
private static final AtomicLong ID_GEN = new AtomicLong();
/** Organization ID (indexed). */
@QuerySqlField(index = true)
- public Long id;
+ private Long id;
/** Organization name (indexed). */
@QuerySqlField(index = true)
- public String name;
+ private String name;
+
+ /** Address. */
+ private Address addr;
+
+ /** Type. */
+ private OrganizationType type;
+
+ /** Last update time. */
+ private Timestamp lastUpdated;
+
+ /**
+ * Required for binary deserialization.
+ */
+ public Organization() {
+ // No-op.
+ }
/**
- * Create organization.
- *
* @param name Organization name.
*/
public Organization(String name) {
@@ -47,8 +61,63 @@ public class Organization implements Serializable {
this.name = name;
}
+ /**
+ * @param name Name.
+ * @param addr Address.
+ * @param type Type.
+ * @param lastUpdated Last update time.
+ */
+ public Organization(String name, Address addr, OrganizationType type, Timestamp lastUpdated) {
+ id = ID_GEN.incrementAndGet();
+
+ this.name = name;
+ this.addr = addr;
+ this.type = type;
+
+ this.lastUpdated = lastUpdated;
+ }
+
+ /**
+ * @return Organization ID.
+ */
+ public Long id() {
+ return id;
+ }
+
+ /**
+ * @return Name.
+ */
+ public String name() {
+ return name;
+ }
+
+ /**
+ * @return Address.
+ */
+ public Address address() {
+ return addr;
+ }
+
+ /**
+ * @return Type.
+ */
+ public OrganizationType type() {
+ return type;
+ }
+
+ /**
+ * @return Last update time.
+ */
+ public Timestamp lastUpdated() {
+ return lastUpdated;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
- return "Organization [id=" + id + ", name=" + name + ']';
+ return "Organization [id=" + id +
+ ", name=" + name +
+ ", address=" + addr +
+ ", type=" + type +
+ ", lastUpdated=" + lastUpdated + ']';
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bda0b19c/examples/src/main/java/org/apache/ignite/examples/model/OrganizationType.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/OrganizationType.java b/examples/src/main/java/org/apache/ignite/examples/model/OrganizationType.java
new file mode 100644
index 0000000..8b22600
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/model/OrganizationType.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+package org.apache.ignite.examples.model;
+
+/**
+ * Organization type enum.
+ */
+public enum OrganizationType {
+ /** Non-profit organization. */
+ NON_PROFIT,
+
+ /** Private organization. */
+ PRIVATE,
+
+ /** Government organization. */
+ GOVERNMENT
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bda0b19c/examples/src/main/java/org/apache/ignite/examples/model/Person.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/Person.java b/examples/src/main/java/org/apache/ignite/examples/model/Person.java
index 618fa5c..6d3a6df 100644
--- a/examples/src/main/java/org/apache/ignite/examples/model/Person.java
+++ b/examples/src/main/java/org/apache/ignite/examples/model/Person.java
@@ -77,7 +77,7 @@ public class Person implements Serializable {
// Generate unique ID for this person.
id = ID_GEN.incrementAndGet();
- orgId = org.id;
+ orgId = org.id();
this.firstName = firstName;
this.lastName = lastName;
http://git-wip-us.apache.org/repos/asf/ignite/blob/bda0b19c/examples/src/main/java/org/apache/ignite/examples/model/binary/Address.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/binary/Address.java b/examples/src/main/java/org/apache/ignite/examples/model/binary/Address.java
deleted file mode 100644
index 2d17cb8..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/model/binary/Address.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
-package org.apache.ignite.examples.model.binary;
-
-import org.apache.ignite.binary.BinaryObjectException;
-import org.apache.ignite.binary.Binarylizable;
-import org.apache.ignite.binary.BinaryReader;
-import org.apache.ignite.binary.BinaryWriter;
-
-/**
- * Employee address.
- * <p>
- * This class implements {@link org.apache.ignite.binary.Binarylizable} only for example purposes,
- * in order to show how to customize serialization and deserialization of
- * binary objects.
- */
-public class Address implements Binarylizable {
- /** Street. */
- private String street;
-
- /** ZIP code. */
- private int zip;
-
- /**
- * Required for binary deserialization.
- */
- public Address() {
- // No-op.
- }
-
- /**
- * @param street Street.
- * @param zip ZIP code.
- */
- public Address(String street, int zip) {
- this.street = street;
- this.zip = zip;
- }
-
- /** {@inheritDoc} */
- @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
- writer.writeString("street", street);
- writer.writeInt("zip", zip);
- }
-
- /** {@inheritDoc} */
- @Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
- street = reader.readString("street");
- zip = reader.readInt("zip");
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "Address [street=" + street +
- ", zip=" + zip + ']';
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bda0b19c/examples/src/main/java/org/apache/ignite/examples/model/binary/Employee.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/binary/Employee.java b/examples/src/main/java/org/apache/ignite/examples/model/binary/Employee.java
deleted file mode 100644
index ad82065..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/model/binary/Employee.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
-package org.apache.ignite.examples.model.binary;
-
-import java.util.Collection;
-
-/**
- * This class represents employee object.
- */
-public class Employee {
- /** Name. */
- private String name;
-
- /** Salary. */
- private long salary;
-
- /** Address. */
- private Address addr;
-
- /** Departments. */
- private Collection<String> departments;
-
- /**
- * Required for binary deserialization.
- */
- public Employee() {
- // No-op.
- }
-
- /**
- * @param name Name.
- * @param salary Salary.
- * @param addr Address.
- * @param departments Departments.
- */
- public Employee(String name, long salary, Address addr, Collection<String> departments) {
- this.name = name;
- this.salary = salary;
- this.addr = addr;
- this.departments = departments;
- }
-
- /**
- * @return Name.
- */
- public String name() {
- return name;
- }
-
- /**
- * @return Salary.
- */
- public long salary() {
- return salary;
- }
-
- /**
- * @return Address.
- */
- public Address address() {
- return addr;
- }
-
- /**
- * @return Departments.
- */
- public Collection<String> departments() {
- return departments;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "Employee [name=" + name +
- ", salary=" + salary +
- ", address=" + addr +
- ", departments=" + departments + ']';
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bda0b19c/examples/src/main/java/org/apache/ignite/examples/model/binary/EmployeeKey.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/binary/EmployeeKey.java b/examples/src/main/java/org/apache/ignite/examples/model/binary/EmployeeKey.java
deleted file mode 100644
index 20367ac..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/model/binary/EmployeeKey.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
-package org.apache.ignite.examples.model.binary;
-
-import org.apache.ignite.cache.affinity.AffinityKeyMapped;
-
-/**
- * This class represents key for employee object.
- * <p>
- * Used in query example to collocate employees
- * with their organizations.
- */
-public class EmployeeKey {
- /** ID. */
- private int id;
-
- /** Organization ID. */
- @AffinityKeyMapped
- private int organizationId;
-
- /**
- * Required for binary deserialization.
- */
- public EmployeeKey() {
- // No-op.
- }
-
- /**
- * @param id ID.
- * @param organizationId Organization ID.
- */
- public EmployeeKey(int id, int organizationId) {
- this.id = id;
- this.organizationId = organizationId;
- }
-
- /**
- * @return ID.
- */
- public int id() {
- return id;
- }
-
- /**
- * @return Organization ID.
- */
- public int organizationId() {
- return organizationId;
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
-
- if (o == null || getClass() != o.getClass())
- return false;
-
- EmployeeKey key = (EmployeeKey)o;
-
- return id == key.id && organizationId == key.organizationId;
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- int res = id;
-
- res = 31 * res + organizationId;
-
- return res;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "EmployeeKey [id=" + id +
- ", organizationId=" + organizationId + ']';
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bda0b19c/examples/src/main/java/org/apache/ignite/examples/model/binary/Organization.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/binary/Organization.java b/examples/src/main/java/org/apache/ignite/examples/model/binary/Organization.java
deleted file mode 100644
index 6b7aca4..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/model/binary/Organization.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
-package org.apache.ignite.examples.model.binary;
-
-import java.sql.Timestamp;
-
-/**
- * This class represents organization object.
- */
-public class Organization {
- /** Name. */
- private String name;
-
- /** Address. */
- private Address addr;
-
- /** Type. */
- private OrganizationType type;
-
- /** Last update time. */
- private Timestamp lastUpdated;
-
- /**
- * Required for binary deserialization.
- */
- public Organization() {
- // No-op.
- }
-
- /**
- * @param name Name.
- * @param addr Address.
- * @param type Type.
- * @param lastUpdated Last update time.
- */
- public Organization(String name, Address addr, OrganizationType type, Timestamp lastUpdated) {
- this.name = name;
- this.addr = addr;
- this.type = type;
- this.lastUpdated = lastUpdated;
- }
-
- /**
- * @return Name.
- */
- public String name() {
- return name;
- }
-
- /**
- * @return Address.
- */
- public Address address() {
- return addr;
- }
-
- /**
- * @return Type.
- */
- public OrganizationType type() {
- return type;
- }
-
- /**
- * @return Last update time.
- */
- public Timestamp lastUpdated() {
- return lastUpdated;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "Organization [name=" + name +
- ", address=" + addr +
- ", type=" + type +
- ", lastUpdated=" + lastUpdated + ']';
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bda0b19c/examples/src/main/java/org/apache/ignite/examples/model/binary/OrganizationType.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/binary/OrganizationType.java b/examples/src/main/java/org/apache/ignite/examples/model/binary/OrganizationType.java
deleted file mode 100644
index 69804c0..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/model/binary/OrganizationType.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
-package org.apache.ignite.examples.model.binary;
-
-/**
- * Organization type enum.
- */
-public enum OrganizationType {
- /** Non-profit organization. */
- NON_PROFIT,
-
- /** Private organization. */
- PRIVATE,
-
- /** Government organization. */
- GOVERNMENT
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bda0b19c/examples/src/main/java/org/apache/ignite/examples/model/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/package-info.java b/examples/src/main/java/org/apache/ignite/examples/model/package-info.java
new file mode 100644
index 0000000..9ddba67
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/model/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+/**
+ * <!-- Package description. -->
+ * Model classes for Apache Ignite examples.
+ */
+
+package org.apache.ignite.examples.model;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/bda0b19c/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
index abe283e..5c63fbd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
@@ -212,7 +212,7 @@ public class BinaryContext implements Externalizable {
registerPredefinedType(LinkedHashMap.class, 0);
// Classes with overriden default serialization flag.
- registerPredefinedType(AffinityKey.class, 0);
+ registerPredefinedType(AffinityKey.class, 0, affinityFieldName(AffinityKey.class));
registerPredefinedType(GridMapEntry.class, 60);
registerPredefinedType(IgniteBiTuple.class, 61);
@@ -761,6 +761,15 @@ public class BinaryContext implements Externalizable {
* @return GridBinaryClassDescriptor.
*/
public BinaryClassDescriptor registerPredefinedType(Class<?> cls, int id) {
+ return registerPredefinedType(cls, id, null);
+ }
+
+ /**
+ * @param cls Class.
+ * @param id Type ID.
+ * @return GridBinaryClassDescriptor.
+ */
+ public BinaryClassDescriptor registerPredefinedType(Class<?> cls, int id, String affFieldName) {
String typeName = typeName(cls.getName());
if (id == 0)
@@ -772,7 +781,7 @@ public class BinaryContext implements Externalizable {
false,
id,
typeName,
- null,
+ affFieldName,
BinaryInternalIdMapper.defaultInstance(),
new BinaryReflectiveSerializer(),
false,
@@ -784,6 +793,9 @@ public class BinaryContext implements Externalizable {
descByCls.put(cls, desc);
+ if (affFieldName != null)
+ affKeyFieldNames.putIfAbsent(id, affFieldName);
+
return desc;
}
[10/13] ignite git commit: IGNITE-2123: Need to add
EntryProcessorExample to cache examples
Posted by av...@apache.org.
IGNITE-2123: Need to add EntryProcessorExample to cache examples
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/32cec994
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/32cec994
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/32cec994
Branch: refs/heads/ignite-1.5.1-2
Commit: 32cec99465e667e98010da87140a9eb80bfca743
Parents: 24eccb8
Author: Roman Shtykh <ap...@gmail.com>
Authored: Fri Dec 18 15:09:00 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Fri Dec 18 15:09:00 2015 +0300
----------------------------------------------------------------------
RELEASE_NOTES.txt | 1 +
.../datagrid/CacheEntryProcessorExample.java | 157 +++++++++++++++++++
.../datagrid/CacheEntryProcessorExample.java | 147 +++++++++++++++++
.../ScalarCacheEntryProcessorExample.scala | 125 +++++++++++++++
.../ignite/examples/CacheExamplesSelfTest.java | 8 +
.../java8/examples/CacheExamplesSelfTest.java | 8 +
.../tests/examples/ScalarExamplesSelfTest.scala | 5 +
7 files changed, 451 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/32cec994/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 243ec18..b0822c9 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -18,6 +18,7 @@ Apache Ignite In-Memory Data Fabric 1.5
* Fixed and improved cache types configuration.
* Fixed cache rebalancing.
* Many stability and fault-tolerance fixes.
+* Added example to demonstrate the usage of EntryProcessor.
Complete list of closed issues: https://issues.apache.org/jira/issues/?jql=project%20%3D%20IGNITE%20AND%20fixVersion%20%3D%201.5%20AND%20status%20%3D%20closed
http://git-wip-us.apache.org/repos/asf/ignite/blob/32cec994/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheEntryProcessorExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheEntryProcessorExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheEntryProcessorExample.java
new file mode 100644
index 0000000..38d9631
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheEntryProcessorExample.java
@@ -0,0 +1,157 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+package org.apache.ignite.examples.datagrid;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import javax.cache.processor.EntryProcessor;
+import javax.cache.processor.EntryProcessorException;
+import javax.cache.processor.MutableEntry;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.examples.ExampleNodeStartup;
+
+/**
+ * This example demonstrates the simplest code that populates the distributed cache
+ * and co-locates simple closure execution with each key. The goal of this particular
+ * example is to provide the simplest code example of this logic using EntryProcessor.
+ * <p>
+ * Remote nodes should always be started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}.
+ * <p>
+ * Alternatively you can run {@link ExampleNodeStartup} in another JVM which will
+ * start node with {@code examples/config/example-ignite.xml} configuration.
+ */
+public class CacheEntryProcessorExample {
+ /** Cache name. */
+ private static final String CACHE_NAME = CacheEntryProcessorExample.class.getSimpleName();
+
+ /** Number of keys. */
+ private static final int KEY_CNT = 20;
+
+ /** Keys predefined set. */
+ private static final Set<Integer> KEYS_SET;
+
+ /**
+ * Initializes keys set that is used in bulked operations in the example.
+ */
+ static {
+ KEYS_SET = new HashSet<>();
+
+ for (int i = 0; i < KEY_CNT; i++)
+ KEYS_SET.add(i);
+ }
+
+ /**
+ * Executes example.
+ *
+ * @param args Command line arguments, none required.
+ * @throws IgniteException If example execution failed.
+ */
+ public static void main(String[] args) throws IgniteException {
+ try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+ System.out.println();
+ System.out.println(">>> Entry processor example started.");
+
+ try (IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(CACHE_NAME)) {
+ // Demonstrates usage of EntryProcessor.invoke(...) method.
+ populateEntriesWithInvoke(cache);
+
+ // Demonstrates usage of EntryProcessor.invokeAll(...) method.
+ incrementEntriesWithInvokeAll(cache);
+ }
+ }
+ }
+
+ /**
+ * Populates cache with values using {@link IgniteCache#invoke(Object, EntryProcessor, Object...)} method.
+ *
+ * @param cache Cache that must be populated.
+ */
+ private static void populateEntriesWithInvoke(IgniteCache<Integer, Integer> cache) {
+ // Must be no entry in the cache at this point.
+ printCacheEntries(cache);
+
+ System.out.println("");
+ System.out.println(">> Populating the cache using EntryProcessor.");
+
+ // Invokes EntryProcessor for every key sequentially.
+ for (int i = 0; i < KEY_CNT; i++) {
+ cache.invoke(i, new EntryProcessor<Integer, Integer, Object>() {
+ @Override public Object process(MutableEntry<Integer, Integer> entry,
+ Object... objects) throws EntryProcessorException {
+ // Initializes entry's value if it's not set.
+ if (entry.getValue() == null)
+ entry.setValue((entry.getKey() + 1) * 10);
+
+ return null;
+ }
+ });
+ }
+
+ // Print outs entries that are set using the EntryProcessor above.
+ printCacheEntries(cache);
+ }
+
+ /**
+ * Increments values of entries stored in the cache using
+ * {@link IgniteCache#invokeAll(Set, EntryProcessor, Object...)} method.
+ *
+ * @param cache Cache instance.
+ */
+ private static void incrementEntriesWithInvokeAll(IgniteCache<Integer, Integer> cache) {
+ System.out.println("");
+ System.out.println(">> Incrementing values in the cache using EntryProcessor.");
+
+ // Using EntryProcessor.invokeAll to increment every value in place.
+ cache.invokeAll(KEYS_SET, new EntryProcessor<Integer, Integer, Object>() {
+ @Override public Object process(MutableEntry<Integer, Integer> entry,
+ Object... arguments) throws EntryProcessorException {
+
+ entry.setValue(entry.getValue() + 5);
+
+ return null;
+ }
+ });
+
+ // Print outs entries that are incremented using the EntryProcessor above.
+ printCacheEntries(cache);
+ }
+
+ /**
+ * Prints out all the entries that are stored in a cache.
+ *
+ * @param cache Cache.
+ */
+ private static void printCacheEntries(IgniteCache<Integer, Integer> cache) {
+ System.out.println();
+ System.out.println(">>> Entries in the cache.");
+
+ Map<Integer, Integer> entries = cache.getAll(KEYS_SET);
+
+ if (entries.isEmpty())
+ System.out.println("No entries in the cache.");
+ else {
+ for (Map.Entry<Integer, Integer> entry : entries.entrySet())
+ System.out.println("Entry [key=" + entry.getKey() + ", value=" + entry.getValue() + ']');
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/32cec994/examples/src/main/java8/org/apache/ignite/examples/java8/datagrid/CacheEntryProcessorExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/datagrid/CacheEntryProcessorExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/datagrid/CacheEntryProcessorExample.java
new file mode 100644
index 0000000..fd07fa5
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/datagrid/CacheEntryProcessorExample.java
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+package org.apache.ignite.examples.java8.datagrid;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import javax.cache.processor.EntryProcessor;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.examples.ExampleNodeStartup;
+
+/**
+ * This example demonstrates the simplest code that populates the distributed cache and co-locates simple closure
+ * execution with each key. The goal of this particular example is to provide the simplest code example of this logic
+ * using EntryProcessor.
+ * <p>
+ * Remote nodes should always be started with special configuration file which enables P2P
+ * class loading: {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}.
+ * <p>
+ * Alternatively you can run {@link ExampleNodeStartup} in another JVM which will start node with
+ * {@code examples/config/example-ignite.xml} configuration.
+ */
+public class CacheEntryProcessorExample {
+ /** Cache name. */
+ private static final String CACHE_NAME = CacheEntryProcessorExample.class.getSimpleName();
+
+ /** Number of keys. */
+ private static final int KEY_CNT = 20;
+
+ /** Set of predefined keys. */
+ private static final Set<Integer> KEYS_SET;
+
+ /**
+ * Initializes keys set that is used in bulked operations in the example.
+ */
+ static {
+ KEYS_SET = new HashSet<>();
+
+ for (int i = 0; i < KEY_CNT; i++)
+ KEYS_SET.add(i);
+ }
+
+ /**
+ * Executes example.
+ *
+ * @param args Command line arguments, none required.
+ * @throws IgniteException If example execution failed.
+ */
+ public static void main(String[] args) throws IgniteException {
+ try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+ System.out.println();
+ System.out.println(">>> Entry processor example started.");
+
+ try (IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(CACHE_NAME)) {
+ // Demonstrates usage of EntryProcessor.invoke(...) method.
+ populateEntriesWithInvoke(cache);
+
+ // Demonstrates usage of EntryProcessor.invokeAll(...) method.
+ incrementEntriesWithInvokeAll(cache);
+ }
+ }
+ }
+
+ /**
+ * Populates cache with values using {@link IgniteCache#invoke(Object, EntryProcessor, Object...)} method.
+ *
+ * @param cache Cache that must be populated.
+ */
+ private static void populateEntriesWithInvoke(IgniteCache<Integer, Integer> cache) {
+ // Must be no entry in the cache at this point.
+ printCacheEntries(cache);
+
+ System.out.println("");
+ System.out.println(">> Populating the cache using EntryProcessor.");
+
+ // Invokes EntryProcessor for every key sequentially.
+ for (int i = 0; i < KEY_CNT; i++) {
+ cache.invoke(i, (entry, object) -> {
+ // Initializes entry's value if it's not set.
+ if (entry.getValue() == null)
+ entry.setValue((entry.getKey() + 1) * 10);
+ return null;
+ });
+ }
+
+ // Print outs entries that are set using the EntryProcessor above.
+ printCacheEntries(cache);
+ }
+
+ /**
+ * Increments values of entries stored in the cache using {@link IgniteCache#invokeAll(Set, EntryProcessor,
+ * Object...)} method.
+ *
+ * @param cache Cache instance.
+ */
+ private static void incrementEntriesWithInvokeAll(IgniteCache<Integer, Integer> cache) {
+ System.out.println("");
+ System.out.println(">> Incrementing values in the cache using EntryProcessor.");
+
+ // Using EntryProcessor.invokeAll to increment every value in place.
+ cache.invokeAll(KEYS_SET, (entry, object) -> {
+ entry.setValue(entry.getValue() + 5);
+
+ return null;
+ });
+
+ // Print outs entries that are incremented using the EntryProcessor above.
+ printCacheEntries(cache);
+ }
+
+ /**
+ * Prints out all the entries that are stored in a cache.
+ *
+ * @param cache Cache.
+ */
+ private static void printCacheEntries(IgniteCache<Integer, Integer> cache) {
+ System.out.println();
+ System.out.println(">>> Entries in the cache.");
+
+ Map<Integer, Integer> entries = cache.getAll(KEYS_SET);
+
+ if (entries.isEmpty())
+ System.out.println("No entries in the cache.");
+ else {
+ for (Map.Entry<Integer, Integer> entry : entries.entrySet())
+ System.out.println("Entry [key=" + entry.getKey() + ", value=" + entry.getValue() + ']');
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/32cec994/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheEntryProcessorExample.scala
----------------------------------------------------------------------
diff --git a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheEntryProcessorExample.scala b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheEntryProcessorExample.scala
new file mode 100644
index 0000000..ffcbbfd
--- /dev/null
+++ b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheEntryProcessorExample.scala
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+package org.apache.ignite.scalar.examples
+
+import javax.cache.processor.{EntryProcessor, MutableEntry}
+
+import org.apache.ignite.IgniteCache
+import org.apache.ignite.scalar.scalar
+import org.apache.ignite.scalar.scalar._
+
+/**
+ * This example demonstrates the simplest code that populates the distributed cache
+ * and co-locates simple closure execution with each key. The goal of this particular
+ * example is to provide the simplest code example of this logic using EntryProcessor.
+ * <p>
+ * Remote nodes should always be started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}.
+ * <p>
+ * Alternatively you can run {@link ExampleNodeStartup} in another JVM which will
+ * start node with {@code examples/config/example-ignite.xml} configuration.
+ */
+object ScalarCacheEntryProcessorExample extends App {
+ /** Configuration file name. */
+ private val CONFIG = "examples/config/example-ignite.xml"
+
+ /** Name of cache. */
+ private val CACHE_NAME = ScalarCacheEntryProcessorExample.getClass.getSimpleName
+
+ /** Number of keys. */
+ private val KEY_CNT = 20
+
+ /** Type alias. */
+ type Cache = IgniteCache[String, Int]
+
+ /*
+ * Note that in case of `LOCAL` configuration,
+ * since there is no distribution, values may come back as `nulls`.
+ */
+ scalar(CONFIG) {
+ println()
+ println(">>> Entry processor example started.")
+
+ val cache = createCache$[String, Int](CACHE_NAME)
+
+ try {
+ populateEntriesWithInvoke(cache)
+
+ checkEntriesInCache(cache)
+
+ incrementEntriesWithInvoke(cache)
+
+ checkEntriesInCache(cache)
+ }
+ finally {
+ cache.destroy()
+ }
+ }
+
+ private def checkEntriesInCache(cache: Cache) {
+ println()
+ println(">>> Entries in the cache.")
+
+ (0 until KEY_CNT).foreach(i =>
+ println("Entry: " + cache.get(i.toString)))
+ }
+
+ /**
+ * Runs jobs on primary nodes with {@link IgniteCache#invoke(Object, CacheEntryProcessor, Object...)} to create
+ * entries when they don't exist.
+ *
+ * @param cache Cache to populate.
+ */
+ private def populateEntriesWithInvoke(cache: Cache) {
+ (0 until KEY_CNT).foreach(i =>
+ cache.invoke(i.toString,
+ new EntryProcessor[String, Int, Object]() {
+ override def process(e: MutableEntry[String, Int], args: AnyRef*): Object = {
+ if (e.getValue == null)
+ e.setValue(i)
+
+ null
+ }
+ }
+ )
+ )
+ }
+
+ /**
+ * Runs jobs on primary nodes with {@link IgniteCache#invoke(Object, CacheEntryProcessor, Object...)} to increment
+ * entries values.
+ *
+ * @param cache Cache to populate.
+ */
+ private def incrementEntriesWithInvoke(cache: Cache) {
+ println()
+ println(">>> Incrementing values.")
+
+ (0 until KEY_CNT).foreach(i =>
+ cache.invoke(i.toString,
+ new EntryProcessor[String, Int, Object]() {
+ override def process(e: MutableEntry[String, Int], args: AnyRef*): Object = {
+ Option(e.getValue) foreach (v => e.setValue(v + 1))
+
+ null
+ }
+ }
+ )
+ )
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/32cec994/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java
----------------------------------------------------------------------
diff --git a/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java
index 050c59f..39c2ea6 100644
--- a/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java
+++ b/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java
@@ -18,6 +18,7 @@
package org.apache.ignite.examples;
import org.apache.ignite.examples.datagrid.CacheAffinityExample;
+import org.apache.ignite.examples.datagrid.CacheEntryProcessorExample;
import org.apache.ignite.examples.datagrid.CacheApiExample;
import org.apache.ignite.examples.datagrid.CacheContinuousQueryExample;
import org.apache.ignite.examples.datagrid.CacheDataStreamerExample;
@@ -49,6 +50,13 @@ public class CacheExamplesSelfTest extends GridAbstractExamplesTest {
/**
* @throws Exception If failed.
*/
+ public void testCacheEntryProcessorExample() throws Exception {
+ CacheEntryProcessorExample.main(EMPTY_ARGS);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testCacheAtomicLongExample() throws Exception {
IgniteAtomicLongExample.main(EMPTY_ARGS);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/32cec994/examples/src/test/java8/org/apache/ignite/java8/examples/CacheExamplesSelfTest.java
----------------------------------------------------------------------
diff --git a/examples/src/test/java8/org/apache/ignite/java8/examples/CacheExamplesSelfTest.java b/examples/src/test/java8/org/apache/ignite/java8/examples/CacheExamplesSelfTest.java
index 4446521..e44fec3 100644
--- a/examples/src/test/java8/org/apache/ignite/java8/examples/CacheExamplesSelfTest.java
+++ b/examples/src/test/java8/org/apache/ignite/java8/examples/CacheExamplesSelfTest.java
@@ -18,6 +18,7 @@
package org.apache.ignite.java8.examples;
import org.apache.ignite.examples.java8.datagrid.CacheAffinityExample;
+import org.apache.ignite.examples.java8.datagrid.CacheEntryProcessorExample;
import org.apache.ignite.examples.java8.datagrid.CacheApiExample;
import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
@@ -36,6 +37,13 @@ public class CacheExamplesSelfTest extends GridAbstractExamplesTest {
CacheAffinityExample.main(EMPTY_ARGS);
}
+ /**
+ * @throws Exception If failed.
+ */
+ public void testCacheEntryProcessorExample() throws Exception {
+ CacheEntryProcessorExample.main(EMPTY_ARGS);
+ }
+
// TODO: IGNITE-711 next example(s) should be implemented for java 8
// or testing method(s) should be removed if example(s) does not applicable for java 8.
// /**
http://git-wip-us.apache.org/repos/asf/ignite/blob/32cec994/examples/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarExamplesSelfTest.scala
----------------------------------------------------------------------
diff --git a/examples/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarExamplesSelfTest.scala b/examples/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarExamplesSelfTest.scala
index ef56434..94c41ad 100644
--- a/examples/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarExamplesSelfTest.scala
+++ b/examples/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarExamplesSelfTest.scala
@@ -35,6 +35,11 @@ class ScalarExamplesSelfTest extends GridAbstractExamplesTest with JUnitSuiteLik
}
/** */
+ def testScalarCacheEntryProcessorExample() {
+ ScalarCacheEntryProcessorExample.main(EMPTY_ARGS)
+ }
+
+ /** */
def testScalarCacheExample() {
ScalarCacheExample.main(EMPTY_ARGS)
}
[02/13] ignite git commit: Fixed cache store examples
Posted by av...@apache.org.
Fixed cache store examples
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e1b2cf28
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e1b2cf28
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e1b2cf28
Branch: refs/heads/ignite-1.5.1-2
Commit: e1b2cf2840b1451dbfc0bbef4540e5a9edaf6c35
Parents: 889b268
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Thu Dec 17 16:05:09 2015 -0800
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Thu Dec 17 16:05:09 2015 -0800
----------------------------------------------------------------------
.../hibernate/CacheHibernateStoreExample.java | 8 +
.../datagrid/store/hibernate/Person.hbm.xml | 6 +-
.../datagrid/store/hibernate/hibernate.cfg.xml | 7 +-
.../store/spring/CacheSpringPersonStore.java | 118 ++++++++++++++
.../store/spring/CacheSpringStoreExample.java | 155 +++++++++++++++++++
.../datagrid/store/spring/package-info.java | 22 +++
6 files changed, 311 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e1b2cf28/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java b/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
index 71c4f68..db34eaf 100644
--- a/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
+++ b/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
@@ -30,6 +30,7 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.examples.ExampleNodeStartup;
import org.apache.ignite.examples.ExamplesUtils;
import org.apache.ignite.examples.model.Person;
+import org.apache.ignite.examples.util.DbH2ServerStartup;
import org.apache.ignite.transactions.Transaction;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -39,6 +40,13 @@ import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
* <p>
* This example uses {@link CacheHibernatePersonStore} as a persistent store.
* <p>
+ * To start the example, you should:
+ * <ul>
+ * <li>Start H2 database TCP server using {@link DbH2ServerStartup}.</li>
+ * <li>Start a few nodes using {@link ExampleNodeStartup}.</li>
+ * <li>Start example using {@link CacheHibernateStoreExample}.</li>
+ * </ul>
+ * <p>
* Remote nodes can be started with {@link ExampleNodeStartup} in another JVM which will
* start node with {@code examples/config/example-ignite.xml} configuration.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/e1b2cf28/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml
----------------------------------------------------------------------
diff --git a/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml b/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml
index 1314b71..0728a03 100644
--- a/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml
+++ b/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml
@@ -23,12 +23,12 @@
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-access="field">
- <class name="org.apache.ignite.examples.model.Person" table="PERSONS">
+ <class name="org.apache.ignite.examples.model.Person" table="PERSON">
<!-- ID. -->
<id name="id"/>
<!-- We only map data we are interested in. -->
- <property name="firstName"/>
- <property name="lastName"/>
+ <property name="firstName" column="first_name"/>
+ <property name="lastName" column="last_name"/>
</class>
</hibernate-mapping>
http://git-wip-us.apache.org/repos/asf/ignite/blob/e1b2cf28/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/hibernate.cfg.xml
----------------------------------------------------------------------
diff --git a/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/hibernate.cfg.xml b/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/hibernate.cfg.xml
index 80a43e7..7bf70af 100644
--- a/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/hibernate.cfg.xml
+++ b/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/hibernate.cfg.xml
@@ -26,8 +26,11 @@
-->
<hibernate-configuration>
<session-factory>
- <!-- Database connection settings (private in-memory database). -->
- <property name="connection.url">jdbc:h2:mem:example;DB_CLOSE_DELAY=-1</property>
+ <!-- Database connection URL. -->
+ <property name="connection.url">jdbc:h2:tcp://localhost/mem:ExampleDb</property>
+
+ <!-- Database connection username. -->
+ <property name="connection.username">sa</property>
<!-- Only validate the database schema on startup in production mode. -->
<property name="hbm2ddl.auto">update</property>
http://git-wip-us.apache.org/repos/asf/ignite/blob/e1b2cf28/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringPersonStore.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringPersonStore.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringPersonStore.java
new file mode 100644
index 0000000..c4b52bb
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringPersonStore.java
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+package org.apache.ignite.examples.datagrid.store.spring;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.concurrent.atomic.AtomicInteger;
+import javax.cache.Cache;
+import javax.cache.integration.CacheLoaderException;
+import javax.sql.DataSource;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cache.store.CacheStore;
+import org.apache.ignite.cache.store.CacheStoreAdapter;
+import org.apache.ignite.examples.model.Person;
+import org.apache.ignite.lang.IgniteBiInClosure;
+import org.h2.jdbcx.JdbcConnectionPool;
+import org.springframework.dao.EmptyResultDataAccessException;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.core.RowCallbackHandler;
+import org.springframework.jdbc.core.RowMapper;
+
+/**
+ * Example of {@link CacheStore} implementation that uses JDBC
+ * transaction with cache transactions and maps {@link Long} to {@link Person}.
+ */
+public class CacheSpringPersonStore extends CacheStoreAdapter<Long, Person> {
+ /** Data source. */
+ public static final DataSource DATA_SRC =
+ JdbcConnectionPool.create("jdbc:h2:tcp://localhost/mem:ExampleDb", "sa", "");
+
+ /** Spring JDBC template. */
+ private JdbcTemplate jdbcTemplate;
+
+ /**
+ * Constructor.
+ *
+ * @throws IgniteException If failed.
+ */
+ public CacheSpringPersonStore() throws IgniteException {
+ jdbcTemplate = new JdbcTemplate(DATA_SRC);
+ }
+
+ /** {@inheritDoc} */
+ @Override public Person load(Long key) {
+ System.out.println(">>> Store load [key=" + key + ']');
+
+ try {
+ return jdbcTemplate.queryForObject("select * from PERSON where id = ?", new RowMapper<Person>() {
+ @Override public Person mapRow(ResultSet rs, int rowNum) throws SQLException {
+ return new Person(rs.getLong(1), rs.getString(2), rs.getString(3));
+ }
+ }, key);
+ }
+ catch (EmptyResultDataAccessException ignored) {
+ return null;
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void write(Cache.Entry<? extends Long, ? extends Person> entry) {
+ Long key = entry.getKey();
+ Person val = entry.getValue();
+
+ System.out.println(">>> Store write [key=" + key + ", val=" + val + ']');
+
+ int updated = jdbcTemplate.update("update PERSON set first_name = ?, last_name = ? where id = ?",
+ val.firstName, val.lastName, val.id);
+
+ if (updated == 0) {
+ jdbcTemplate.update("insert into PERSON (id, first_name, last_name) values (?, ?, ?)",
+ val.id, val.firstName, val.lastName);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void delete(Object key) {
+ System.out.println(">>> Store delete [key=" + key + ']');
+
+ jdbcTemplate.update("delete from PERSON where id = ?", key);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void loadCache(final IgniteBiInClosure<Long, Person> clo, Object... args) {
+ if (args == null || args.length == 0 || args[0] == null)
+ throw new CacheLoaderException("Expected entry count parameter is not provided.");
+
+ int entryCnt = (Integer)args[0];
+
+ final AtomicInteger cnt = new AtomicInteger();
+
+ jdbcTemplate.query("select * from PERSON limit ?", new RowCallbackHandler() {
+ @Override public void processRow(ResultSet rs) throws SQLException {
+ Person person = new Person(rs.getLong(1), rs.getString(2), rs.getString(3));
+
+ clo.apply(person.id, person);
+
+ cnt.incrementAndGet();
+ }
+ }, entryCnt);
+
+ System.out.println(">>> Loaded " + cnt + " values into cache.");
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e1b2cf28/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringStoreExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringStoreExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringStoreExample.java
new file mode 100644
index 0000000..5380fce
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringStoreExample.java
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+package org.apache.ignite.examples.datagrid.store.spring;
+
+import java.util.UUID;
+import javax.cache.configuration.Factory;
+import javax.cache.configuration.FactoryBuilder;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.store.CacheStoreSessionListener;
+import org.apache.ignite.cache.store.spring.CacheSpringStoreSessionListener;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.examples.ExampleNodeStartup;
+import org.apache.ignite.examples.ExamplesUtils;
+import org.apache.ignite.examples.model.Person;
+import org.apache.ignite.examples.util.DbH2ServerStartup;
+import org.apache.ignite.transactions.Transaction;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+
+/**
+ * Demonstrates usage of cache with underlying persistent store configured.
+ * <p>
+ * This example uses {@link CacheSpringPersonStore} as a persistent store.
+ * <p>
+ * To start the example, you should:
+ * <ul>
+ * <li>Start H2 database TCP server using {@link DbH2ServerStartup}.</li>
+ * <li>Start a few nodes using {@link ExampleNodeStartup}.</li>
+ * <li>Start example using {@link CacheSpringStoreExample}.</li>
+ * </ul>
+ * <p>
+ * Remote nodes can be started with {@link ExampleNodeStartup} in another JVM which will
+ * start node with {@code examples/config/example-ignite.xml} configuration.
+ */
+public class CacheSpringStoreExample {
+ /** Cache name. */
+ private static final String CACHE_NAME = CacheSpringStoreExample.class.getSimpleName();
+
+ /** Heap size required to run this example. */
+ public static final int MIN_MEMORY = 1024 * 1024 * 1024;
+
+ /** Number of entries to load. */
+ private static final int ENTRY_COUNT = 100_000;
+
+ /** Global person ID to use across entire example. */
+ private static final Long id = Math.abs(UUID.randomUUID().getLeastSignificantBits());
+
+ /**
+ * Executes example.
+ *
+ * @param args Command line arguments, none required.
+ * @throws IgniteException If example execution failed.
+ */
+ public static void main(String[] args) throws IgniteException {
+ ExamplesUtils.checkMinMemory(MIN_MEMORY);
+
+ // To start ignite with desired configuration uncomment the appropriate line.
+ try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+ System.out.println();
+ System.out.println(">>> Cache store example started.");
+
+ CacheConfiguration<Long, Person> cacheCfg = new CacheConfiguration<>(CACHE_NAME);
+
+ // Set atomicity as transaction, since we are showing transactions in example.
+ cacheCfg.setAtomicityMode(TRANSACTIONAL);
+
+ // Configure Spring store.
+ cacheCfg.setCacheStoreFactory(FactoryBuilder.factoryOf(CacheSpringPersonStore.class));
+
+ // Configure Spring session listener.
+ cacheCfg.setCacheStoreSessionListenerFactories(new Factory<CacheStoreSessionListener>() {
+ @Override public CacheStoreSessionListener create() {
+ CacheSpringStoreSessionListener lsnr = new CacheSpringStoreSessionListener();
+
+ lsnr.setDataSource(CacheSpringPersonStore.DATA_SRC);
+
+ return lsnr;
+ }
+ });
+
+ cacheCfg.setReadThrough(true);
+ cacheCfg.setWriteThrough(true);
+
+ try (IgniteCache<Long, Person> cache = ignite.getOrCreateCache(cacheCfg)) {
+ // Make initial cache loading from persistent store. This is a
+ // distributed operation and will call CacheStore.loadCache(...)
+ // method on all nodes in topology.
+ loadCache(cache);
+
+ // Start transaction and execute several cache operations with
+ // read/write-through to persistent store.
+ executeTransaction(cache);
+ }
+ }
+ }
+
+ /**
+ * Makes initial cache loading.
+ *
+ * @param cache Cache to load.
+ */
+ private static void loadCache(IgniteCache<Long, Person> cache) {
+ long start = System.currentTimeMillis();
+
+ // Start loading cache from persistent store on all caching nodes.
+ cache.loadCache(null, ENTRY_COUNT);
+
+ long end = System.currentTimeMillis();
+
+ System.out.println(">>> Loaded " + cache.size() + " keys with backups in " + (end - start) + "ms.");
+ }
+
+ /**
+ * Executes transaction with read/write-through to persistent store.
+ *
+ * @param cache Cache to execute transaction on.
+ */
+ private static void executeTransaction(IgniteCache<Long, Person> cache) {
+ try (Transaction tx = Ignition.ignite().transactions().txStart()) {
+ Person val = cache.get(id);
+
+ System.out.println("Read value: " + val);
+
+ val = cache.getAndPut(id, new Person(id, "Isaac", "Newton"));
+
+ System.out.println("Overwrote old value: " + val);
+
+ val = cache.get(id);
+
+ System.out.println("Read value: " + val);
+
+ tx.commit();
+ }
+
+ System.out.println("Read value after commit: " + cache.get(id));
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e1b2cf28/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/package-info.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/package-info.java
new file mode 100644
index 0000000..211239f
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+/**
+ * <!-- Package description. -->
+ * Contains Spring-based cache store implementation.
+ */
+package org.apache.ignite.examples.datagrid.store.spring;
[03/13] ignite git commit: Fixed CacheEntry toString()
Posted by av...@apache.org.
Fixed CacheEntry toString()
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a4b547bd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a4b547bd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a4b547bd
Branch: refs/heads/ignite-1.5.1-2
Commit: a4b547bd11ca3bf4a5cdfaac3ad01936cf6e995e
Parents: e1b2cf2
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Thu Dec 17 17:07:26 2015 -0800
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Thu Dec 17 17:07:26 2015 -0800
----------------------------------------------------------------------
.../internal/processors/cache/CacheEntryImpl.java | 6 +++---
.../processors/cache/CacheEntryImplEx.java | 17 ++++++++++++++---
2 files changed, 17 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a4b547bd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl.java
index 71c684a..48649d2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl.java
@@ -81,10 +81,10 @@ public class CacheEntryImpl<K, V> implements Cache.Entry<K, V>, Externalizable {
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public <T> T unwrap(Class<T> cls) {
- if(cls.isAssignableFrom(getClass()))
+ if (cls.isAssignableFrom(getClass()))
return cls.cast(this);
- if (ver != null && cls.isAssignableFrom(CacheEntry.class))
+ if (cls.isAssignableFrom(CacheEntry.class))
return (T)new CacheEntryImplEx<>(key, val, ver);
throw new IllegalArgumentException("Unwrapping to class is not supported: " + cls);
@@ -106,4 +106,4 @@ public class CacheEntryImpl<K, V> implements Cache.Entry<K, V>, Externalizable {
public String toString() {
return "Entry [key=" + key + ", val=" + val + ']';
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a4b547bd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImplEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImplEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImplEx.java
index f3e6c18..1c7111a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImplEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImplEx.java
@@ -78,7 +78,18 @@ public class CacheEntryImplEx<K, V> extends CacheEntryImpl<K, V> implements Cach
/** {@inheritDoc} */
public String toString() {
- return "VersionedEntry [key=" + getKey() + ", val=" + getValue() + ", topVer=" + ver.topologyVersion() +
- ", nodeOrder=" + ver.nodeOrder() + ", order=" + ver.order() + ", updateTime=" + ver.globalTime() + ']';
+ String res = "CacheEntry [key=" + getKey() +
+ ", val=" + getValue();
+
+ if (ver != null) {
+ res += ", topVer=" + ver.topologyVersion() +
+ ", nodeOrder=" + ver.nodeOrder() +
+ ", order=" + ver.order() +
+ ", updateTime=" + ver.globalTime();
+ }
+ else
+ res += ", ver=n/a";
+
+ return res + ']';
}
-}
\ No newline at end of file
+}
[07/13] ignite git commit: IGNITE-2199: Java 8 compile error fix
(ambiguous reference to assertEquals) - Fixes #351.
Posted by av...@apache.org.
IGNITE-2199: Java 8 compile error fix (ambiguous reference to assertEquals) - Fixes #351.
Signed-off-by: Alexey Goncharuk <al...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1a2ebdd0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1a2ebdd0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1a2ebdd0
Branch: refs/heads/ignite-1.5.1-2
Commit: 1a2ebdd0bef4a3dd68551ccda09111c1646c76c6
Parents: b1f9065
Author: shtykh_roman <rs...@yahoo.com>
Authored: Fri Dec 18 12:27:40 2015 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Dec 18 12:27:40 2015 +0300
----------------------------------------------------------------------
.../cache/IgniteCacheBinaryEntryProcessorSelfTest.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1a2ebdd0/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheBinaryEntryProcessorSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheBinaryEntryProcessorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheBinaryEntryProcessorSelfTest.java
index 8e20c3e..a6c2b44 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheBinaryEntryProcessorSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheBinaryEntryProcessorSelfTest.java
@@ -162,11 +162,11 @@ public class IgniteCacheBinaryEntryProcessorSelfTest extends GridCommonAbstractT
assertEquals("updated-" + i, updated.stringValue());
BinaryObject updatedBinary = nodeBinaryCache.get(i);
- assertEquals(i + 1, updatedBinary.field("val"));
+ assertEquals(new Integer(i + 1), updatedBinary.field("val"));
assertEquals("updated-" + i, updatedBinary.field("strVal"));
updatedBinary = nodeBinaryCache.get(-(i + 1));
- assertEquals(i + 1, updatedBinary.field("val"));
+ assertEquals(new Integer(i + 1), updatedBinary.field("val"));
assertEquals("updated-" + i, updatedBinary.field("strVal"));
}
}
[06/13] ignite git commit: ignite-1.5 Properly handle duplicated job
responses in GridTaskWorker.onResponse. Use correct 'initialRebalanceFuture'
for client nodes.
Posted by av...@apache.org.
ignite-1.5 Properly handle duplicated job responses in GridTaskWorker.onResponse. Use correct 'initialRebalanceFuture' for client nodes.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b1f90655
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b1f90655
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b1f90655
Branch: refs/heads/ignite-1.5.1-2
Commit: b1f906555cea8990dd39e8050ca4348f09da7f7f
Parents: 301e7a1
Author: sboikov <sb...@gridgain.com>
Authored: Fri Dec 18 12:08:20 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Dec 18 12:08:20 2015 +0300
----------------------------------------------------------------------
.../ClientAbstractConnectivitySelfTest.java | 2 +-
.../internal/cluster/ClusterGroupAdapter.java | 10 +-
.../dht/preloader/GridDhtPreloader.java | 2 +-
.../processors/task/GridTaskWorker.java | 8 +-
.../internal/util/lang/GridNodePredicate.java | 13 +-
.../ignite/internal/util/nio/GridNioServer.java | 11 +-
.../util/nio/GridSelectorNioSessionImpl.java | 7 +
.../TcpDiscoveryMulticastIpFinder.java | 12 +-
.../ignite/internal/ClusterGroupSelfTest.java | 32 ++-
.../IgniteClientReconnectCacheTest.java | 7 +-
.../ignite/internal/TaskNodeRestartTest.java | 230 +++++++++++++++++++
.../IgniteCacheSizeFailoverTest.java | 4 +-
.../random/RandomEvictionPolicySelfTest.java | 4 +-
.../GridServiceProcessorStopSelfTest.java | 18 +-
.../IgniteMessagingWithClientTest.java | 2 -
.../GridSessionCheckpointAbstractSelfTest.java | 3 +-
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 2 +-
.../testsuites/IgniteComputeGridTestSuite.java | 2 +
18 files changed, 340 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b1f90655/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractConnectivitySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractConnectivitySelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractConnectivitySelfTest.java
index ef18a29..8207ccf 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractConnectivitySelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractConnectivitySelfTest.java
@@ -134,7 +134,7 @@ public abstract class ClientAbstractConnectivitySelfTest extends GridCommonAbstr
/**
* Simple test of address list filtering.
- * @throws Exception
+ * @throws Exception If failed.
*/
public void testResolveReachableOneAddress() throws Exception {
InetAddress addr = InetAddress.getByAddress(new byte[] {127, 0, 0, 1} );
http://git-wip-us.apache.org/repos/asf/ignite/blob/b1f90655/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
index 9039ed8..75168a1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
@@ -626,7 +626,15 @@ public class ClusterGroupAdapter implements ClusterGroupEx, Externalizable {
/** {@inheritDoc} */
@Override public final ClusterGroup forRandom() {
- return ids != null ? forNodeId(F.rand(ids)) : forNode(F.rand(nodes()));
+ if (!F.isEmpty(ids))
+ return forNodeId(F.rand(ids));
+
+ Collection<ClusterNode> nodes = nodes();
+
+ if (nodes.isEmpty())
+ return new ClusterGroupAdapter(ctx, null, Collections.<UUID>emptySet());
+
+ return forNode(F.rand(nodes));
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/b1f90655/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
index 9a6246f..c46a66c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
@@ -482,7 +482,7 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
/** {@inheritDoc} */
@Override public IgniteInternalFuture<?> initialRebalanceFuture() {
- return cctx.kernalContext().clientNode() ? new GridFinishedFuture<>(true) : initRebalanceFut;
+ return cctx.kernalContext().clientNode() ? startFut : initRebalanceFut;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/b1f90655/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
index 9315d7c..59d3f90 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
@@ -696,8 +696,9 @@ class GridTaskWorker<T, R> extends GridWorker implements GridTimeoutObject {
if (log.isDebugEnabled())
U.warn(log, "Received response for unknown child job (was job presumed failed?): " + res);
- selfOccupied = true;
+ res = delayedRess.poll();
+ // We can not return here because there can be more delayed messages in the queue.
continue;
}
@@ -708,7 +709,10 @@ class GridTaskWorker<T, R> extends GridWorker implements GridTimeoutObject {
if (log.isDebugEnabled())
log.debug("Received redundant response for a job (will ignore): " + res);
- return;
+ res = delayedRess.poll();
+
+ // We can not return here because there can be more delayed messages in the queue.
+ continue;
}
if (!jobRes.getNode().id().equals(res.getNodeId())) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/b1f90655/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridNodePredicate.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridNodePredicate.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridNodePredicate.java
index 4ce0b35..edec862 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridNodePredicate.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridNodePredicate.java
@@ -100,13 +100,18 @@ public class GridNodePredicate implements IgnitePredicate<ClusterNode>, Iterable
public GridNodePredicate(@Nullable ClusterNode... nodes) {
if (F.isEmpty(nodes))
ids = Collections.emptySet();
- else if (nodes.length == 1)
- ids = Collections.singleton(nodes[0].id());
+ else if (nodes.length == 1) {
+ ClusterNode node = nodes[0];
+
+ ids = node != null ? Collections.singleton(node.id()) : Collections.<UUID>emptySet();
+ }
else {
ids = U.newHashSet(nodes.length);
- for (ClusterNode n : nodes)
- ids.add(n.id());
+ for (ClusterNode n : nodes) {
+ if (n != null)
+ ids.add(n.id());
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b1f90655/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
index 53cec84..be28c30 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
@@ -425,10 +425,10 @@ public class GridNioServer<T> {
int msgCnt = sys ? ses.offerSystemFuture(fut) : ses.offerFuture(fut);
- IgniteInClosure<IgniteException> ackClosure;
+ IgniteInClosure<IgniteException> ackC;
- if (!sys && (ackClosure = ses.removeMeta(ACK_CLOSURE.ordinal())) != null)
- fut.ackClosure(ackClosure);
+ if (!sys && (ackC = ses.removeMeta(ACK_CLOSURE.ordinal())) != null)
+ fut.ackClosure(ackC);
if (ses.closed()) {
if (ses.removeFuture(fut))
@@ -1609,15 +1609,14 @@ public class GridNioServer<T> {
sessions.remove(ses);
- if (closed)
- ses.onServerStopped();
-
SelectionKey key = ses.key();
// Shutdown input and output so that remote client will see correct socket close.
Socket sock = ((SocketChannel)key.channel()).socket();
if (ses.setClosed()) {
+ ses.onClosed();
+
if (directBuf) {
if (ses.writeBuffer() != null)
((DirectBuffer)ses.writeBuffer()).cleaner().clean();
http://git-wip-us.apache.org/repos/asf/ignite/blob/b1f90655/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java
index 6b1f6a7..deb7d2b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java
@@ -294,6 +294,13 @@ class GridSelectorNioSessionImpl extends GridNioSessionImpl {
*
*/
void onServerStopped() {
+ onClosed();
+ }
+
+ /**
+ *
+ */
+ void onClosed() {
if (sem != null)
sem.release(1_000_000);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b1f90655/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
index 77bb99d..8402cbf 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
@@ -136,6 +136,9 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
/** */
private boolean mcastErr;
+ @GridToStringExclude
+ private Set<InetSocketAddress> locNodeAddrs;
+
/**
* Constructs new IP finder.
*/
@@ -369,6 +372,8 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
}
if (!clientMode) {
+ locNodeAddrs = new HashSet<>(addrs);
+
if (addrSnds.isEmpty()) {
try {
// Create non-bound socket if local host is loopback or failed to create sockets explicitly
@@ -403,8 +408,11 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
else
mcastErr = true;
}
- else
+ else {
assert addrSnds.isEmpty() : addrSnds;
+
+ locNodeAddrs = Collections.emptySet();
+ }
}
/** {@inheritDoc} */
@@ -607,7 +615,7 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
U.close(sock);
}
- if (!rmtAddrs.isEmpty())
+ if (rmtAddrs.size() > locNodeAddrs.size())
break;
if (i < addrReqAttempts - 1) // Wait some time before re-sending address request.
http://git-wip-us.apache.org/repos/asf/ignite/blob/b1f90655/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupSelfTest.java
index d916d78..18eb3b7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupSelfTest.java
@@ -109,6 +109,10 @@ public class ClusterGroupSelfTest extends ClusterGroupAbstractTest {
}
assertEquals(oldest.node(), ignite.cluster().forNode(node).node());
+
+ ClusterGroup emptyGrp = ignite.cluster().forAttribute("nonExistent", "val");
+
+ assertEquals(0, emptyGrp.forOldest().nodes().size());
}
/**
@@ -130,6 +134,10 @@ public class ClusterGroupSelfTest extends ClusterGroupAbstractTest {
}
assertEquals(youngest.node(), ignite.cluster().forNode(node).node());
+
+ ClusterGroup emptyGrp = ignite.cluster().forAttribute("nonExistent", "val");
+
+ assertEquals(0, emptyGrp.forYoungest().nodes().size());
}
/**
@@ -187,8 +195,7 @@ public class ClusterGroupSelfTest extends ClusterGroupAbstractTest {
assertEquals(grid(gridMaxOrder(clusterSize, false)).localNode().id(), oddYoungest.node().id());
assertEquals(grid(2).localNode().id(), oddOldest.node().id());
- try (Ignite g4 = startGrid(NODES_CNT);
- Ignite g5 = startGrid(NODES_CNT + 1))
+ try (Ignite g4 = startGrid(NODES_CNT); Ignite g5 = startGrid(NODES_CNT + 1))
{
clusterSize = g4.cluster().nodes().size();
@@ -241,6 +248,27 @@ public class ClusterGroupSelfTest extends ClusterGroupAbstractTest {
}
/**
+ * @throws Exception If failed.
+ */
+ public void testEmptyGroup() throws Exception {
+ ClusterGroup emptyGrp = ignite.cluster().forAttribute("nonExistent", "val");
+
+ assertEquals(0, emptyGrp.forOldest().nodes().size());
+ assertEquals(0, emptyGrp.forYoungest().nodes().size());
+ assertEquals(0, emptyGrp.forAttribute("nonExistent2", "val").nodes().size());
+ assertEquals(0, emptyGrp.forCacheNodes("cacheName").nodes().size());
+ assertEquals(0, emptyGrp.forClientNodes("cacheName").nodes().size());
+ assertEquals(0, emptyGrp.forClients().nodes().size());
+ assertEquals(0, emptyGrp.forDaemons().nodes().size());
+ assertEquals(0, emptyGrp.forDataNodes("cacheName").nodes().size());
+ assertEquals(0, emptyGrp.forRandom().nodes().size());
+ assertEquals(0, emptyGrp.forRemotes().nodes().size());
+ assertEquals(0, emptyGrp.forServers().nodes().size());
+ assertEquals(0, emptyGrp.forHost(ignite.cluster().localNode()).nodes().size());
+ assertEquals(0, emptyGrp.forHost("127.0.0.1").nodes().size());
+ }
+
+ /**
* @param cnt Count.
* @param even Even.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b1f90655/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
index 5dbf75a..5234d6e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
@@ -73,6 +73,9 @@ import org.apache.ignite.transactions.Transaction;
import org.apache.ignite.transactions.TransactionConcurrency;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
+import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
+import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.values;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -169,6 +172,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
ccfg.setWriteSynchronizationMode(FULL_SYNC);
ccfg.setName("nearCache");
+ ccfg.setAtomicWriteOrderMode(PRIMARY);
final IgniteCache<Object, Object> nearCache = client.getOrCreateCache(ccfg, new NearCacheConfiguration<>());
@@ -786,8 +790,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
for (CacheAtomicityMode atomicityMode : CacheAtomicityMode.values()) {
CacheAtomicWriteOrderMode[] writeOrders =
- atomicityMode == ATOMIC ? CacheAtomicWriteOrderMode.values() :
- new CacheAtomicWriteOrderMode[]{CacheAtomicWriteOrderMode.CLOCK};
+ atomicityMode == ATOMIC ? values() : new CacheAtomicWriteOrderMode[]{CLOCK};
for (CacheAtomicWriteOrderMode writeOrder : writeOrders) {
for (CacheWriteSynchronizationMode syncMode : CacheWriteSynchronizationMode.values()) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/b1f90655/modules/core/src/test/java/org/apache/ignite/internal/TaskNodeRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/TaskNodeRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/TaskNodeRestartTest.java
new file mode 100644
index 0000000..1e3b213
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/TaskNodeRestartTest.java
@@ -0,0 +1,230 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+package org.apache.ignite.internal;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCompute;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.ComputeJobAdapter;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.compute.ComputeJobResultPolicy;
+import org.apache.ignite.compute.ComputeTask;
+import org.apache.ignite.compute.ComputeTaskAdapter;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteCallable;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ *
+ */
+public class TaskNodeRestartTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private static final int NODES = 3;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
+
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ super.beforeTestsStarted();
+
+ startGridsMultiThreaded(NODES);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+
+ super.afterTestsStopped();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testTaskNodeRestart() throws Exception {
+ final AtomicBoolean finished = new AtomicBoolean();
+
+ final AtomicInteger stopIdx = new AtomicInteger();
+
+ IgniteInternalFuture<?> restartFut = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ int idx = stopIdx.getAndIncrement();
+
+ int node = NODES + idx;
+
+ while (!finished.get()) {
+ log.info("Start node: " + node);
+
+ startGrid(node);
+
+ U.sleep(300);
+
+ log.info("Stop node: " + node);
+
+ stopGrid(node);
+ }
+
+ return null;
+ }
+ }, 2, "stop-thread");
+
+ IgniteInternalFuture<?> fut = null;
+
+ try {
+ final long stopTime = System.currentTimeMillis() + 60_000;
+
+ final AtomicInteger idx = new AtomicInteger();
+
+ fut = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ int node = idx.getAndIncrement() % NODES;
+
+ Ignite ignite = ignite(node);
+
+ log.info("Start thread: " + ignite.name());
+
+ IgniteCompute compute = ignite.compute();
+
+ while (U.currentTimeMillis() < stopTime) {
+ try {
+ compute.broadcast(new TestCallable());
+
+ compute.call(new TestCallable());
+
+ compute.execute(new TestTask1(), null);
+
+ compute.execute(new TestTask2(), null);
+ }
+ catch (IgniteException e) {
+ log.info("Error: " + e);
+ }
+ }
+
+ return null;
+ }
+ }, 20, "test-thread");
+
+ fut.get(90_000);
+
+ finished.set(true);
+
+ restartFut.get();
+ }
+ finally {
+ finished.set(true);
+
+ if (fut != null)
+ fut.cancel();
+
+ restartFut.get(5000);
+ }
+ }
+
+ /**
+ *
+ */
+ private static class TestTask1 extends ComputeTaskAdapter<Void, Void> {
+ /** {@inheritDoc} */
+ @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, Void arg)
+ throws IgniteException {
+ Map<TestJob, ClusterNode> jobs = new HashMap<>();
+
+ for (ClusterNode node : subgrid)
+ jobs.put(new TestJob(), node);
+
+ return jobs;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Void reduce(List<ComputeJobResult> results) throws IgniteException {
+ return null;
+ }
+ }
+
+ /**
+ *
+ */
+ private static class TestTask2 implements ComputeTask<Void, Void> {
+ /** {@inheritDoc} */
+ @Nullable public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, Void arg)
+ throws IgniteException {
+ Map<TestJob, ClusterNode> jobs = new HashMap<>();
+
+ for (ClusterNode node : subgrid)
+ jobs.put(new TestJob(), node);
+
+ return jobs;
+ }
+
+ /** {@inheritDoc} */
+ @Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd) {
+ return ComputeJobResultPolicy.WAIT;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Void reduce(List<ComputeJobResult> results) {
+ return null;
+ }
+ }
+
+ /**
+ *
+ */
+ private static class TestJob extends ComputeJobAdapter {
+ /** {@inheritDoc} */
+ @Override public Object execute() throws IgniteException {
+ return null;
+ }
+ }
+
+ /**
+ *
+ */
+ private static class TestCallable implements IgniteCallable<Void> {
+ /** {@inheritDoc} */
+ @Nullable @Override public Void call() throws Exception {
+ return null;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b1f90655/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSizeFailoverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSizeFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSizeFailoverTest.java
index 1738a0d..5d074e1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSizeFailoverTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSizeFailoverTest.java
@@ -82,7 +82,7 @@ public class IgniteCacheSizeFailoverTest extends GridCommonAbstractTest {
IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
@Override public Object call() throws Exception {
- int idx = cntr.getAndIncrement();
+ int idx = cntr.getAndIncrement() % 2;
IgniteCache<Object, Object> cache = ignite(idx).cache(null);
@@ -97,7 +97,7 @@ public class IgniteCacheSizeFailoverTest extends GridCommonAbstractTest {
return null;
}
- }, 2, "size-thread");
+ }, 10, "size-thread");
try {
for (int i = 0; i < 10; i++) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/b1f90655/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/random/RandomEvictionPolicySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/random/RandomEvictionPolicySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/random/RandomEvictionPolicySelfTest.java
index af04cdc..a253a25 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/random/RandomEvictionPolicySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/random/RandomEvictionPolicySelfTest.java
@@ -197,7 +197,9 @@ public class RandomEvictionPolicySelfTest extends
}
}, 10);
- assert g.cache(null).size() <= max;
+ int size = g.cache(null).size();
+
+ assertTrue("Unexpected cache size [size=" + size + ", max=" + max + ']', size <= max);
info(policy(0));
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b1f90655/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorStopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorStopSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorStopSelfTest.java
index 16ea5e4..dfea37a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorStopSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorStopSelfTest.java
@@ -23,6 +23,7 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteServices;
import org.apache.ignite.Ignition;
+import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.services.Service;
import org.apache.ignite.services.ServiceContext;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -31,6 +32,13 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
* Tests that {@link GridServiceProcessor} completes deploy/undeploy futures during node stop.
*/
public class GridServiceProcessorStopSelfTest extends GridCommonAbstractTest {
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+
+ super.afterTest();
+ }
+
/**
* @throws Exception If failed.
*/
@@ -43,6 +51,8 @@ public class GridServiceProcessorStopSelfTest extends GridCommonAbstractTest {
Thread t = new Thread(new Runnable() {
@Override public void run() {
+ Thread.currentThread().setName("deploy-thread");
+
IgniteServices svcs = ignite.services();
IgniteServices services = svcs.withAsync();
@@ -69,13 +79,19 @@ public class GridServiceProcessorStopSelfTest extends GridCommonAbstractTest {
Ignition.stopAll(true);
- assertTrue("Deploy future isn't completed", finishLatch.await(15, TimeUnit.SECONDS));
+ boolean wait = finishLatch.await(15, TimeUnit.SECONDS);
+
+ if (!wait)
+ U.dumpThreads(log);
+
+ assertTrue("Deploy future isn't completed", wait);
}
/**
* Simple map service.
*/
public interface TestService {
+ // No-op.
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/b1f90655/modules/core/src/test/java/org/apache/ignite/messaging/IgniteMessagingWithClientTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/messaging/IgniteMessagingWithClientTest.java b/modules/core/src/test/java/org/apache/ignite/messaging/IgniteMessagingWithClientTest.java
index 62f4c1a..e885f48 100644
--- a/modules/core/src/test/java/org/apache/ignite/messaging/IgniteMessagingWithClientTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/messaging/IgniteMessagingWithClientTest.java
@@ -78,8 +78,6 @@ public class IgniteMessagingWithClientTest extends GridCommonAbstractTest implem
* @throws Exception If failed.
*/
public void testMessageSendWithClientJoin() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-996");
-
startGrid(0);
Ignite ignite1 = startGrid(1);
http://git-wip-us.apache.org/repos/asf/ignite/blob/b1f90655/modules/core/src/test/java/org/apache/ignite/session/GridSessionCheckpointAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/session/GridSessionCheckpointAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/session/GridSessionCheckpointAbstractSelfTest.java
index 06cbf1c..c087d38 100644
--- a/modules/core/src/test/java/org/apache/ignite/session/GridSessionCheckpointAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/session/GridSessionCheckpointAbstractSelfTest.java
@@ -36,6 +36,7 @@ import org.apache.ignite.compute.ComputeTaskSessionScope;
import org.apache.ignite.compute.ComputeTaskSplitAdapter;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.resources.IgniteInstanceResource;
import org.apache.ignite.resources.TaskSessionResource;
@@ -55,7 +56,7 @@ public abstract class GridSessionCheckpointAbstractSelfTest extends GridCommonAb
private static final int SPLIT_COUNT = 5;
/** */
- private static CountDownLatch taskLatch;
+ private static volatile CountDownLatch taskLatch;
/** */
protected GridSessionCheckpointAbstractSelfTest() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/b1f90655/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
index 5475f25..5af0596 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
@@ -980,7 +980,7 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
}
}
- assertTrue("GridTcpDiscoveryMulticastIpFinder should register port." , found);
+ assertTrue("TcpDiscoveryMulticastIpFinder should register port." , found);
}
}
finally {
http://git-wip-us.apache.org/repos/asf/ignite/blob/b1f90655/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteComputeGridTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteComputeGridTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteComputeGridTestSuite.java
index 23f2edc..e2c7e26 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteComputeGridTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteComputeGridTestSuite.java
@@ -65,6 +65,7 @@ import org.apache.ignite.internal.IgniteComputeEmptyClusterGroupTest;
import org.apache.ignite.internal.IgniteComputeTopologyExceptionTest;
import org.apache.ignite.internal.IgniteExecutorServiceTest;
import org.apache.ignite.internal.IgniteExplicitImplicitDeploymentSelfTest;
+import org.apache.ignite.internal.TaskNodeRestartTest;
import org.apache.ignite.internal.managers.checkpoint.GridCheckpointManagerSelfTest;
import org.apache.ignite.internal.managers.checkpoint.GridCheckpointTaskSelfTest;
import org.apache.ignite.internal.managers.communication.GridCommunicationManagerListenersSelfTest;
@@ -144,6 +145,7 @@ public class IgniteComputeGridTestSuite {
suite.addTestSuite(IgniteComputeEmptyClusterGroupTest.class);
suite.addTestSuite(IgniteComputeTopologyExceptionTest.class);
suite.addTestSuite(GridTaskFailoverAffinityRunTest.class);
+ suite.addTestSuite(TaskNodeRestartTest.class);
return suite;
}
[11/13] ignite git commit: fixed compilation error for Java 8
Posted by av...@apache.org.
fixed compilation error for Java 8
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d391daaf
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d391daaf
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d391daaf
Branch: refs/heads/ignite-1.5.1-2
Commit: d391daaf24f0f1545e223d6d47d58ba8c592e850
Parents: 32cec99
Author: Denis Magda <dm...@gridgain.com>
Authored: Fri Dec 18 15:09:55 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Fri Dec 18 15:09:55 2015 +0300
----------------------------------------------------------------------
.../processors/cache/BinarySerializationQuerySelfTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d391daaf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/BinarySerializationQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/BinarySerializationQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/BinarySerializationQuerySelfTest.java
index 1eba7d1..669c482 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/BinarySerializationQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/BinarySerializationQuerySelfTest.java
@@ -221,7 +221,7 @@ public class BinarySerializationQuerySelfTest extends GridCommonAbstractTest {
Cache.Entry res = (Cache.Entry)iter.next();
assertEquals(2, res.getKey());
- assertEquals(20, U.field(res.getValue(), "val"));
+ assertEquals(Integer.valueOf(20), U.field(res.getValue(), "val"));
assert !iter.hasNext();
[09/13] ignite git commit: Merge remote-tracking branch
'origin/ignite-1.5' into ignite-1.5
Posted by av...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/24eccb87
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/24eccb87
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/24eccb87
Branch: refs/heads/ignite-1.5.1-2
Commit: 24eccb87f7657703390caefe00b06b5a6db08506
Parents: 7ff4759 1a2ebdd
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Dec 18 12:44:15 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Dec 18 12:44:15 2015 +0300
----------------------------------------------------------------------
.../ClientAbstractConnectivitySelfTest.java | 2 +-
.../internal/cluster/ClusterGroupAdapter.java | 10 +-
.../dht/preloader/GridDhtPreloader.java | 2 +-
.../processors/task/GridTaskWorker.java | 8 +-
.../internal/util/lang/GridNodePredicate.java | 13 +-
.../ignite/internal/util/nio/GridNioServer.java | 11 +-
.../util/nio/GridSelectorNioSessionImpl.java | 7 +
.../TcpDiscoveryMulticastIpFinder.java | 12 +-
.../ignite/internal/ClusterGroupSelfTest.java | 32 ++-
.../IgniteClientReconnectCacheTest.java | 7 +-
.../ignite/internal/TaskNodeRestartTest.java | 230 +++++++++++++++++++
...IgniteCacheBinaryEntryProcessorSelfTest.java | 4 +-
.../IgniteCacheSizeFailoverTest.java | 4 +-
.../random/RandomEvictionPolicySelfTest.java | 4 +-
.../GridServiceProcessorStopSelfTest.java | 18 +-
.../IgniteMessagingWithClientTest.java | 2 -
.../GridSessionCheckpointAbstractSelfTest.java | 3 +-
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 2 +-
.../testsuites/IgniteComputeGridTestSuite.java | 2 +
19 files changed, 342 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
[08/13] ignite git commit: Failed test
IgniteSqlSplitterSelfTest.testFunctionNpe: Added reference to a ticket.
Posted by av...@apache.org.
Failed test IgniteSqlSplitterSelfTest.testFunctionNpe: Added reference to a ticket.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7ff47599
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7ff47599
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7ff47599
Branch: refs/heads/ignite-1.5.1-2
Commit: 7ff475999116174852222e3562b8de73e943bd78
Parents: 301e7a1
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Dec 18 12:43:55 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Dec 18 12:43:55 2015 +0300
----------------------------------------------------------------------
.../internal/processors/query/IgniteSqlSplitterSelfTest.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ff47599/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
index 865a0fd..5702649 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
@@ -230,7 +230,8 @@ public class IgniteSqlSplitterSelfTest extends GridCommonAbstractTest {
*
*/
public void testFunctionNpe() {
- // TODO IGNITE-1886
+ assert false : "https://issues.apache.org/jira/browse/IGNITE-1886";
+
IgniteCache<Integer, User> userCache = ignite(0).createCache(
cacheConfig("UserCache", true, Integer.class, User.class));
IgniteCache<Integer, UserOrder> userOrderCache = ignite(0).createCache(
[05/13] ignite git commit: IGNITE-2203: Fixed a bug in
BinaryClassDescriptor causing Externalizable object to be mistakenly analyzed
for duplicate fields.
Posted by av...@apache.org.
IGNITE-2203: Fixed a bug in BinaryClassDescriptor causing Externalizable object to be mistakenly analyzed for duplicate fields.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/301e7a1a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/301e7a1a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/301e7a1a
Branch: refs/heads/ignite-1.5.1-2
Commit: 301e7a1af38a3d9ef8640e74070e8c6b558eb332
Parents: d5a56da
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Dec 18 11:46:50 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Dec 18 11:46:50 2015 +0300
----------------------------------------------------------------------
.../apache/ignite/internal/binary/BinaryClassDescriptor.java | 5 ++++-
.../java/org/apache/ignite/internal/binary/BinaryWriteMode.java | 3 +++
2 files changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/301e7a1a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
index eac1874..1eb3882 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
@@ -166,7 +166,7 @@ public class BinaryClassDescriptor {
if (excluded)
mode = BinaryWriteMode.EXCLUSION;
else if (useOptMarshaller)
- mode = BinaryWriteMode.OBJECT; // Will not be used anywhere.
+ mode = BinaryWriteMode.OPTIMIZED; // Will not be used anywhere.
else {
if (cls == BinaryEnumObjectImpl.class)
mode = BinaryWriteMode.BINARY_ENUM;
@@ -225,6 +225,7 @@ public class BinaryClassDescriptor {
case BINARY_ENUM:
case ENUM_ARR:
case CLASS:
+ case OPTIMIZED:
case EXCLUSION:
ctor = null;
fields = null;
@@ -395,6 +396,7 @@ public class BinaryClassDescriptor {
void write(Object obj, BinaryWriterExImpl writer) throws BinaryObjectException {
assert obj != null;
assert writer != null;
+ assert mode != BinaryWriteMode.OPTIMIZED : "OptimizedMarshaller should not be used here: " + cls.getName();
writer.typeId(typeId);
@@ -648,6 +650,7 @@ public class BinaryClassDescriptor {
*/
Object read(BinaryReaderExImpl reader) throws BinaryObjectException {
assert reader != null;
+ assert mode != BinaryWriteMode.OPTIMIZED : "OptimizedMarshaller should not be used here: " + cls.getName();
Object res;
http://git-wip-us.apache.org/repos/asf/ignite/blob/301e7a1a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriteMode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriteMode.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriteMode.java
index 30e0458..b037945 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriteMode.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriteMode.java
@@ -154,6 +154,9 @@ public enum BinaryWriteMode {
OBJECT(GridBinaryMarshaller.OBJ),
/** */
+ OPTIMIZED(GridBinaryMarshaller.OBJ),
+
+ /** */
EXCLUSION(GridBinaryMarshaller.OBJ);
/** Type ID. */
[13/13] ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-1.5' into ignite-1.5.1-2
Posted by av...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-1.5' into ignite-1.5.1-2
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0482316e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0482316e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0482316e
Branch: refs/heads/ignite-1.5.1-2
Commit: 0482316e413661a3fb1bd15bab15c2a1e48cc294
Parents: 206e5a5 bda0b19
Author: Anton Vinogradov <av...@apache.org>
Authored: Fri Dec 18 15:40:57 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Fri Dec 18 15:40:57 2015 +0300
----------------------------------------------------------------------
RELEASE_NOTES.txt | 1 +
.../hibernate/CacheHibernateStoreExample.java | 8 +
.../datagrid/store/hibernate/Person.hbm.xml | 6 +-
.../datagrid/store/hibernate/hibernate.cfg.xml | 7 +-
...ComputeClientBinaryTaskExecutionExample.java | 4 +-
.../CacheClientBinaryPutGetExample.java | 6 +-
.../datagrid/CacheClientBinaryQueryExample.java | 10 +-
.../datagrid/CacheEntryProcessorExample.java | 157 +++++++++++++
.../examples/datagrid/CacheQueryExample.java | 4 +-
.../store/spring/CacheSpringPersonStore.java | 118 ++++++++++
.../store/spring/CacheSpringStoreExample.java | 155 +++++++++++++
.../datagrid/store/spring/package-info.java | 22 ++
.../apache/ignite/examples/model/Address.java | 72 ++++++
.../apache/ignite/examples/model/Employee.java | 93 ++++++++
.../ignite/examples/model/EmployeeKey.java | 93 ++++++++
.../ignite/examples/model/Organization.java | 85 ++++++-
.../ignite/examples/model/OrganizationType.java | 32 +++
.../apache/ignite/examples/model/Person.java | 2 +-
.../ignite/examples/model/binary/Address.java | 72 ------
.../ignite/examples/model/binary/Employee.java | 93 --------
.../examples/model/binary/EmployeeKey.java | 93 --------
.../examples/model/binary/Organization.java | 93 --------
.../examples/model/binary/OrganizationType.java | 32 ---
.../ignite/examples/model/package-info.java | 23 ++
.../datagrid/CacheEntryProcessorExample.java | 147 ++++++++++++
.../ScalarCacheEntryProcessorExample.scala | 125 ++++++++++
.../ignite/examples/CacheExamplesSelfTest.java | 8 +
.../java8/examples/CacheExamplesSelfTest.java | 8 +
.../tests/examples/ScalarExamplesSelfTest.scala | 5 +
.../ClientAbstractConnectivitySelfTest.java | 2 +-
.../internal/binary/BinaryClassDescriptor.java | 5 +-
.../ignite/internal/binary/BinaryContext.java | 16 +-
.../ignite/internal/binary/BinaryWriteMode.java | 3 +
.../internal/cluster/ClusterGroupAdapter.java | 10 +-
.../processors/cache/CacheEntryImpl.java | 6 +-
.../processors/cache/CacheEntryImplEx.java | 17 +-
.../dht/preloader/GridDhtPreloader.java | 2 +-
.../processors/task/GridTaskWorker.java | 8 +-
.../internal/util/lang/GridNodePredicate.java | 13 +-
.../ignite/internal/util/nio/GridNioServer.java | 11 +-
.../util/nio/GridSelectorNioSessionImpl.java | 7 +
.../TcpDiscoveryMulticastIpFinder.java | 12 +-
.../ignite/internal/ClusterGroupSelfTest.java | 32 ++-
.../IgniteClientReconnectCacheTest.java | 7 +-
.../ignite/internal/TaskNodeRestartTest.java | 230 +++++++++++++++++++
...IgniteCacheBinaryEntryProcessorSelfTest.java | 4 +-
.../CacheGetInsideLockChangingTopologyTest.java | 2 +
.../IgniteCacheSizeFailoverTest.java | 4 +-
.../random/RandomEvictionPolicySelfTest.java | 4 +-
.../GridServiceProcessorStopSelfTest.java | 18 +-
.../IgniteMessagingWithClientTest.java | 2 -
.../GridSessionCheckpointAbstractSelfTest.java | 3 +-
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 2 +-
.../testsuites/IgniteComputeGridTestSuite.java | 2 +
.../cache/BinarySerializationQuerySelfTest.java | 2 +-
.../query/IgniteSqlSplitterSelfTest.java | 3 +-
.../Services/ServicesTest.cs | 23 +-
57 files changed, 1567 insertions(+), 457 deletions(-)
----------------------------------------------------------------------
[04/13] ignite git commit: ignite-2204 Disabled hanging test.
Posted by av...@apache.org.
ignite-2204 Disabled hanging test.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d5a56da6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d5a56da6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d5a56da6
Branch: refs/heads/ignite-1.5.1-2
Commit: d5a56da6b2503ef06cd3620a24f487988c2be5e2
Parents: a4b547b
Author: sboikov <sb...@gridgain.com>
Authored: Fri Dec 18 09:40:35 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Dec 18 09:40:35 2015 +0300
----------------------------------------------------------------------
.../cache/distributed/CacheGetInsideLockChangingTopologyTest.java | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d5a56da6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetInsideLockChangingTopologyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetInsideLockChangingTopologyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetInsideLockChangingTopologyTest.java
index 7073a94..03502d3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetInsideLockChangingTopologyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetInsideLockChangingTopologyTest.java
@@ -357,6 +357,8 @@ public class CacheGetInsideLockChangingTopologyTest extends GridCommonAbstractTe
* @throws Exception If failed.
*/
public void testMultithreaded() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-2204");
+
final AtomicBoolean finished = new AtomicBoolean();
final int NEW_NODE = SRVS + CLIENTS;