Merge branch 'ignite-1.5' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-2050
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index f7f48fa..243ec18 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -11,6 +11,7 @@
* Added MQTT Streamer.
* Added Twitter Streamer.
* Added Ignite Sink (integration with Apache Flume).
+* Fixed optimistic serializable transactions: implemented "deadlock-free" locking algorithm.
* Fixed failover for continuous queries.
* Fixed compilation and runtime errors under OpenJDK and IBM JDK.
* Fixed Integer.size limitation for cache.
diff --git a/examples/config/example-default.xml b/examples/config/example-default.xml
index e6c359d..6bd6f16 100644
--- a/examples/config/example-default.xml
+++ b/examples/config/example-default.xml
@@ -28,6 +28,13 @@
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
+
+ <!-- Datasource for sample in-memory H2 database. -->
+ <bean id="h2-example-db" class="org.h2.jdbcx.JdbcDataSource">
+ <property name="URL" value="jdbc:h2:tcp://localhost/mem:ExampleDb" />
+ <property name="user" value="sa" />
+ </bean>
+
<bean abstract="true" id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<!-- Set to true to enable distributed class loading for examples, default is false. -->
<property name="peerClassLoadingEnabled" value="true"/>
diff --git a/examples/pom.xml b/examples/pom.xml
index e7cd059..33c4f51 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -34,7 +34,7 @@
<dependency>
<groupId>javax.cache</groupId>
<artifactId>cache-api</artifactId>
- <version>1.0.0</version>
+ <version>${javax.cache.version}</version>
</dependency>
<dependency>
diff --git a/examples/schema-import/pom.xml b/examples/schema-import/pom.xml
index a6b635c..d315c63 100644
--- a/examples/schema-import/pom.xml
+++ b/examples/schema-import/pom.xml
@@ -41,7 +41,7 @@
<dependency>
<groupId>javax.cache</groupId>
<artifactId>cache-api</artifactId>
- <version>1.0.0</version>
+ <version>${javax.cache.version}</version>
</dependency>
<dependency>
diff --git a/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/store/auto/CacheBinaryAutoStoreExample.java b/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/store/auto/CacheBinaryAutoStoreExample.java
new file mode 100644
index 0000000..63d947c
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/store/auto/CacheBinaryAutoStoreExample.java
@@ -0,0 +1,158 @@
+/*
+ * 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.binary.datagrid.store.auto;
+
+import java.sql.Types;
+import java.util.UUID;
+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.jdbc.CacheJdbcPojoStore;
+import org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory;
+import org.apache.ignite.cache.store.jdbc.JdbcType;
+import org.apache.ignite.cache.store.jdbc.JdbcTypeField;
+import org.apache.ignite.cache.store.jdbc.dialect.H2Dialect;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.examples.ExampleNodeStartup;
+import org.apache.ignite.examples.util.DbH2ServerStartup;
+import org.apache.ignite.examples.model.Person;
+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 CacheJdbcPojoStore} 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} or by starting remote nodes as specified below.</li>
+ * <li>Start example using {@link CacheBinaryAutoStoreExample}.</li>
+ * </ul>
+ * <p>
+ * Remote nodes should always be started with special configuration file which
+ * contains H2 data source bean descriptor: {@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 CacheBinaryAutoStoreExample {
+ /** Global person ID to use across entire example. */
+ private static final Long id = Math.abs(UUID.randomUUID().getLeastSignificantBits());
+
+ /** Cache name. */
+ public static final String CACHE_NAME = CacheBinaryAutoStoreExample.class.getSimpleName();
+
+ /**
+ * Configure cache with store.
+ */
+ private static CacheConfiguration<Long, Person> cacheConfiguration() {
+ CacheJdbcPojoStoreFactory<Long, Person> storeFactory = new CacheJdbcPojoStoreFactory<>();
+
+ storeFactory.setDataSourceBean("h2-example-db");
+ storeFactory.setDialect(new H2Dialect());
+
+ JdbcType jdbcType = new JdbcType();
+
+ jdbcType.setCacheName(CACHE_NAME);
+ jdbcType.setDatabaseSchema("PUBLIC");
+ jdbcType.setDatabaseTable("PERSON");
+
+ jdbcType.setKeyType("java.lang.Long");
+ jdbcType.setKeyFields(new JdbcTypeField(Types.BIGINT, "ID", Long.class, "id"));
+
+ jdbcType.setValueType("org.apache.ignite.examples.model.Person");
+ jdbcType.setValueFields(
+ new JdbcTypeField(Types.BIGINT, "ID", Long.class, "id"),
+ new JdbcTypeField(Types.VARCHAR, "FIRST_NAME", String.class, "firstName"),
+ new JdbcTypeField(Types.VARCHAR, "LAST_NAME", String.class, "lastName")
+ );
+
+ storeFactory.setTypes(jdbcType);
+
+ CacheConfiguration<Long, Person> cfg = new CacheConfiguration<>(CACHE_NAME);
+
+ cfg.setCacheStoreFactory(storeFactory);
+
+ // Set atomicity as transaction, since we are showing transactions in the example.
+ cfg.setAtomicityMode(TRANSACTIONAL);
+
+ // This option will allow to start remote nodes without having user classes in classpath.
+ cfg.setKeepBinaryInStore(true);
+
+ cfg.setReadThrough(true);
+ cfg.setWriteThrough(true);
+
+ return cfg;
+ }
+
+ /**
+ * Executes example.
+ *
+ * @param args Command line arguments, none required.
+ * @throws IgniteException If example execution failed.
+ */
+ public static void main(String[] args) throws IgniteException {
+ // 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 auto store example started.");
+
+ try (IgniteCache<Long, Person> cache = ignite.getOrCreateCache(cacheConfiguration())) {
+ try (Transaction tx = 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));
+
+ cache.clear();
+
+ System.out.println(">>> ------------------------------------------");
+ System.out.println(">>> Load data to cache from DB with custom SQL...");
+
+ // Load cache on all data nodes with custom SQL statement.
+ cache.loadCache(null, "java.lang.Long", "select * from PERSON where id <= 3");
+
+ System.out.println("Loaded cache entries: " + cache.size());
+
+ cache.clear();
+
+ // Load cache on all data nodes with default SQL statement.
+ System.out.println(">>> Load ALL data to cache from DB...");
+ cache.loadCache(null);
+
+ System.out.println("Loaded cache entries: " + cache.size());
+ }
+ }
+ }
+}
diff --git a/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/store/auto/package-info.java b/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/store/auto/package-info.java
new file mode 100644
index 0000000..153f210
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/store/auto/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 automatic JDBC store example.
+ */
+package org.apache.ignite.examples.binary.datagrid.store.auto;
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreExample.java
index 37a31d7..5498e57 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreExample.java
@@ -17,15 +17,25 @@
package org.apache.ignite.examples.datagrid.store.auto;
+import java.sql.Types;
import java.util.UUID;
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.jdbc.CacheJdbcPojoStore;
+import org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory;
+import org.apache.ignite.cache.store.jdbc.JdbcType;
+import org.apache.ignite.cache.store.jdbc.JdbcTypeField;
+import org.apache.ignite.cache.store.jdbc.dialect.H2Dialect;
+import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.examples.ExampleNodeStartup;
import org.apache.ignite.examples.model.Person;
+import org.apache.ignite.examples.util.DbH2ServerStartup;
import org.apache.ignite.transactions.Transaction;
+import org.h2.jdbcx.JdbcConnectionPool;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
/**
* Demonstrates usage of cache with underlying persistent store configured.
@@ -35,23 +45,70 @@
* 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} or by starting remote nodes as specified below.</li>
+ * <li>Start a few nodes using {@link ExampleNodeStartup}.</li>
* <li>Start example using {@link CacheAutoStoreExample}.</li>
* </ul>
* <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
+ * 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 CacheAutoStoreExample {
- /** Cache name. */
- public static final String CACHE_NAME = CacheAutoStoreLoadDataExample.class.getSimpleName();
-
/** Global person ID to use across entire example. */
private static final Long id = Math.abs(UUID.randomUUID().getLeastSignificantBits());
+ /** Cache name. */
+ public static final String CACHE_NAME = CacheAutoStoreExample.class.getSimpleName();
+
+ /**
+ * Example store factory.
+ */
+ private static final class CacheJdbcPojoStoreExampleFactory extends CacheJdbcPojoStoreFactory<Long, Person> {
+ /** {@inheritDoc} */
+ @Override public CacheJdbcPojoStore<Long, Person> create() {
+ JdbcType jdbcType = new JdbcType();
+
+ jdbcType.setCacheName(CACHE_NAME);
+ jdbcType.setDatabaseSchema("PUBLIC");
+ jdbcType.setDatabaseTable("PERSON");
+
+ jdbcType.setKeyType("java.lang.Long");
+ jdbcType.setKeyFields(new JdbcTypeField(Types.BIGINT, "ID", Long.class, "id"));
+
+ jdbcType.setValueType("org.apache.ignite.examples.model.Person");
+ jdbcType.setValueFields(
+ new JdbcTypeField(Types.BIGINT, "ID", Long.class, "id"),
+ new JdbcTypeField(Types.VARCHAR, "FIRST_NAME", String.class, "firstName"),
+ new JdbcTypeField(Types.VARCHAR, "LAST_NAME", String.class, "lastName")
+ );
+
+ CacheJdbcPojoStore<Long, Person> store = new CacheJdbcPojoStore<>();
+
+ store.setDataSource(JdbcConnectionPool.create("jdbc:h2:tcp://localhost/mem:ExampleDb", "sa", ""));
+ store.setDialect(new H2Dialect());
+
+ store.setTypes(jdbcType);
+
+ return store;
+ }
+ }
+
+ /**
+ * Configure cache with store.
+ */
+ private static CacheConfiguration<Long, Person> cacheConfiguration() {
+ CacheConfiguration<Long, Person> cfg = new CacheConfiguration<>(CACHE_NAME);
+
+ cfg.setCacheStoreFactory(new CacheJdbcPojoStoreExampleFactory());
+
+ // Set atomicity as transaction, since we are showing transactions in the example.
+ cfg.setAtomicityMode(TRANSACTIONAL);
+
+ cfg.setReadThrough(true);
+ cfg.setWriteThrough(true);
+
+ return cfg;
+ }
+
/**
* Executes example.
*
@@ -64,7 +121,7 @@
System.out.println();
System.out.println(">>> Cache auto store example started.");
- try (IgniteCache<Long, Person> cache = ignite.getOrCreateCache(CacheConfig.jdbcPojoStoreCache(CACHE_NAME))) {
+ try (IgniteCache<Long, Person> cache = ignite.getOrCreateCache(cacheConfiguration())) {
try (Transaction tx = ignite.transactions().txStart()) {
Person val = cache.get(id);
@@ -82,6 +139,24 @@
}
System.out.println("Read value after commit: " + cache.get(id));
+
+ cache.clear();
+
+ System.out.println(">>> ------------------------------------------");
+ System.out.println(">>> Load data to cache from DB with custom SQL...");
+
+ // Load cache on all data nodes with custom SQL statement.
+ cache.loadCache(null, "java.lang.Long", "select * from PERSON where id <= 3");
+
+ System.out.println("Loaded cache entries: " + cache.size());
+
+ cache.clear();
+
+ // Load cache on all data nodes with default SQL statement.
+ System.out.println(">>> Load ALL data to cache from DB...");
+ cache.loadCache(null);
+
+ System.out.println("Loaded cache entries: " + cache.size());
}
}
}
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreLoadDataExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreLoadDataExample.java
deleted file mode 100644
index 63a8c6f..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreLoadDataExample.java
+++ /dev/null
@@ -1,85 +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.datagrid.store.auto;
-
-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.jdbc.CacheJdbcPojoStore;
-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;
-
-/**
- * Demonstrates how to load data from database.
- * <p>
- * This example uses {@link CacheJdbcPojoStore} 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} or by starting remote nodes as specified below.</li>
- * <li>Start example using {@link CacheAutoStoreLoadDataExample}.</li>
- * </ul>
- * <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 CacheAutoStoreLoadDataExample {
- /** Cache name. */
- public static final String CACHE_NAME = CacheAutoStoreLoadDataExample.class.getSimpleName();
-
- /** Heap size required to run this example. */
- public static final int MIN_MEMORY = 1024 * 1024 * 1024;
-
- /**
- * 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);
-
- try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
- System.out.println();
- System.out.println(">>> Cache auto store load data example started.");
-
- CacheConfiguration<Long, Person> cacheCfg = CacheConfig.jdbcPojoStoreCache(CACHE_NAME);
-
- try (IgniteCache<Long, Person> cache = ignite.getOrCreateCache(cacheCfg)) {
- // Load cache on all data nodes with custom SQL statement.
- cache.loadCache(null, "java.lang.Long", "select * from PERSON where id <= 3");
-
- System.out.println("Loaded cache entries: " + cache.size());
-
- cache.clear();
-
- // Load cache on all data nodes with default SQL statement.
- cache.loadCache(null);
-
- System.out.println("Loaded cache entries: " + cache.size());
- }
- }
- }
-}
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheConfig.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheConfig.java
deleted file mode 100644
index 3b38aeb..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheConfig.java
+++ /dev/null
@@ -1,81 +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.datagrid.store.auto;
-
-import java.sql.Types;
-import java.util.Arrays;
-import java.util.Collections;
-import javax.cache.configuration.Factory;
-import org.apache.ignite.cache.CacheTypeFieldMetadata;
-import org.apache.ignite.cache.CacheTypeMetadata;
-import org.apache.ignite.cache.store.CacheStore;
-import org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.examples.model.Person;
-import org.h2.jdbcx.JdbcConnectionPool;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
-
-/**
- * Predefined configuration for examples with {@link CacheJdbcPojoStore}.
- */
-public class CacheConfig {
- /**
- * Configure cache with store.
- */
- public static CacheConfiguration<Long, Person> jdbcPojoStoreCache(String name) {
- CacheConfiguration<Long, Person> cfg = new CacheConfiguration<>(name);
-
- // Set atomicity as transaction, since we are showing transactions in the example.
- cfg.setAtomicityMode(TRANSACTIONAL);
-
- cfg.setCacheStoreFactory(new Factory<CacheStore<? super Long, ? super Person>>() {
- @Override public CacheStore<? super Long, ? super Person> create() {
- CacheJdbcPojoStore<Long, Person> store = new CacheJdbcPojoStore<>();
-
- store.setDataSource(JdbcConnectionPool.create("jdbc:h2:tcp://localhost/mem:ExampleDb", "sa", ""));
-
- return store;
- }
- });
-
- CacheTypeMetadata meta = new CacheTypeMetadata();
-
- meta.setDatabaseTable("PERSON");
-
- meta.setKeyType("java.lang.Long");
- meta.setValueType("org.apache.ignite.examples.model.Person");
-
- meta.setKeyFields(Collections.singletonList(new CacheTypeFieldMetadata("ID", Types.BIGINT, "id", Long.class)));
-
- meta.setValueFields(Arrays.asList(
- new CacheTypeFieldMetadata("ID", Types.BIGINT, "id", long.class),
- new CacheTypeFieldMetadata("FIRST_NAME", Types.VARCHAR, "firstName", String.class),
- new CacheTypeFieldMetadata("LAST_NAME", Types.VARCHAR, "lastName", String.class)
- ));
-
- cfg.setTypeMetadata(Collections.singletonList(meta));
-
- cfg.setWriteBehindEnabled(true);
-
- cfg.setReadThrough(true);
- cfg.setWriteThrough(true);
-
- return cfg;
- }
-}
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/DbH2ServerStartup.java b/examples/src/main/java/org/apache/ignite/examples/util/DbH2ServerStartup.java
similarity index 98%
rename from examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/DbH2ServerStartup.java
rename to examples/src/main/java/org/apache/ignite/examples/util/DbH2ServerStartup.java
index f5e07a8..01717d0 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/DbH2ServerStartup.java
+++ b/examples/src/main/java/org/apache/ignite/examples/util/DbH2ServerStartup.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.ignite.examples.datagrid.store.auto;
+package org.apache.ignite.examples.util;
import java.io.IOException;
import java.io.StringReader;
@@ -76,4 +76,4 @@
// No-op.
}
}
-}
\ No newline at end of file
+}
diff --git a/examples/src/main/java/org/apache/ignite/examples/util/package-info.java b/examples/src/main/java/org/apache/ignite/examples/util/package-info.java
new file mode 100644
index 0000000..1d87d02
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/util/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 utility classes for examples.
+ */
+package org.apache.ignite.examples.util;
diff --git a/modules/aop/pom.xml b/modules/aop/pom.xml
index f410f65..8598863 100644
--- a/modules/aop/pom.xml
+++ b/modules/aop/pom.xml
@@ -44,13 +44,13 @@
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
- <version>1.7.2</version>
+ <version>${aspectj.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
- <version>1.7.2</version>
+ <version>${aspectj.version}</version>
</dependency>
<dependency>
@@ -107,5 +107,13 @@
</excludes>
</testResource>
</testResources>
+
+ <plugins>
+ <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+ </plugins>
</build>
</project>
diff --git a/modules/aws/pom.xml b/modules/aws/pom.xml
index 53979cb..68bb4c8 100644
--- a/modules/aws/pom.xml
+++ b/modules/aws/pom.xml
@@ -44,25 +44,25 @@
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
- <version>1.3.21.1</version>
+ <version>${aws.sdk.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
- <version>4.2.3</version>
+ <version>${httpclient.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
- <version>4.2.3</version>
+ <version>${httpcore.version}</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
- <version>1.6</version>
+ <version>${commons.codec.version}</version>
</dependency>
<dependency>
@@ -100,4 +100,14 @@
<scope>test</scope>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git a/modules/camel/pom.xml b/modules/camel/pom.xml
index 328780a..e1c20f2 100644
--- a/modules/camel/pom.xml
+++ b/modules/camel/pom.xml
@@ -35,7 +35,6 @@
<url>http://ignite.apache.org</url>
<properties>
- <camel.version>2.16.0</camel.version>
<guava.version>18.0</guava.version>
<okhttp.version>2.5.0</okhttp.version>
</properties>
@@ -98,4 +97,14 @@
</dependencies>
+ <build>
+ <plugins>
+ <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
diff --git a/modules/core/pom.xml b/modules/core/pom.xml
index 907c553..88e1c25 100644
--- a/modules/core/pom.xml
+++ b/modules/core/pom.xml
@@ -43,13 +43,29 @@
<properties>
<ignite.update.notifier.product>apache-ignite</ignite.update.notifier.product>
+
+ <!-- Imports:
+ - com.sun.jmx.mbeanserver => only used from TCKMBeanServerBuilder which has no usages within Ignite's
+ runtime codebase. Therefore, it's likely that code will not be hit during normal operation and we exclude it.
+ - javax.enterprise.util is optional.
+ -->
+ <osgi.import.package>
+ javax.enterprise.util;resolution:=optional,
+ !com.sun.jmx.mbeanserver,
+ *
+ </osgi.import.package>
+ <osgi.export.package>
+ org.apache.ignite.*,
+ org.jsr166.*;version=1.0.0;
+ {local-packages}
+ </osgi.export.package>
</properties>
<dependencies>
<dependency>
<groupId>javax.cache</groupId>
<artifactId>cache-api</artifactId>
- <version>1.0.0</version>
+ <version>${javax.cache.version}</version>
</dependency>
<dependency>
@@ -90,7 +106,7 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
- <version>1.3.175</version>
+ <version>${h2.version}</version>
<scope>test</scope>
</dependency>
@@ -139,7 +155,7 @@
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
- <version>2.4</version>
+ <version>${jsonlib.version}</version>
<classifier>jdk15</classifier>
<scope>test</scope>
</dependency>
@@ -276,6 +292,12 @@
</execution>
</executions>
</plugin>
+
+ <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
</plugins>
</build>
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
index 7617e48..366262c 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
@@ -49,6 +49,7 @@
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.cache.CacheTypeFieldMetadata;
import org.apache.ignite.cache.CacheTypeMetadata;
import org.apache.ignite.cache.store.CacheStore;
@@ -1442,8 +1443,7 @@
* @return Next index for parameters.
* @throws CacheException If failed to set statement parameters.
*/
- protected int fillKeyParameters(PreparedStatement stmt, int idx, EntryMapping em,
- Object key) throws CacheException {
+ protected int fillKeyParameters(PreparedStatement stmt, int idx, EntryMapping em, Object key) throws CacheException {
for (JdbcTypeField field : em.keyColumns()) {
Object fieldVal = extractParameter(em.cacheName, em.keyType(), em.keyKind(), field.getJavaFieldName(), key);
@@ -1474,8 +1474,14 @@
*/
protected int fillValueParameters(PreparedStatement stmt, int idx, EntryMapping em, Object val)
throws CacheWriterException {
+ TypeKind valKind = em.valueKind();
+
+ // Object could be passed by cache in binary format in case of cache configured with setKeepBinaryInStore(true).
+ if (valKind == TypeKind.POJO && val instanceof BinaryObject)
+ valKind = TypeKind.BINARY;
+
for (JdbcTypeField field : em.uniqValFlds) {
- Object fieldVal = extractParameter(em.cacheName, em.valueType(), em.valueKind(), field.getJavaFieldName(), val);
+ Object fieldVal = extractParameter(em.cacheName, em.valueType(), valKind, field.getJavaFieldName(), val);
fillParameter(stmt, idx++, field, fieldVal);
}
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java
index abc4b2e..a25df04 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java
@@ -354,6 +354,15 @@
this.getter = getter;
this.setter = setter;
this.field = field;
+
+ if (getter != null)
+ getter.setAccessible(true);
+
+ if (setter != null)
+ setter.setAccessible(true);
+
+ if (field != null)
+ field.setAccessible(true);
}
/**
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
index 5c9b54f..276cdc3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
@@ -123,10 +123,9 @@
}
catch (CachePartialUpdateCheckedException | GridCacheTryPutFailedException e) {
if (++failedCnt > 10) {
- String msg = "Failed to register marshalled class for more than 10 times in a row " +
- "(may affect performance).";
-
- U.quietAndWarn(log, msg, msg);
+ if (log.isQuiet())
+ U.quiet(false, "Failed to register marshalled class for more than 10 times in a row " +
+ "(may affect performance).");
failedCnt = 0;
}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
index ddbf6ba..91b67f6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
@@ -246,7 +246,7 @@
dataStart = start + DFLT_HDR_LEN;
}
- idMapper = userType ? ctx.userTypeIdMapper(typeId) : null;
+ idMapper = userType ? ctx.userTypeIdMapper(typeId) : BinaryInternalIdMapper.defaultInstance();
schema = PortableUtils.hasSchema(flags) ? getOrCreateSchema() : null;
}
else {
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
index 1482df9..fd6c41d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
@@ -66,6 +66,8 @@
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.IgnitionEx;
import org.apache.ignite.internal.processors.cache.portable.CacheObjectBinaryProcessorImpl;
+import org.apache.ignite.internal.processors.datastructures.CollocatedQueueItemKey;
+import org.apache.ignite.internal.processors.datastructures.CollocatedSetItemKey;
import org.apache.ignite.internal.util.IgniteUtils;
import org.apache.ignite.internal.util.lang.GridMapEntry;
import org.apache.ignite.internal.util.typedef.F;
@@ -233,7 +235,8 @@
/**
* @param marsh Portable marshaller.
- * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
+ * @param cfg Configuration.
+ * @throws BinaryObjectException In case of error.
*/
public void configure(BinaryMarshaller marsh, IgniteConfiguration cfg) throws BinaryObjectException {
if (marsh == null)
@@ -265,7 +268,7 @@
* @param globalIdMapper ID mapper.
* @param globalSerializer Serializer.
* @param typeCfgs Type configurations.
- * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
+ * @throws BinaryObjectException In case of error.
*/
private void configure(
BinaryIdMapper globalIdMapper,
@@ -313,9 +316,8 @@
}
}
- for (TypeDescriptor desc : descs.descriptors()) {
+ for (TypeDescriptor desc : descs.descriptors())
registerUserType(desc.clsName, desc.idMapper, desc.serializer, desc.affKeyFieldName, desc.isEnum);
- }
BinaryInternalIdMapper dfltMapper = BinaryInternalIdMapper.create(globalIdMapper);
@@ -327,6 +329,20 @@
affKeyFieldNames.putIfAbsent(typeId, entry.getValue());
}
+
+ addSystemClassAffinityKey(CollocatedSetItemKey.class);
+ addSystemClassAffinityKey(CollocatedQueueItemKey.class);
+ }
+
+ /**
+ * @param cls Class.
+ */
+ private void addSystemClassAffinityKey(Class<?> cls) {
+ String fieldName = affinityFieldName(cls);
+
+ assert fieldName != null : cls;
+
+ affKeyFieldNames.putIfAbsent(cls.getName().hashCode(), affinityFieldName(cls));
}
/**
@@ -400,7 +416,7 @@
/**
* @param cls Class.
* @return Class descriptor.
- * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
+ * @throws BinaryObjectException In case of error.
*/
public PortableClassDescriptor descriptorForClass(Class<?> cls, boolean deserialize)
throws BinaryObjectException {
@@ -722,7 +738,7 @@
* @param serializer Serializer.
* @param affKeyFieldName Affinity key field name.
* @param isEnum If enum.
- * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
+ * @throws BinaryObjectException In case of error.
*/
@SuppressWarnings("ErrorNotRethrown")
public void registerUserType(String clsName,
@@ -808,7 +824,7 @@
/**
* @param typeId Type ID.
* @return Meta data.
- * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
+ * @throws BinaryObjectException In case of error.
*/
@Nullable public BinaryType metadata(int typeId) throws BinaryObjectException {
return metaHnd != null ? metaHnd.metadata(typeId) : null;
@@ -964,7 +980,7 @@
* @param affKeyFieldName Affinity key field name.
* @param isEnum Enum flag.
* @param canOverride Whether this descriptor can be override.
- * @throws org.apache.ignite.binary.BinaryObjectException If failed.
+ * @throws BinaryObjectException If failed.
*/
private void add(String clsName,
BinaryIdMapper idMapper,
@@ -1044,7 +1060,7 @@
* Override portable class descriptor.
*
* @param other Other descriptor.
- * @throws org.apache.ignite.binary.BinaryObjectException If failed.
+ * @throws BinaryObjectException If failed.
*/
private void override(TypeDescriptor other) throws BinaryObjectException {
assert clsName.equals(other.clsName);
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index 5b4f22c..d689ba6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -36,6 +36,7 @@
import javax.cache.configuration.Factory;
import javax.cache.expiry.EternalExpiryPolicy;
import javax.cache.expiry.ExpiryPolicy;
+import javax.cache.processor.EntryProcessorResult;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cache.CacheInterceptor;
@@ -53,6 +54,7 @@
import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
import org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager;
import org.apache.ignite.internal.managers.swapspace.GridSwapSpaceManager;
+import org.apache.ignite.internal.portable.BinaryMarshaller;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.datastructures.CacheDataStructuresManager;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter;
@@ -1682,6 +1684,13 @@
}
/**
+ * @return {@code True} if {@link BinaryMarshaller is configured}.
+ */
+ public boolean binaryMarshaller() {
+ return marshaller() instanceof BinaryMarshaller;
+ }
+
+ /**
* @return Keep portable flag.
*/
public boolean keepPortable() {
@@ -1752,6 +1761,27 @@
}
/**
+ * @param resMap Invoke results map.
+ * @param keepBinary Keep binary flag.
+ * @return Unwrapped results.
+ */
+ public Map unwrapInvokeResult(@Nullable Map<Object, EntryProcessorResult> resMap, final boolean keepBinary) {
+ return F.viewReadOnly(resMap, new C1<EntryProcessorResult, EntryProcessorResult>() {
+ @Override public EntryProcessorResult apply(EntryProcessorResult res) {
+ if (res instanceof CacheInvokeResult) {
+ CacheInvokeResult invokeRes = (CacheInvokeResult)res;
+
+ if (invokeRes.result() != null)
+ res = CacheInvokeResult.fromResult(unwrapPortableIfNeeded(invokeRes.result(),
+ keepBinary, false));
+ }
+
+ return res;
+ }
+ });
+ }
+
+ /**
* @return Cache object context.
*/
public CacheObjectContext cacheObjectContext() {
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index b06526e..9a391e5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -562,7 +562,7 @@
default:
throw new IgniteCheckedException("Failed to send response to node. Unsupported direct type [message="
- + msg + "]");
+ + msg + "]", msg.classError());
}
}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java
index ec787f8..6ec29b4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java
@@ -54,9 +54,9 @@
import org.apache.ignite.internal.processors.datastructures.GridCacheSetHeader;
import org.apache.ignite.internal.processors.datastructures.GridCacheSetHeaderKey;
import org.apache.ignite.internal.processors.datastructures.GridCacheSetImpl;
-import org.apache.ignite.internal.processors.datastructures.GridCacheSetItemKey;
import org.apache.ignite.internal.processors.datastructures.GridCacheSetProxy;
import org.apache.ignite.internal.processors.datastructures.GridTransactionalCacheQueueImpl;
+import org.apache.ignite.internal.processors.datastructures.SetItemKey;
import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.internal.util.GridConcurrentHashSet;
import org.apache.ignite.internal.util.GridSpinBusyLock;
@@ -79,7 +79,7 @@
private final ConcurrentMap<IgniteUuid, GridCacheSetProxy> setsMap;
/** Set keys used for set iteration. */
- private ConcurrentMap<IgniteUuid, GridConcurrentHashSet<GridCacheSetItemKey>> setDataMap =
+ private ConcurrentMap<IgniteUuid, GridConcurrentHashSet<SetItemKey>> setDataMap =
new ConcurrentHashMap8<>();
/** Queues map. */
@@ -311,12 +311,13 @@
*
* @param key Key.
* @param rmv {@code True} if entry was removed.
+ * @param keepPortable Keep portable flag.
*/
public void onEntryUpdated(KeyCacheObject key, boolean rmv, boolean keepPortable) {
Object key0 = cctx.cacheObjectContext().unwrapPortableIfNeeded(key, keepPortable, false);
- if (key0 instanceof GridCacheSetItemKey)
- onSetItemUpdated((GridCacheSetItemKey)key0, rmv);
+ if (key0 instanceof SetItemKey)
+ onSetItemUpdated((SetItemKey)key0, rmv);
}
/**
@@ -327,11 +328,11 @@
public void onPartitionEvicted(int part) {
GridCacheAffinityManager aff = cctx.affinity();
- for (GridConcurrentHashSet<GridCacheSetItemKey> set : setDataMap.values()) {
- Iterator<GridCacheSetItemKey> iter = set.iterator();
+ for (GridConcurrentHashSet<SetItemKey> set : setDataMap.values()) {
+ Iterator<SetItemKey> iter = set.iterator();
while (iter.hasNext()) {
- GridCacheSetItemKey key = iter.next();
+ SetItemKey key = iter.next();
if (aff.partition(key) == part)
iter.remove();
@@ -415,7 +416,7 @@
* @param id Set ID.
* @return Data for given set.
*/
- @Nullable public GridConcurrentHashSet<GridCacheSetItemKey> setData(IgniteUuid id) {
+ @Nullable public GridConcurrentHashSet<SetItemKey> setData(IgniteUuid id) {
return setDataMap.get(id);
}
@@ -436,7 +437,7 @@
cctx.preloader().syncFuture().get();
}
- GridConcurrentHashSet<GridCacheSetItemKey> set = setDataMap.get(setId);
+ GridConcurrentHashSet<SetItemKey> set = setDataMap.get(setId);
if (set == null)
return;
@@ -445,9 +446,9 @@
final int BATCH_SIZE = 100;
- Collection<GridCacheSetItemKey> keys = new ArrayList<>(BATCH_SIZE);
+ Collection<SetItemKey> keys = new ArrayList<>(BATCH_SIZE);
- for (GridCacheSetItemKey key : set) {
+ for (SetItemKey key : set) {
if (!loc && !aff.primary(cctx.localNode(), key, topVer))
continue;
@@ -555,14 +556,14 @@
* @param key Set item key.
* @param rmv {@code True} if item was removed.
*/
- private void onSetItemUpdated(GridCacheSetItemKey key, boolean rmv) {
- GridConcurrentHashSet<GridCacheSetItemKey> set = setDataMap.get(key.setId());
+ private void onSetItemUpdated(SetItemKey key, boolean rmv) {
+ GridConcurrentHashSet<SetItemKey> set = setDataMap.get(key.setId());
if (set == null) {
if (rmv)
return;
- GridConcurrentHashSet<GridCacheSetItemKey> old = setDataMap.putIfAbsent(key.setId(),
+ GridConcurrentHashSet<SetItemKey> old = setDataMap.putIfAbsent(key.setId(),
set = new GridConcurrentHashSet<>());
if (old != null)
@@ -592,7 +593,7 @@
* @throws IgniteCheckedException If failed.
*/
@SuppressWarnings("unchecked")
- private void retryRemoveAll(final IgniteInternalCache cache, final Collection<GridCacheSetItemKey> keys)
+ private void retryRemoveAll(final IgniteInternalCache cache, final Collection<SetItemKey> keys)
throws IgniteCheckedException {
DataStructuresProcessor.retry(log, new Callable<Void>() {
@Override public Void call() throws Exception {
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index 9f1f8a1..3829e28 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
@@ -337,6 +337,13 @@
cacheCtx.config().isLoadPreviousValue() &&
!txEntry.skipStore();
+ boolean evt = retVal || txEntry.op() == TRANSFORM;
+
+ EntryProcessor entryProc = null;
+
+ if (evt && txEntry.op() == TRANSFORM)
+ entryProc = F.first(txEntry.entryProcessors()).get1();
+
CacheObject val = cached.innerGet(
tx,
/*swap*/true,
@@ -344,11 +351,11 @@
/*fail fast*/false,
/*unmarshal*/true,
/*metrics*/retVal,
- /*event*/retVal,
+ /*event*/evt,
/*tmp*/false,
- null,
- null,
- null,
+ tx.subjectId(),
+ entryProc,
+ tx.resolveTaskName(),
null,
txEntry.keepBinary());
@@ -364,11 +371,13 @@
Object procRes = null;
Exception err = null;
- for (T2<EntryProcessor<Object, Object, Object>, Object[]> t : txEntry.entryProcessors()) {
- try {
- CacheInvokeEntry<Object, Object> invokeEntry = new CacheInvokeEntry<>(
- txEntry.context(), key, val, txEntry.cached().version(), txEntry.keepBinary());
+ boolean modified = false;
+ for (T2<EntryProcessor<Object, Object, Object>, Object[]> t : txEntry.entryProcessors()) {
+ CacheInvokeEntry<Object, Object> invokeEntry = new CacheInvokeEntry<>(
+ txEntry.context(), key, val, txEntry.cached().version(), txEntry.keepBinary());
+
+ try {
EntryProcessor<Object, Object, Object> processor = t.get1();
procRes = processor.process(invokeEntry, t.get2());
@@ -380,9 +389,27 @@
break;
}
+
+ modified |= invokeEntry.modified();
}
- txEntry.entryProcessorCalculatedValue(val);
+ if (modified)
+ val = cacheCtx.toCacheObject(cacheCtx.unwrapTemporary(val));
+
+ GridCacheOperation op = modified ? (val == null ? DELETE : UPDATE) : NOOP;
+
+ if (op == NOOP) {
+ if (expiry != null) {
+ long ttl = CU.toTtl(expiry.getExpiryForAccess());
+
+ txEntry.ttl(ttl);
+
+ if (ttl == CU.TTL_ZERO)
+ op = DELETE;
+ }
+ }
+
+ txEntry.entryProcessorCalculatedValue(new T2<>(op, op == NOOP ? null : val));
if (retVal) {
if (err != null || procRes != null)
@@ -1301,10 +1328,12 @@
entry.cached().partition());
if (state != GridDhtPartitionState.OWNING && state != GridDhtPartitionState.EVICTED) {
- CacheObject procVal = entry.entryProcessorCalculatedValue();
+ T2<GridCacheOperation, CacheObject> procVal = entry.entryProcessorCalculatedValue();
- entry.op(procVal == null ? DELETE : UPDATE);
- entry.value(procVal, true, false);
+ assert procVal != null : entry;
+
+ entry.op(procVal.get1());
+ entry.value(procVal.get2(), true, false);
entry.entryProcessors(null);
}
}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index d8ab62a..c5ec258 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -824,25 +824,9 @@
return resFut.chain(new CX1<IgniteInternalFuture<Map<K, EntryProcessorResult<T>>>, Map<K, EntryProcessorResult<T>>>() {
@Override public Map<K, EntryProcessorResult<T>> applyx(IgniteInternalFuture<Map<K, EntryProcessorResult<T>>> fut) throws IgniteCheckedException {
- Map<K, EntryProcessorResult<T>> resMap = fut.get();
+ Map<Object, EntryProcessorResult> resMap = (Map)fut.get();
- if (resMap != null) {
- return F.viewReadOnly(resMap, new C1<EntryProcessorResult<T>, EntryProcessorResult<T>>() {
- @Override public EntryProcessorResult<T> apply(EntryProcessorResult<T> res) {
- if (res instanceof CacheInvokeResult) {
- CacheInvokeResult invokeRes = (CacheInvokeResult)res;
-
- if (invokeRes.result() != null)
- res = CacheInvokeResult.fromResult((T)ctx.unwrapPortableIfNeeded(invokeRes.result(),
- keepBinary, false));
- }
-
- return res;
- }
- });
- }
-
- return null;
+ return ctx.unwrapInvokeResult(resMap, keepBinary);
}
});
}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
index ced0d10..998f7a2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
@@ -359,7 +359,7 @@
* @param fut Future.
* @param assigns Assignments.
* @throws IgniteCheckedException If failed.
- * @return
+ * @return Partitions were requested.
*/
private boolean requestPartitions(
RebalanceFuture fut,
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index f7e6acc..31bfa79 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -754,6 +754,9 @@
// Assign to class variable so it will be included into toString() method.
this.partReleaseFut = partReleaseFut;
+ if (exchId.isLeft())
+ cctx.mvcc().removeExplicitNodeLocks(exchId.nodeId(), exchId.topologyVersion());
+
if (log.isDebugEnabled())
log.debug("Before waiting for partition release future: " + this);
@@ -778,9 +781,6 @@
if (log.isDebugEnabled())
log.debug("After waiting for partition release future: " + this);
- if (exchId.isLeft())
- cctx.mvcc().removeExplicitNodeLocks(exchId.nodeId(), exchId.topologyVersion());
-
IgniteInternalFuture<?> locksFut = cctx.mvcc().finishLocks(exchId.topologyVersion());
dumpedObjects = 0;
@@ -1015,9 +1015,8 @@
if (ready) {
GridDhtPartitionFullMap locMap = cacheCtx.topology().partitionMap(true);
- if (useOldApi) {
+ if (useOldApi)
locMap = new GridDhtPartitionFullMap(locMap.nodeId(), locMap.nodeOrder(), locMap.updateSequence(), locMap);
- }
m.addFullPartitionsMap(cacheCtx.cacheId(), locMap);
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
index 220a45a..d172bca 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
@@ -602,6 +602,14 @@
if (affKeyFieldName != null)
return po.field(affKeyFieldName);
}
+ else if (po instanceof BinaryObjectEx) {
+ int id = ((BinaryObjectEx)po).typeId();
+
+ String affKeyFieldName = portableCtx.affinityKeyFieldName(id);
+
+ if (affKeyFieldName != null)
+ return po.field(affKeyFieldName);
+ }
}
catch (BinaryObjectException e) {
U.error(log, "Failed to get affinity field from portable object: " + po, e);
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
index bef587a..bb5d230 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
@@ -47,8 +47,8 @@
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtUnreservedPartitionException;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.processors.datastructures.GridCacheSetItemKey;
import org.apache.ignite.internal.processors.datastructures.GridSetQueryPredicate;
+import org.apache.ignite.internal.processors.datastructures.SetItemKey;
import org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryFilter;
import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;
import org.apache.ignite.internal.processors.query.GridQueryFieldsResult;
@@ -761,21 +761,21 @@
IgniteUuid id = filter.setId();
- Collection<GridCacheSetItemKey> data = cctx.dataStructures().setData(id);
+ Collection<SetItemKey> data = cctx.dataStructures().setData(id);
if (data == null)
data = Collections.emptyList();
final GridIterator<IgniteBiTuple<K, V>> it = F.iterator(
data,
- new C1<GridCacheSetItemKey, IgniteBiTuple<K, V>>() {
- @Override public IgniteBiTuple<K, V> apply(GridCacheSetItemKey e) {
+ new C1<SetItemKey, IgniteBiTuple<K, V>>() {
+ @Override public IgniteBiTuple<K, V> apply(SetItemKey e) {
return new IgniteBiTuple<>((K)e.item(), (V)Boolean.TRUE);
}
},
true,
- new P1<GridCacheSetItemKey>() {
- @Override public boolean apply(GridCacheSetItemKey e) {
+ new P1<SetItemKey>() {
+ @Override public boolean apply(SetItemKey e) {
return filter.apply(e, null);
}
});
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
index 3065ac2..53f4f56 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
@@ -1233,6 +1233,11 @@
if (F.isEmpty(txEntry.entryProcessors()))
return F.t(txEntry.op(), txEntry.value());
else {
+ T2<GridCacheOperation, CacheObject> calcVal = txEntry.entryProcessorCalculatedValue();
+
+ if (calcVal != null)
+ return calcVal;
+
boolean recordEvt = cctx.gridEvents().isRecordable(EVT_CACHE_OBJECT_READ);
CacheObject cacheVal = txEntry.hasValue() ? txEntry.value() :
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
index fba1513..2c6c3df 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
@@ -105,7 +105,7 @@
/** Transient field for calculated entry processor value. */
@GridDirectTransient
- private CacheObject entryProcessorCalcVal;
+ private T2<GridCacheOperation, CacheObject> entryProcessorCalcVal;
/** Transform closure bytes. */
@GridToStringExclude
@@ -888,14 +888,16 @@
/**
* @return Entry processor calculated value.
*/
- public CacheObject entryProcessorCalculatedValue() {
+ public T2<GridCacheOperation, CacheObject> entryProcessorCalculatedValue() {
return entryProcessorCalcVal;
}
/**
* @param entryProcessorCalcVal Entry processor calculated value.
*/
- public void entryProcessorCalculatedValue(CacheObject entryProcessorCalcVal) {
+ public void entryProcessorCalculatedValue(T2<GridCacheOperation, CacheObject> entryProcessorCalcVal) {
+ assert entryProcessorCalcVal != null;
+
this.entryProcessorCalcVal = entryProcessorCalcVal;
}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index f13cff4..33c0fa9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -3220,8 +3220,15 @@
try {
txFut.get();
- return new GridCacheReturn(cacheCtx, true, keepBinary,
- implicitRes.value(), implicitRes.success());
+ Object res = implicitRes.value();
+
+ if (implicitRes.invokeResult()) {
+ assert res == null || res instanceof Map : implicitRes;
+
+ res = cacheCtx.unwrapInvokeResult((Map)res, keepBinary);
+ }
+
+ return new GridCacheReturn(cacheCtx, true, keepBinary, res, implicitRes.success());
}
catch (IgniteCheckedException | RuntimeException e) {
rollbackAsync();
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CollocatedQueueItemKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CollocatedQueueItemKey.java
new file mode 100644
index 0000000..8eb9fa0
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CollocatedQueueItemKey.java
@@ -0,0 +1,75 @@
+/*
+ * 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.processors.datastructures;
+
+import org.apache.ignite.cache.affinity.AffinityKeyMapped;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.lang.IgniteUuid;
+
+/**
+ *
+ */
+public class CollocatedQueueItemKey implements QueueItemKey {
+ /** */
+ private IgniteUuid queueId;
+
+ /** */
+ @AffinityKeyMapped
+ private int queueNameHash;
+
+ /** */
+ private long idx;
+
+ /**
+ * @param queueId Queue unique ID.
+ * @param queueName Queue name.
+ * @param idx Item index.
+ */
+ public CollocatedQueueItemKey(IgniteUuid queueId, String queueName, long idx) {
+ this.queueId = queueId;
+ this.queueNameHash = queueName.hashCode();
+ this.idx = idx;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ CollocatedQueueItemKey itemKey = (CollocatedQueueItemKey)o;
+
+ return idx == itemKey.idx && queueId.equals(itemKey.queueId);
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ int res = queueId.hashCode();
+
+ res = 31 * res + (int)(idx ^ (idx >>> 32));
+
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(CollocatedQueueItemKey.class, this);
+ }
+}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CollocatedSetItemKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CollocatedSetItemKey.java
new file mode 100644
index 0000000..94cffd4
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CollocatedSetItemKey.java
@@ -0,0 +1,87 @@
+/*
+ * 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.processors.datastructures;
+
+import org.apache.ignite.cache.affinity.AffinityKeyMapped;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.lang.IgniteUuid;
+
+/**
+ *
+ */
+public class CollocatedSetItemKey implements SetItemKey {
+ /** */
+ private IgniteUuid setId;
+
+ /** */
+ @GridToStringInclude
+ private Object item;
+
+ /** */
+ @AffinityKeyMapped
+ private int setNameHash;
+
+ /**
+ * @param setName Set name.
+ * @param setId Set unique ID.
+ * @param item Set item.
+ */
+ public CollocatedSetItemKey(String setName, IgniteUuid setId, Object item) {
+ this.setNameHash = setName.hashCode();
+ this.setId = setId;
+ this.item = item;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteUuid setId() {
+ return setId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Object item() {
+ return item;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ int res = setId.hashCode();
+
+ res = 31 * res + item.hashCode();
+
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ CollocatedSetItemKey that = (CollocatedSetItemKey)o;
+
+ return setId.equals(that.setId) && item.equals(that.item);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(CollocatedSetItemKey.class, this);
+ }
+}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
index 998bd92..9ed9350 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
@@ -113,12 +113,6 @@
/** Initial capacity. */
private static final int INITIAL_CAPACITY = 10;
- /** */
- private static final int MAX_UPDATE_RETRIES = 100;
-
- /** */
- private static final long RETRY_DELAY = 1;
-
/** Initialization latch. */
private final CountDownLatch initLatch = new CountDownLatch(1);
@@ -986,6 +980,7 @@
hdr.id(),
name,
hdr.collocated(),
+ cctx.binaryMarshaller(),
hdr.head(),
hdr.tail(),
0);
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridAtomicCacheQueueImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridAtomicCacheQueueImpl.java
index b433887..58d3efe 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridAtomicCacheQueueImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridAtomicCacheQueueImpl.java
@@ -55,7 +55,7 @@
checkRemoved(idx);
- GridCacheQueueItemKey key = itemKey(idx);
+ QueueItemKey key = itemKey(idx);
cache.getAndPut(key, item);
@@ -78,7 +78,7 @@
checkRemoved(idx);
- GridCacheQueueItemKey key = itemKey(idx);
+ QueueItemKey key = itemKey(idx);
T data = (T)cache.getAndRemove(key);
@@ -115,7 +115,7 @@
checkRemoved(idx);
- Map<GridCacheQueueItemKey, T> putMap = new HashMap<>();
+ Map<QueueItemKey, T> putMap = new HashMap<>();
for (T item : items) {
putMap.put(itemKey(idx), item);
@@ -140,7 +140,7 @@
if (idx != null) {
checkRemoved(idx);
- GridCacheQueueItemKey key = itemKey(idx);
+ QueueItemKey key = itemKey(idx);
if (cache.remove(key))
return;
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheQueueAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheQueueAdapter.java
index df1bd88..ca0250d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheQueueAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheQueueAdapter.java
@@ -58,9 +58,6 @@
protected static final long QUEUE_REMOVED_IDX = Long.MIN_VALUE;
/** */
- protected static final long RETRY_DELAY = 1;
-
- /** */
private static final int DFLT_CLEAR_BATCH_SIZE = 100;
/** Logger. */
@@ -98,6 +95,9 @@
@GridToStringExclude
private final Semaphore writeSem;
+ /** */
+ private final boolean binaryMarsh;
+
/**
* @param queueName Queue name.
* @param hdr Queue hdr.
@@ -112,6 +112,7 @@
collocated = hdr.collocated();
queueKey = new GridCacheQueueHeaderKey(queueName);
cache = cctx.kernalContext().cache().internalCache(cctx.name());
+ binaryMarsh = cctx.binaryMarshaller();
log = cctx.logger(getClass());
@@ -369,7 +370,7 @@
checkRemoved(t.get1());
- removeKeys(cache, id, queueName, collocated, t.get1(), t.get2(), batchSize);
+ removeKeys(cache, id, queueName, collocated, binaryMarsh, t.get1(), t.get2(), batchSize);
}
catch (IgniteCheckedException e) {
throw U.convertException(e);
@@ -407,6 +408,7 @@
* @param id Queue unique ID.
* @param name Queue name.
* @param collocated Collocation flag.
+ * @param binaryMarsh {@code True} if binary marshaller is configured.
* @param startIdx Start item index.
* @param endIdx End item index.
* @param batchSize Batch size.
@@ -418,14 +420,15 @@
IgniteUuid id,
String name,
boolean collocated,
+ boolean binaryMarsh,
long startIdx,
long endIdx,
int batchSize)
throws IgniteCheckedException {
- Set<GridCacheQueueItemKey> keys = new HashSet<>(batchSize > 0 ? batchSize : 10);
+ Set<QueueItemKey> keys = new HashSet<>(batchSize > 0 ? batchSize : 10);
for (long idx = startIdx; idx < endIdx; idx++) {
- keys.add(itemKey(id, name, collocated, idx));
+ keys.add(itemKey(id, name, collocated, binaryMarsh, idx));
if (batchSize > 0 && keys.size() == batchSize) {
cache.removeAll(keys);
@@ -536,8 +539,8 @@
* @param idx Item index.
* @return Item key.
*/
- protected GridCacheQueueItemKey itemKey(Long idx) {
- return itemKey(id, queueName, collocated(), idx);
+ protected QueueItemKey itemKey(Long idx) {
+ return itemKey(id, queueName, collocated(), binaryMarsh, idx);
}
/** {@inheritDoc} */
@@ -558,11 +561,18 @@
* @param id Queue unique ID.
* @param queueName Queue name.
* @param collocated Collocation flag.
+ * @param binaryMarsh {@code True} if binary marshaller is configured.
* @param idx Item index.
* @return Item key.
*/
- private static GridCacheQueueItemKey itemKey(IgniteUuid id, String queueName, boolean collocated, long idx) {
- return collocated ? new CollocatedItemKey(id, queueName, idx) : new GridCacheQueueItemKey(id, queueName, idx);
+ private static QueueItemKey itemKey(IgniteUuid id,
+ String queueName,
+ boolean collocated,
+ boolean binaryMarsh,
+ long idx) {
+ return collocated ?
+ (binaryMarsh ? new CollocatedQueueItemKey(id, queueName, idx) : new CollocatedItemKey(id, queueName, idx)) :
+ new GridCacheQueueItemKey(id, queueName, idx);
}
/**
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheQueueItemKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheQueueItemKey.java
index c4cb7b1..df47e73 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheQueueItemKey.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheQueueItemKey.java
@@ -21,7 +21,6 @@
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
-import org.apache.ignite.internal.processors.cache.GridCacheInternal;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteUuid;
@@ -29,7 +28,7 @@
/**
* Queue item key.
*/
-class GridCacheQueueItemKey implements Externalizable, GridCacheInternal {
+class GridCacheQueueItemKey implements Externalizable, QueueItemKey {
/** */
private static final long serialVersionUID = 0L;
@@ -110,11 +109,11 @@
/** {@inheritDoc} */
@Override public int hashCode() {
- int result = queueId.hashCode();
+ int res = queueId.hashCode();
- result = 31 * result + (int)(idx ^ (idx >>> 32));
+ res = 31 * res + (int)(idx ^ (idx >>> 32));
- return result;
+ return res;
}
/** {@inheritDoc} */
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java
index 62eab61..f25e361 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java
@@ -66,7 +66,7 @@
private final GridCacheContext ctx;
/** Cache. */
- private final IgniteInternalCache<GridCacheSetItemKey, Boolean> cache;
+ private final IgniteInternalCache<SetItemKey, Boolean> cache;
/** Logger. */
private final IgniteLogger log;
@@ -86,6 +86,9 @@
/** Removed flag. */
private volatile boolean rmvd;
+ /** */
+ private final boolean binaryMarsh;
+
/**
* @param ctx Cache context.
* @param name Set name.
@@ -97,6 +100,7 @@
this.name = name;
id = hdr.id();
collocated = hdr.collocated();
+ binaryMarsh = ctx.binaryMarshaller();
cache = ctx.cache();
@@ -140,7 +144,7 @@
onAccess();
if (ctx.isLocal() || ctx.isReplicated()) {
- GridConcurrentHashSet<GridCacheSetItemKey> set = ctx.dataStructures().setData(id);
+ GridConcurrentHashSet<SetItemKey> set = ctx.dataStructures().setData(id);
return set != null ? set.size() : 0;
}
@@ -171,7 +175,7 @@
@Override public boolean isEmpty() {
onAccess();
- GridConcurrentHashSet<GridCacheSetItemKey> set = ctx.dataStructures().setData(id);
+ GridConcurrentHashSet<SetItemKey> set = ctx.dataStructures().setData(id);
return (set == null || set.isEmpty()) && size() == 0;
}
@@ -180,7 +184,7 @@
@Override public boolean contains(Object o) {
onAccess();
- final GridCacheSetItemKey key = itemKey(o);
+ final SetItemKey key = itemKey(o);
return retry(new Callable<Boolean>() {
@Override public Boolean call() throws Exception {
@@ -193,7 +197,7 @@
@Override public boolean add(T o) {
onAccess();
- final GridCacheSetItemKey key = itemKey(o);
+ final SetItemKey key = itemKey(o);
return retry(new Callable<Boolean>() {
@Override public Boolean call() throws Exception {
@@ -206,7 +210,7 @@
@Override public boolean remove(Object o) {
onAccess();
- final GridCacheSetItemKey key = itemKey(o);
+ final SetItemKey key = itemKey(o);
return retry(new Callable<Boolean>() {
@Override public Boolean call() throws Exception {
@@ -231,7 +235,7 @@
boolean add = false;
- Map<GridCacheSetItemKey, Boolean> addKeys = null;
+ Map<SetItemKey, Boolean> addKeys = null;
for (T obj : c) {
if (add) {
@@ -247,7 +251,7 @@
}
}
else
- add |= add(obj);
+ add = add(obj);
}
if (!F.isEmpty(addKeys))
@@ -262,7 +266,7 @@
boolean rmv = false;
- Set<GridCacheSetItemKey> rmvKeys = null;
+ Set<SetItemKey> rmvKeys = null;
for (Object obj : c) {
if (rmv) {
@@ -278,7 +282,7 @@
}
}
else
- rmv |= remove(obj);
+ rmv = remove(obj);
}
if (!F.isEmpty(rmvKeys))
@@ -295,7 +299,7 @@
try (GridCloseableIterator<T> iter = iterator0()) {
boolean rmv = false;
- Set<GridCacheSetItemKey> rmvKeys = null;
+ Set<SetItemKey> rmvKeys = null;
for (T val : iter) {
if (!c.contains(val)) {
@@ -331,7 +335,7 @@
onAccess();
try (GridCloseableIterator<T> iter = iterator0()) {
- Collection<GridCacheSetItemKey> rmvKeys = new ArrayList<>(BATCH_SIZE);
+ Collection<SetItemKey> rmvKeys = new ArrayList<>(BATCH_SIZE);
for (T val : iter) {
rmvKeys.add(itemKey(val));
@@ -425,7 +429,7 @@
/**
* @param keys Keys to remove.
*/
- private void retryRemoveAll(final Collection<GridCacheSetItemKey> keys) {
+ private void retryRemoveAll(final Collection<SetItemKey> keys) {
retry(new Callable<Void>() {
@Override public Void call() throws Exception {
cache.removeAll(keys);
@@ -438,7 +442,7 @@
/**
* @param keys Keys to remove.
*/
- private void retryPutAll(final Map<GridCacheSetItemKey, Boolean> keys) {
+ private void retryPutAll(final Map<SetItemKey, Boolean> keys) {
retry(new Callable<Void>() {
@Override public Void call() throws Exception {
cache.putAll(keys);
@@ -523,8 +527,9 @@
* @param item Set item.
* @return Item key.
*/
- private GridCacheSetItemKey itemKey(Object item) {
- return collocated ? new CollocatedItemKey(name, id, item) : new GridCacheSetItemKey(id, item);
+ private SetItemKey itemKey(Object item) {
+ return collocated ? (binaryMarsh ? new CollocatedSetItemKey(name, id, item) : new CollocatedItemKey(name, id, item))
+ : new GridCacheSetItemKey(id, item);
}
/** {@inheritDoc} */
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetItemKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetItemKey.java
index d025dce..8b47b3d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetItemKey.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetItemKey.java
@@ -21,7 +21,6 @@
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
-import org.apache.ignite.internal.processors.cache.GridCacheInternal;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -30,7 +29,7 @@
/**
* Set item key.
*/
-public class GridCacheSetItemKey implements GridCacheInternal, Externalizable {
+public class GridCacheSetItemKey implements SetItemKey, Externalizable {
/** */
private static final long serialVersionUID = 0L;
@@ -57,27 +56,23 @@
this.item = item;
}
- /**
- * @return Set UUID.
- */
- public IgniteUuid setId() {
+ /** {@inheritDoc} */
+ @Override public IgniteUuid setId() {
return setId;
}
- /**
- * @return Set item.
- */
- public Object item() {
+ /** {@inheritDoc} */
+ @Override public Object item() {
return item;
}
/** {@inheritDoc} */
@Override public int hashCode() {
- int result = setId.hashCode();
+ int res = setId.hashCode();
- result = 31 * result + item.hashCode();
+ res = 31 * res + item.hashCode();
- return result;
+ return res;
}
/** {@inheritDoc} */
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridTransactionalCacheQueueImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridTransactionalCacheQueueImpl.java
index 4880324..32e94d3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridTransactionalCacheQueueImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridTransactionalCacheQueueImpl.java
@@ -143,7 +143,7 @@
if (idx != null) {
checkRemoved(idx);
- Map<GridCacheQueueItemKey, T> putMap = new HashMap<>();
+ Map<QueueItemKey, T> putMap = new HashMap<>();
for (T item : items) {
putMap.put(itemKey(idx), item);
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/QueueItemKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/QueueItemKey.java
new file mode 100644
index 0000000..fe0cef3
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/QueueItemKey.java
@@ -0,0 +1,27 @@
+/*
+ * 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.processors.datastructures;
+
+import org.apache.ignite.internal.processors.cache.GridCacheInternal;
+
+/**
+ *
+ */
+public interface QueueItemKey extends GridCacheInternal {
+ // No-op.
+}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/SetItemKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/SetItemKey.java
new file mode 100644
index 0000000..759945a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/SetItemKey.java
@@ -0,0 +1,36 @@
+/*
+ * 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.processors.datastructures;
+
+import org.apache.ignite.internal.processors.cache.GridCacheInternal;
+import org.apache.ignite.lang.IgniteUuid;
+
+/**
+ *
+ */
+public interface SetItemKey extends GridCacheInternal {
+ /**
+ * @return Set UUID.
+ */
+ public IgniteUuid setId();
+
+ /**
+ * @return Set item.
+ */
+ public Object item();
+}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
index bb929a4..0c44077 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
@@ -443,14 +443,16 @@
if (qryCurIt == null)
return new GridRestResponse(GridRestResponse.STATUS_FAILED,
- "Failed to find query with ID: " + req.queryId());
+ "Failed to find query with ID: " + req.queryId() + ". " +
+ "Possible reasons: wrong query ID, no more data to fetch from query, query was closed by timeout" +
+ " or node where query was executed is not found.");
qryCurIt.lock();
try {
if (qryCurIt.timestamp() == -1)
return new GridRestResponse(GridRestResponse.STATUS_FAILED,
- "Query is closed by timeout. Restart query with ID: " + req.queryId());
+ "Query with ID: " + req.queryId() + " was closed by timeout");
qryCurIt.timestamp(U.currentTimeMillis());
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicEntryProcessorDeploymentSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicEntryProcessorDeploymentSelfTest.java
index 0873d2d..35ee6cc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicEntryProcessorDeploymentSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicEntryProcessorDeploymentSelfTest.java
@@ -30,6 +30,7 @@
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.config.GridTestProperties;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
@@ -45,7 +46,10 @@
private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
/** Entry processor */
- protected static String TEST_ENT_PROCESSOR = "org.apache.ignite.tests.p2p.CacheDeploymentEntryProcessor";
+ protected static String TEST_ENT_PROCESSOR =
+ GridTestProperties.getProperty(GridTestProperties.ENTRY_PROCESSOR_CLASS_NAME) != null ?
+ GridTestProperties.getProperty(GridTestProperties.ENTRY_PROCESSOR_CLASS_NAME) :
+ "org.apache.ignite.tests.p2p.CacheDeploymentEntryProcessor";
/** Test value. */
protected static String TEST_VALUE = "org.apache.ignite.tests.p2p.CacheDeploymentTestValue";
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorCallTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorCallTest.java
new file mode 100644
index 0000000..5163d96
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorCallTest.java
@@ -0,0 +1,497 @@
+/*
+ * 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.processors.cache;
+
+import java.util.concurrent.atomic.AtomicInteger;
+import javax.cache.processor.EntryProcessor;
+import javax.cache.processor.MutableEntry;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.typedef.internal.S;
+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.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.transactions.Transaction;
+import org.apache.ignite.transactions.TransactionConcurrency;
+import org.apache.ignite.transactions.TransactionIsolation;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_GRID_NAME;
+import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
+import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
+import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
+import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE;
+
+/**
+ *
+ */
+public class IgniteCacheEntryProcessorCallTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ static final AtomicInteger callCnt = new AtomicInteger();
+
+ /** */
+ private static final int SRV_CNT = 4;
+
+ /** */
+ private static final int NODES = 5;
+
+ /** */
+ private boolean client;
+
+ /** */
+ private static final int OP_UPDATE = 1;
+
+ /** */
+ private static final int OP_REMOVE = 2;
+
+ /** */
+ private static final int OP_GET = 3;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+
+ cfg.setClientMode(client);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+
+ super.afterTestsStopped();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ super.beforeTestsStarted();
+
+ startGridsMultiThreaded(SRV_CNT);
+
+ client = true;
+
+ Ignite client = startGrid(SRV_CNT);
+
+ assertTrue(client.configuration().isClientMode());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testEntryProcessorCall() throws Exception {
+ {
+ CacheConfiguration<Integer, TestValue> ccfg = new CacheConfiguration<>();
+ ccfg.setBackups(1);
+ ccfg.setWriteSynchronizationMode(FULL_SYNC);
+ ccfg.setAtomicityMode(ATOMIC);
+ ccfg.setAtomicWriteOrderMode(PRIMARY);
+
+ checkEntryProcessorCallCount(ccfg, 1);
+ }
+
+ {
+ CacheConfiguration<Integer, TestValue> ccfg = new CacheConfiguration<>();
+ ccfg.setBackups(0);
+ ccfg.setWriteSynchronizationMode(FULL_SYNC);
+ ccfg.setAtomicityMode(ATOMIC);
+ ccfg.setAtomicWriteOrderMode(PRIMARY);
+
+ checkEntryProcessorCallCount(ccfg, 1);
+ }
+
+ {
+ CacheConfiguration<Integer, TestValue> ccfg = new CacheConfiguration<>();
+ ccfg.setBackups(1);
+ ccfg.setWriteSynchronizationMode(FULL_SYNC);
+ ccfg.setAtomicityMode(TRANSACTIONAL);
+
+ checkEntryProcessorCallCount(ccfg, 2);
+ }
+
+ {
+ CacheConfiguration<Integer, TestValue> ccfg = new CacheConfiguration<>();
+ ccfg.setBackups(0);
+ ccfg.setWriteSynchronizationMode(FULL_SYNC);
+ ccfg.setAtomicityMode(TRANSACTIONAL);
+
+ checkEntryProcessorCallCount(ccfg, 1);
+ }
+ }
+
+ /**
+ * @param ccfg Cache configuration.
+ * @param expCallCnt Expected entry processor calls count.
+ * @throws Exception If failed.
+ */
+ private void checkEntryProcessorCallCount(CacheConfiguration<Integer, TestValue> ccfg,
+ int expCallCnt) throws Exception {
+ Ignite client1 = ignite(SRV_CNT);
+
+ IgniteCache<Integer, TestValue> clientCache1 = client1.createCache(ccfg);
+
+ IgniteCache<Integer, TestValue> srvCache = ignite(0).cache(ccfg.getName());
+
+ awaitPartitionMapExchange();
+
+ int key = 0;
+
+ checkEntryProcessCall(key++, clientCache1, null, null, expCallCnt);
+
+ if (ccfg.getAtomicityMode() == TRANSACTIONAL) {
+ checkEntryProcessCall(key++, clientCache1, OPTIMISTIC, REPEATABLE_READ, expCallCnt + 1);
+ checkEntryProcessCall(key++, clientCache1, PESSIMISTIC, REPEATABLE_READ, expCallCnt + 1);
+ checkEntryProcessCall(key++, clientCache1, OPTIMISTIC, SERIALIZABLE, expCallCnt + 1);
+ }
+
+ for (int i = 100; i < 110; i++) {
+ checkEntryProcessCall(key++, srvCache, null, null, expCallCnt);
+
+ if (ccfg.getAtomicityMode() == TRANSACTIONAL) {
+ checkEntryProcessCall(key++, srvCache, OPTIMISTIC, REPEATABLE_READ, expCallCnt + 1);
+ checkEntryProcessCall(key++, srvCache, PESSIMISTIC, REPEATABLE_READ, expCallCnt + 1);
+ checkEntryProcessCall(key++, srvCache, OPTIMISTIC, SERIALIZABLE, expCallCnt + 1);
+ }
+ }
+
+ for (int i = 0; i < NODES; i++)
+ ignite(i).destroyCache(ccfg.getName());
+ }
+
+ /**
+ *
+ * @param key Key.
+ * @param cache Cache.
+ * @param concurrency Transaction concurrency.
+ * @param isolation Transaction isolation.
+ * @param expCallCnt Expected entry processor calls count.
+ */
+ private void checkEntryProcessCall(Integer key,
+ IgniteCache<Integer, TestValue> cache,
+ @Nullable TransactionConcurrency concurrency,
+ @Nullable TransactionIsolation isolation,
+ int expCallCnt) {
+ Ignite ignite = cache.unwrap(Ignite.class);
+
+ ClusterNode primary = ignite.affinity(cache.getName()).mapKeyToNode(key);
+
+ assertNotNull(primary);
+
+ log.info("Check call [key=" + key +
+ ", primary=" + primary.attribute(ATTR_GRID_NAME) +
+ ", concurrency=" + concurrency +
+ ", isolation=" + isolation + "]");
+
+ Transaction tx;
+ TestReturnValue retVal;
+
+ log.info("Invoke: " + key);
+
+ // Update.
+ callCnt.set(0);
+
+ tx = startTx(cache, concurrency, isolation);
+
+ retVal = cache.invoke(key, new TestEntryProcessor(OP_UPDATE), new TestValue(Integer.MIN_VALUE));
+
+ if (tx != null)
+ tx.commit();
+
+ assertEquals(expCallCnt, callCnt.get());
+
+ checkReturnValue(retVal, "null");
+ checkCacheValue(cache.getName(), key, new TestValue(0));
+
+ log.info("Invoke: " + key);
+
+ // Get.
+ callCnt.set(0);
+
+ tx = startTx(cache, concurrency, isolation);
+
+ retVal = cache.invoke(key, new TestEntryProcessor(OP_GET), new TestValue(Integer.MIN_VALUE));
+
+ if (tx != null)
+ tx.commit();
+
+ assertEquals(expCallCnt, callCnt.get());
+
+ checkReturnValue(retVal, "0");
+ checkCacheValue(cache.getName(), key, new TestValue(0));
+
+ log.info("Invoke: " + key);
+
+ // Update.
+ callCnt.set(0);
+
+ tx = startTx(cache, concurrency, isolation);
+
+ retVal = cache.invoke(key, new TestEntryProcessor(OP_UPDATE), new TestValue(Integer.MIN_VALUE));
+
+ if (tx != null)
+ tx.commit();
+
+ assertEquals(expCallCnt, callCnt.get());
+
+ checkReturnValue(retVal, "0");
+ checkCacheValue(cache.getName(), key, new TestValue(1));
+
+ log.info("Invoke: " + key);
+
+ // Remove.
+ callCnt.set(0);
+
+ tx = startTx(cache, concurrency, isolation);
+
+ retVal = cache.invoke(key, new TestEntryProcessor(OP_REMOVE), new TestValue(Integer.MIN_VALUE));
+
+ if (tx != null)
+ tx.commit();
+
+ assertEquals(expCallCnt, callCnt.get());
+
+ checkReturnValue(retVal, "1");
+ checkCacheValue(cache.getName(), key, null);
+ }
+
+ /**
+ * @param retVal Return value.
+ * @param expVal Expected value.
+ */
+ private void checkReturnValue(TestReturnValue retVal, String expVal) {
+ assertNotNull(retVal);
+
+ TestValue arg = (TestValue)retVal.argument();
+ assertNotNull(arg);
+ assertEquals(Integer.MIN_VALUE, (Object)arg.value());
+
+ assertEquals(expVal, retVal.value());
+ }
+
+ /**
+ * @param cacheName Cache name.
+ * @param key Key.
+ * @param expVal Expected value.
+ */
+ private void checkCacheValue(String cacheName, Integer key, TestValue expVal) {
+ for (int i = 0; i < NODES; i++) {
+ Ignite ignite = ignite(i);
+
+ IgniteCache<Integer, TestValue> cache = ignite.cache(cacheName);
+
+ assertEquals(expVal, cache.get(key));
+ }
+ }
+
+ /**
+ * @param cache Cache.
+ * @param concurrency Transaction concurrency.
+ * @param isolation Transaction isolation.
+ * @return Started transaction.
+ */
+ @Nullable private Transaction startTx(IgniteCache<Integer, TestValue> cache,
+ @Nullable TransactionConcurrency concurrency,
+ @Nullable TransactionIsolation isolation) {
+ if (concurrency != null) {
+ assert isolation != null;
+
+ return cache.unwrap(Ignite.class).transactions().txStart(concurrency, isolation);
+ }
+
+ return null;
+ }
+
+ /**
+ *
+ */
+ static class TestEntryProcessor implements EntryProcessor<Integer, TestValue, TestReturnValue> {
+ /** */
+ private int op;
+
+ /**
+ * @param op Operation.
+ */
+ public TestEntryProcessor(int op) {
+ this.op = op;
+ }
+
+ /** {@inheritDoc} */
+ @Override public TestReturnValue process(MutableEntry<Integer, TestValue> entry,
+ Object... args) {
+ Ignite ignite = entry.unwrap(Ignite.class);
+
+ ignite.log().info("TestEntryProcessor called [op=" + op + ", entry=" + entry + ']');
+
+ callCnt.incrementAndGet();
+
+ assertEquals(1, args.length);
+
+ TestReturnValue retVal;
+
+ TestValue val = entry.getValue();
+
+ if (val == null)
+ retVal = new TestReturnValue("null", args[0]);
+ else
+ retVal = new TestReturnValue(String.valueOf(val.value()), args[0]);
+
+ switch (op) {
+ case OP_GET:
+ return retVal;
+
+ case OP_UPDATE: {
+ if (val == null)
+ val = new TestValue(0);
+ else
+ val = new TestValue(val.val + 1);
+
+ entry.setValue(val);
+
+ break;
+ }
+
+ case OP_REMOVE:
+ entry.remove();
+
+ break;
+
+ default:
+ assert false;
+ }
+
+ return retVal;
+ }
+ }
+
+ /**
+ *
+ */
+ static class TestValue {
+ /** */
+ private Integer val;
+
+ /**
+ * @param val Value.
+ */
+ public TestValue(Integer val) {
+ this.val = val;
+ }
+
+ /**
+ * @return Value.
+ */
+ public Integer value() {
+ return val;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ TestValue testVal = (TestValue) o;
+
+ return val.equals(testVal.val);
+
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return val.hashCode();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(TestValue.class, this);
+ }
+ }
+
+ /**
+ *
+ */
+ static class TestReturnValue {
+ /** */
+ private String val;
+
+ /** */
+ private Object arg;
+
+ /**
+ * @param val Value.
+ * @param arg Entry processor argument.
+ */
+ public TestReturnValue(String val, Object arg) {
+ this.val = val;
+ this.arg = arg;
+ }
+
+ /**
+ * @return Value.
+ */
+ public String value() {
+ return val;
+ }
+
+ /**
+ * @return Entry processor argument.
+ */
+ public Object argument() {
+ return arg;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ TestReturnValue testVal = (TestReturnValue) o;
+
+ return val.equals(testVal.val);
+
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return val.hashCode();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(TestReturnValue.class, this);
+ }
+ }
+}
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java
index b881d90..51a70b9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java
@@ -22,6 +22,7 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Callable;
@@ -139,6 +140,31 @@
tx = startTx(txMode);
+ TestValue testVal = cache.invoke(key, new UserClassValueProcessor());
+
+ if (tx != null)
+ tx.commit();
+
+ assertEquals("63", testVal.value());
+
+ checkValue(key, 63);
+
+ tx = startTx(txMode);
+
+ Collection<TestValue> testValCol = cache.invoke(key, new CollectionReturnProcessor());
+
+ if (tx != null)
+ tx.commit();
+
+ assertEquals(10, testValCol.size());
+
+ for (TestValue val : testValCol)
+ assertEquals("64", val.value());
+
+ checkValue(key, 63);
+
+ tx = startTx(txMode);
+
GridTestUtils.assertThrows(log, new Callable<Void>() {
@Override public Void call() throws Exception {
cache.invoke(key, new ExceptionProcessor(63));
@@ -237,12 +263,236 @@
IncrementProcessor incProcessor = new IncrementProcessor();
- Transaction tx = startTx(txMode);
+ {
+ Transaction tx = startTx(txMode);
- Map<Integer, EntryProcessorResult<Integer>> resMap = cache.invokeAll(keys, incProcessor);
+ Map<Integer, EntryProcessorResult<Integer>> resMap = cache.invokeAll(keys, incProcessor);
- if (tx != null)
- tx.commit();
+ if (tx != null)
+ tx.commit();
+
+ Map<Object, Object> exp = new HashMap<>();
+
+ for (Integer key : keys)
+ exp.put(key, -1);
+
+ checkResult(resMap, exp);
+
+ for (Integer key : keys)
+ checkValue(key, 1);
+ }
+
+ {
+ Transaction tx = startTx(txMode);
+
+ Map<Integer, EntryProcessorResult<TestValue>> resMap = cache.invokeAll(keys, new UserClassValueProcessor());
+
+ if (tx != null)
+ tx.commit();
+
+ Map<Object, Object> exp = new HashMap<>();
+
+ for (Integer key : keys)
+ exp.put(key, new TestValue("1"));
+
+ checkResult(resMap, exp);
+
+ for (Integer key : keys)
+ checkValue(key, 1);
+ }
+
+ {
+ Transaction tx = startTx(txMode);
+
+ Map<Integer, EntryProcessorResult<Collection<TestValue>>> resMap =
+ cache.invokeAll(keys, new CollectionReturnProcessor());
+
+ if (tx != null)
+ tx.commit();
+
+ Map<Object, Object> exp = new HashMap<>();
+
+ for (Integer key : keys) {
+ List<TestValue> expCol = new ArrayList<>();
+
+ for (int i = 0; i < 10; i++)
+ expCol.add(new TestValue("2"));
+
+ exp.put(key, expCol);
+ }
+
+ checkResult(resMap, exp);
+
+ for (Integer key : keys)
+ checkValue(key, 1);
+ }
+
+ {
+ Transaction tx = startTx(txMode);
+
+ Map<Integer, EntryProcessorResult<Integer>> resMap = cache.invokeAll(keys, incProcessor);
+
+ if (tx != null)
+ tx.commit();
+
+ Map<Object, Object> exp = new HashMap<>();
+
+ for (Integer key : keys)
+ exp.put(key, 1);
+
+ checkResult(resMap, exp);
+
+ for (Integer key : keys)
+ checkValue(key, 2);
+ }
+
+ {
+ Transaction tx = startTx(txMode);
+
+ Map<Integer, EntryProcessorResult<Integer>> resMap =
+ cache.invokeAll(keys, new ArgumentsSumProcessor(), 10, 20, 30);
+
+ if (tx != null)
+ tx.commit();
+
+ Map<Object, Object> exp = new HashMap<>();
+
+ for (Integer key : keys)
+ exp.put(key, 3);
+
+ checkResult(resMap, exp);
+
+ for (Integer key : keys)
+ checkValue(key, 62);
+ }
+
+ {
+ Transaction tx = startTx(txMode);
+
+ Map<Integer, EntryProcessorResult<Integer>> resMap = cache.invokeAll(keys, new ExceptionProcessor(null));
+
+ if (tx != null)
+ tx.commit();
+
+ for (Integer key : keys) {
+ final EntryProcessorResult<Integer> res = resMap.get(key);
+
+ assertNotNull("No result for " + key);
+
+ GridTestUtils.assertThrows(log, new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ res.get();
+
+ return null;
+ }
+ }, EntryProcessorException.class, "Test processor exception.");
+ }
+
+ for (Integer key : keys)
+ checkValue(key, 62);
+ }
+
+ {
+ Transaction tx = startTx(txMode);
+
+ Map<Integer, EntryProcessor<Integer, Integer, Integer>> invokeMap = new HashMap<>();
+
+ for (Integer key : keys) {
+ switch (key % 4) {
+ case 0: invokeMap.put(key, new IncrementProcessor()); break;
+
+ case 1: invokeMap.put(key, new RemoveProcessor(62)); break;
+
+ case 2: invokeMap.put(key, new ArgumentsSumProcessor()); break;
+
+ case 3: invokeMap.put(key, new ExceptionProcessor(62)); break;
+
+ default:
+ fail();
+ }
+ }
+
+ Map<Integer, EntryProcessorResult<Integer>> resMap = cache.invokeAll(invokeMap, 10, 20, 30);
+
+ if (tx != null)
+ tx.commit();
+
+ for (Integer key : keys) {
+ final EntryProcessorResult<Integer> res = resMap.get(key);
+
+ switch (key % 4) {
+ case 0: {
+ assertNotNull("No result for " + key, res);
+
+ assertEquals(62, (int)res.get());
+
+ checkValue(key, 63);
+
+ break;
+ }
+
+ case 1: {
+ assertNull(res);
+
+ checkValue(key, null);
+
+ break;
+ }
+
+ case 2: {
+ assertNotNull("No result for " + key, res);
+
+ assertEquals(3, (int)res.get());
+
+ checkValue(key, 122);
+
+ break;
+ }
+
+ case 3: {
+ assertNotNull("No result for " + key, res);
+
+ GridTestUtils.assertThrows(log, new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ res.get();
+
+ return null;
+ }
+ }, EntryProcessorException.class, "Test processor exception.");
+
+ checkValue(key, 62);
+
+ break;
+ }
+ }
+ }
+ }
+
+ cache.invokeAll(keys, new IncrementProcessor());
+
+ {
+ Transaction tx = startTx(txMode);
+
+ Map<Integer, EntryProcessorResult<Integer>> resMap = cache.invokeAll(keys, new RemoveProcessor(null));
+
+ if (tx != null)
+ tx.commit();
+
+ assertEquals("Unexpected results: " + resMap, 0, resMap.size());
+
+ for (Integer key : keys)
+ checkValue(key, null);
+ }
+
+ IgniteCache<Integer, Integer> asyncCache = cache.withAsync();
+
+ assertTrue(asyncCache.isAsync());
+
+ assertNull(asyncCache.invokeAll(keys, new IncrementProcessor()));
+
+ IgniteFuture<Map<Integer, EntryProcessorResult<Integer>>> fut = asyncCache.future();
+
+ Map<Integer, EntryProcessorResult<Integer>> resMap = fut.get();
Map<Object, Object> exp = new HashMap<>();
@@ -254,172 +504,8 @@
for (Integer key : keys)
checkValue(key, 1);
- tx = startTx(txMode);
-
- resMap = cache.invokeAll(keys, incProcessor);
-
- if (tx != null)
- tx.commit();
-
- exp = new HashMap<>();
-
- for (Integer key : keys)
- exp.put(key, 1);
-
- checkResult(resMap, exp);
-
- for (Integer key : keys)
- checkValue(key, 2);
-
- tx = startTx(txMode);
-
- resMap = cache.invokeAll(keys, new ArgumentsSumProcessor(), 10, 20, 30);
-
- if (tx != null)
- tx.commit();
-
- for (Integer key : keys)
- exp.put(key, 3);
-
- checkResult(resMap, exp);
-
- for (Integer key : keys)
- checkValue(key, 62);
-
- tx = startTx(txMode);
-
- resMap = cache.invokeAll(keys, new ExceptionProcessor(null));
-
- if (tx != null)
- tx.commit();
-
- for (Integer key : keys) {
- final EntryProcessorResult<Integer> res = resMap.get(key);
-
- assertNotNull("No result for " + key);
-
- GridTestUtils.assertThrows(log, new Callable<Void>() {
- @Override public Void call() throws Exception {
- res.get();
-
- return null;
- }
- }, EntryProcessorException.class, "Test processor exception.");
- }
-
- for (Integer key : keys)
- checkValue(key, 62);
-
- tx = startTx(txMode);
-
Map<Integer, EntryProcessor<Integer, Integer, Integer>> invokeMap = new HashMap<>();
- for (Integer key : keys) {
- switch (key % 4) {
- case 0: invokeMap.put(key, new IncrementProcessor()); break;
-
- case 1: invokeMap.put(key, new RemoveProcessor(62)); break;
-
- case 2: invokeMap.put(key, new ArgumentsSumProcessor()); break;
-
- case 3: invokeMap.put(key, new ExceptionProcessor(62)); break;
-
- default:
- fail();
- }
- }
-
- resMap = cache.invokeAll(invokeMap, 10, 20, 30);
-
- if (tx != null)
- tx.commit();
-
- for (Integer key : keys) {
- final EntryProcessorResult<Integer> res = resMap.get(key);
-
- switch (key % 4) {
- case 0: {
- assertNotNull("No result for " + key, res);
-
- assertEquals(62, (int)res.get());
-
- checkValue(key, 63);
-
- break;
- }
-
- case 1: {
- assertNull(res);
-
- checkValue(key, null);
-
- break;
- }
-
- case 2: {
- assertNotNull("No result for " + key, res);
-
- assertEquals(3, (int)res.get());
-
- checkValue(key, 122);
-
- break;
- }
-
- case 3: {
- assertNotNull("No result for " + key, res);
-
- GridTestUtils.assertThrows(log, new Callable<Void>() {
- @Override public Void call() throws Exception {
- res.get();
-
- return null;
- }
- }, EntryProcessorException.class, "Test processor exception.");
-
- checkValue(key, 62);
-
- break;
- }
- }
- }
-
- cache.invokeAll(keys, new IncrementProcessor());
-
- tx = startTx(txMode);
-
- resMap = cache.invokeAll(keys, new RemoveProcessor(null));
-
- if (tx != null)
- tx.commit();
-
- assertEquals("Unexpected results: " + resMap, 0, resMap.size());
-
- for (Integer key : keys)
- checkValue(key, null);
-
- IgniteCache<Integer, Integer> asyncCache = cache.withAsync();
-
- assertTrue(asyncCache.isAsync());
-
- assertNull(asyncCache.invokeAll(keys, new IncrementProcessor()));
-
- IgniteFuture<Map<Integer, EntryProcessorResult<Integer>>> fut = asyncCache.future();
-
- resMap = fut.get();
-
- exp = new HashMap<>();
-
- for (Integer key : keys)
- exp.put(key, -1);
-
- checkResult(resMap, exp);
-
- for (Integer key : keys)
- checkValue(key, 1);
-
- invokeMap = new HashMap<>();
-
for (Integer key : keys)
invokeMap.put(key, incProcessor);
@@ -442,15 +528,16 @@
* @param resMap Result map.
* @param exp Expected results.
*/
- private void checkResult(Map<Integer, EntryProcessorResult<Integer>> resMap, Map<Object, Object> exp) {
+ @SuppressWarnings("unchecked")
+ private void checkResult(Map resMap, Map<Object, Object> exp) {
assertNotNull(resMap);
assertEquals(exp.size(), resMap.size());
for (Map.Entry<Object, Object> expVal : exp.entrySet()) {
- EntryProcessorResult<Integer> res = resMap.get(expVal.getKey());
+ EntryProcessorResult<?> res = (EntryProcessorResult)resMap.get(expVal.getKey());
- assertNotNull("No result for " + expVal.getKey());
+ assertNotNull("No result for " + expVal.getKey(), res);
assertEquals("Unexpected result for " + expVal.getKey(), res.get(), expVal.getValue());
}
@@ -557,6 +644,44 @@
/**
*
*/
+ protected static class UserClassValueProcessor implements EntryProcessor<Integer, Integer, TestValue> {
+ /** {@inheritDoc} */
+ @Override public TestValue process(MutableEntry<Integer, Integer> e, Object... arguments)
+ throws EntryProcessorException {
+ return new TestValue(String.valueOf(e.getValue()));
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(UserClassValueProcessor.class, this);
+ }
+ }
+
+ /**
+ *
+ */
+ protected static class CollectionReturnProcessor implements
+ EntryProcessor<Integer, Integer, Collection<TestValue>> {
+ /** {@inheritDoc} */
+ @Override public Collection<TestValue> process(MutableEntry<Integer, Integer> e, Object... arguments)
+ throws EntryProcessorException {
+ List<TestValue> vals = new ArrayList<>();
+
+ for (int i = 0; i < 10; i++)
+ vals.add(new TestValue(String.valueOf(e.getValue() + 1)));
+
+ return vals;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(CollectionReturnProcessor.class, this);
+ }
+ }
+
+ /**
+ *
+ */
protected static class IncrementProcessor implements EntryProcessor<Integer, Integer, Integer> {
/** {@inheritDoc} */
@Override public Integer process(MutableEntry<Integer, Integer> e,
@@ -656,4 +781,50 @@
return S.toString(ExceptionProcessor.class, this);
}
}
+
+ /**
+ *
+ */
+ static class TestValue {
+ /** */
+ private String val;
+
+ /**
+ * @param val Value.
+ */
+ public TestValue(String val) {
+ this.val = val;
+ }
+
+ /**
+ * @return Value.
+ */
+ public String value() {
+ return val;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ TestValue testVal = (TestValue) o;
+
+ return val.equals(testVal.val);
+
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return val.hashCode();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(TestValue.class, this);
+ }
+ }
}
\ No newline at end of file
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java
index 2751de1..ef96d9f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java
@@ -170,11 +170,8 @@
while (U.currentTimeMillis() < stopTime)
assertEquals(10, atomic.get());
}
- catch (IgniteException e) {
- if (X.hasCause(e, ClusterTopologyServerNotFoundException.class))
- return;
-
- throw e;
+ catch (IgniteException ignore) {
+ return; // Test that client does not hang.
}
fail();
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueApiSelfAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueApiSelfAbstractTest.java
index cf638df..6366f09 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueApiSelfAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueApiSelfAbstractTest.java
@@ -244,15 +244,27 @@
}
/**
- * JUnit.
- *
* @throws Exception If failed.
*/
public void testIterator() throws Exception {
+ checkIterator(false);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testIteratorCollocated() throws Exception {
+ checkIterator(true);
+ }
+
+ /**
+ * @param collocated Collocated flag.
+ */
+ private void checkIterator(boolean collocated) {
// Random queue name.
String queueName = UUID.randomUUID().toString();
- IgniteQueue<String> queue = grid(0).queue(queueName, 0, config(false));
+ IgniteQueue<String> queue = grid(0).queue(queueName, 0, config(collocated));
for (int i = 0; i < 100; i++)
assert queue.add(Integer.toString(i));
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetFailoverAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetFailoverAbstractSelfTest.java
index 74c9a4f..ca57205 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetFailoverAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetFailoverAbstractSelfTest.java
@@ -31,7 +31,7 @@
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
-import org.apache.ignite.internal.processors.datastructures.GridCacheSetItemKey;
+import org.apache.ignite.internal.processors.datastructures.SetItemKey;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.testframework.GridTestUtils;
@@ -183,8 +183,8 @@
if (entry.hasValue()) {
cnt++;
- if (entry.key() instanceof GridCacheSetItemKey) {
- GridCacheSetItemKey setItem = (GridCacheSetItemKey)entry.key();
+ if (entry.key() instanceof SetItemKey) {
+ SetItemKey setItem = (SetItemKey)entry.key();
if (setIds.add(setItem.setId()))
log.info("Unexpected set item [setId=" + setItem.setId() +
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueApiSelfTest.java
index 2420153..de2fa07 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueApiSelfTest.java
@@ -31,6 +31,11 @@
*/
public class GridCachePartitionedQueueApiSelfTest extends GridCacheQueueApiSelfAbstractTest {
/** {@inheritDoc} */
+ @Override protected int gridCount() {
+ return 4;
+ }
+
+ /** {@inheritDoc} */
@Override protected CacheMode collectionCacheMode() {
return PARTITIONED;
}
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueEntryMoveSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueEntryMoveSelfTest.java
index 1d225a6..db11291 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueEntryMoveSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueEntryMoveSelfTest.java
@@ -90,7 +90,7 @@
* @throws Exception If failed.
*/
public void testQueue() throws Exception {
- final String queueName = "queue-test-name";
+ final String queueName = "q";
System.out.println(U.filler(20, '\n'));
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/IgnitePartitionedQueueNoBackupsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/IgnitePartitionedQueueNoBackupsTest.java
new file mode 100644
index 0000000..880c638
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/IgnitePartitionedQueueNoBackupsTest.java
@@ -0,0 +1,92 @@
+/*
+ * 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.processors.cache.datastructures.partitioned;
+
+import java.util.Iterator;
+import java.util.UUID;
+import org.apache.ignite.IgniteQueue;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMemoryMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CollectionConfiguration;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
+import org.apache.ignite.testframework.GridTestUtils;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+import static org.apache.ignite.cache.CacheMemoryMode.ONHEAP_TIERED;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+
+/**
+ *
+ */
+public class IgnitePartitionedQueueNoBackupsTest extends GridCachePartitionedQueueApiSelfTest {
+ /** {@inheritDoc} */
+ @Override protected CacheMode collectionCacheMode() {
+ return PARTITIONED;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected CacheMemoryMode collectionMemoryMode() {
+ return ONHEAP_TIERED;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected CacheAtomicityMode collectionCacheAtomicityMode() {
+ return ATOMIC;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected CollectionConfiguration collectionConfiguration() {
+ CollectionConfiguration colCfg = super.collectionConfiguration();
+
+ colCfg.setBackups(0);
+
+ return colCfg;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testCollocation() throws Exception {
+ IgniteQueue<Integer> queue = grid(0).queue("queue", 0, config(true));
+
+ for (int i = 0; i < 1000; i++)
+ assertTrue(queue.add(i));
+
+ assertEquals(1000, queue.size());
+
+ GridCacheContext cctx = GridTestUtils.getFieldValue(queue, "cctx");
+
+ UUID setNodeId = null;
+
+ for (int i = 0; i < gridCount(); i++) {
+ IgniteKernal grid = (IgniteKernal)grid(i);
+
+ Iterator<GridCacheEntryEx> entries =
+ grid.context().cache().internalCache(cctx.name()).map().allEntries0().iterator();
+
+ if (entries.hasNext()) {
+ if (setNodeId == null)
+ setNodeId = grid.localNode().id();
+ else
+ fail("For collocated queue all items should be stored on single node.");
+ }
+ }
+ }}
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/GridCacheReplicatedQueueApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/GridCacheReplicatedQueueApiSelfTest.java
index 1aea6d9..bad37a9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/GridCacheReplicatedQueueApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/GridCacheReplicatedQueueApiSelfTest.java
@@ -31,6 +31,11 @@
*/
public class GridCacheReplicatedQueueApiSelfTest extends GridCacheQueueApiSelfAbstractTest {
/** {@inheritDoc} */
+ @Override protected int gridCount() {
+ return 4;
+ }
+
+ /** {@inheritDoc} */
@Override protected CacheMode collectionCacheMode() {
return REPLICATED;
}
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java
index fe0b84e..78e7672 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java
@@ -295,6 +295,8 @@
// Check that thread successfully finished.
fut.get();
+ awaitPartitionMapExchange();
+
// Check there are no hanging transactions.
assertEquals(0, ((IgniteEx)ignite(0)).context().cache().context().tm().idMapSize());
assertEquals(0, ((IgniteEx)ignite(2)).context().cache().context().tm().idMapSize());
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNearCacheTxNodeFailureSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNearCacheTxNodeFailureSelfTest.java
index ca23646..5735182 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNearCacheTxNodeFailureSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNearCacheTxNodeFailureSelfTest.java
@@ -28,8 +28,4 @@
@Override protected CacheConfiguration cacheConfiguration(String gridName) {
return super.cacheConfiguration(gridName).setNearConfiguration(new NearCacheConfiguration());
}
-
- @Override public void testPrimaryNodeFailureBackupCommitImplicit(){
- fail("https://issues.apache.org/jira/browse/IGNITE-1611");
- }
}
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedHitsAndMissesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedHitsAndMissesSelfTest.java
index a2ae2e1..02eb9d8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedHitsAndMissesSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedHitsAndMissesSelfTest.java
@@ -121,8 +121,8 @@
}
// Check that invoke and loader updated metrics
- assertEquals(CNT, hits);
- assertEquals(CNT, misses);
+ assertEquals(CNT / 2, hits);
+ assertEquals(CNT / 2, misses);
}
finally {
stopAllGrids();
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreAbstractTest.java
index 4a5141e..e9674f3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreAbstractTest.java
@@ -114,7 +114,7 @@
Map<Integer, String> map = store.getMap();
- assert map.isEmpty();
+ assert map.isEmpty() : map;
Transaction tx = grid().transactions().txStart(OPTIMISTIC, REPEATABLE_READ);
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/config/GridTestProperties.java b/modules/core/src/test/java/org/apache/ignite/testframework/config/GridTestProperties.java
index 1ea8c38..491f38f 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/config/GridTestProperties.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/config/GridTestProperties.java
@@ -72,6 +72,9 @@
/** */
public static final String MARSH_CLASS_NAME = "marshaller.class";
+ /** */
+ public static final String ENTRY_PROCESSOR_CLASS_NAME = "entry.processor.class";
+
/** Binary marshaller compact footers property. */
public static final String BINARY_COMPACT_FOOTERS = "binary.marshaller.compact.footers";
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
index 95661cb..eaf63d7 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
@@ -60,6 +60,7 @@
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.IgnitionEx;
+import org.apache.ignite.internal.portable.BinaryMarshaller;
import org.apache.ignite.internal.processors.resource.GridSpringResourceContext;
import org.apache.ignite.internal.util.GridClassLoaderCache;
import org.apache.ignite.internal.portable.BinaryEnumCache;
@@ -119,6 +120,9 @@
/** Null name for execution map. */
private static final String NULL_NAME = UUID.randomUUID().toString();
+ /** */
+ private static final boolean BINARY_MARSHALLER = false;
+
/** Ip finder for TCP discovery. */
public static final TcpDiscoveryIpFinder LOCAL_IP_FINDER = new TcpDiscoveryVmIpFinder(false) {{
setAddresses(Collections.singleton("127.0.0.1:47500..47509"));
@@ -155,6 +159,9 @@
System.setProperty(IgniteSystemProperties.IGNITE_ATOMIC_CACHE_DELETE_HISTORY_SIZE, "10000");
System.setProperty(IgniteSystemProperties.IGNITE_UPDATE_NOTIFIER, "false");
+ if (BINARY_MARSHALLER)
+ GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName());
+
Thread timer = new Thread(new GridTestClockTimer(), "ignite-clock-for-tests");
timer.setDaemon(true);
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheTestSuite3.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheTestSuite3.java
index 2778c97..3d25645 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheTestSuite3.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheTestSuite3.java
@@ -31,6 +31,8 @@
*/
public static TestSuite suite() throws Exception {
GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName());
+ GridTestProperties.setProperty(GridTestProperties.ENTRY_PROCESSOR_CLASS_NAME,
+ "org.apache.ignite.tests.p2p.CacheDeploymentPortableEntryProcessor");
return IgniteCacheTestSuite3.suite();
}
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java
index c44455f..519d3c1 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java
@@ -65,6 +65,7 @@
import org.apache.ignite.internal.processors.cache.datastructures.partitioned.GridCachePartitionedSetSelfTest;
import org.apache.ignite.internal.processors.cache.datastructures.partitioned.IgnitePartitionedAtomicLongApiSelfTest;
import org.apache.ignite.internal.processors.cache.datastructures.partitioned.IgnitePartitionedCountDownLatchSelfTest;
+import org.apache.ignite.internal.processors.cache.datastructures.partitioned.IgnitePartitionedQueueNoBackupsTest;
import org.apache.ignite.internal.processors.cache.datastructures.partitioned.IgnitePartitionedSetNoBackupsSelfTest;
import org.apache.ignite.internal.processors.cache.datastructures.replicated.GridCacheReplicatedAtomicReferenceApiSelfTest;
import org.apache.ignite.internal.processors.cache.datastructures.replicated.GridCacheReplicatedAtomicStampedApiSelfTest;
@@ -165,6 +166,8 @@
suite.addTest(new TestSuite(IgniteClientDataStructuresTest.class));
suite.addTest(new TestSuite(IgniteClientDiscoveryDataStructuresTest.class));
+ suite.addTest(new TestSuite(IgnitePartitionedQueueNoBackupsTest.class));
+
return suite;
}
}
\ No newline at end of file
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
index ca31c28..7e45470 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
@@ -91,6 +91,7 @@
import org.apache.ignite.internal.processors.cache.IgniteCacheEntryListenerTxLocalTest;
import org.apache.ignite.internal.processors.cache.IgniteCacheEntryListenerTxReplicatedTest;
import org.apache.ignite.internal.processors.cache.IgniteCacheEntryListenerTxTest;
+import org.apache.ignite.internal.processors.cache.IgniteCacheEntryProcessorCallTest;
import org.apache.ignite.internal.processors.cache.IgniteCacheManyAsyncOperationsTest;
import org.apache.ignite.internal.processors.cache.IgniteCacheNearLockValueSelfTest;
import org.apache.ignite.internal.processors.cache.IgniteCacheTransactionalStopBusySelfTest;
@@ -167,6 +168,7 @@
suite.addTestSuite(IgniteCacheAtomicLocalInvokeTest.class);
suite.addTestSuite(IgniteCacheAtomicLocalWithStoreInvokeTest.class);
suite.addTestSuite(IgniteCacheTxInvokeTest.class);
+ suite.addTestSuite(IgniteCacheEntryProcessorCallTest.class);
suite.addTestSuite(IgniteCacheTxNearEnabledInvokeTest.class);
suite.addTestSuite(IgniteCacheTxLocalInvokeTest.class);
suite.addTestSuite(IgniteCrossCacheTxStoreSelfTest.class);
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
index 74b688f..c94931e 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
@@ -35,6 +35,7 @@
import org.apache.ignite.internal.processors.cache.IgniteCachePartitionMapUpdateTest;
import org.apache.ignite.internal.processors.cache.IgniteDynamicCacheAndNodeStop;
import org.apache.ignite.internal.processors.cache.distributed.CacheLoadingConcurrentGridStartSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.CacheLockReleaseNodeLeaveTest;
import org.apache.ignite.internal.processors.cache.distributed.GridCachePartitionNotLoadedEventSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.GridCachePartitionedNearDisabledTxMultiThreadedSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.GridCacheTransformEventSelfTest;
@@ -244,6 +245,7 @@
suite.addTest(new TestSuite(GridCacheNearTxForceKeyTest.class));
suite.addTest(new TestSuite(CrossCacheTxRandomOperationsTest.class));
suite.addTest(new TestSuite(IgniteDynamicCacheAndNodeStop.class));
+ suite.addTest(new TestSuite(CacheLockReleaseNodeLeaveTest.class));
return suite;
}
diff --git a/modules/flume/pom.xml b/modules/flume/pom.xml
index 0768410..8598248 100644
--- a/modules/flume/pom.xml
+++ b/modules/flume/pom.xml
@@ -34,10 +34,6 @@
<version>1.5.0-b1-SNAPSHOT</version>
<url>http://ignite.apache.org</url>
- <properties>
- <flume-ng.version>1.6.0</flume-ng.version>
- </properties>
-
<dependencies>
<dependency>
<groupId>org.apache.ignite</groupId>
@@ -48,7 +44,7 @@
<dependency>
<groupId>org.apache.flume</groupId>
<artifactId>flume-ng-core</artifactId>
- <version>${flume-ng.version}</version>
+ <version>${flume.ng.version}</version>
</dependency>
<dependency>
@@ -73,4 +69,14 @@
<scope>test</scope>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git a/modules/geospatial/pom.xml b/modules/geospatial/pom.xml
index eefe279..229ecef 100644
--- a/modules/geospatial/pom.xml
+++ b/modules/geospatial/pom.xml
@@ -82,4 +82,24 @@
<scope>test</scope>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <!-- Generate the OSGi MANIFEST.MF for this bundle.
+ This bundle is a fragment attached to the ignite-core bundle, as it contains and exports classes in
+ the org.apache.ignite.internal.processors.query.h2.opt in the same manner as ignite-indexing, thus
+ leading to a split package situation in OSGi.
+ -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Fragment-Host>org.apache.ignite.ignite-core</Fragment-Host>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
diff --git a/modules/hadoop/pom.xml b/modules/hadoop/pom.xml
index 75a9eea..df39996 100644
--- a/modules/hadoop/pom.xml
+++ b/modules/hadoop/pom.xml
@@ -104,7 +104,7 @@
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
- <version>1.8.3</version>
+ <version>${commons.beanutils.version}</version>
<scope>test</scope>
</dependency>
diff --git a/modules/hibernate/pom.xml b/modules/hibernate/pom.xml
index d5a1be4..766ca97 100644
--- a/modules/hibernate/pom.xml
+++ b/modules/hibernate/pom.xml
@@ -71,7 +71,7 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
- <version>1.3.175</version>
+ <version>${h2.version}</version>
<scope>test</scope>
</dependency>
@@ -134,5 +134,13 @@
</excludes>
</testResource>
</testResources>
+
+ <plugins>
+ <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+ </plugins>
</build>
</project>
diff --git a/modules/indexing/pom.xml b/modules/indexing/pom.xml
index 13a11b4..e7a1c3b 100644
--- a/modules/indexing/pom.xml
+++ b/modules/indexing/pom.xml
@@ -44,19 +44,19 @@
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
- <version>1.6</version>
+ <version>${commons.codec.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
- <version>3.5.0</version>
+ <version>${lucene.version}</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
- <version>1.3.175</version>
+ <version>${h2.version}</version>
</dependency>
<dependency>
@@ -108,6 +108,22 @@
</execution>
</executions>
</plugin>
+
+ <!-- Generate the OSGi MANIFEST.MF for this bundle.
+ This bundle is a fragment attached to the ignite-core bundle, as it contains and exports classes in
+ the org.apache.ignite.internal.processors.query.h2.opt in the same manner as ignite-geospatial, thus
+ leading to a split package situation in OSGi. It also contains an internal processor.
+ -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Fragment-Host>org.apache.ignite.ignite-core</Fragment-Host>
+ </instructions>
+ </configuration>
+ </plugin>
</plugins>
</build>
+
</project>
diff --git a/modules/jcl/pom.xml b/modules/jcl/pom.xml
index a2ee45f..8678caa 100644
--- a/modules/jcl/pom.xml
+++ b/modules/jcl/pom.xml
@@ -55,4 +55,15 @@
<scope>test</scope>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
diff --git a/modules/jms11/pom.xml b/modules/jms11/pom.xml
index 4665ce9..2e2ffe6 100644
--- a/modules/jms11/pom.xml
+++ b/modules/jms11/pom.xml
@@ -34,10 +34,6 @@
<version>1.5.0-b1-SNAPSHOT</version>
<url>http://ignite.apache.org</url>
- <properties>
- <activemq.version>5.12.0</activemq.version>
- </properties>
-
<dependencies>
<dependency>
<groupId>org.apache.ignite</groupId>
@@ -46,9 +42,9 @@
</dependency>
<dependency>
- <groupId>javax.jms</groupId>
- <artifactId>jms-api</artifactId>
- <version>1.1-rev-1</version>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ <version>${jms.spec.version}</version>
</dependency>
<dependency>
@@ -88,4 +84,14 @@
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
diff --git a/modules/jta/pom.xml b/modules/jta/pom.xml
index 4724c4f..9dabe28 100644
--- a/modules/jta/pom.xml
+++ b/modules/jta/pom.xml
@@ -83,4 +83,21 @@
<scope>test</scope>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+ <!-- This is a fragment because it's a processor module. -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Fragment-Host>org.apache.ignite.ignite-core</Fragment-Host>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
diff --git a/modules/kafka/pom.xml b/modules/kafka/pom.xml
index b62f177..443d73c 100644
--- a/modules/kafka/pom.xml
+++ b/modules/kafka/pom.xml
@@ -44,7 +44,7 @@
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.10</artifactId>
- <version>0.8.2.1</version>
+ <version>${kafka.version}</version>
<exclusions>
<exclusion>
<groupId>com.sun.jmx</groupId>
@@ -72,7 +72,7 @@
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
- <version>3.4.5</version>
+ <version>${zookeeper.version}</version>
</dependency>
<dependency>
@@ -84,7 +84,7 @@
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-all</artifactId>
- <version>4.2</version>
+ <version>${asm.version}</version>
</dependency>
<dependency>
@@ -103,4 +103,14 @@
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
diff --git a/modules/log4j/pom.xml b/modules/log4j/pom.xml
index f08217e..e27732e 100644
--- a/modules/log4j/pom.xml
+++ b/modules/log4j/pom.xml
@@ -54,4 +54,14 @@
<scope>test</scope>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git a/modules/log4j2/pom.xml b/modules/log4j2/pom.xml
index db351cb..e195ce7 100644
--- a/modules/log4j2/pom.xml
+++ b/modules/log4j2/pom.xml
@@ -61,4 +61,15 @@
<version>2.3</version>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
diff --git a/modules/mqtt/pom.xml b/modules/mqtt/pom.xml
index a1ce973..c0b17e6 100644
--- a/modules/mqtt/pom.xml
+++ b/modules/mqtt/pom.xml
@@ -34,12 +34,6 @@
<version>1.5.0-b1-SNAPSHOT</version>
<url>http://ignite.apache.org</url>
- <properties>
- <paho.version>1.0.2</paho.version>
- <activemq.version>5.12.0</activemq.version>
- <guava-retryier.version>2.0.0</guava-retryier.version>
- </properties>
-
<dependencies>
<dependency>
<groupId>org.apache.ignite</groupId>
@@ -56,7 +50,13 @@
<dependency>
<groupId>com.github.rholder</groupId>
<artifactId>guava-retrying</artifactId>
- <version>${guava-retryier.version}</version>
+ <version>${guava.retrying.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>${guava.version}</version>
</dependency>
<dependency>
@@ -110,4 +110,14 @@
</repository>
</repositories>
+ <build>
+ <plugins>
+ <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
diff --git a/modules/osgi-karaf/README.txt b/modules/osgi-karaf/README.txt
new file mode 100644
index 0000000..6bd1555
--- /dev/null
+++ b/modules/osgi-karaf/README.txt
@@ -0,0 +1,18 @@
+Apache Ignite OSGi Karaf Integration Module
+-------------------------------------------
+
+This module contains a feature repository to facilitate installing Apache Ignite into an Apache Karaf container.
+
+Use the following Karaf command:
+
+ karaf@root()> feature:repo-add mvn:org.apache.ignite/ignite-osgi-karaf/${ignite.version}/xml/features
+
+Replacing ${ignite.version} with the Apache Ignite version you woudl like to install.
+
+You may now list the Ignite features that are available for installation:
+
+ karaf@root()> feature:list | grep ignite
+
+Each feature installs the corresponding ignite module + its dependencies.
+
+We include an global feature with name 'ignite-all' that collectively installs all Ignite features at once.
diff --git a/modules/osgi-karaf/licenses/apache-2.0.txt b/modules/osgi-karaf/licenses/apache-2.0.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/modules/osgi-karaf/licenses/apache-2.0.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/modules/osgi-karaf/pom.xml b/modules/osgi-karaf/pom.xml
new file mode 100644
index 0000000..e1f53e2
--- /dev/null
+++ b/modules/osgi-karaf/pom.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<!--
+ POM file.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-parent</artifactId>
+ <version>1</version>
+ <relativePath>../../parent</relativePath>
+ </parent>
+
+ <artifactId>ignite-osgi-karaf</artifactId>
+ <version>1.5.0-b1-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>filter</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.9.1</version>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>target/classes/features.xml</file>
+ <type>xml</type>
+ <classifier>features</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/modules/osgi-karaf/src/main/resources/features.xml b/modules/osgi-karaf/src/main/resources/features.xml
new file mode 100644
index 0000000..4dca39b
--- /dev/null
+++ b/modules/osgi-karaf/src/main/resources/features.xml
@@ -0,0 +1,327 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<features name="ignite" xmlns="http://karaf.apache.org/xmlns/features/v1.3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.3.0 http://karaf.apache.org/xmlns/features/v1.3.0">
+
+ <feature name="ignite-all" version="${project.version}" description="Apache Ignite :: All">
+ <details>
+ <![CDATA[Aggregate feature for installing all Apache Ignite module + their dependencies.
+
+ NOTE: Due to a bug in Apache Karaf (KARAF-4129), you must install the ignite-log4j feature explicitly and then either:
+ - manually refresh the pax-logging-api framework bundle - or -
+ - restart the Apache Karaf container.
+ You may safely ignore the 'Resource has no uri' exception if you follow this method.]]>
+ </details>
+ <feature>ignite-core</feature>
+ <feature>ignite-aop</feature>
+ <feature>ignite-aws</feature>
+ <feature>ignite-camel</feature>
+ <feature>ignite-flume</feature>
+ <feature>ignite-indexing</feature>
+ <feature>ignite-hibernate</feature>
+ <feature>ignite-jcl</feature>
+ <feature>ignite-jms11</feature>
+ <feature>ignite-jta</feature>
+ <feature>ignite-kafka</feature>
+ <feature>ignite-mqtt</feature>
+ <!-- KARAF-4129 Karaf feature containing a fragment that attaches to pax-logging-api cannot be installed
+ <feature>ignite-log4j</feature>-->
+ <feature>ignite-rest-http</feature>
+ <feature>ignite-scalar-2.11</feature>
+ <feature>ignite-schedule</feature>
+ <feature>ignite-slf4j</feature>
+ <feature>ignite-spring</feature>
+ <feature>ignite-ssh</feature>
+ <feature>ignite-twitter</feature>
+ <feature>ignite-urideploy</feature>
+ <feature>ignite-web</feature>
+ <feature>ignite-zookeeper</feature>
+ </feature>
+
+ <feature name="ignite-core" version="${project.version}" description="Apache Ignite :: Core">
+ <details><![CDATA[The Apache Ignite core module. This feature also installs the JCache 1.0 specification API.]]></details>
+ <bundle start="true" dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax-cache-api/${javax.cache.bundle.version}</bundle>
+ <bundle dependency="true">mvn:org.apache.ignite/ignite-osgi/${project.version}</bundle>
+ <bundle start="true">mvn:org.apache.ignite/ignite-core/${project.version}</bundle>
+ </feature>
+
+ <feature name="ignite-aop" version="${project.version}" description="Apache Ignite :: AOP">
+ <details><![CDATA[The Apache Ignite AOP module + dependencies.]]></details>
+ <feature dependency="true" version="[${spring41.osgi.feature.version},4.2)">spring-aspects</feature>
+ <bundle start="true" dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.aopalliance/${aopalliance.bundle.version}</bundle>
+ <bundle start="true" dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.aspectj/${aspectj.bundle.version}</bundle>
+ <bundle start="true">mvn:org.apache.ignite/ignite-aop/${project.version}</bundle>
+ </feature>
+
+ <feature name="ignite-aws" version="${project.version}" description="Apache Ignite :: AWS">
+ <details><![CDATA[The Apache Ignite AWS module + dependencies.]]></details>
+ <bundle start="true" dependency="true">mvn:org.apache.httpcomponents/httpcore-osgi/${httpcore.version}</bundle>
+ <bundle start="true" dependency="true">mvn:org.apache.httpcomponents/httpclient-osgi/${httpclient.version}</bundle>
+ <bundle start="true" dependency="true">mvn:commons-codec/commons-codec/${commons.codec.version}</bundle>
+ <bundle start="true" dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.aws-java-sdk/${aws.sdk.bundle.version}</bundle>
+ <bundle start="true">mvn:org.apache.ignite/ignite-aws/${project.version}</bundle>
+ </feature>
+
+ <feature name="ignite-camel" version="${project.version}" description="Apache Ignite :: Camel">
+ <details>
+ <![CDATA[The Apache Ignite Camel module.
+
+ Make sure to install the Apache Camel feature repository before installing this feature.
+
+ mvn:org.apache.camel.karaf/apache-camel/\${camel.version}/xml/features
+
+ Installing this feature will trigger the installation of the 'camel-core' feature from the Camel repository.]]>
+ </details>
+ <feature>camel-core</feature>
+ <bundle start="true">mvn:org.apache.ignite/ignite-camel/${project.version}</bundle>
+ </feature>
+
+ <feature name="ignite-flume" version="${project.version}" description="Apache Ignite :: Flume">
+ <details>
+ <![CDATA[The Apache Ignite Flume module + dependencies.]]>
+ </details>
+ <feature prerequisite="true">wrap</feature>
+ <bundle start="true" dependency="true">wrap:mvn:org.apache.flume/flume-ng-core/${flume.ng.version}$Bundle-SymbolicName=flume-ng-core&Bundle-Version=${flume.ng.version}</bundle>
+ <bundle start="true">mvn:org.apache.ignite/ignite-flume/${project.version}</bundle>
+ </feature>
+
+ <feature name="ignite-hibernate" version="${project.version}" description="Apache Ignite :: Hibernate">
+ <details>
+ <![CDATA[The Apache Ignite Hibernate module + dependencies.
+
+ Installing this feature will trigger the installation of the 'hibernate' feature from the Apache Karaf distribution.]]>
+ </details>
+ <feature>hibernate</feature>
+ <bundle start="true">mvn:org.apache.ignite/ignite-hibernate/${project.version}</bundle>
+ </feature>
+
+ <feature name="ignite-indexing" version="${project.version}" description="Apache Ignite :: Indexing">
+ <details>
+ <![CDATA[The Apache Ignite Indexing module + dependencies. This module is a fragment of ignite-core.
+
+ Be sure to refresh ignite-core manually in case it is not refreshed automatically.]]>
+ </details>
+ <bundle start="true" dependency="true">mvn:org.osgi/org.osgi.enterprise/${osgi.enterprise.version}</bundle>
+ <bundle start="true" dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene/${lucene.bundle.version}</bundle>
+ <bundle start="true" dependency="true">mvn:com.h2database/h2/${h2.version}</bundle>
+ <bundle start="false">mvn:org.apache.ignite/ignite-indexing/${project.version}</bundle>
+ </feature>
+
+ <feature name="ignite-jcl" version="${project.version}" description="Apache Ignite :: JCL">
+ <details>
+ <![CDATA[The Apache Ignite JCL integration module. In Apache Karaf, this module will integrate with Pax Logging.]]>
+ </details>
+ <bundle start="true">mvn:org.apache.ignite/ignite-jcl/${project.version}</bundle>
+ </feature>
+
+ <feature name="ignite-jms11" version="${project.version}" description="Apache Ignite :: JMS 1.1">
+ <details>
+ <![CDATA[The Apache Ignite JMS 1.1 module. Make sure to install your broker's JMS client bundle as well.]]>
+ </details>
+ <bundle start="true" dependency="true">mvn:org.apache.geronimo.specs/geronimo-jms_1.1_spec/${jms.spec.version}</bundle>
+ <bundle start="true">mvn:org.apache.ignite/ignite-jms11/${project.version}</bundle>
+ </feature>
+
+ <feature name="ignite-jta" version="${project.version}" description="Apache Ignite :: JTA">
+ <details>
+ <![CDATA[The Apache Ignite JTA module + dependencies. This module is a fragment of ignite-core.
+
+ Be sure to refresh ignite-core manually in case it is not refreshed automatically.
+
+ Installing this feature will trigger the installation of the 'transaction' feature from the Apache Karaf distribution.]]>
+ </details>
+ <feature dependency="true">transaction</feature>
+ <bundle start="true">mvn:org.apache.ignite/ignite-jta/${project.version}</bundle>
+ </feature>
+
+ <feature name="ignite-kafka" version="${project.version}" description="Apache Ignite :: Kafka">
+ <details>
+ <![CDATA[The Apache Ignite Kafka module + dependencies. This module installs the Scala 2.10 library bundle.]]>
+ </details>
+ <feature prerequisite="true">wrap</feature>
+ <bundle start="true" dependency="true">mvn:org.scala-lang/scala-library/${scala210.library.version}</bundle>
+ <bundle start="true" dependency="true">mvn:org.apache.zookeeper/zookeeper/${zookeeper.version}</bundle>
+ <bundle start="true" dependency="true">wrap:mvn:com.101tec/zkclient/${zkclient.version}$Bundle-SymbolicName=zkclient&Bundle-Version=${zkclient.version}&Export-Package=*;-noimport:=true;version=${zkclient.version}</bundle>
+ <bundle start="true" dependency="true">wrap:mvn:com.yammer.metrics/metrics-core/${yammer.metrics.core.version}$Bundle-SymbolicName=yammer-metrics-core&Bundle-Version=2.2.0&Export-Package=*;-noimport:=true;version=${yammer.metrics.core.version}</bundle>
+ <bundle start="true" dependency="true">wrap:mvn:com.yammer.metrics/metrics-annotation/${yammer.metrics.annotation.version}$Bundle-SymbolicName=yammer-metrics-annotation&Bundle-Version=2.2.0&Export-Package=*;-noimport:=true;version=${yammer.metrics.annotation.version}</bundle>
+ <bundle start="true" dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.kafka-clients/${kafka.clients.bundle.version}</bundle>
+ <bundle start="true" dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.kafka_2.10/${kafka.bundle.version}</bundle>
+ <bundle start="true">mvn:org.apache.ignite/ignite-kafka/${project.version}</bundle>
+ </feature>
+
+ <feature name="ignite-log4j" version="${project.version}" description="Apache Ignite :: log4j">
+ <details>
+ <![CDATA[The Apache Ignite log4j module + dependencies.
+
+ This module installs an OSGi fragment that exposes extra packages from the Pax Logging bundle required by Ignite.
+
+ Be sure to refresh the Pax Logging bundles manually in case this does not happen automatically.]]>
+ </details>
+ <bundle dependency="true" start-level="8">mvn:org.apache.ignite/ignite-osgi-paxlogging/${project.version}</bundle>
+ <bundle start="true">mvn:org.apache.ignite/ignite-log4j/${project.version}</bundle>
+ </feature>
+
+ <feature name="ignite-mqtt" version="${project.version}" description="Apache Ignite :: MQTT">
+ <details>
+ <![CDATA[The Apache Ignite MQTT module + dependencies.]]>
+ </details>
+ <feature prerequisite="true">wrap</feature>
+ <bundle start="true" dependency="true">mvn:com.google.guava/guava/${guava.version}</bundle>
+ <bundle start="true" dependency="true">mvn:org.eclipse.paho/org.eclipse.paho.client.mqttv3/${paho.version}</bundle>
+ <bundle start="true" dependency="true">wrap:mvn:com.github.rholder/guava-retrying/${guava.retrying.version}$Bundle-SymbolicName=guava-retrying&Bundle-SymbolicName=guava-retrying&Bundle-Version=${guava.retrying.version}</bundle>
+ <bundle start="true">mvn:org.apache.ignite/ignite-mqtt/${project.version}</bundle>
+ </feature>
+
+ <feature name="ignite-rest-http" version="${project.version}" description="Apache Ignite :: REST HTTP">
+ <!-- NOTICE: XOM cannot be included by default due to an incompatible license;
+ please review its license model and install the dependency manually if you agree. -->
+ <details>
+ <![CDATA[The Apache Ignite REST HTTP module + dependencies.
+
+ Installing this feature will trigger the installation of the 'http' feature from the Apache Karaf distribution.
+
+ NOTE: Before using this feature you must review the license of the XOM bundle and install it manually if you accept it:
+ install -s mvn:xom/xom/1.2.5]]>
+ </details>
+ <feature dependency="true">http</feature>
+ <bundle start="true" dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-beanutils/${commons.beanutils.bundle.version}</bundle>
+ <bundle start="true" dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.oro/${oro.bundle.version}</bundle>
+ <bundle start="true" dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.ezmorph/${ezmorph.bundle.version}</bundle>
+ <bundle start="true" dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.json-lib/${jsonlib.bundle.version}</bundle>
+ <bundle start="true" dependency="true">mvn:commons-lang/commons-lang/${commons.lang.version}</bundle>
+ <bundle start="true" dependency="true">mvn:commons-collections/commons-collections/${commons.collections.version}</bundle>
+ <bundle start="true">mvn:org.apache.ignite/ignite-rest-http/${project.version}</bundle>
+ </feature>
+
+ <feature name="ignite-scalar-2.10" version="${project.version}" description="Apache Ignite :: Scala 2.10">
+ <details>
+ <![CDATA[The Apache Ignite Scala 2.11 integration module + dependencies. This module installs the Scala 2.10 library bundle.]]>
+ </details>
+ <bundle start="true" dependency="true">mvn:org.scala-lang/scala-library/${scala210.library.version}</bundle>
+ <bundle start="true">mvn:org.apache.ignite/ignite-scalar_2.10/${project.version}</bundle>
+ </feature>
+
+ <feature name="ignite-scalar-2.11" version="${project.version}" description="Apache Ignite :: Scala 2.11">
+ <details>
+ <![CDATA[The Apache Ignite Scala 2.11 integration module + dependencies. This module installs the Scala 2.11 library bundle.]]>
+ </details>
+ <bundle start="true" dependency="true">mvn:org.scala-lang/scala-library/${scala211.library.version}</bundle>
+ <bundle start="true">mvn:org.apache.ignite/ignite-scalar/${project.version}</bundle>
+ </feature>
+
+ <feature name="ignite-schedule" version="${project.version}" description="Apache Ignite :: Schedule">
+ <details>
+ <![CDATA[The Apache Ignite Schedule module + dependencies. This module is a fragment of ignite-core.]]>
+ </details>
+ <feature prerequisite="true">wrap</feature>
+ <bundle start="true" dependency="true">wrap:mvn:it.sauronsoftware.cron4j/cron4j/${cron4j.version}$Bundle-SymbolicName=cron4j&Bundle-Version=${cron4j.version}</bundle>
+ <bundle start="true">mvn:org.apache.ignite/ignite-schedule/${project.version}</bundle>
+ </feature>
+
+ <feature name="ignite-slf4j" version="${project.version}" description="Apache Ignite :: slf4j">
+ <details>
+ <![CDATA[The Apache Ignite slf4j module.]]>
+ </details>
+ <bundle start="true">mvn:org.apache.ignite/ignite-slf4j/${project.version}</bundle>
+ </feature>
+
+ <feature name="ignite-spring" version="${project.version}" description="Apache Ignite :: Spring Support">
+ <details>
+ <![CDATA[The Apache Ignite Spring integration module + dependencies. This module is a fragment of ignite-core.
+
+ Be sure to refresh ignite-core in case it is not refreshed automatically.
+
+ This feature installs the following features from the Apache Karaf distribution:
+ - spring
+ - spring-aspects
+ - spring-tx
+ - spring-jdbc
+
+ With version range: [${spring41.osgi.feature.version},4.2).]]>
+ </details>
+ <feature dependency="true" version="[${spring41.osgi.feature.version},4.2)">spring</feature>
+ <feature dependency="true" version="[${spring41.osgi.feature.version},4.2)">spring-aspects</feature>
+ <feature dependency="true" version="[${spring41.osgi.feature.version},4.2)">spring-tx</feature>
+ <feature dependency="true" version="[${spring41.osgi.feature.version},4.2)">spring-jdbc</feature>
+ <bundle start="true">mvn:org.apache.ignite/ignite-spring/${project.version}</bundle>
+ </feature>
+
+ <feature name="ignite-ssh" version="${project.version}" description="Apache Ignite :: SSH">
+ <details>
+ <![CDATA[The Apache Ignite SSH module + dependencies.]]>
+ </details>
+ <bundle start="true" dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jsch/${jsch.bundle.version}</bundle>
+ <bundle start="true">mvn:org.apache.ignite/ignite-ssh/${project.version}</bundle>
+ </feature>
+
+ <feature name="ignite-twitter" version="${project.version}" description="Apache Ignite :: Twitter">
+ <details>
+ <![CDATA[The Apache Ignite Twitter module + dependencies.]]>
+ </details>
+ <feature prerequisite="true">wrap</feature>
+ <bundle start="true" dependency="true">mvn:com.google.guava/guava/${guava14.version}</bundle>
+ <bundle start="true" dependency="true">wrap:mvn:com.twitter/hbc-core/${twitter.hbc.version}$Bundle-SymbolicName=Hosebird Client Core&Bundle-Version=${twitter.hbc.version}</bundle>
+ <bundle start="true" dependency="true">wrap:mvn:com.twitter/hbc-twitter4j/${twitter.hbc.version}$Bundle-SymbolicName=Hosebird Client Twitter4J&Bundle-Version=${twitter.hbc.version}</bundle>
+ <bundle start="true">mvn:org.apache.ignite/ignite-twitter/${project.version}</bundle>
+ </feature>
+
+ <feature name="ignite-urideploy" version="${project.version}" description="Apache Ignite :: URI Deploy">
+ <details>
+ <![CDATA[The Apache Ignite URI Deploy module + dependencies.
+
+ This feature installs the following features from the Apache Karaf distribution:
+ - spring
+ - spring-aspects
+ - spring-tx
+
+ With version range: [${spring41.osgi.feature.version},4.2).]]>
+ </details>
+ <feature prerequisite="true">wrap</feature>
+ <feature dependency="true" version="[${spring41.osgi.feature.version},4.2)">spring</feature>
+ <feature dependency="true" version="[${spring41.osgi.feature.version},4.2)">spring-aspects</feature>
+ <feature dependency="true" version="[${spring41.osgi.feature.version},4.2)">spring-tx</feature>
+ <bundle start="true" dependency="true">wrap:mvn:net.sf.jtidy/jtidy/${jtidy.version}$Bundle-SymbolicName=JTidy&Bundle-Version=938</bundle>
+ <bundle start="true" dependency="true">mvn:commons-codec/commons-codec/${commons.codec.version}</bundle>
+ <bundle start="true">mvn:org.apache.ignite/ignite-urideploy/${project.version}</bundle>
+ </feature>
+
+ <feature name="ignite-web" version="${project.version}" description="Apache Ignite :: Web">
+ <details>
+ <![CDATA[The Apache Ignite Web module + dependencies.
+
+ This feature installs the 'http' feature from the Apache Karaf distribution.]]>
+ </details>
+ <feature dependency="true">http</feature>
+ <bundle start="true">mvn:org.apache.ignite/ignite-web/${project.version}</bundle>
+ </feature>
+
+ <feature name="ignite-zookeeper" version="${project.version}" description="Apache Ignite :: ZooKeeper">
+ <details>
+ <![CDATA[The Apache Ignite ZooKeeper module + dependencies.]]>
+ </details>
+ <bundle start="true" dependency="true">mvn:com.google.guava/guava/${guava16.version}</bundle>
+ <bundle start="true" dependency="true">mvn:org.codehaus.jackson/jackson-core-asl/${jackson.version}</bundle>
+ <bundle start="true" dependency="true">mvn:org.codehaus.jackson/jackson-mapper-asl/${jackson.version}</bundle>
+ <bundle start="true" dependency="true">mvn:org.apache.curator/curator-client/${curator.version}</bundle>
+ <bundle start="true" dependency="true">mvn:org.apache.curator/curator-framework/${curator.version}</bundle>
+ <bundle start="true" dependency="true">mvn:org.apache.curator/curator-recipes/${curator.version}</bundle>
+ <bundle start="true" dependency="true">mvn:org.apache.curator/curator-x-discovery/${curator.version}</bundle>
+ <bundle start="true">mvn:org.apache.ignite/ignite-zookeeper/${project.version}</bundle>
+ </feature>
+
+</features>
\ No newline at end of file
diff --git a/modules/osgi-paxlogging/README.txt b/modules/osgi-paxlogging/README.txt
new file mode 100644
index 0000000..f6346f1
--- /dev/null
+++ b/modules/osgi-paxlogging/README.txt
@@ -0,0 +1,12 @@
+Apache Ignite OSGi Pax Logging Fragment Module
+----------------------------------------------
+
+This module is an OSGi fragment that exposes the following packages from the Pax Logging API bundle:
+
+ - org.apache.log4j.varia
+ - org.apache.log4j.xml
+
+These packages are required when installing the ignite-log4j bundle, and are not exposed by default
+by the Pax Logging API - the logging framework used by Apache Karaf.
+
+This fragment exposes them.
diff --git a/modules/osgi-paxlogging/licenses/apache-2.0.txt b/modules/osgi-paxlogging/licenses/apache-2.0.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/modules/osgi-paxlogging/licenses/apache-2.0.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/modules/osgi-paxlogging/pom.xml b/modules/osgi-paxlogging/pom.xml
new file mode 100644
index 0000000..15a5e0c
--- /dev/null
+++ b/modules/osgi-paxlogging/pom.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<!--
+ POM file.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-parent</artifactId>
+ <version>1</version>
+ <relativePath>../../parent</relativePath>
+ </parent>
+
+ <artifactId>ignite-osgi-paxlogging</artifactId>
+ <version>1.5.0-b1-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>${maven.bundle.plugin.version}</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Fragment-Host>org.ops4j.pax.logging.pax-logging-api</Fragment-Host>
+ <Export-Package>
+ org.apache.log4j.varia;-noimport:=true,
+ org.apache.log4j.xml;-noimport:=true
+ </Export-Package>
+ <Import-Package>!*</Import-Package>
+ <_invalidfilenames />
+ <_nodefaultversion>true</_nodefaultversion>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/modules/osgi/README.txt b/modules/osgi/README.txt
new file mode 100644
index 0000000..35b133d
--- /dev/null
+++ b/modules/osgi/README.txt
@@ -0,0 +1,65 @@
+Apache Ignite OSGi Integration Module
+-------------------------------------
+
+This module provides the bridging components to make Apache Ignite run seamlessly inside an OSGi container
+like Apache Karaf. It provides a Bundle Activator to initialize Ignite, along with different classloaders
+facilitate class resolution within an OSGi environment.
+
+If using Ignite within Apache Karaf, please refer to the osgi-karaf and osgi-paxlogging modules too:
+
+ - osgi-karaf contains a feature repository to facilitate installing Ignite into a Karaf container.
+ - osgi-paxlogging contains an OSGi fragment required to make pax-logging-api expose certain log4j packages
+ required by ignite-log4j
+
+Importing the ignite-osgi module in a Maven project
+---------------------------------------------------
+
+If you are using Maven to manage dependencies of your project, you can add the ignite-osgi module
+dependency like this (replace '${ignite.version}' with actual Ignite version you are interested in):
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ ...
+ <dependencies>
+ ...
+ <dependency>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-osgi</artifactId>
+ <version>${ignite.version}</version>
+ </dependency>
+ ...
+ </dependencies>
+ ...
+</project>
+
+Running the tests in this module
+--------------------------------
+
+We use the Pax Exam framework to fire up an Apache Karaf container (forked process) in order to execute the OSGi tests.
+
+Bundles are provisioned into the container via mvn: URLs. For this to work, you must have run a full build from the
+top directory of the Ignite source tree, including the install goal, which provisions the modules into your local
+Maven repository:
+
+ mvn clean install -Plgpl
+
+Neither compiling and running the tests, nor generating Javadocs are necessary. To disable these steps,
+use these switches:
+
+ -DskipTests -Dmaven.test.skip=true -Dmaven.javadoc.skip=true
+
+You may then run the OSGi test suite:
+
+ mvn test -Dtest=IgniteOsgiTestSuite
+
+NOTE: This test uses environment variables set by the maven-surefire-plugin configuration. If you are running the
+test suite from within an IDE, either run it via Maven or set these environment variables manually in your
+Run/Debug configuration:
+
+ - projectVersion
+ - karafVersion
+ - camelVersion
+
+See the pom.xml file of this module to understand which values to set.
diff --git a/modules/osgi/licenses/apache-2.0.txt b/modules/osgi/licenses/apache-2.0.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/modules/osgi/licenses/apache-2.0.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/modules/osgi/pom.xml b/modules/osgi/pom.xml
new file mode 100644
index 0000000..47c7928
--- /dev/null
+++ b/modules/osgi/pom.xml
@@ -0,0 +1,171 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<!--
+ POM file.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-parent</artifactId>
+ <version>1</version>
+ <relativePath>../../parent</relativePath>
+ </parent>
+
+ <artifactId>ignite-osgi</artifactId>
+ <version>1.5.0-b1-SNAPSHOT</version>
+ <url>http://ignite.apache.org</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>${osgi.core.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam</artifactId>
+ <version>4.6.0</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-junit4</artifactId>
+ <version>4.6.0</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-container-karaf</artifactId>
+ <version>4.6.0</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.karaf</groupId>
+ <artifactId>apache-karaf</artifactId>
+ <version>${karaf.version}</version>
+ <type>tar.gz</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <version>1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.url</groupId>
+ <artifactId>pax-url-aether</artifactId>
+ <version>2.4.3</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- Generate the OSGi MANIFEST.MF for this bundle.
+ This bundle is a fragment attached to the ignite-core bundle, as it contains and exports classes in
+ the org.apache.ignite.internal.processors.query.h2.opt in the same manner as ignite-geospatial, thus
+ leading to a split package situation in OSGi. It also contains an internal processor.
+ -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Fragment-Host>org.apache.ignite.ignite-core</Fragment-Host>
+ </instructions>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.servicemix.tooling</groupId>
+ <artifactId>depends-maven-plugin</artifactId>
+ <version>1.3.1</version>
+ <executions>
+ <execution>
+ <id>generate-depends-file</id>
+ <goals>
+ <goal>generate-depends-file</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkCount>1</forkCount>
+ <systemProperties>
+ <property>
+ <name>karafVersion</name>
+ <value>${karaf.version}</value>
+ </property>
+ <property>
+ <name>projectVersion</name>
+ <value>${project.version}</value>
+ </property>
+ <property>
+ <name>camelVersion</name>
+ <value>${camel.version}</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+
+</project>
diff --git a/modules/osgi/src/main/java/org/apache/ignite/osgi/IgniteAbstractOsgiContextActivator.java b/modules/osgi/src/main/java/org/apache/ignite/osgi/IgniteAbstractOsgiContextActivator.java
new file mode 100644
index 0000000..ac76f6e
--- /dev/null
+++ b/modules/osgi/src/main/java/org/apache/ignite/osgi/IgniteAbstractOsgiContextActivator.java
@@ -0,0 +1,238 @@
+/*
+ * 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.osgi;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.typedef.internal.A;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.osgi.classloaders.BundleDelegatingClassLoader;
+import org.apache.ignite.osgi.classloaders.ContainerSweepClassLoader;
+import org.apache.ignite.osgi.classloaders.OsgiClassLoadingStrategyType;
+import org.jetbrains.annotations.Nullable;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * This {@link BundleActivator} starts Apache Ignite inside the OSGi container when the bundle is started.
+ * <p>
+ * Create an implementation of this class and set the {@code Bundle-Activator} OSGi Manifest header to the FQN of
+ * your class.
+ * <p>
+ * You must provide the {@link IgniteConfiguration} to start by implementing the {@link #igniteConfiguration()}
+ * abstract method. The return value of this method cannot be {@code null}. For example, if your implementation is
+ * called {@code org.myorg.osgi.IgniteActivator}, your bundle must provide the following header:
+ * <pre>
+ * Bundle-Activator: org.myorg.osgi.IgniteActivator
+ * </pre>
+ * You may use the
+ * <a href="https://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html">Maven
+ * Bundle Plugin</a> to generate your bundle (or bundle manifest), including the required header.
+ * <p>
+ * This activator also exports the Ignite instance as an OSGi service, with the property {@code ignite.name} set
+ * to the value of {@link Ignite#name()}, if and only if the name is not null.
+ * <p>
+ * Currently, Ignite only allows a single instance per container. We may remove this limitation if enough demand
+ * builds up in the community.
+ *
+ * @see <a href="http://wiki.osgi.org/wiki/Bundle-Activator">Bundle-Activator OSGi Manifest header</a>
+ *
+ */
+public abstract class IgniteAbstractOsgiContextActivator implements BundleActivator {
+ /** OSGI service property name. */
+ public static final String OSGI_SERVICE_PROP_IGNITE_NAME = "ignite.name";
+
+ /** The instance of Ignite started by this Activator. */
+ protected Ignite ignite;
+
+ /** Our bundle context. */
+ private BundleContext bundleCtx;
+
+ /** Ignite logger. */
+ private IgniteLogger log;
+
+ /**
+ * Method invoked by OSGi to start the bundle. It starts the specified Ignite configuration.
+ *
+ * @param ctx Bundle context.
+ * @throws Exception
+ */
+ @Override public final void start(BundleContext ctx) throws Exception {
+ // Ensure that no other instances are running.
+ if (IgniteOsgiUtils.gridCount() > 0) {
+ throw new IgniteException("Failed to start Ignite instance (another instance is already running " +
+ "and ignite-osgi is currently limited to a single instance per container).");
+ }
+
+ bundleCtx = ctx;
+
+ // Start the Ignite configuration specified by the user.
+ IgniteConfiguration cfg = igniteConfiguration();
+
+ A.notNull(cfg, "Ignite configuration");
+
+ // Override the classloader with the classloading strategy chosen by the user.
+ ClassLoader clsLdr;
+
+ if (classLoadingStrategy() == OsgiClassLoadingStrategyType.BUNDLE_DELEGATING)
+ clsLdr = new BundleDelegatingClassLoader(bundleCtx.getBundle(), Ignite.class.getClassLoader());
+ else
+ clsLdr = new ContainerSweepClassLoader(bundleCtx.getBundle(), Ignite.class.getClassLoader());
+
+ cfg.setClassLoader(clsLdr);
+
+ onBeforeStart(ctx);
+
+ // Start Ignite.
+ try {
+ ignite = Ignition.start(cfg);
+ }
+ catch (Throwable t) {
+ U.error(log, "Failed to start Ignite via OSGi Activator [errMsg=" + t.getMessage() + ']', t);
+
+ onAfterStart(ctx, t);
+
+ return;
+ }
+
+ log = ignite.log();
+
+ log.info("Started Ignite from OSGi Activator [name=" + ignite.name() + ']');
+
+ // Add into Ignite's OSGi registry.
+ IgniteOsgiUtils.classloaders().put(ignite, clsLdr);
+
+ // Export Ignite as a service.
+ exportOsgiService(ignite);
+
+ onAfterStart(ctx, null);
+ }
+
+ /**
+ * Stops Ignite when the bundle is stopping.
+ *
+ * @param ctx Bundle context.
+ * @throws Exception If failed.
+ */
+ @Override public final void stop(BundleContext ctx) throws Exception {
+ onBeforeStop(ctx);
+
+ try {
+ ignite.close();
+ }
+ catch (Throwable t) {
+ U.error(log, "Failed to stop Ignite via OSGi Activator [errMsg=" + t.getMessage() + ']', t);
+
+ onAfterStop(ctx, t);
+
+ return;
+ }
+
+ if (log.isInfoEnabled())
+ log.info("Stopped Ignite from OSGi Activator [name=" + ignite.name() + ']');
+
+ IgniteOsgiUtils.classloaders().remove(ignite);
+
+ onAfterStop(ctx, null);
+ }
+
+ /**
+ * This method is called before Ignite initialises.
+ * <p>
+ * The default implementation is empty. Override it to introduce custom logic.
+ *
+ * @param ctx The {@link BundleContext}.
+ */
+ protected void onBeforeStart(BundleContext ctx) {
+ // No-op.
+ }
+
+ /**
+ * This method is called after Ignite initialises, only if initialization succeeded.
+ * <p>
+ * The default implementation is empty. Override it to introduce custom logic.
+ *
+ * @param ctx The {@link BundleContext}.
+ * @param t Throwable in case an error occurred when starting. {@code null} otherwise.
+ */
+ protected void onAfterStart(BundleContext ctx, @Nullable Throwable t) {
+ // No-op.
+ }
+
+ /**
+ * This method is called before Ignite stops.
+ * <p>
+ * The default implementation is empty. Override it to introduce custom logic.
+ *
+ * @param ctx The {@link BundleContext}.
+ */
+ protected void onBeforeStop(BundleContext ctx) {
+ // No-op.
+ }
+
+ /**
+ * This method is called after Ignite stops, only if the operation succeeded.
+ * <p>
+ * The default implementation is empty. Override it to introduce custom logic.
+ *
+ * @param ctx The {@link BundleContext}.
+ * @param t Throwable in case an error occurred when stopping. {@code null} otherwise.
+ */
+ protected void onAfterStop(BundleContext ctx, @Nullable Throwable t) {
+ // No-op.
+ }
+
+ /**
+ * Override this method to provide the Ignite configuration this bundle will start.
+ *
+ * @return The Ignite configuration.
+ */
+ public abstract IgniteConfiguration igniteConfiguration();
+
+ /**
+ * Override this method to indicate which classloading strategy to use.
+ *
+ * @return The strategy.
+ */
+ public OsgiClassLoadingStrategyType classLoadingStrategy() {
+ return OsgiClassLoadingStrategyType.BUNDLE_DELEGATING;
+ }
+
+ /**
+ * Exports the Ignite instance onto the OSGi Service Registry.
+ *
+ * @param ignite Ignite.
+ */
+ private void exportOsgiService(Ignite ignite) {
+ Dictionary<String, String> dict = new Hashtable<>();
+
+ // Only add the service property if the grid name != null.
+ if (ignite.name() != null)
+ dict.put(OSGI_SERVICE_PROP_IGNITE_NAME, ignite.name());
+
+ bundleCtx.registerService(Ignite.class, ignite, dict);
+
+ if (log.isInfoEnabled())
+ log.info("Exported OSGi service for Ignite with properties: " + dict);
+ }
+}
diff --git a/modules/osgi/src/main/java/org/apache/ignite/osgi/IgniteOsgiUtils.java b/modules/osgi/src/main/java/org/apache/ignite/osgi/IgniteOsgiUtils.java
new file mode 100644
index 0000000..deda3e8
--- /dev/null
+++ b/modules/osgi/src/main/java/org/apache/ignite/osgi/IgniteOsgiUtils.java
@@ -0,0 +1,69 @@
+/*
+ * 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.osgi;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentMap;
+import org.apache.ignite.Ignite;
+import org.jsr166.ConcurrentHashMap8;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.FrameworkUtil;
+
+/**
+ * Helper class for OSGi.
+ */
+public class IgniteOsgiUtils {
+ /** Whether we are running in an OSGi container. */
+ private static boolean osgi = FrameworkUtil.getBundle(IgniteOsgiUtils.class) != null;
+
+ /** Maps Ignite instances to the ClassLoaders of the bundles they were started from. */
+ private static final ConcurrentMap<Ignite, ClassLoader> CLASSLOADERS = new ConcurrentHashMap8<>();
+
+ /**
+ * Private constructor.
+ */
+ private IgniteOsgiUtils() { }
+
+ /**
+ * Returns whether we are running in an OSGi environment.
+ *
+ * @return {@code true/false}.
+ */
+ public static boolean isOsgi() {
+ return osgi;
+ }
+
+ /**
+ * Returns a {@link Map} of {@link Ignite} instances and the classloaders of the {@link Bundle}s they were
+ * started from.
+ *
+ * @return The {@link Map}.
+ */
+ protected static Map<Ignite, ClassLoader> classloaders() {
+ return CLASSLOADERS;
+ }
+
+ /**
+ * Returns the number of grids currently running in this OSGi container.
+ *
+ * @return The grid count.
+ */
+ public static int gridCount() {
+ return CLASSLOADERS.size();
+ }
+}
diff --git a/modules/osgi/src/main/java/org/apache/ignite/osgi/classloaders/BundleDelegatingClassLoader.java b/modules/osgi/src/main/java/org/apache/ignite/osgi/classloaders/BundleDelegatingClassLoader.java
new file mode 100644
index 0000000..07c0682
--- /dev/null
+++ b/modules/osgi/src/main/java/org/apache/ignite/osgi/classloaders/BundleDelegatingClassLoader.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.osgi.classloaders;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Enumeration;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.osgi.framework.Bundle;
+
+/**
+ * A {@link ClassLoader} implementation delegating to a given OSGi bundle, and to the specified {@link ClassLoader}
+ * as a fallback.
+ */
+public class BundleDelegatingClassLoader extends ClassLoader {
+ /** The bundle which loaded Ignite. */
+ protected final Bundle bundle;
+
+ /** The fallback classloader, expected to be the ignite-core classloader. */
+ @GridToStringExclude
+ protected final ClassLoader clsLdr;
+
+ /**
+ * Constructor.
+ *
+ * @param bundle The bundle
+ */
+ public BundleDelegatingClassLoader(Bundle bundle) {
+ this(bundle, null);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param bundle The bundle.
+ * @param classLoader Fallback classloader.
+ */
+ public BundleDelegatingClassLoader(Bundle bundle, ClassLoader classLoader) {
+ this.bundle = bundle;
+ this.clsLdr = classLoader;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected Class<?> findClass(String name) throws ClassNotFoundException {
+ return bundle.loadClass(name);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected URL findResource(String name) {
+ URL resource = bundle.getResource(name);
+
+ if (resource == null && clsLdr != null)
+ resource = clsLdr.getResource(name);
+
+ return resource;
+ }
+
+ /**
+ * Finds a given resource from within the {@link #bundle}.
+ *
+ * @param name The resource name.
+ * @return URLs of resources.
+ * @throws IOException
+ */
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ protected Enumeration findResources(String name) throws IOException {
+ return bundle.getResources(name);
+ }
+
+ /**
+ * Loads a class trying the {@link #bundle} first, falling back to the ClassLoader {@link #clsLdr}.
+ *
+ * @param name Class name.
+ * @param resolve {@code true} to resolve the class.
+ * @return The Class.
+ * @throws ClassNotFoundException
+ */
+ @Override protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
+ Class<?> cls;
+
+ try {
+ cls = findClass(name);
+ }
+ catch (ClassNotFoundException e) {
+ if (clsLdr == null)
+ throw classNotFoundException(name);
+
+ try {
+ cls = clsLdr.loadClass(name);
+ }
+ catch (ClassNotFoundException e2) {
+ throw classNotFoundException(name);
+ }
+
+ }
+
+ if (resolve)
+ resolveClass(cls);
+
+ return cls;
+ }
+
+ /**
+ * Returns the {@link Bundle} to which this ClassLoader is associated.
+ *
+ * @return The Bundle.
+ */
+ public Bundle getBundle() {
+ return bundle;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(BundleDelegatingClassLoader.class, this);
+ }
+
+ /**
+ * Builds a {@link ClassNotFoundException}.
+ *
+ * @param clsName Class name.
+ * @return The exception.
+ */
+ protected ClassNotFoundException classNotFoundException(String clsName) {
+ String s = "Failed to resolve class [name=" + clsName +
+ ", bundleId=" + bundle.getBundleId() +
+ ", symbolicName=" + bundle.getSymbolicName() +
+ ", fallbackClsLdr=" + clsLdr + ']';
+
+ return new ClassNotFoundException(s);
+ }
+}
diff --git a/modules/osgi/src/main/java/org/apache/ignite/osgi/classloaders/ContainerSweepClassLoader.java b/modules/osgi/src/main/java/org/apache/ignite/osgi/classloaders/ContainerSweepClassLoader.java
new file mode 100644
index 0000000..e2e773a
--- /dev/null
+++ b/modules/osgi/src/main/java/org/apache/ignite/osgi/classloaders/ContainerSweepClassLoader.java
@@ -0,0 +1,134 @@
+/*
+ * 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.osgi.classloaders;
+
+import java.util.Set;
+import java.util.concurrent.ConcurrentMap;
+import org.apache.ignite.internal.util.GridConcurrentHashSet;
+import org.jsr166.ConcurrentHashMap8;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+
+/**
+ * A {@link ClassLoader} implementation that first attempts to load the class from the associated {@link Bundle}. As
+ * a fallback, it sweeps the entire OSGi container to find the requested class, returning the first hit.
+ * <p>
+ * It keeps a cache of resolved classes and unresolvable classes, in order to optimize subsequent lookups.
+ */
+public class ContainerSweepClassLoader extends BundleDelegatingClassLoader {
+ /** Classes resolved previously. */
+ private final ConcurrentMap<String, Bundle> resolved = new ConcurrentHashMap8<>();
+
+ /** Unresolvable classes. */
+ private final Set<String> nonResolvable = new GridConcurrentHashSet<>();
+
+ /**
+ * Constructor with a {@link Bundle} only.
+ *
+ * @param bundle The bundle.
+ */
+ public ContainerSweepClassLoader(Bundle bundle) {
+ super(bundle);
+ }
+
+ /**
+ * Constructor with a {@link Bundle} and another {@link ClassLoader} to check.
+ *
+ * @param bundle The bundle.
+ * @param classLoader The other classloader to check.
+ */
+ public ContainerSweepClassLoader(Bundle bundle, ClassLoader classLoader) {
+ super(bundle, classLoader);
+ }
+
+ /**
+ * Runs the same logic to find the class as {@link BundleDelegatingClassLoader}, but if not found, sweeps the
+ * OSGi container to locate the first {@link Bundle} that can load the class, and uses it to do so.
+ *
+ * @param name The classname.
+ * @param resolve Whether to resolve the class or not.
+ * @return The loaded class.
+ * @throws ClassNotFoundException
+ */
+ @Override protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
+ // If we know it's not resolvable, throw the exception immediately.
+ if (nonResolvable.contains(name))
+ throw classNotFoundException(name);
+
+ Class<?> cls;
+
+ // First, delegate to super, and return the class if found.
+ try {
+ cls = super.loadClass(name, resolve);
+ return cls;
+ }
+ catch (ClassNotFoundException e) {
+ // Continue.
+ }
+
+ // Else, check the cache.
+ if (resolved.containsKey(name))
+ return resolved.get(name).loadClass(name);
+
+ // If still unresolved, sweep the container.
+ cls = sweepContainer(name);
+
+ // If still unresolved, throw the exception.
+ if (cls == null)
+ throw classNotFoundException(name);
+
+ return cls;
+ }
+
+ /**
+ * Sweeps the OSGi container to find the first {@link Bundle} that can load the class.
+ *
+ * @param name The classname.
+ * @return The loaded class.
+ */
+ protected Class<?> sweepContainer(String name) {
+ Class<?> cls = null;
+
+ Bundle[] bundles = bundle.getBundleContext().getBundles();
+
+ int bundleIdx = 0;
+
+ for (; bundleIdx < bundles.length; bundleIdx++) {
+ Bundle b = bundles[bundleIdx];
+
+ // Skip bundles that haven't reached RESOLVED state; skip fragments.
+ if (b.getState() <= Bundle.RESOLVED || b.getHeaders().get(Constants.FRAGMENT_HOST) != null)
+ continue;
+
+ try {
+ cls = b.loadClass(name);
+ break;
+ }
+ catch (ClassNotFoundException e) {
+ // No-op.
+ }
+ }
+
+ if (cls == null)
+ nonResolvable.add(name);
+ else
+ resolved.put(name, bundles[bundleIdx]);
+
+ return cls;
+ }
+}
diff --git a/modules/osgi/src/main/java/org/apache/ignite/osgi/classloaders/OsgiClassLoadingStrategyType.java b/modules/osgi/src/main/java/org/apache/ignite/osgi/classloaders/OsgiClassLoadingStrategyType.java
new file mode 100644
index 0000000..9afde42
--- /dev/null
+++ b/modules/osgi/src/main/java/org/apache/ignite/osgi/classloaders/OsgiClassLoadingStrategyType.java
@@ -0,0 +1,29 @@
+/*
+ * 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.osgi.classloaders;
+
+/**
+ * Enum for the user to indicate which type of {@link ClassLoader} Ignite should use.
+ */
+public enum OsgiClassLoadingStrategyType {
+ /** Use this value for {@link BundleDelegatingClassLoader}. */
+ BUNDLE_DELEGATING,
+
+ /** Use this value for {@link ContainerSweepClassLoader}. */
+ CONTAINER_SWEEP
+}
diff --git a/modules/osgi/src/test/java/org/apache/ignite/osgi/AbstractIgniteKarafTest.java b/modules/osgi/src/test/java/org/apache/ignite/osgi/AbstractIgniteKarafTest.java
new file mode 100644
index 0000000..786b543
--- /dev/null
+++ b/modules/osgi/src/test/java/org/apache/ignite/osgi/AbstractIgniteKarafTest.java
@@ -0,0 +1,109 @@
+/*
+ * 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.osgi;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import javax.inject.Inject;
+
+import org.apache.karaf.features.FeaturesService;
+
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.karaf.options.LogLevelOption;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
+import org.osgi.framework.BundleContext;
+
+import static org.ops4j.pax.exam.CoreOptions.junitBundles;
+import static org.ops4j.pax.exam.CoreOptions.maven;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFileExtend;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
+
+/**
+ * Abstract test class that sets up an Apache Karaf container with Ignite installed.
+ */
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerMethod.class)
+public abstract class AbstractIgniteKarafTest {
+ /** Features we do not expect to be installed. */
+ protected static final Set<String> IGNORED_FEATURES = new HashSet<>(
+ Arrays.asList("ignite-log4j", "ignite-scalar-2.10"));
+
+ /** Regex matching ignite features. */
+ protected static final String IGNITE_FEATURES_NAME_REGEX = "ignite.*";
+
+ /** Project version. */
+ protected static final String PROJECT_VERSION = System.getProperty("projectVersion");
+
+ /** Pax Exam will inject the Bundle Context here. */
+ @Inject
+ protected BundleContext bundleCtx;
+
+ /** Pax Exam will inject the Karaf Features Service. */
+ @Inject
+ protected FeaturesService featuresSvc;
+
+ /**
+ * Base configuration for a Karaf container running the specified Ignite features.
+ *
+ * @return The configuration.
+ */
+ public Option[] baseConfig() {
+ return options(
+
+ // Specify which version of Karaf to use.
+ karafDistributionConfiguration()
+ .frameworkUrl(maven().groupId("org.apache.karaf").artifactId("apache-karaf").type("tar.gz")
+ .versionAsInProject())
+ .karafVersion(System.getProperty("karafVersion"))
+ .useDeployFolder(false)
+ .unpackDirectory(new File("target/paxexam/unpack")),
+
+ // Add JUnit bundles.
+ junitBundles(),
+
+ // Add the additional JRE exports that Ignite requires.
+ editConfigurationFileExtend("etc/jre.properties", "jre-1.7", "sun.nio.ch"),
+ editConfigurationFileExtend("etc/jre.properties", "jre-1.8", "sun.nio.ch"),
+
+ // Make log level INFO.
+ logLevel(LogLevelOption.LogLevel.INFO),
+
+ // Add our features repository.
+ features(mavenBundle()
+ .groupId("org.apache.ignite").artifactId("ignite-osgi-karaf")
+ .version(System.getProperty("projectVersion")).type("xml/features"),
+ featuresToInstall().toArray(new String[0])),
+
+ // Propagate the projectVersion system property.
+ systemProperty("projectVersion").value(System.getProperty("projectVersion"))
+ );
+ }
+
+ protected abstract List<String> featuresToInstall();
+}
diff --git a/modules/osgi/src/test/java/org/apache/ignite/osgi/IgniteKarafFeaturesInstallationTest.java b/modules/osgi/src/test/java/org/apache/ignite/osgi/IgniteKarafFeaturesInstallationTest.java
new file mode 100644
index 0000000..112a607
--- /dev/null
+++ b/modules/osgi/src/test/java/org/apache/ignite/osgi/IgniteKarafFeaturesInstallationTest.java
@@ -0,0 +1,100 @@
+/*
+ * 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.osgi;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import org.apache.karaf.features.Feature;
+import org.junit.Test;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.CoreOptions;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.karaf.options.KarafDistributionOption;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Pax Exam test class to check if all features could be resolved and installed.
+ */
+public class IgniteKarafFeaturesInstallationTest extends AbstractIgniteKarafTest {
+ /** Number of features expected to exist. */
+ private static final int EXPECTED_FEATURES = 25;
+
+ private static final String CAMEL_REPO_URI = "mvn:org.apache.camel.karaf/apache-camel/" +
+ System.getProperty("camelVersion") + "/xml/features";
+
+ /**
+ * Container configuration.
+ *
+ * @return The configuration.
+ */
+ @Configuration
+ public Option[] config() {
+ List<Option> options = new ArrayList<>(Arrays.asList(baseConfig()));
+
+ options.add(KarafDistributionOption.features(CAMEL_REPO_URI));
+
+ return CoreOptions.options(options.toArray(new Option[0]));
+ }
+
+ /**
+ * @throws Exception
+ */
+ @Test
+ public void testAllBundlesActiveAndFeaturesInstalled() throws Exception {
+ // Asssert all bundles except fragments are ACTIVE.
+ for (Bundle b : bundleCtx.getBundles()) {
+ System.out.println(String.format("Checking state of bundle [symbolicName=%s, state=%s]",
+ b.getSymbolicName(), b.getState()));
+
+ if (b.getHeaders().get(Constants.FRAGMENT_HOST) == null)
+ assertTrue(b.getState() == Bundle.ACTIVE);
+ }
+
+ // Check that according to the FeaturesService, all Ignite features except ignite-log4j are installed.
+ Feature[] features = featuresSvc.getFeatures(IGNITE_FEATURES_NAME_REGEX);
+
+ assertNotNull(features);
+ assertEquals(EXPECTED_FEATURES, features.length);
+
+ for (Feature f : features) {
+ if (IGNORED_FEATURES.contains(f.getName()))
+ continue;
+
+ boolean installed = featuresSvc.isInstalled(f);
+
+ System.out.println(String.format("Checking if feature is installed [featureName=%s, installed=%s]",
+ f.getName(), installed));
+
+ assertTrue(installed);
+ assertEquals(PROJECT_VERSION.replaceAll("-", "."), f.getVersion().replaceAll("-", "."));
+ }
+ }
+
+ /**
+ * @return Features list.
+ */
+ @Override protected List<String> featuresToInstall() {
+ return Arrays.asList("ignite-all");
+ }
+}
diff --git a/modules/osgi/src/test/java/org/apache/ignite/osgi/IgniteOsgiServiceTest.java b/modules/osgi/src/test/java/org/apache/ignite/osgi/IgniteOsgiServiceTest.java
new file mode 100644
index 0000000..9a2e92d
--- /dev/null
+++ b/modules/osgi/src/test/java/org/apache/ignite/osgi/IgniteOsgiServiceTest.java
@@ -0,0 +1,131 @@
+/*
+ * 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.osgi;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import javax.inject.Inject;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.osgi.activators.BasicIgniteTestActivator;
+import org.apache.ignite.osgi.activators.TestOsgiFlags;
+import org.apache.ignite.osgi.activators.TestOsgiFlagsImpl;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.CoreOptions;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.ProbeBuilder;
+import org.ops4j.pax.exam.TestProbeBuilder;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
+import org.ops4j.pax.exam.util.Filter;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.ops4j.pax.exam.CoreOptions.streamBundle;
+import static org.ops4j.pax.tinybundles.core.TinyBundles.bundle;
+import static org.ops4j.pax.tinybundles.core.TinyBundles.withBnd;
+
+/**
+ * Pax Exam test class to check whether the Ignite service is exposed properly and whether lifecycle callbacks
+ * are invoked.
+ */
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerMethod.class)
+public class IgniteOsgiServiceTest extends AbstractIgniteKarafTest {
+ /** Injects the Ignite OSGi service. */
+ @Inject @Filter("(ignite.name=testGrid)")
+ private Ignite ignite;
+
+ @Inject
+ private BundleContext bundleCtx;
+
+ /**
+ * @return Config.
+ */
+ @Configuration
+ public Option[] bundleDelegatingConfig() {
+ List<Option> options = new ArrayList<>(Arrays.asList(baseConfig()));
+
+ // Add bundles we require.
+ options.add(
+ streamBundle(bundle()
+ .add(BasicIgniteTestActivator.class)
+ .add(TestOsgiFlags.class)
+ .add(TestOsgiFlagsImpl.class)
+ .set(Constants.BUNDLE_SYMBOLICNAME, BasicIgniteTestActivator.class.getSimpleName())
+ .set(Constants.BUNDLE_ACTIVATOR, BasicIgniteTestActivator.class.getName())
+ .set(Constants.EXPORT_PACKAGE, "org.apache.ignite.osgi.activators")
+ .set(Constants.DYNAMICIMPORT_PACKAGE, "*")
+ .build(withBnd())));
+
+ // Uncomment this if you'd like to debug inside the container.
+ // options.add(KarafDistributionOption.debugConfiguration());
+
+ return CoreOptions.options(options.toArray(new Option[0]));
+ }
+
+ /**
+ * Builds the probe.
+ *
+ * @param probe The probe builder.
+ * @return The probe builder.
+ */
+ @ProbeBuilder
+ public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) {
+ probe.setHeader(Constants.IMPORT_PACKAGE, "*,org.apache.ignite.osgi.activators");
+
+ return probe;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ @Test
+ public void testServiceExposedAndCallbacksInvoked() throws Exception {
+ assertNotNull(ignite);
+ assertEquals("testGrid", ignite.name());
+
+ TestOsgiFlags flags = (TestOsgiFlags) bundleCtx.getService(
+ bundleCtx.getAllServiceReferences(TestOsgiFlags.class.getName(), null)[0]);
+
+ assertNotNull(flags);
+ assertEquals(Boolean.TRUE, flags.getOnBeforeStartInvoked());
+ assertEquals(Boolean.TRUE, flags.getOnAfterStartInvoked());
+
+ // The bundle is still not stopped, therefore these callbacks cannot be tested.
+ assertNull(flags.getOnBeforeStopInvoked());
+ assertNull(flags.getOnAfterStopInvoked());
+
+ // No exceptions.
+ assertNull(flags.getOnAfterStartThrowable());
+ assertNull(flags.getOnAfterStopThrowable());
+ }
+
+ /**
+ * @return Features.
+ */
+ @Override protected List<String> featuresToInstall() {
+ return Arrays.asList("ignite-core");
+ }
+}
diff --git a/modules/osgi/src/test/java/org/apache/ignite/osgi/IgniteOsgiTestSuite.java b/modules/osgi/src/test/java/org/apache/ignite/osgi/IgniteOsgiTestSuite.java
new file mode 100644
index 0000000..0a3d69c
--- /dev/null
+++ b/modules/osgi/src/test/java/org/apache/ignite/osgi/IgniteOsgiTestSuite.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.osgi;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite for OSGi-related test cases.
+ * <p>
+ * NOTE: Have to use JUnit 4 annotations because Pax Exam is built on JUnit 4.
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({IgniteOsgiServiceTest.class, IgniteKarafFeaturesInstallationTest.class})
+public class IgniteOsgiTestSuite {
+ // No-op.
+}
diff --git a/modules/osgi/src/test/java/org/apache/ignite/osgi/activators/BasicIgniteTestActivator.java b/modules/osgi/src/test/java/org/apache/ignite/osgi/activators/BasicIgniteTestActivator.java
new file mode 100644
index 0000000..c414092
--- /dev/null
+++ b/modules/osgi/src/test/java/org/apache/ignite/osgi/activators/BasicIgniteTestActivator.java
@@ -0,0 +1,76 @@
+/*
+ * 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.osgi.activators;
+
+import java.util.Hashtable;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.osgi.IgniteAbstractOsgiContextActivator;
+import org.apache.ignite.osgi.classloaders.OsgiClassLoadingStrategyType;
+import org.jetbrains.annotations.Nullable;
+import org.osgi.framework.BundleContext;
+
+/**
+ * Basic Ignite Activator for testing.
+ */
+public class BasicIgniteTestActivator extends IgniteAbstractOsgiContextActivator {
+ /** Flags to report our state to a watcher. */
+ private TestOsgiFlagsImpl flags = new TestOsgiFlagsImpl();
+
+ /**
+ * @return Ignite config.
+ */
+ @Override public IgniteConfiguration igniteConfiguration() {
+ IgniteConfiguration config = new IgniteConfiguration();
+
+ config.setGridName("testGrid");
+
+ return config;
+ }
+
+ /**
+ * @return Strategy.
+ */
+ @Override public OsgiClassLoadingStrategyType classLoadingStrategy() {
+ return OsgiClassLoadingStrategyType.BUNDLE_DELEGATING;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void onBeforeStart(BundleContext ctx) {
+ flags.onBeforeStartInvoked = Boolean.TRUE;
+
+ // Export the flags as an OSGi service.
+ ctx.registerService(TestOsgiFlags.class, flags, new Hashtable<String, Object>());
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void onAfterStart(BundleContext ctx, @Nullable Throwable t) {
+ flags.onAfterStartInvoked = Boolean.TRUE;
+ flags.onAfterStartThrowable = t;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void onBeforeStop(BundleContext ctx) {
+ flags.onBeforeStopInvoked = Boolean.TRUE;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void onAfterStop(BundleContext ctx, @Nullable Throwable t) {
+ flags.onAfterStopInvoked = Boolean.TRUE;
+ flags.onAfterStopThrowable = t;
+ }
+}
diff --git a/modules/osgi/src/test/java/org/apache/ignite/osgi/activators/TestOsgiFlags.java b/modules/osgi/src/test/java/org/apache/ignite/osgi/activators/TestOsgiFlags.java
new file mode 100644
index 0000000..09a2d29
--- /dev/null
+++ b/modules/osgi/src/test/java/org/apache/ignite/osgi/activators/TestOsgiFlags.java
@@ -0,0 +1,53 @@
+/*
+ * 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.osgi.activators;
+
+/**
+ * Interface to export the flags in OSGi.
+ */
+public interface TestOsgiFlags {
+ /**
+ * @return The flag.
+ */
+ Boolean getOnBeforeStartInvoked();
+
+ /**
+ * @return The flag.
+ */
+ Boolean getOnAfterStartInvoked();
+
+ /**
+ * @return The flag.
+ */
+ Throwable getOnAfterStartThrowable();
+
+ /**
+ * @return The flag.
+ */
+ Boolean getOnBeforeStopInvoked();
+
+ /**
+ * @return The flag.
+ */
+ Boolean getOnAfterStopInvoked();
+
+ /**
+ * @return The flag.
+ */
+ Throwable getOnAfterStopThrowable();
+}
diff --git a/modules/osgi/src/test/java/org/apache/ignite/osgi/activators/TestOsgiFlagsImpl.java b/modules/osgi/src/test/java/org/apache/ignite/osgi/activators/TestOsgiFlagsImpl.java
new file mode 100644
index 0000000..ccec2df
--- /dev/null
+++ b/modules/osgi/src/test/java/org/apache/ignite/osgi/activators/TestOsgiFlagsImpl.java
@@ -0,0 +1,83 @@
+/*
+ * 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.osgi.activators;
+
+/**
+ * Data transfer object representing flags we want to watch from the OSGi tests.
+ */
+public class TestOsgiFlagsImpl implements TestOsgiFlags {
+ /** onBeforeStartInvoked flag. */
+ public Boolean onBeforeStartInvoked;
+
+ /** onAfterStartInvoked flag. */
+ public Boolean onAfterStartInvoked;
+
+ /** onAfterStartThrowable flag. */
+ public Throwable onAfterStartThrowable;
+
+ /** onBeforeStartInvoked flag. */
+ public Boolean onBeforeStopInvoked;
+
+ /** onAfterStopInvoked flag. */
+ public Boolean onAfterStopInvoked;
+
+ /** onAfterStopThrowable flag. */
+ public Throwable onAfterStopThrowable;
+
+ /**
+ * @return The flag.
+ */
+ @Override public Boolean getOnBeforeStartInvoked() {
+ return onBeforeStartInvoked;
+ }
+
+ /**
+ * @return The flag.
+ */
+ @Override public Boolean getOnAfterStartInvoked() {
+ return onAfterStartInvoked;
+ }
+
+ /**
+ * @return The flag.
+ */
+ @Override public Throwable getOnAfterStartThrowable() {
+ return onAfterStartThrowable;
+ }
+
+ /**
+ * @return The flag.
+ */
+ @Override public Boolean getOnBeforeStopInvoked() {
+ return onBeforeStopInvoked;
+ }
+
+ /**
+ * @return The flag.
+ */
+ @Override public Boolean getOnAfterStopInvoked() {
+ return onAfterStopInvoked;
+ }
+
+ /**
+ * @return The flag.
+ */
+ @Override public Throwable getOnAfterStopThrowable() {
+ return onAfterStopThrowable;
+ }
+}
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
index 9f22355..a538cb4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
@@ -568,7 +568,8 @@
Assert.AreEqual(EventType.SwapSpaceCleared, evt.Type);
Assert.IsNotNullOrEmpty(evt.Name);
Assert.AreNotEqual(Guid.Empty, evt.Id.GlobalId);
- Assert.IsTrue((evt.Timestamp - DateTime.Now).TotalSeconds < 10);
+ Assert.IsTrue(Math.Abs((evt.Timestamp - DateTime.UtcNow).TotalSeconds) < 20,
+ "Invalid event timestamp: '{0}', current time: '{1}'", evt.Timestamp, DateTime.Now);
}
/// <summary>
diff --git a/modules/rest-http/pom.xml b/modules/rest-http/pom.xml
index 3dc18d3..0780144 100644
--- a/modules/rest-http/pom.xml
+++ b/modules/rest-http/pom.xml
@@ -34,6 +34,13 @@
<version>1.5.0-b1-SNAPSHOT</version>
<url>http://ignite.apache.org</url>
+ <properties>
+ <osgi.export.package>
+ org.apache.ignite.internal.processors.rest.protocols.http.jetty,
+ {local-packages}
+ </osgi.export.package>
+ </properties>
+
<dependencies>
<dependency>
<groupId>org.apache.ignite</groupId>
@@ -44,13 +51,13 @@
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-servlet-api</artifactId>
- <version>8.0.23</version>
+ <version>${tomcat.version}</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
- <version>2.6</version>
+ <version>${commons.lang.version}</version>
</dependency>
<dependency>
@@ -92,38 +99,38 @@
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
- <version>2.4</version>
+ <version>${jsonlib.version}</version>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>net.sf.ezmorph</groupId>
<artifactId>ezmorph</artifactId>
- <version>1.0.6</version>
+ <version>${ezmorph.version}</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
- <version>3.2.1</version>
+ <version>${commons.collections.version}</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
- <version>1.8.3</version>
+ <version>${commons.beanutils.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>1.7.7</version>
+ <version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
- <version>1.7.7</version>
+ <version>${slf4j.version}</version>
</dependency>
<dependency>
@@ -131,4 +138,15 @@
<artifactId>log4j</artifactId>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
diff --git a/modules/scalar-2.10/pom.xml b/modules/scalar-2.10/pom.xml
index 83e515b..9a958eb 100644
--- a/modules/scalar-2.10/pom.xml
+++ b/modules/scalar-2.10/pom.xml
@@ -44,7 +44,7 @@
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
- <version>2.10.4</version>
+ <version>${scala210.library.version}</version>
</dependency>
<dependency>
@@ -109,6 +109,12 @@
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
</plugin>
+
+ <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
</plugins>
<!-- TODO IGNITE-956 FIX scaladocs plugins-->
@@ -194,5 +200,6 @@
<!--</executions>-->
<!--</plugin>-->
<!--</plugins>-->
+
</build>
</project>
diff --git a/modules/scalar/pom.xml b/modules/scalar/pom.xml
index e78ce73..301a103 100644
--- a/modules/scalar/pom.xml
+++ b/modules/scalar/pom.xml
@@ -44,7 +44,7 @@
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
- <version>2.11.7</version>
+ <version>${scala211.library.version}</version>
</dependency>
<dependency>
@@ -184,6 +184,13 @@
</execution>
</executions>
</plugin>
+
+ <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+
</plugins>
</build>
</project>
diff --git a/modules/schedule/pom.xml b/modules/schedule/pom.xml
index 6e687a6..cb53713 100644
--- a/modules/schedule/pom.xml
+++ b/modules/schedule/pom.xml
@@ -34,6 +34,13 @@
<version>1.5.0-b1-SNAPSHOT</version>
<url>http://ignite.apache.org</url>
+ <properties>
+ <osgi.export.package>
+ org.apache.ignite.internal.processors.schedule,
+ {local-packages}
+ </osgi.export.package>
+ </properties>
+
<dependencies>
<dependency>
<groupId>org.apache.ignite</groupId>
@@ -44,7 +51,7 @@
<dependency>
<groupId>it.sauronsoftware.cron4j</groupId>
<artifactId>cron4j</artifactId>
- <version>2.2.5</version>
+ <version>${cron4j.version}</version>
</dependency>
<dependency>
@@ -75,4 +82,20 @@
<scope>test</scope>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <!-- Generate the OSGi MANIFEST.MF for this fragment. It is a fragment because it contains internal processors
+ that would be looked up by ignite-core. -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Fragment-Host>org.apache.ignite.ignite-core</Fragment-Host>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git a/modules/schema-import/pom.xml b/modules/schema-import/pom.xml
index 2fae337..36f6b13 100644
--- a/modules/schema-import/pom.xml
+++ b/modules/schema-import/pom.xml
@@ -44,7 +44,7 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
- <version>1.3.175</version>
+ <version>${h2.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/SchemaImportApp.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/SchemaImportApp.java
index 495c316..6f9e05b 100644
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/SchemaImportApp.java
+++ b/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/SchemaImportApp.java
@@ -22,6 +22,7 @@
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.lang.reflect.Field;
import java.net.URL;
import java.net.URLClassLoader;
import java.sql.Connection;
@@ -1738,6 +1739,19 @@
catch (Exception ignore) {
// No-op.
}
+
+ // Workaround for JDK 7/JavaFX 2 application on Mac OSX El Capitan.
+ try {
+ Class<?> fontFinderCls = Class.forName("com.sun.t2k.MacFontFinder");
+
+ Field psNameToPathMap = fontFinderCls.getDeclaredField("psNameToPathMap");
+
+ psNameToPathMap.setAccessible(true);
+ psNameToPathMap.set(null, new HashMap<String, String>());
+ }
+ catch (Exception ignore) {
+ // No-op.
+ }
}
launch(args);
diff --git a/modules/slf4j/pom.xml b/modules/slf4j/pom.xml
index 130ea19..1449549 100644
--- a/modules/slf4j/pom.xml
+++ b/modules/slf4j/pom.xml
@@ -44,7 +44,17 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>1.6.4</version>
+ <version>${slf4j.version}</version>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git a/modules/spark-2.10/pom.xml b/modules/spark-2.10/pom.xml
index 627cc49..0b24898 100644
--- a/modules/spark-2.10/pom.xml
+++ b/modules/spark-2.10/pom.xml
@@ -52,7 +52,7 @@
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
- <version>2.10.4</version>
+ <version>${scala210.library.version}</version>
</dependency>
<dependency>
diff --git a/modules/spring/pom.xml b/modules/spring/pom.xml
index 2e90632..1808a0a 100644
--- a/modules/spring/pom.xml
+++ b/modules/spring/pom.xml
@@ -106,7 +106,7 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
- <version>1.3.175</version>
+ <version>${h2.version}</version>
<scope>test</scope>
</dependency>
@@ -118,11 +118,10 @@
<scope>test</scope>
</dependency>
-
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
- <version>1.3.175</version>
+ <version>${h2.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -136,5 +135,30 @@
</excludes>
</testResource>
</testResources>
+
+ <plugins>
+ <!-- Generate the OSGi MANIFEST.MF for this bundle.
+ This bundle is a fragment attached to the ignite-core bundle, as it contains and exports classes in the org.apache.ignite
+ leading to a split package situation in OSGi.
+ -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Fragment-Host>org.apache.ignite.ignite-core</Fragment-Host>
+ <Require-Bundle>
+ org.apache.servicemix.bundles.spring-beans,
+ org.apache.servicemix.bundles.spring-context,
+ org.apache.servicemix.bundles.spring-context-support,
+ org.apache.servicemix.bundles.spring-core,
+ org.apache.servicemix.bundles.spring-expression,
+ org.apache.servicemix.bundles.spring-jdbc,
+ org.apache.servicemix.bundles.spring-tx
+ </Require-Bundle>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
</build>
</project>
diff --git a/modules/ssh/pom.xml b/modules/ssh/pom.xml
index 1079c00..e1b0fe5 100644
--- a/modules/ssh/pom.xml
+++ b/modules/ssh/pom.xml
@@ -44,7 +44,7 @@
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
- <version>0.1.53</version>
+ <version>${jsch.version}</version>
</dependency>
<dependency>
@@ -69,4 +69,21 @@
<scope>test</scope>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+ <!-- This is a fragment because it's an internal processor module. -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Fragment-Host>org.apache.ignite.ignite-core</Fragment-Host>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
diff --git a/modules/twitter/pom.xml b/modules/twitter/pom.xml
index fc924f6..1649043 100644
--- a/modules/twitter/pom.xml
+++ b/modules/twitter/pom.xml
@@ -65,7 +65,7 @@
<dependency>
<groupId>com.twitter</groupId>
<artifactId>hbc-twitter4j</artifactId>
- <version>2.2.0</version>
+ <version>${twitter.hbc.version}</version>
</dependency>
<dependency>
@@ -118,4 +118,14 @@
<scope>test</scope>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git a/modules/urideploy/pom.xml b/modules/urideploy/pom.xml
index 5f2436e..37c77ba 100644
--- a/modules/urideploy/pom.xml
+++ b/modules/urideploy/pom.xml
@@ -80,19 +80,19 @@
<dependency>
<groupId>net.sf.jtidy</groupId>
<artifactId>jtidy</artifactId>
- <version>r938</version>
+ <version>${jtidy.version}</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
- <version>1.6</version>
+ <version>${commons.codec.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-servlet-api</artifactId>
- <version>8.0.23</version>
+ <version>${tomcat.version}</version>
<scope>test</scope>
</dependency>
@@ -145,4 +145,15 @@
<scope>test</scope>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
diff --git a/modules/visor-console-2.10/pom.xml b/modules/visor-console-2.10/pom.xml
index 8d1bd74..87ce699 100644
--- a/modules/visor-console-2.10/pom.xml
+++ b/modules/visor-console-2.10/pom.xml
@@ -80,13 +80,13 @@
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
- <version>2.10.4</version>
+ <version>${scala210.library.version}</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>jline</artifactId>
- <version>2.10.4</version>
+ <version>${scala210.jline.version}</version>
</dependency>
<!-- Third party dependencies -->
diff --git a/modules/visor-console/pom.xml b/modules/visor-console/pom.xml
index 1ed21ae..d4fc6cf 100644
--- a/modules/visor-console/pom.xml
+++ b/modules/visor-console/pom.xml
@@ -80,7 +80,7 @@
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
- <version>2.11.7</version>
+ <version>${scala211.library.version}</version>
</dependency>
<dependency>
diff --git a/modules/visor-plugins/pom.xml b/modules/visor-plugins/pom.xml
index 5cdda0c..7754a4b 100644
--- a/modules/visor-plugins/pom.xml
+++ b/modules/visor-plugins/pom.xml
@@ -53,13 +53,13 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>1.7.7</version>
+ <version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
- <version>1.7.7</version>
+ <version>${slf4j.version}</version>
</dependency>
<!-- Third party dependencies -->
</dependencies>
diff --git a/modules/web/pom.xml b/modules/web/pom.xml
index c97e77b..d25ce61e 100644
--- a/modules/web/pom.xml
+++ b/modules/web/pom.xml
@@ -44,7 +44,7 @@
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-servlet-api</artifactId>
- <version>8.0.23</version>
+ <version>${tomcat.version}</version>
</dependency>
<dependency>
@@ -89,4 +89,15 @@
<scope>test</scope>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java
index 9c3389f3..15b7cd6 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java
@@ -18,8 +18,11 @@
package org.apache.ignite.yardstick.cache;
import java.util.Map;
+import java.util.concurrent.Callable;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteSystemProperties;
+import org.apache.ignite.IgniteTransactions;
+import org.apache.ignite.yardstick.IgniteBenchmarkUtils;
import org.apache.ignite.yardstick.cache.model.SampleValue;
import org.yardstickframework.BenchmarkConfiguration;
@@ -27,20 +30,35 @@
* Ignite benchmark that performs transactional put operations.
*/
public class IgnitePutTxBenchmark extends IgniteCacheAbstractBenchmark<Integer, Object> {
+ /** */
+ private IgniteTransactions txs;
+
+ /** */
+ private Callable<Void> clo;
+
/** {@inheritDoc} */
@Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
super.setUp(cfg);
if (!IgniteSystemProperties.getBoolean("SKIP_MAP_CHECK"))
ignite().compute().broadcast(new WaitMapExchangeFinishCallable());
+
+ txs = ignite().transactions();
+
+ clo = new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ int key = nextRandom(args.range());
+
+ cache.put(key, new SampleValue(key));
+
+ return null;
+ }
+ };
}
/** {@inheritDoc} */
@Override public boolean test(Map<Object, Object> ctx) throws Exception {
- int key = nextRandom(args.range());
-
- // Implicit transaction is used.
- cache.put(key, new SampleValue(key));
+ IgniteBenchmarkUtils.doInTransaction(txs, args.txConcurrency(), args.txIsolation(), clo);
return true;
}
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalInvokeRetryBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalInvokeRetryBenchmark.java
index 16b0959..b5a08da 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalInvokeRetryBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalInvokeRetryBenchmark.java
@@ -169,7 +169,7 @@
if (ex != null)
throw ex;
- asyncCache.invoke(key, new IncrementCacheEntryProcessor());
+ asyncCache.invoke(key, new IncrementInvokeRetryCacheEntryProcessor());
asyncCache.future().get(args.cacheOperationTimeoutMillis());
AtomicLong prevVal = map.putIfAbsent(key, new AtomicLong(0));
@@ -195,7 +195,7 @@
/**
*/
- private static class IncrementCacheEntryProcessor implements CacheEntryProcessor<String, Long, Long> {
+ private static class IncrementInvokeRetryCacheEntryProcessor implements CacheEntryProcessor<String, Long, Long> {
/** */
private static final long serialVersionUID = 0;
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteInvokeBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteInvokeBenchmark.java
index a52ea78..35befad 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteInvokeBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteInvokeBenchmark.java
@@ -68,17 +68,15 @@
long start = System.nanoTime();
- if (cfg.memberId() == 0) {
- try (IgniteDataStreamer<String, Long> dataLdr = ignite().dataStreamer(cacheName())) {
- for (int k = 0; k < args.range() && !Thread.currentThread().isInterrupted(); k++) {
- dataLdr.addData("key-" + k + "-master", INITIAL_VALUE);
+ try (IgniteDataStreamer<String, Long> dataLdr = ignite().dataStreamer(cacheName())) {
+ for (int k = 0; k < args.range() && !Thread.currentThread().isInterrupted(); k++) {
+ dataLdr.addData("key-" + k + "-master", INITIAL_VALUE);
- for (int i = 0; i < args.keysCount(); i++)
- dataLdr.addData("key-" + k + "-" + i, INITIAL_VALUE);
+ for (int i = 0; i < args.keysCount(); i++)
+ dataLdr.addData("key-" + k + "-" + i, INITIAL_VALUE);
- if (k % 100000 == 0)
- println(cfg, "Populated accounts: " + k);
- }
+ if (k % 100000 == 0)
+ println(cfg, "Populated accounts: " + k);
}
}
@@ -123,7 +121,7 @@
Set<Long> values = new HashSet<>(map.values());
if (values.size() != 1)
- throw new IgniteConsistencyException("Found different values for keys [map="+map+"]");
+ throw new IgniteConsistencyException("Found different values for keys [map=" + map + "]");
break;
case 1: // Invoke scenario.
@@ -137,7 +135,7 @@
asyncCache.future().get(timeout);
for (String key : keys) {
- asyncCache.invoke(key, new IncrementCacheEntryProcessor(), cacheName());
+ asyncCache.invoke(key, new IncrementWriteInvokeCacheEntryProcessor(), cacheName());
Object o = asyncCache.future().get(timeout);
if (o != null)
@@ -165,7 +163,7 @@
/**
*/
- private static class IncrementCacheEntryProcessor implements CacheEntryProcessor<String, Long, Object> {
+ private static class IncrementWriteInvokeCacheEntryProcessor implements CacheEntryProcessor<String, Long, Object> {
/** */
private static final long serialVersionUID = 0;
diff --git a/modules/yarn/src/main/java/org/apache/ignite/yarn/utils/package-info.java b/modules/yarn/src/main/java/org/apache/ignite/yarn/utils/package-info.java
new file mode 100644
index 0000000..a73c390
--- /dev/null
+++ b/modules/yarn/src/main/java/org/apache/ignite/yarn/utils/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. -->
+ * Utility and helper classes.
+ */
+package org.apache.ignite.yarn.utils;
\ No newline at end of file
diff --git a/modules/zookeeper/pom.xml b/modules/zookeeper/pom.xml
index 8aa5730..8ade247 100644
--- a/modules/zookeeper/pom.xml
+++ b/modules/zookeeper/pom.xml
@@ -34,10 +34,6 @@
<version>1.5.0-b1-SNAPSHOT</version>
<url>http://ignite.apache.org</url>
- <properties>
- <curator.version>2.9.1</curator.version>
- </properties>
-
<dependencies>
<dependency>
<groupId>org.apache.ignite</groupId>
@@ -87,4 +83,14 @@
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
diff --git a/parent/pom.xml b/parent/pom.xml
index a7ae644..68ba62b 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -35,15 +35,87 @@
<properties>
<ignite.edition>fabric</ignite.edition>
- <hadoop.version>2.4.1</hadoop.version>
- <spark.version>1.5.2</spark.version>
- <spring.version>4.1.0.RELEASE</spring.version>
+
+ <!-- Build parameters. -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.build.timestamp.format>MMMM d yyyy</maven.build.timestamp.format>
<doxygen.exec>doxygen</doxygen.exec>
<git.exec>git</git.exec>
- <jetty.version>9.2.11.v20150529</jetty.version>
+ <maven.bundle.plugin.version>2.5.4</maven.bundle.plugin.version>
<javadoc.opts>-XDenableSunApiLintControl</javadoc.opts>
+
+ <!-- Dependency versions. -->
+ <activemq.version>5.12.0</activemq.version>
+ <aopalliance.bundle.version>1.0_6</aopalliance.bundle.version>
+ <asm.version>4.2</asm.version>
+ <aspectj.bundle.version>1.7.2_1</aspectj.bundle.version>
+ <aspectj.version>1.7.2</aspectj.version>
+ <aws.sdk.bundle.version>1.10.12_1</aws.sdk.bundle.version>
+ <aws.sdk.version>1.10.29</aws.sdk.version>
+ <camel.version>2.16.0</camel.version>
+ <commons.beanutils.bundle.version>1.8.3_1</commons.beanutils.bundle.version>
+ <commons.beanutils.version>1.8.3</commons.beanutils.version>
+ <commons.codec.version>1.6</commons.codec.version>
+ <commons.collections.version>3.2.1</commons.collections.version>
+ <commons.lang.version>2.6</commons.lang.version>
+ <cron4j.version>2.2.5</cron4j.version>
+ <curator.version>2.9.1</curator.version>
+ <ezmorph.bundle.version>1.0.6_1</ezmorph.bundle.version>
+ <ezmorph.version>1.0.6</ezmorph.version>
+ <flume.ng.version>1.6.0</flume.ng.version>
+ <guava.retrying.version>2.0.0</guava.retrying.version>
+ <guava.version>18.0</guava.version>
+ <guava14.version>14.0.1</guava14.version>
+ <guava16.version>16.0.1</guava16.version>
+ <h2.version>1.3.175</h2.version>
+ <hadoop.version>2.4.1</hadoop.version>
+ <httpclient.version>4.5.1</httpclient.version>
+ <httpcore.version>4.4.3</httpcore.version>
+ <jackson.version>1.9.13</jackson.version>
+ <javax.cache.bundle.version>1.0.0_1</javax.cache.bundle.version>
+ <javax.cache.version>1.0.0</javax.cache.version>
+ <jetty.version>9.2.11.v20150529</jetty.version>
+ <jms.spec.version>1.1.1</jms.spec.version>
+ <jsch.bundle.version>0.1.53_1</jsch.bundle.version>
+ <jsch.version>0.1.53</jsch.version>
+ <jsonlib.bundle.version>2.4_1</jsonlib.bundle.version>
+ <jsonlib.version>2.4</jsonlib.version>
+ <jtidy.version>r938</jtidy.version>
+ <kafka.bundle.version>0.8.2.1_1</kafka.bundle.version>
+ <kafka.clients.bundle.version>0.8.2.0_1</kafka.clients.bundle.version>
+ <kafka.clients.version>0.8.2.0</kafka.clients.version>
+ <kafka.version>0.8.2.1</kafka.version>
+ <kafka.version>0.8.2.1</kafka.version>
+ <karaf.version>4.0.2</karaf.version>
+ <lucene.bundle.version>3.5.0_1</lucene.bundle.version>
+ <lucene.version>3.5.0</lucene.version>
+ <oro.bundle.version>2.0.8_6</oro.bundle.version>
+ <osgi.core.version>5.0.0</osgi.core.version>
+ <osgi.enterprise.version>5.0.0</osgi.enterprise.version>
+ <paho.version>1.0.2</paho.version>
+ <scala210.jline.version>2.10.4</scala210.jline.version>
+ <scala210.library.version>2.10.4</scala210.library.version>
+ <scala211.library.version>2.11.7</scala211.library.version>
+ <slf4j.version>1.7.7</slf4j.version>
+ <slf4j16.version>1.6.4</slf4j16.version>
+ <spark.version>1.5.2</spark.version>
+ <spring.version>4.1.0.RELEASE</spring.version>
+ <spring41.osgi.feature.version>4.1.7.RELEASE_1</spring41.osgi.feature.version>
+ <tomcat.version>8.0.23</tomcat.version>
+ <twitter.hbc.version>2.2.0</twitter.hbc.version>
+ <yammer.metrics.annotation.version>2.2.0</yammer.metrics.annotation.version>
+ <yammer.metrics.core.version>2.2.0</yammer.metrics.core.version>
+ <zkclient.version>0.5</zkclient.version>
+ <zookeeper.version>3.4.6</zookeeper.version>
+
+ <!-- OSGI Manifest generation default property values -->
+ <osgi.import.package>*</osgi.import.package>
+ <osgi.export.package>{local-packages}</osgi.export.package>
+ <osgi.private.package></osgi.private.package>
+ <osgi.embed.dependency></osgi.embed.dependency>
+ <osgi.embed.transitive>false</osgi.embed.transitive>
+ <osgi.fail.ok>false</osgi.fail.ok>
+
</properties>
<groupId>org.apache.ignite</groupId>
@@ -182,6 +254,15 @@
</execution>
</executions>
</plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <useDefaultManifestFile>true</useDefaultManifestFile>
+ </configuration>
+ </plugin>
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
@@ -347,6 +428,10 @@
<title>Spark Integration</title>
<packages>org.apache.ignite.spark.examples.java</packages>
</group>
+ <group>
+ <title>OSGi integration</title>
+ <packages>org.apache.ignite.osgi*</packages>
+ </group>
</groups>
<header>
<![CDATA[
@@ -402,6 +487,52 @@
</bottom>
</configuration>
</plugin>
+
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>${maven.bundle.plugin.version}</version>
+ <extensions>true</extensions>
+ <configuration>
+ <archive>
+ <addMavenDescriptor>true</addMavenDescriptor>
+ </archive>
+ <supportedProjectTypes>
+ <supportedProjectType>jar</supportedProjectType>
+ <supportedProjectType>war</supportedProjectType>
+ </supportedProjectTypes>
+ <instructions>
+ <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
+ <Bundle-Version>${project.version}</Bundle-Version>
+ <Bundle-Vendor>${project.organization.name}</Bundle-Vendor>
+ <Bundle-Description>${project.description}</Bundle-Description>
+ <Bundle-DocURL>${project.url}</Bundle-DocURL>
+ <Import-Package>
+ ${osgi.import.package}
+ </Import-Package>
+ <Export-Package>
+ ${osgi.export.package}
+ </Export-Package>
+ <Private-Package>
+ ${osgi.private.package}
+ </Private-Package>
+ <Embed-Dependency>${osgi.embed.dependency}</Embed-Dependency>
+ <Embed-Directory>lib</Embed-Directory>
+ <Embed-Transitive>${osgi.embed.transitive}</Embed-Transitive>
+ <_failok>${osgi.fail.ok}</_failok>
+ <_invalidfilenames />
+ </instructions>
+ </configuration>
+ <executions>
+ <execution>
+ <id>bundle-manifest</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>manifest</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</pluginManagement>
@@ -625,6 +756,7 @@
</execution>
</executions>
</plugin>
+
</plugins>
</build>
diff --git a/pom.xml b/pom.xml
index 109dc94..993eab2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -80,6 +80,9 @@
<module>modules/mqtt</module>
<module>modules/zookeeper</module>
<module>modules/camel</module>
+ <module>modules/osgi-paxlogging</module>
+ <module>modules/osgi-karaf</module>
+ <module>modules/osgi</module>
</modules>
<profiles>
@@ -774,20 +777,37 @@
<target>
<script language="javascript">
function setClientVersion(ggVer, clientVer) {
- var p = project.getProperty(ggVer);
+ var p = project.getProperty(ggVer);
- if (java.util.regex.Pattern.matches(".*-p\\d+", p))
- project.setProperty(clientVer, p.replace("-p", "."));
- else
- if (java.util.regex.Pattern.matches(".*-[a-zA-Z]+\\d+.*", p))
- project.setProperty(clientVer, p.replaceAll("-[a-zA-Z]+(\\d+)?.*", ".$1"));
- else
- project.setProperty(clientVer, p);
+ var pos = p.search("-");
+
+ if (pos > 0)
+ {
+ var suffix = p.substring(pos);
+
+ var ver = 0;
+
+ var beta = /-b([0-9]+)/.exec(suffix);
+ if (beta !== null)
+ ver += parseInt(beta[1]);
+
+ var patch = /-p([0-9]+)/.exec(suffix);
+ if (patch !== null)
+ ver += parseInt(patch[1]) * 100;
+
+ if (suffix.search("final") > 0)
+ ver += 10000;
+
+ var resVer = p.substring(0, pos) +"." + ver;
+ project.setProperty(clientVer, resVer);
+ }
+ else
+ project.setProperty(clientVer, p);
}
function fix(dest, source) {
- project.setProperty(dest, project.getProperty(source).replace("-SNAPSHOT",
- ""));
+ project.setProperty(dest, project.getProperty(source).replace("-SNAPSHOT",
+ ""));
}
fix('ignite.version.fixed', 'project.version');
@@ -810,8 +830,8 @@
<echo message="Update ignite.version in cpp client" />
<replaceregexp byline="true" encoding="UTF-8">
- <regexp pattern="(AC_INIT.+\[)\d.\d.\d(.\d)?(\].+)" />
- <substitution expression="\1${new.client.version}\3" />
+ <regexp pattern="(AC_INIT.+\[)\d.\d.\d.*?(\].+)" />
+ <substitution expression="\1${new.client.version}\2" />
<fileset dir="${basedir}/">
<include name="**/configure.ac" />
</fileset>