+ * Remote nodes should always be started with configuration file which includes + * IGFS: {@code 'ignite.sh examples/config/filesystem/example-igfs.xml'}. + *
+ * Alternatively you can run {@link IgfsNodeStartup} in another JVM which will start
+ * node with {@code examples/config/filesystem/example-igfs.xml} configuration.
+ */
+public final class IgfsExample {
+ /**
+ * Executes example.
+ * restart:
+ * control.bat --cache reset_lost_partitions igfs-internal-igfs-data
+ * @param args Command line arguments, none required.
+ * @throws Exception If example execution failed.
+ */
+ public static void main(String[] args) throws Exception {
+ Ignite ignite = Ignition.start("config/example-igfs.xml");
+ ignite.active(true);
+
+ while(!ignite.cluster().active()){
+ Thread.sleep(100);
+ }
+
+ System.out.println();
+ System.out.println(">>> IGFS example started.");
+
+ try {
+ // Get an instance of Ignite File System.
+ IgniteFileSystem fs = ignite.fileSystem("igfs");
+
+ // Working directory path.
+ IgfsPath workDir = new IgfsPath("/examples/fs");
+
+
+ if(!fs.exists(workDir)) {
+ // Create empty working directory.
+ mkdirs(fs, workDir);
+ }
+
+ Collection
+ * Remote nodes should always be started with configuration file which includes
+ * IGFS: {@code 'ignite.sh examples/config/filesystem/example-igfs.xml'}.
+ *
+ * Alternatively you can run {@link IgfsNodeStartup} in another JVM which will start
+ * node with {@code examples/config/filesystem/example-igfs.xml} configuration.
+ */
+public class IgfsMapReduceExample {
+ /**
+ * Executes example.
+ *
+ * @param args Command line arguments. First argument is file name, second argument is regex to look for.
+ * @throws Exception If failed.
+ */
+ public static void main(String[] args) throws Exception {
+ if (args.length == 0)
+ System.out.println("Please provide file name and regular expression.");
+ else if (args.length == 1)
+ System.out.println("Please provide regular expression.");
+ else {
+ File file0 = new File("./config/example-igfs.xml");
+ String pwd = file0.getCanonicalPath();
+ String url = file0.toURL().toString();
+ try (Ignite ignite = Ignition.start(url)) {
+ System.out.println();
+ System.out.println(">>> IGFS map reduce example started.");
+
+ ignite.active(true);
+
+ while(!ignite.cluster().active()){
+ Thread.sleep(100);
+ }
+
+ // Prepare arguments.
+ String fileName = args[0];
+
+ File file = new File(fileName);
+
+ String regexStr = args[1];
+
+ // Get an instance of Ignite File System.
+ IgniteFileSystem fs = ignite.fileSystem("igfs");
+
+ // Working directory path.
+ IgfsPath workDir = new IgfsPath("/examples/fs");
+
+ // Write file to IGFS.
+ IgfsPath fsPath = new IgfsPath(workDir, file.getName());
+
+ writeFile(fs, fsPath, file);
+
+ Collection Contains only Spring ignite examples tests.
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- ComputeScheduleExampleSelfTest.class,
-
- // Multi-node.
- ComputeScheduleExampleMultiNodeSelfTest.class
-})
-public class IgniteLgplExamplesSelfTestSuite {
- /** */
- @BeforeClass
- public static void init() {
- System.setProperty(IGNITE_OVERRIDE_MCAST_GRP,
- GridTestUtils.getNextMulticastGroup(IgniteLgplExamplesSelfTestSuite.class));
- }
-}
diff --git a/examples/src/test/java/org/apache/ignite/examples/BasicExamplesMultiNodeSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/BasicExamplesMultiNodeSelfTest.java
deleted file mode 100644
index f2ce6fe3a8b88..0000000000000
--- a/examples/src/test/java/org/apache/ignite/examples/BasicExamplesMultiNodeSelfTest.java
+++ /dev/null
@@ -1,28 +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;
-
-/**
- * Closure examples multi-node self test.
- */
-public class BasicExamplesMultiNodeSelfTest extends BasicExamplesSelfTest {
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- startRemoteNodes();
- }
-}
diff --git a/examples/src/test/java/org/apache/ignite/examples/BasicExamplesSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/BasicExamplesSelfTest.java
deleted file mode 100644
index dee77fc081ea6..0000000000000
--- a/examples/src/test/java/org/apache/ignite/examples/BasicExamplesSelfTest.java
+++ /dev/null
@@ -1,98 +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;
-
-import org.apache.ignite.examples.computegrid.ComputeBroadcastExample;
-import org.apache.ignite.examples.computegrid.ComputeCallableExample;
-import org.apache.ignite.examples.computegrid.ComputeClosureExample;
-import org.apache.ignite.examples.computegrid.ComputeReducerExample;
-import org.apache.ignite.examples.computegrid.ComputeRunnableExample;
-import org.apache.ignite.examples.computegrid.ComputeTaskMapExample;
-import org.apache.ignite.examples.computegrid.ComputeTaskSplitExample;
-import org.apache.ignite.examples.datastructures.IgniteExecutorServiceExample;
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
-import org.junit.Test;
-
-/**
- * Closure examples self test.
- */
-public class BasicExamplesSelfTest extends GridAbstractExamplesTest {
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testBroadcastExample() throws Exception {
- ComputeBroadcastExample.main(EMPTY_ARGS);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCallableExample() throws Exception {
- ComputeCallableExample.main(EMPTY_ARGS);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testClosureExample() throws Exception {
- ComputeClosureExample.main(EMPTY_ARGS);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testExecutorExample() throws Exception {
- IgniteExecutorServiceExample.main(EMPTY_ARGS);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testReducerExample() throws Exception {
- ComputeReducerExample.main(EMPTY_ARGS);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testRunnableExample() throws Exception {
- ComputeRunnableExample.main(EMPTY_ARGS);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testTaskMapExample() throws Exception {
- ComputeTaskMapExample.main(EMPTY_ARGS);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testTaskSplitExample() throws Exception {
- ComputeTaskSplitExample.main(EMPTY_ARGS);
- }
-}
diff --git a/examples/src/test/java/org/apache/ignite/examples/CacheClientBinaryExampleTest.java b/examples/src/test/java/org/apache/ignite/examples/CacheClientBinaryExampleTest.java
deleted file mode 100644
index db25c603fd4fb..0000000000000
--- a/examples/src/test/java/org/apache/ignite/examples/CacheClientBinaryExampleTest.java
+++ /dev/null
@@ -1,49 +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;
-
-import org.apache.ignite.examples.binary.datagrid.CacheClientBinaryPutGetExample;
-import org.apache.ignite.examples.binary.datagrid.CacheClientBinaryQueryExample;
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
-import org.junit.Test;
-
-/**
- *
- */
-public class CacheClientBinaryExampleTest extends GridAbstractExamplesTest {
- /** {@inheritDoc} */
- @Override protected String defaultConfig() {
- return "examples/config/binary/example-ignite-binary.xml";
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testBinaryPutGetExample() throws Exception {
- CacheClientBinaryPutGetExample.main(new String[] {});
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testBinaryQueryExample() throws Exception {
- CacheClientBinaryQueryExample.main(new String[] {});
- }
-}
diff --git a/examples/src/test/java/org/apache/ignite/examples/CacheContinuousQueryExamplesSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/CacheContinuousQueryExamplesSelfTest.java
deleted file mode 100644
index d3aa704edcd2d..0000000000000
--- a/examples/src/test/java/org/apache/ignite/examples/CacheContinuousQueryExamplesSelfTest.java
+++ /dev/null
@@ -1,52 +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;
-
-import org.apache.ignite.examples.datagrid.CacheContinuousAsyncQueryExample;
-import org.apache.ignite.examples.datagrid.CacheContinuousQueryExample;
-import org.apache.ignite.examples.datagrid.CacheContinuousQueryWithTransformerExample;
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
-import org.junit.Test;
-
-/**
- */
-public class CacheContinuousQueryExamplesSelfTest extends GridAbstractExamplesTest {
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCacheContinuousAsyncQueryExample() throws Exception {
- CacheContinuousAsyncQueryExample.main(new String[] {});
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCacheContinuousQueryExample() throws Exception {
- CacheContinuousQueryExample.main(new String[] {});
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCacheContinuousQueryWithTransformerExample() throws Exception {
- CacheContinuousQueryWithTransformerExample.main(new String[] {});
- }
-}
diff --git a/examples/src/test/java/org/apache/ignite/examples/CacheExamplesMultiNodeSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/CacheExamplesMultiNodeSelfTest.java
deleted file mode 100644
index b7734e690ae84..0000000000000
--- a/examples/src/test/java/org/apache/ignite/examples/CacheExamplesMultiNodeSelfTest.java
+++ /dev/null
@@ -1,38 +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;
-
-/**
- * Cache examples multi-node self test.
- */
-public class CacheExamplesMultiNodeSelfTest extends CacheExamplesSelfTest {
- /** {@inheritDoc} */
- @Override protected String defaultConfig() {
- return "examples/config/example-ignite.xml";
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- startRemoteNodes();
- }
-
- /** {@inheritDoc} */
- @Override protected long getTestTimeout() {
- return 10 * 60 * 1000;
- }
-}
diff --git a/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java
deleted file mode 100644
index b52658488fe2f..0000000000000
--- a/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java
+++ /dev/null
@@ -1,170 +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;
-
-import org.apache.ignite.examples.datagrid.CacheAffinityExample;
-import org.apache.ignite.examples.datagrid.CacheApiExample;
-import org.apache.ignite.examples.datagrid.CacheContinuousQueryExample;
-import org.apache.ignite.examples.datagrid.CacheDataStreamerExample;
-import org.apache.ignite.examples.datagrid.CacheEntryProcessorExample;
-import org.apache.ignite.examples.datagrid.CachePutGetExample;
-import org.apache.ignite.examples.datagrid.CacheQueryExample;
-import org.apache.ignite.examples.datagrid.CacheTransactionExample;
-import org.apache.ignite.examples.datagrid.starschema.CacheStarSchemaExample;
-import org.apache.ignite.examples.datastructures.IgniteAtomicLongExample;
-import org.apache.ignite.examples.datastructures.IgniteAtomicReferenceExample;
-import org.apache.ignite.examples.datastructures.IgniteAtomicSequenceExample;
-import org.apache.ignite.examples.datastructures.IgniteAtomicStampedExample;
-import org.apache.ignite.examples.datastructures.IgniteCountDownLatchExample;
-import org.apache.ignite.examples.datastructures.IgniteQueueExample;
-import org.apache.ignite.examples.datastructures.IgniteSetExample;
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
-import org.junit.Test;
-
-/**
- * Cache examples self test.
- */
-public class CacheExamplesSelfTest extends GridAbstractExamplesTest {
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCacheAffinityExample() throws Exception {
- CacheAffinityExample.main(EMPTY_ARGS);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCacheEntryProcessorExample() throws Exception {
- CacheEntryProcessorExample.main(EMPTY_ARGS);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCacheAtomicLongExample() throws Exception {
- IgniteAtomicLongExample.main(EMPTY_ARGS);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCacheAtomicReferenceExample() throws Exception {
- IgniteAtomicReferenceExample.main(EMPTY_ARGS);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCacheAtomicSequenceExample() throws Exception {
- IgniteAtomicSequenceExample.main(EMPTY_ARGS);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCacheAtomicStampedExample() throws Exception {
- IgniteAtomicStampedExample.main(EMPTY_ARGS);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCacheCountDownLatchExample() throws Exception {
- IgniteCountDownLatchExample.main(EMPTY_ARGS);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCacheQueueExample() throws Exception {
- IgniteQueueExample.main(EMPTY_ARGS);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCacheSetExample() throws Exception {
- IgniteSetExample.main(EMPTY_ARGS);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCacheQueryExample() throws Exception {
- CacheQueryExample.main(EMPTY_ARGS);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCacheApiExample() throws Exception {
- CacheApiExample.main(EMPTY_ARGS);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCacheTransactionExample() throws Exception {
- CacheTransactionExample.main(EMPTY_ARGS);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCacheDataStreamerExample() throws Exception {
- CacheDataStreamerExample.main(EMPTY_ARGS);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCachePutGetExample() throws Exception {
- CachePutGetExample.main(EMPTY_ARGS);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testSnowflakeSchemaExample() throws Exception {
- CacheStarSchemaExample.main(EMPTY_ARGS);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCacheContinuousQueryExample() throws Exception {
- CacheContinuousQueryExample.main(EMPTY_ARGS);
- }
-}
diff --git a/examples/src/test/java/org/apache/ignite/examples/CheckpointExamplesSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/CheckpointExamplesSelfTest.java
deleted file mode 100644
index fc63ba8aa3669..0000000000000
--- a/examples/src/test/java/org/apache/ignite/examples/CheckpointExamplesSelfTest.java
+++ /dev/null
@@ -1,48 +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;
-
-import org.apache.ignite.examples.computegrid.failover.ComputeFailoverExample;
-import org.apache.ignite.examples.computegrid.failover.ComputeFailoverNodeStartup;
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
-import org.junit.Test;
-
-/**
- * Checkpoint examples self test.
- */
-public class CheckpointExamplesSelfTest extends GridAbstractExamplesTest {
- /**
- * Starts remote nodes before each test.
- *
- * Note: using beforeTestsStarted() to start nodes only once won't work.
- *
- * @throws Exception If remote nodes start failed.
- */
- @Override protected void beforeTest() throws Exception {
- for (int i = 0; i < RMT_NODES_CNT; i++)
- startGrid("node-" + i, ComputeFailoverNodeStartup.configuration());
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCheckpointExample() throws Exception {
- ComputeFailoverExample.main(EMPTY_ARGS);
- }
-}
diff --git a/examples/src/test/java/org/apache/ignite/examples/ClusterGroupExampleSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/ClusterGroupExampleSelfTest.java
deleted file mode 100644
index fd557e287217a..0000000000000
--- a/examples/src/test/java/org/apache/ignite/examples/ClusterGroupExampleSelfTest.java
+++ /dev/null
@@ -1,41 +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;
-
-import org.apache.ignite.examples.cluster.ClusterGroupExample;
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
-import org.junit.Test;
-
-/**
- *
- */
-public class ClusterGroupExampleSelfTest extends GridAbstractExamplesTest {
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- // Start up a node.
- startGrid("ignite-cluster-groups-example", DFLT_CFG);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testComputeClusterGroupsExample() throws Exception {
- ClusterGroupExample.main(EMPTY_ARGS);
- }
-}
diff --git a/examples/src/test/java/org/apache/ignite/examples/ComputeClientBinaryExampleTest.java b/examples/src/test/java/org/apache/ignite/examples/ComputeClientBinaryExampleTest.java
deleted file mode 100644
index 30480f0ea3a34..0000000000000
--- a/examples/src/test/java/org/apache/ignite/examples/ComputeClientBinaryExampleTest.java
+++ /dev/null
@@ -1,39 +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;
-
-import org.apache.ignite.examples.binary.computegrid.ComputeClientBinaryTaskExecutionExample;
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
-import org.junit.Test;
-
-/**
- *
- */
-public class ComputeClientBinaryExampleTest extends GridAbstractExamplesTest {
- /** {@inheritDoc} */
- @Override protected String defaultConfig() {
- return "examples/config/binary/example-ignite-binary.xml";
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testBinaryTaskExecutionExample() throws Exception {
- ComputeClientBinaryTaskExecutionExample.main(new String[] {});
- }
-}
diff --git a/examples/src/test/java/org/apache/ignite/examples/ContinuationExamplesMultiNodeSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/ContinuationExamplesMultiNodeSelfTest.java
deleted file mode 100644
index 8b0d305042e3e..0000000000000
--- a/examples/src/test/java/org/apache/ignite/examples/ContinuationExamplesMultiNodeSelfTest.java
+++ /dev/null
@@ -1,28 +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;
-
-/**
- * Continuation example multi-node self test.
- */
-public class ContinuationExamplesMultiNodeSelfTest extends ContinuationExamplesSelfTest {
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- startRemoteNodes();
- }
-}
diff --git a/examples/src/test/java/org/apache/ignite/examples/ContinuationExamplesSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/ContinuationExamplesSelfTest.java
deleted file mode 100644
index c4a2734e45e44..0000000000000
--- a/examples/src/test/java/org/apache/ignite/examples/ContinuationExamplesSelfTest.java
+++ /dev/null
@@ -1,35 +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;
-
-import org.apache.ignite.examples.computegrid.ComputeFibonacciContinuationExample;
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
-import org.junit.Test;
-
-/**
- * Continuation example self test.
- */
-public class ContinuationExamplesSelfTest extends GridAbstractExamplesTest {
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testContinuationExample() throws Exception {
- ComputeFibonacciContinuationExample.main(EMPTY_ARGS);
- }
-}
diff --git a/examples/src/test/java/org/apache/ignite/examples/ContinuousMapperExamplesMultiNodeSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/ContinuousMapperExamplesMultiNodeSelfTest.java
deleted file mode 100644
index 2d435f41e8922..0000000000000
--- a/examples/src/test/java/org/apache/ignite/examples/ContinuousMapperExamplesMultiNodeSelfTest.java
+++ /dev/null
@@ -1,28 +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;
-
-/**
- * ContinuousMapperExample multi-node self test.
- */
-public class ContinuousMapperExamplesMultiNodeSelfTest extends ContinuationExamplesSelfTest {
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- startRemoteNodes();
- }
-}
diff --git a/examples/src/test/java/org/apache/ignite/examples/ContinuousMapperExamplesSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/ContinuousMapperExamplesSelfTest.java
deleted file mode 100644
index 02e01ea484728..0000000000000
--- a/examples/src/test/java/org/apache/ignite/examples/ContinuousMapperExamplesSelfTest.java
+++ /dev/null
@@ -1,35 +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;
-
-import org.apache.ignite.examples.computegrid.ComputeContinuousMapperExample;
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
-import org.junit.Test;
-
-/**
- * ContinuousMapperExample self test.
- */
-public class ContinuousMapperExamplesSelfTest extends GridAbstractExamplesTest {
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testContinuousMapperExample() throws Exception {
- ComputeContinuousMapperExample.main(EMPTY_ARGS);
- }
-}
diff --git a/examples/src/test/java/org/apache/ignite/examples/DeploymentExamplesMultiNodeSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/DeploymentExamplesMultiNodeSelfTest.java
deleted file mode 100644
index 7011a9b5053f9..0000000000000
--- a/examples/src/test/java/org/apache/ignite/examples/DeploymentExamplesMultiNodeSelfTest.java
+++ /dev/null
@@ -1,30 +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;
-
-/**
- * Deployment examples multi-node self test.
- */
-public class DeploymentExamplesMultiNodeSelfTest extends DeploymentExamplesSelfTest {
- /** {@inheritDoc} */
- @Override public void testDeploymentExample() throws Exception {
- startRemoteNodes();
-
- super.testDeploymentExample();
- }
-}
diff --git a/examples/src/test/java/org/apache/ignite/examples/DeploymentExamplesSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/DeploymentExamplesSelfTest.java
deleted file mode 100644
index 7b9507900222d..0000000000000
--- a/examples/src/test/java/org/apache/ignite/examples/DeploymentExamplesSelfTest.java
+++ /dev/null
@@ -1,35 +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;
-
-import org.apache.ignite.examples.misc.deployment.DeploymentExample;
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
-import org.junit.Test;
-
-/**
- * Deployment examples self test.
- */
-public class DeploymentExamplesSelfTest extends GridAbstractExamplesTest {
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testDeploymentExample() throws Exception {
- DeploymentExample.main(EMPTY_ARGS);
- }
-}
diff --git a/examples/src/test/java/org/apache/ignite/examples/EncryptedCacheExampleSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/EncryptedCacheExampleSelfTest.java
deleted file mode 100644
index 66cd4cf341ac9..0000000000000
--- a/examples/src/test/java/org/apache/ignite/examples/EncryptedCacheExampleSelfTest.java
+++ /dev/null
@@ -1,39 +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;
-
-import org.apache.ignite.examples.encryption.EncryptedCacheExample;
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
-import org.junit.Test;
-
-/**
- */
-public class EncryptedCacheExampleSelfTest extends GridAbstractExamplesTest {
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- cleanPersistenceDir();
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testBinaryPutGetExample() throws Exception {
- EncryptedCacheExample.main(new String[] {});
- }
-}
diff --git a/examples/src/test/java/org/apache/ignite/examples/EventsExamplesMultiNodeSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/EventsExamplesMultiNodeSelfTest.java
deleted file mode 100644
index 8ce2aad317da9..0000000000000
--- a/examples/src/test/java/org/apache/ignite/examples/EventsExamplesMultiNodeSelfTest.java
+++ /dev/null
@@ -1,28 +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;
-
-/**
- * Events examples multi-node self test.
- */
-public class EventsExamplesMultiNodeSelfTest extends EventsExamplesSelfTest {
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- startRemoteNodes();
- }
-}
diff --git a/examples/src/test/java/org/apache/ignite/examples/EventsExamplesSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/EventsExamplesSelfTest.java
deleted file mode 100644
index 635b247ad76f5..0000000000000
--- a/examples/src/test/java/org/apache/ignite/examples/EventsExamplesSelfTest.java
+++ /dev/null
@@ -1,35 +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;
-
-import org.apache.ignite.examples.events.EventsExample;
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
-import org.junit.Test;
-
-/**
- * Events examples self test.
- */
-public class EventsExamplesSelfTest extends GridAbstractExamplesTest {
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testEventsExample() throws Exception {
- EventsExample.main(EMPTY_ARGS);
- }
-}
diff --git a/examples/src/test/java/org/apache/ignite/examples/LifecycleExamplesSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/LifecycleExamplesSelfTest.java
deleted file mode 100644
index ef4967d5e781d..0000000000000
--- a/examples/src/test/java/org/apache/ignite/examples/LifecycleExamplesSelfTest.java
+++ /dev/null
@@ -1,35 +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;
-
-import org.apache.ignite.examples.misc.lifecycle.LifecycleExample;
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
-import org.junit.Test;
-
-/**
- * LifecycleExample self test.
- */
-public class LifecycleExamplesSelfTest extends GridAbstractExamplesTest {
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testLifecycleExample() throws Exception {
- LifecycleExample.main(EMPTY_ARGS);
- }
-}
diff --git a/examples/src/test/java/org/apache/ignite/examples/MemcacheRestExamplesMultiNodeSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/MemcacheRestExamplesMultiNodeSelfTest.java
deleted file mode 100644
index 89de6505d75ad..0000000000000
--- a/examples/src/test/java/org/apache/ignite/examples/MemcacheRestExamplesMultiNodeSelfTest.java
+++ /dev/null
@@ -1,31 +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;
-
-import org.apache.ignite.examples.misc.client.memcache.MemcacheRestExampleNodeStartup;
-
-/**
- * MemcacheRestExample multi-node self test.
- */
-public class MemcacheRestExamplesMultiNodeSelfTest extends MemcacheRestExamplesSelfTest {
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- for (int i = 0; i < RMT_NODES_CNT; i++)
- startGrid("memcache-rest-examples-" + i, MemcacheRestExampleNodeStartup.configuration());
- }
-}
diff --git a/examples/src/test/java/org/apache/ignite/examples/MemcacheRestExamplesSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/MemcacheRestExamplesSelfTest.java
deleted file mode 100644
index 44a2f68a601a0..0000000000000
--- a/examples/src/test/java/org/apache/ignite/examples/MemcacheRestExamplesSelfTest.java
+++ /dev/null
@@ -1,44 +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;
-
-import org.apache.ignite.examples.misc.client.memcache.MemcacheRestExample;
-import org.apache.ignite.examples.misc.client.memcache.MemcacheRestExampleNodeStartup;
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
-import org.junit.Test;
-
-/**
- * MemcacheRestExample self test.
- */
-public class MemcacheRestExamplesSelfTest extends GridAbstractExamplesTest {
- /**
- * @throws Exception If failed.
- */
- @Override protected void beforeTest() throws Exception {
- // Start up a cluster node.
- startGrid("memcache-rest-examples", MemcacheRestExampleNodeStartup.configuration());
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testMemcacheRestExample() throws Exception {
- MemcacheRestExample.main(EMPTY_ARGS);
- }
-}
diff --git a/examples/src/test/java/org/apache/ignite/examples/MessagingExamplesSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/MessagingExamplesSelfTest.java
deleted file mode 100644
index 1a39dc6f9ed07..0000000000000
--- a/examples/src/test/java/org/apache/ignite/examples/MessagingExamplesSelfTest.java
+++ /dev/null
@@ -1,58 +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;
-
-import org.apache.ignite.examples.messaging.MessagingExample;
-import org.apache.ignite.examples.messaging.MessagingPingPongExample;
-import org.apache.ignite.examples.messaging.MessagingPingPongListenActorExample;
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
-import org.junit.Test;
-
-/**
- * Messaging examples self test.
- */
-public class MessagingExamplesSelfTest extends GridAbstractExamplesTest {
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- startGrid("companion", DFLT_CFG);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testMessagingExample() throws Exception {
- MessagingExample.main(EMPTY_ARGS);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testMessagingPingPongExample() throws Exception {
- MessagingPingPongExample.main(EMPTY_ARGS);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testMessagingPingPongListenActorExample() throws Exception {
- MessagingPingPongListenActorExample.main(EMPTY_ARGS);
- }
-}
diff --git a/examples/src/test/java/org/apache/ignite/examples/MonteCarloExamplesMultiNodeSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/MonteCarloExamplesMultiNodeSelfTest.java
deleted file mode 100644
index f432a1ac7e1e9..0000000000000
--- a/examples/src/test/java/org/apache/ignite/examples/MonteCarloExamplesMultiNodeSelfTest.java
+++ /dev/null
@@ -1,28 +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;
-
-/**
- * PrimeExample multi-node self test.
- */
-public class MonteCarloExamplesMultiNodeSelfTest extends MonteCarloExamplesSelfTest {
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- startRemoteNodes();
- }
-}
diff --git a/examples/src/test/java/org/apache/ignite/examples/MonteCarloExamplesSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/MonteCarloExamplesSelfTest.java
deleted file mode 100644
index 2f3b4b2e8c4d4..0000000000000
--- a/examples/src/test/java/org/apache/ignite/examples/MonteCarloExamplesSelfTest.java
+++ /dev/null
@@ -1,76 +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;
-
-import org.apache.ignite.examples.computegrid.montecarlo.CreditRiskExample;
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
-import org.junit.Test;
-
-/**
- * Ignite examples self test. Excludes Ignite Spring tests.
- *
- *
- *
- * Contains all Ignite examples tests.AOP Configuration
- * In order for this test to execute, any of the following
- * AOP configurations must be provided.
- * Jboss AOP
- * The following configuration needs to be applied to enable JBoss byte code
- * weaving. Note that Ignite is not shipped with JBoss and necessary
- * libraries will have to be downloaded separately (they come standard
- * if you have JBoss installed already):
- *
- *
- *
- *
- *
- *
- * AspectJ AOP
- * The following configuration needs to be applied to enable AspectJ byte code
- * weaving.
- *
- *
- * args[0] - required - path to closure for tuning IgniteConfiguration before node startup; - * args[1] - required - name of the starting node; - * args[2] - required - id of the starting node; - * args[3] - required - sync-id of a node for synchronization of startup. Must be equals - * to arg[2] in case of starting the first node in the Ignite cluster; - * args[4] - required - expected Ignite's version to check at startup; - * args[5] - optional - path to closure for actions after node startup. - *- * - * @param args Command-line arguments. - * @throws Exception In case of an error. - */ - public static void main(String[] args) throws Exception { - try { - X.println(GridJavaProcess.PID_MSG_PREFIX + U.jvmPid()); - - X.println("Starting Ignite Node... Args=" + Arrays.toString(args)); - - if (args.length < 5) { - throw new IllegalArgumentException("At least five arguments expected:" + - " [path/to/closure/file] [ignite-instance-name] [node-id] [sync-node-id] [node-ver]" + - " [optional/path/to/closure/file]"); - } - - startParentPipeWatcher(); - - final Thread watchdog = delayedDumpClasspath(); - - IgniteConfiguration cfg = CompatibilityTestsFacade.getConfiguration(); - - IgniteInClosure
This logic is intentionally duplicated here and in {@link IgniteNodeRunner}. - * Compatibility tests may run with an older {@code ignite-core-tests} on the classpath, - * so this runner cannot safely depend on newly added methods in {@code IgniteNodeRunner}.
- * - *We listen on {@code System.in} because this compatibility node is started by the parent JVM via - * {@link ProcessBuilder}, where {@code System.in} is a pipe from the parent. When the parent process exits, - * the write-end of the pipe is closed and {@code System.in.read()} returns EOF. We treat this as a signal - * to stop Ignite and terminate the process.
- */ - private static void startParentPipeWatcher() { - Thread thread = new Thread(() -> { - try { - while (System.in.read() != -1) { - // No-op - } - } - catch (IOException e) { - X.println("Failed to read parent stdin pipe, stopping compatibility node: " + e); - } - - X.println("Parent JVM stdin pipe is closed, stopping compatibility node"); - - try { - if (ignite != null) - Ignition.stop(ignite.name(), true); - } - catch (Throwable e) { - X.println("Failed to stop compatibility node after parent pipe closure: " + e); - } - finally { - System.exit(0); - } - }, "compatibility-parent-pipe-watcher"); - - thread.setDaemon(true); - thread.start(); - } - - /** - * Starts background watchdog thread which will dump main thread stacktrace and classpath dump if main thread - * will not respond with node startup finished. - * - * @return Thread to be interrupted. - */ - private static Thread delayedDumpClasspath() { - final Thread mainThread = Thread.currentThread(); - final Runnable target = new Runnable() { - @Override public void run() { - try { - final int timeout = IgniteCompatibilityAbstractTest.NODE_JOIN_TIMEOUT - 1_000; - if (timeout > 0) - Thread.sleep(timeout); - } - catch (InterruptedException ignored) { - //interrupt is correct behaviour - return; - } - - X.println("Ignite startup/Init closure/post configuration closure is probably hanging at"); - - for (StackTraceElement ste : mainThread.getStackTrace()) - X.println("\t" + ste.toString()); - - X.println("\nDumping classpath"); - dumpClasspath(); - } - }; - - final Thread thread = new Thread(target); - - thread.setDaemon(true); - thread.start(); - - return thread; - } - - /** - * Dumps classpath to output stream. - */ - private static void dumpClasspath() { - ClassLoader clsLdr = IgniteCompatibilityNodeRunner.class.getClassLoader(); - - for (URL url : CompatibilityTestsUtils.classLoaderUrls(clsLdr)) - X.println("Classpath url: [" + url.getPath() + ']'); - } - - /** - * Stores {@link IgniteInClosure} to file as xml. - * - * @param clo IgniteInClosure. - * @return A name of file where the closure was stored. - * @throws IOException In case of an error. - * @see #readClosureFromFileAndDelete(String) - */ - @Nullable public static String storeToFile(@Nullable IgniteInClosure clo) throws IOException { - if (clo == null) - return null; - - String fileName = IGNITE_COMPATIBILITY_CLOSURE_FILE + clo.hashCode(); - - storeToFile(clo, fileName); - - return fileName; - } - - /** - * Stores {@link IgniteInClosure} to file as xml. - * - * @param clo IgniteInClosure. - * @param fileName A name of file where the closure was stored. - * @throws IOException In case of an error. - * @see #readClosureFromFileAndDelete(String) - */ - public static void storeToFile(@NotNull IgniteInClosure clo, @NotNull String fileName) throws IOException { - try (BufferedWriter writer = Files.newBufferedWriter(Paths.get(fileName), StandardCharsets.UTF_8)) { - new XStream().toXML(clo, writer); - } - } - - /** - * Reads closure from given file name and delete the file after. - * - * @param fileName Closure file name. - * @param
+ * IGFS is fully compliant with Hadoop {@code FileSystem} APIs and can
+ * be plugged into Hadoop installations. For more information refer to
+ * documentation on Hadoop integration shipped with Ignite.
+ *
+ * @param name IGFS name.
+ * @return IGFS instance.
+ * @throws IllegalArgumentException If IGFS with such name is not configured.
+ */
+ public IgniteFileSystem fileSystem(String name) throws IllegalArgumentException;
+
+ /**
+ * Gets all instances of IGFS (Ignite In-Memory File System).
+ *
+ * @return Collection of IGFS instances.
+ */
+ public Collection
- *
- *
+ *
+ *
- *
+ *
- *
+ *
- *
+ *
- * The lock associated with this {@code IgniteCondition} is atomically
- * released and the current thread becomes disabled for thread scheduling
- * purposes and lies dormant until one of six things happens:
- * If lock is not broken (because of failure of lock owner node)
- * in non-failoverSafe mode and local node is alive,
- * before this method can return the current thread must
- * re-acquire the lock associated with this condition. In all other cases
- * when the thread returns it is guaranteed to hold this lock.
- *
- * If the current thread:
- * Implementation Considerations
- *
- * The current thread is assumed to hold the lock associated with this
- * {@code Condition} when this method is called. If not, an {@link IllegalMonitorStateException}
- * will be thrown.
- *
- * @throws IgniteInterruptedException if the current thread is interrupted
- * @throws IgniteException if the node stopped, or
- * node owning the lock failed in non-failoversafe mode
- */
- @Override void await() throws IgniteInterruptedException, IgniteException;
-
- /**
- * Causes the current thread to wait until it is signalled.
- *
- * The lock associated with this condition is atomically
- * released and the current thread becomes disabled for thread scheduling
- * purposes and lies dormant until one of five things happens:
- * If lock is not broken (because of failure of lock owner node)
- * in non-failoverSafe mode and local node is alive,
- * before this method can return the current thread must
- * re-acquire the lock associated with this condition. In all other cases,
- * when the thread returns it is guaranteed to hold this lock.
- *
- * If the current thread's interrupted status is set when it enters
- * this method, or it is {@linkplain Thread#interrupt interrupted}
- * while waiting, it will continue to wait until signalled. When it finally
- * returns from this method its interrupted status will still
- * be set.
- *
- * Implementation Considerations
- *
- * The current thread is assumed to hold the lock associated with this
- * {@code Condition} when this method is called. If not, an {@link IllegalMonitorStateException}
- * will be thrown.
- *
- * @throws IgniteException if the node stopped, or
- * node owning the lock failed in non-failoversafe mode
- */
- @Override void awaitUninterruptibly() throws IgniteException;
-
- /**
- * Causes the current thread to wait until it is signalled or interrupted,
- * or the specified waiting time elapses.
- *
- * The lock associated with this condition is atomically
- * released and the current thread becomes disabled for thread scheduling
- * purposes and lies dormant until one of seven things happens:
- * If lock is not broken (because of failure of lock owner node)
- * in non-failoverSafe mode and local node is alive,
- * before this method can return the current thread must
- * re-acquire the lock associated with this condition. When the
- * thread returns it is guaranteed to hold this lock.
- *
- * If the current thread:
- * The method returns an estimate of the number of nanoseconds
- * remaining to wait given the supplied {@code nanosTimeout}
- * value upon return, or a value less than or equal to zero if it
- * timed out. This value can be used to determine whether and how
- * long to re-wait in cases where the wait returns but an awaited
- * condition still does not hold. Typical uses of this method take
- * the following form:
- *
- * Design note: This method requires a nanosecond argument so
- * as to avoid truncation errors in reporting remaining times.
- * Such precision loss would make it difficult for programmers to
- * ensure that total waiting times are not systematically shorter
- * than specified when re-waits occur.
- *
- * Implementation Considerations
- *
- * The current thread is assumed to hold the lock associated with this
- * {@code Condition} when this method is called. If not, an {@link IllegalMonitorStateException}
- * will be thrown.
- *
- * @param nanosTimeout the maximum time to wait, in nanoseconds
- * @return an estimate of the {@code nanosTimeout} value minus
- * the time spent waiting upon return from this method.
- * A positive value may be used as the argument to a
- * subsequent call to this method to finish waiting out
- * the desired time. A value less than or equal to zero
- * indicates that no time remains.
- * @throws IgniteInterruptedException if the current thread is interrupted
- * @throws IgniteException if the node stopped, or
- * node owning the lock failed in non-failoversafe mode
- */
- @Override long awaitNanos(long nanosTimeout) throws IgniteInterruptedException, IgniteException;
-
- /**
- * Causes the current thread to wait until it is signalled or interrupted,
- * or the specified waiting time elapses. This method is behaviorally
- * equivalent to:
- * The lock associated with this condition is atomically
- * released and the current thread becomes disabled for thread scheduling
- * purposes and lies dormant until one of seven things happens:
- * If lock is not broken (because of failure of lock owner node)
- * in non-failoverSafe mode and local node is alive,
- * before this method can return the current thread must
- * re-acquire the lock associated with this condition. When the
- * thread returns it is guaranteed to hold this lock.
- *
- * If the current thread:
- * The return value indicates whether the deadline has elapsed,
- * which can be used as follows:
- * Implementation Considerations
- *
- * The current thread is assumed to hold the lock associated with this
- * {@code Condition} when this method is called. If not, an {@link IllegalMonitorStateException}
- * will be thrown.
- *
- * @param deadline the absolute time to wait until
- * @return {@code false} if the deadline has elapsed upon return, else
- * {@code true}
- * @throws IgniteInterruptedException if the current thread is interrupted
- * (and interruption of thread suspension is supported)
- * @throws IgniteException if the node stopped, or
- * node owning the lock failed in non-failoversafe mode
- */
- @Override boolean awaitUntil(Date deadline) throws IgniteInterruptedException, IgniteException;
-
- /**
- * Wakes up one waiting thread.
- *
- * If any threads are waiting on this condition then one
- * is selected for waking up. That thread must then re-acquire the
- * lock before returning from {@code await}.
- *
- * Implementation Considerations
- *
- * The current thread is assumed to hold the lock associated with this
- * {@code Condition} when this method is called. If not, an {@link IllegalMonitorStateException}
- * will be thrown.
- *
- * @throws IgniteException if node is stopped or
- * node owning the lock failed in non-failoversafe mode
- */
- @Override void signal() throws IgniteException;
-
- /**
- * Wakes up all waiting threads.
- *
- * If any threads are waiting on this condition then they are
- * all woken up. Each thread must re-acquire the lock before it can
- * return from {@code await}.
- *
- * Implementation Considerations
- *
- * The current thread is assumed to hold the lock associated with this
- * {@code Condition} when this method is called. If not, an {@link IllegalMonitorStateException}
- * will be thrown.
- *
- * @throws IgniteException if node is stopped or
- * node owning the lock failed in non-failoversafe mode
- */
- @Override void signalAll() throws IgniteException;
-}
+/*
+ * 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;
+
+import java.util.Date;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Condition;
+
+/**
+ * This interface provides a rich API for working with condition objects
+ * associated with distributed reentrant locks.
+ *
+ * The lock associated with this {@code IgniteCondition} is atomically
+ * released and the current thread becomes disabled for thread scheduling
+ * purposes and lies dormant until one of six things happens:
+ * If lock is not broken (because of failure of lock owner node)
+ * in non-failoverSafe mode and local node is alive,
+ * before this method can return the current thread must
+ * re-acquire the lock associated with this condition. In all other cases
+ * when the thread returns it is guaranteed to hold this lock.
+ *
+ * If the current thread:
+ * Implementation Considerations
+ *
+ * The current thread is assumed to hold the lock associated with this
+ * {@code Condition} when this method is called. If not, an {@link IllegalMonitorStateException}
+ * will be thrown.
+ *
+ * @throws IgniteInterruptedException if the current thread is interrupted
+ * @throws IgniteException if the node stopped, or
+ * node owning the lock failed in non-failoversafe mode
+ */
+ @Override void await() throws IgniteInterruptedException, IgniteException;
+
+ /**
+ * Causes the current thread to wait until it is signalled.
+ *
+ * The lock associated with this condition is atomically
+ * released and the current thread becomes disabled for thread scheduling
+ * purposes and lies dormant until one of five things happens:
+ * If lock is not broken (because of failure of lock owner node)
+ * in non-failoverSafe mode and local node is alive,
+ * before this method can return the current thread must
+ * re-acquire the lock associated with this condition. In all other cases,
+ * when the thread returns it is guaranteed to hold this lock.
+ *
+ * If the current thread's interrupted status is set when it enters
+ * this method, or it is {@linkplain Thread#interrupt interrupted}
+ * while waiting, it will continue to wait until signalled. When it finally
+ * returns from this method its interrupted status will still
+ * be set.
+ *
+ * Implementation Considerations
+ *
+ * The current thread is assumed to hold the lock associated with this
+ * {@code Condition} when this method is called. If not, an {@link IllegalMonitorStateException}
+ * will be thrown.
+ *
+ * @throws IgniteException if the node stopped, or
+ * node owning the lock failed in non-failoversafe mode
+ */
+ @Override void awaitUninterruptibly() throws IgniteException;
+
+ /**
+ * Causes the current thread to wait until it is signalled or interrupted,
+ * or the specified waiting time elapses.
+ *
+ * The lock associated with this condition is atomically
+ * released and the current thread becomes disabled for thread scheduling
+ * purposes and lies dormant until one of seven things happens:
+ * If lock is not broken (because of failure of lock owner node)
+ * in non-failoverSafe mode and local node is alive,
+ * before this method can return the current thread must
+ * re-acquire the lock associated with this condition. When the
+ * thread returns it is guaranteed to hold this lock.
+ *
+ * If the current thread:
+ * The method returns an estimate of the number of nanoseconds
+ * remaining to wait given the supplied {@code nanosTimeout}
+ * value upon return, or a value less than or equal to zero if it
+ * timed out. This value can be used to determine whether and how
+ * long to re-wait in cases where the wait returns but an awaited
+ * condition still does not hold. Typical uses of this method take
+ * the following form:
+ *
+ * Design note: This method requires a nanosecond argument so
+ * as to avoid truncation errors in reporting remaining times.
+ * Such precision loss would make it difficult for programmers to
+ * ensure that total waiting times are not systematically shorter
+ * than specified when re-waits occur.
+ *
+ * Implementation Considerations
+ *
+ * The current thread is assumed to hold the lock associated with this
+ * {@code Condition} when this method is called. If not, an {@link IllegalMonitorStateException}
+ * will be thrown.
+ *
+ * @param nanosTimeout the maximum time to wait, in nanoseconds
+ * @return an estimate of the {@code nanosTimeout} value minus
+ * the time spent waiting upon return from this method.
+ * A positive value may be used as the argument to a
+ * subsequent call to this method to finish waiting out
+ * the desired time. A value less than or equal to zero
+ * indicates that no time remains.
+ * @throws IgniteInterruptedException if the current thread is interrupted
+ * @throws IgniteException if the node stopped, or
+ * node owning the lock failed in non-failoversafe mode
+ */
+ @Override long awaitNanos(long nanosTimeout) throws IgniteInterruptedException, IgniteException;
+
+ /**
+ * Causes the current thread to wait until it is signalled or interrupted,
+ * or the specified waiting time elapses. This method is behaviorally
+ * equivalent to:
+ * The lock associated with this condition is atomically
+ * released and the current thread becomes disabled for thread scheduling
+ * purposes and lies dormant until one of seven things happens:
+ * If lock is not broken (because of failure of lock owner node)
+ * in non-failoverSafe mode and local node is alive,
+ * before this method can return the current thread must
+ * re-acquire the lock associated with this condition. When the
+ * thread returns it is guaranteed to hold this lock.
+ *
+ * If the current thread:
+ * The return value indicates whether the deadline has elapsed,
+ * which can be used as follows:
+ * Implementation Considerations
+ *
+ * The current thread is assumed to hold the lock associated with this
+ * {@code Condition} when this method is called. If not, an {@link IllegalMonitorStateException}
+ * will be thrown.
+ *
+ * @param deadline the absolute time to wait until
+ * @return {@code false} if the deadline has elapsed upon return, else
+ * {@code true}
+ * @throws IgniteInterruptedException if the current thread is interrupted
+ * (and interruption of thread suspension is supported)
+ * @throws IgniteException if the node stopped, or
+ * node owning the lock failed in non-failoversafe mode
+ */
+ @Override boolean awaitUntil(Date deadline) throws IgniteInterruptedException, IgniteException;
+
+ /**
+ * Wakes up one waiting thread.
+ *
+ * If any threads are waiting on this condition then one
+ * is selected for waking up. That thread must then re-acquire the
+ * lock before returning from {@code await}.
+ *
+ * Implementation Considerations
+ *
+ * The current thread is assumed to hold the lock associated with this
+ * {@code Condition} when this method is called. If not, an {@link IllegalMonitorStateException}
+ * will be thrown.
+ *
+ * @throws IgniteException if node is stopped or
+ * node owning the lock failed in non-failoversafe mode
+ */
+ @Override void signal() throws IgniteException;
+
+ /**
+ * Wakes up all waiting threads.
+ *
+ * If any threads are waiting on this condition then they are
+ * all woken up. Each thread must re-acquire the lock before it can
+ * return from {@code await}.
+ *
+ * Implementation Considerations
+ *
+ * The current thread is assumed to hold the lock associated with this
+ * {@code Condition} when this method is called. If not, an {@link IllegalMonitorStateException}
+ * will be thrown.
+ *
+ * @throws IgniteException if node is stopped or
+ * node owning the lock failed in non-failoversafe mode
+ */
+ @Override void signalAll() throws IgniteException;
+}
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCountDownLatch.java b/modules/core/src/main/java/org/apache/ignite/IgniteCountDownLatch.java
index fa22dfb8dc553..84674c0d76efc 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCountDownLatch.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCountDownLatch.java
@@ -1,230 +1,230 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite;
-
-import java.io.Closeable;
-import java.util.concurrent.TimeUnit;
-
-/**
- * This interface provides a rich API for working with distributed count down latch.
- *
- *
- * If the current count of the latch is zero then this method returns immediately.
- *
- * If the current count is greater than zero then the current
- * thread becomes disabled for thread scheduling purposes and lies
- * dormant until one of two things happen:
- *
- * If the current thread:
- *
- * If the current count is zero then this method returns immediately
- * with the value {@code true}.
- *
- * If the current count is greater than zero then the current
- * thread becomes disabled for thread scheduling purposes and lies
- * dormant until one of three things happen:
- *
- * If the count reaches zero then the method returns with the
- * value {@code true}.
- *
- * If the current thread:
- *
- * If the specified waiting time elapses then the value {@code false}
- * is returned. If the time is less than or equal to zero, the method
- * will not wait at all.
- *
- * @param timeout The maximum time to wait in milliseconds.
- * @return {@code True} if the count reached zero and {@code false}
- * if the waiting time elapsed before the count reached zero.
- * @throws org.apache.ignite.IgniteInterruptedException If the current thread is interrupted
- * while waiting.
- * @throws IgniteException If operation failed.
- */
- public boolean await(long timeout) throws IgniteException;
-
- /**
- * Causes the current thread to wait until the latch has counted down to
- * zero, unless the thread is interrupted, or the specified waiting time elapses.
- *
- * If the current count is zero then this method returns immediately
- * with the value {@code true}.
- *
- * If the current count is greater than zero then the current
- * thread becomes disabled for thread scheduling purposes and lies
- * dormant until one of three things happen:
- *
- * If the count reaches zero then the method returns with the
- * value {@code true}.
- *
- * If the current thread:
- *
- * If the specified waiting time elapses then the value {@code false}
- * is returned. If the time is less than or equal to zero, the method
- * will not wait at all.
- *
- *
- * @param timeout The maximum time to wait.
- * @param unit The time unit of the {@code timeout} argument.
- * @return {@code True} if the count reached zero and {@code false}
- * if the waiting time elapsed before the count reached zero.
- * @throws org.apache.ignite.IgniteInterruptedException If the current thread is interrupted
- * while waiting.
- * @throws IgniteException If operation failed.
- */
- public boolean await(long timeout, TimeUnit unit) throws IgniteException;
-
- /**
- * Decrements the count of the latch, releasing all waiting threads
- * on all nodes if the count reaches zero.
- *
- * If the current count is greater than zero then it is decremented.
- * If the new count is zero then all waiting threads are re-enabled for
- * thread scheduling purposes.
- *
- * If the current count equals zero then nothing happens.
- *
- * @return Count after decrement.
- * @throws IgniteException If operation failed.
- */
- public int countDown() throws IgniteException;
-
- /**
- * Decreases the count of the latch using passed in value,
- * releasing all waiting threads on all nodes if the count reaches zero.
- *
- * If the current count is greater than zero then it is decreased.
- * If the new count is zero then all waiting threads are re-enabled for
- * thread scheduling purposes.
- *
- * If the current count equals zero then nothing happens.
- *
- * @param val Value to decrease counter on.
- * @return Count after decreasing.
- * @throws IgniteException If operation failed.
- */
- public int countDown(int val) throws IgniteException;
-
- /**
- * Counts down this latch to zero, releasing all waiting threads on all nodes.
- *
- * If the current count equals zero then nothing happens.
- *
- * @throws IgniteException If operation failed.
- */
- public void countDownAll() throws IgniteException;
-
- /**
- * Gets {@code removed} status of the latch.
- *
- * @return {@code True} if latch was removed from cache, {@code false} otherwise.
- */
- public boolean removed();
-
- /**
- * Removes this count down latch.
- *
- * @throws IgniteException If operation failed.
- */
- @Override public void close();
-}
+/*
+ * 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;
+
+import java.io.Closeable;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * This interface provides a rich API for working with distributed count down latch.
+ *
+ *
+ * If the current count of the latch is zero then this method returns immediately.
+ *
+ * If the current count is greater than zero then the current
+ * thread becomes disabled for thread scheduling purposes and lies
+ * dormant until one of two things happen:
+ *
+ * If the current thread:
+ *
+ * If the current count is zero then this method returns immediately
+ * with the value {@code true}.
+ *
+ * If the current count is greater than zero then the current
+ * thread becomes disabled for thread scheduling purposes and lies
+ * dormant until one of three things happen:
+ *
+ * If the count reaches zero then the method returns with the
+ * value {@code true}.
+ *
+ * If the current thread:
+ *
+ * If the specified waiting time elapses then the value {@code false}
+ * is returned. If the time is less than or equal to zero, the method
+ * will not wait at all.
+ *
+ * @param timeout The maximum time to wait in milliseconds.
+ * @return {@code True} if the count reached zero and {@code false}
+ * if the waiting time elapsed before the count reached zero.
+ * @throws org.apache.ignite.IgniteInterruptedException If the current thread is interrupted
+ * while waiting.
+ * @throws IgniteException If operation failed.
+ */
+ public boolean await(long timeout) throws IgniteException;
+
+ /**
+ * Causes the current thread to wait until the latch has counted down to
+ * zero, unless the thread is interrupted, or the specified waiting time elapses.
+ *
+ * If the current count is zero then this method returns immediately
+ * with the value {@code true}.
+ *
+ * If the current count is greater than zero then the current
+ * thread becomes disabled for thread scheduling purposes and lies
+ * dormant until one of three things happen:
+ *
+ * If the count reaches zero then the method returns with the
+ * value {@code true}.
+ *
+ * If the current thread:
+ *
+ * If the specified waiting time elapses then the value {@code false}
+ * is returned. If the time is less than or equal to zero, the method
+ * will not wait at all.
+ *
+ *
+ * @param timeout The maximum time to wait.
+ * @param unit The time unit of the {@code timeout} argument.
+ * @return {@code True} if the count reached zero and {@code false}
+ * if the waiting time elapsed before the count reached zero.
+ * @throws org.apache.ignite.IgniteInterruptedException If the current thread is interrupted
+ * while waiting.
+ * @throws IgniteException If operation failed.
+ */
+ public boolean await(long timeout, TimeUnit unit) throws IgniteException;
+
+ /**
+ * Decrements the count of the latch, releasing all waiting threads
+ * on all nodes if the count reaches zero.
+ *
+ * If the current count is greater than zero then it is decremented.
+ * If the new count is zero then all waiting threads are re-enabled for
+ * thread scheduling purposes.
+ *
+ * If the current count equals zero then nothing happens.
+ *
+ * @return Count after decrement.
+ * @throws IgniteException If operation failed.
+ */
+ public int countDown() throws IgniteException;
+
+ /**
+ * Decreases the count of the latch using passed in value,
+ * releasing all waiting threads on all nodes if the count reaches zero.
+ *
+ * If the current count is greater than zero then it is decreased.
+ * If the new count is zero then all waiting threads are re-enabled for
+ * thread scheduling purposes.
+ *
+ * If the current count equals zero then nothing happens.
+ *
+ * @param val Value to decrease counter on.
+ * @return Count after decreasing.
+ * @throws IgniteException If operation failed.
+ */
+ public int countDown(int val) throws IgniteException;
+
+ /**
+ * Counts down this latch to zero, releasing all waiting threads on all nodes.
+ *
+ * If the current count equals zero then nothing happens.
+ *
+ * @throws IgniteException If operation failed.
+ */
+ public void countDownAll() throws IgniteException;
+
+ /**
+ * Gets {@code removed} status of the latch.
+ *
+ * @return {@code True} if latch was removed from cache, {@code false} otherwise.
+ */
+ public boolean removed();
+
+ /**
+ * Removes this count down latch.
+ *
+ * @throws IgniteException If operation failed.
+ */
+ @Override public void close();
+}
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteDataStreamerTimeoutException.java b/modules/core/src/main/java/org/apache/ignite/IgniteDataStreamerTimeoutException.java
index c6c7367e7a321..5ec55c5bdfed6 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteDataStreamerTimeoutException.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteDataStreamerTimeoutException.java
@@ -1,45 +1,45 @@
-/*
- * 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;
-
-/**
- * Exception is thrown when timeout of some {@link IgniteDataStreamer} operations occurs.
- */
-public class IgniteDataStreamerTimeoutException extends IgniteException {
- /** */
- private static final long serialVersionUID = 0L;
-
- /**
- * Creates new timeout exception with given error message.
- *
- * @param msg Error message.
- */
- public IgniteDataStreamerTimeoutException(String msg) {
- super(msg);
- }
-
- /**
- * Creates new timeout exception with given error message and optional nested exception.
- *
- * @param msg Error message.
- * @param cause Optional nested exception (can be {@code null}).
- */
- public IgniteDataStreamerTimeoutException(String msg, Throwable cause) {
- super(msg, cause);
- }
-}
+/*
+ * 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;
+
+/**
+ * Exception is thrown when timeout of some {@link IgniteDataStreamer} operations occurs.
+ */
+public class IgniteDataStreamerTimeoutException extends IgniteException {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Creates new timeout exception with given error message.
+ *
+ * @param msg Error message.
+ */
+ public IgniteDataStreamerTimeoutException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Creates new timeout exception with given error message and optional nested exception.
+ *
+ * @param msg Error message.
+ * @param cause Optional nested exception (can be {@code null}).
+ */
+ public IgniteDataStreamerTimeoutException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+}
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteDeploymentException.java b/modules/core/src/main/java/org/apache/ignite/IgniteDeploymentException.java
index c89839d9db339..c43e7c8da2d76 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteDeploymentException.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteDeploymentException.java
@@ -1,57 +1,57 @@
-/*
- * 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;
-
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Deployment or re-deployment failed.
- */
-public class IgniteDeploymentException extends IgniteException {
- /** */
- private static final long serialVersionUID = 0L;
-
- /**
- * Creates new exception with given error message.
- *
- * @param msg Error message.
- */
- public IgniteDeploymentException(String msg) {
- super(msg);
- }
-
- /**
- * Creates new exception with given throwable as a nested cause and
- * source of error message.
- *
- * @param cause Non-null throwable cause.
- */
- public IgniteDeploymentException(Throwable cause) {
- this(cause.getMessage(), cause);
- }
-
- /**
- * Creates a new exception with given error message and optional nested cause exception.
- *
- * @param msg Error message.
- * @param cause Optional nested exception (can be {@code null}).
- */
- public IgniteDeploymentException(String msg, @Nullable Throwable cause) {
- super(msg, cause);
- }
-}
+/*
+ * 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;
+
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Deployment or re-deployment failed.
+ */
+public class IgniteDeploymentException extends IgniteException {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Creates new exception with given error message.
+ *
+ * @param msg Error message.
+ */
+ public IgniteDeploymentException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Creates new exception with given throwable as a nested cause and
+ * source of error message.
+ *
+ * @param cause Non-null throwable cause.
+ */
+ public IgniteDeploymentException(Throwable cause) {
+ this(cause.getMessage(), cause);
+ }
+
+ /**
+ * Creates a new exception with given error message and optional nested cause exception.
+ *
+ * @param msg Error message.
+ * @param cause Optional nested exception (can be {@code null}).
+ */
+ public IgniteDeploymentException(String msg, @Nullable Throwable cause) {
+ super(msg, cause);
+ }
+}
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteFileSystem.java b/modules/core/src/main/java/org/apache/ignite/IgniteFileSystem.java
new file mode 100644
index 0000000000000..e8f419fb1fb82
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteFileSystem.java
@@ -0,0 +1,541 @@
+/*
+ * 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;
+
+import java.util.Collection;
+import java.util.Map;
+import org.apache.ignite.configuration.FileSystemConfiguration;
+import org.apache.ignite.igfs.IgfsBlockLocation;
+import org.apache.ignite.igfs.IgfsFile;
+import org.apache.ignite.igfs.IgfsInputStream;
+import org.apache.ignite.igfs.IgfsMetrics;
+import org.apache.ignite.igfs.IgfsMode;
+import org.apache.ignite.igfs.IgfsOutputStream;
+import org.apache.ignite.igfs.IgfsPath;
+import org.apache.ignite.igfs.IgfsPathSummary;
+import org.apache.ignite.igfs.mapreduce.IgfsRecordResolver;
+import org.apache.ignite.igfs.mapreduce.IgfsTask;
+import org.apache.ignite.lang.IgniteAsyncSupport;
+import org.apache.ignite.lang.IgniteFuture;
+import org.apache.ignite.lang.IgniteUuid;
+import org.jetbrains.annotations.Nullable;
+import org.apache.ignite.igfs.IgfsPathNotFoundException;
+
+/**
+ * IGnite File System API. It provides a typical file system "view" on a particular cache:
+ *
+ * {@code IGFS} can be started as a data node or as a client node. Data node is responsible for
+ * caching data, while client node is responsible for basic file system operations and accessing
+ * data nodes remotely. When used as Hadoop file system, clients nodes usually started together
+ * with {@code job-submitter} or {@code job-scheduler} processes, while data nodes are usually
+ * started together with Hadoop {@code task-tracker} processes.
+ *
+ * NOTE: integration with Hadoop is available only in {@code In-Memory Accelerator For Hadoop} edition.
+ */
+public interface IgniteFileSystem extends IgniteAsyncSupport {
+ /** IGFS scheme name. */
+ public static final String IGFS_SCHEME = "igfs";
+
+ /**
+ * Gets IGFS name.
+ *
+ * @return IGFS name.
+ */
+ public String name();
+
+ /**
+ * Gets IGFS configuration.
+ *
+ * @return IGFS configuration.
+ */
+ public FileSystemConfiguration configuration();
+
+ /**
+ * Gets summary (total number of files, total number of directories and total length)
+ * for a given path.
+ *
+ * @param path Path to get information for.
+ * @return Summary object.
+ * @throws IgfsPathNotFoundException If path is not found.
+ * @throws IgniteException If failed.
+ */
+ public IgfsPathSummary summary(IgfsPath path) throws IgniteException;
+
+ /**
+ * Opens a file for reading.
+ *
+ * @param path File path to read.
+ * @return File input stream to read data from.
+ * @throws IgniteException In case of error.
+ * @throws IgfsPathNotFoundException If path doesn't exist.
+ */
+ public IgfsInputStream open(IgfsPath path) throws IgniteException;
+
+ /**
+ * Opens a file for reading.
+ *
+ * @param path File path to read.
+ * @param bufSize Read buffer size (bytes) or {@code zero} to use default value.
+ * @return File input stream to read data from.
+ * @throws IgniteException In case of error.
+ * @throws IgfsPathNotFoundException If path doesn't exist.
+ */
+ public IgfsInputStream open(IgfsPath path, int bufSize) throws IgniteException;
+
+ /**
+ * Opens a file for reading.
+ *
+ * @param path File path to read.
+ * @param bufSize Read buffer size (bytes) or {@code zero} to use default value.
+ * @param seqReadsBeforePrefetch Amount of sequential reads before prefetch is started.
+ * @return File input stream to read data from.
+ * @throws IgniteException In case of error.
+ * @throws IgfsPathNotFoundException If path doesn't exist.
+ */
+ public IgfsInputStream open(IgfsPath path, int bufSize, int seqReadsBeforePrefetch) throws IgniteException;
+
+ /**
+ * Creates a file and opens it for writing.
+ *
+ * @param path File path to create.
+ * @param overwrite Overwrite file if it already exists. Note: you cannot overwrite an existent directory.
+ * @return File output stream to write data to.
+ * @throws IgniteException In case of error.
+ */
+ public IgfsOutputStream create(IgfsPath path, boolean overwrite) throws IgniteException;
+
+ /**
+ * Creates a file and opens it for writing.
+ *
+ * @param path File path to create.
+ * @param bufSize Write buffer size (bytes) or {@code zero} to use default value.
+ * @param overwrite Overwrite file if it already exists. Note: you cannot overwrite an existent directory.
+ * @param replication Replication factor.
+ * @param blockSize Block size.
+ * @param props File properties to set.
+ * @return File output stream to write data to.
+ * @throws IgniteException In case of error.
+ */
+ public IgfsOutputStream create(IgfsPath path, int bufSize, boolean overwrite, int replication,
+ long blockSize, @Nullable Map
+ * Supports asynchronous execution (see {@link IgniteAsyncSupport}).
+ *
+ * @param task Task to execute.
+ * @param rslvr Optional resolver to control split boundaries.
+ * @param paths Collection of paths to be processed within this task.
+ * @param skipNonExistentFiles Whether to skip non existent files. If set to {@code true} non-existent files will
+ * be ignored. Otherwise an exception will be thrown.
+ * @param maxRangeLen Optional maximum range length. If {@code 0}, then by default all consecutive
+ * IGFS blocks will be included.
+ * @param arg Optional task argument.
+ * @return Task result.
+ * @throws IgniteException If execution failed.
+ */
+ public
+ * Supports asynchronous execution (see {@link IgniteAsyncSupport}).
+ *
+ * @param taskCls Task class to execute.
+ * @param rslvr Optional resolver to control split boundaries.
+ * @param paths Collection of paths to be processed within this task.
+ * @param arg Optional task argument.
+ * @return Task result.
+ * @throws IgniteException If execution failed.
+ */
+ public
+ * Supports asynchronous execution (see {@link IgniteAsyncSupport}).
+ *
+ * @param taskCls Task class to execute.
+ * @param rslvr Optional resolver to control split boundaries.
+ * @param paths Collection of paths to be processed within this task.
+ * @param skipNonExistentFiles Whether to skip non existent files. If set to {@code true} non-existent files will
+ * be ignored. Otherwise an exception will be thrown.
+ * @param maxRangeLen Maximum range length.
+ * @param arg Optional task argument.
+ * @return Task result.
+ * @throws IgniteException If execution failed.
+ */
+ public
+ * When working in {@code DUAL_SYNC} or {@code DUAL_ASYNC} modes with Hadoop secondary file system only the following properties will be updated:
+ *
+ * You are free to rename/move data files as you wish, but directories can be only renamed.
+ * You cannot move the directory between different parent directories.
+ *
+ * Examples:
+ * See more at JSSE Reference Guide.
- *
- * @param sslProtocol SSL protocol name.
- */
- public void setSslProtocol(String sslProtocol) {
- props.setSslProtocol(sslProtocol);
- }
-
- /**
- * Gets cipher suites.
- *
- * @return SSL cipher suites.
- */
- public String getCipherSuites() {
- return props.getSslCipherSuites();
- }
-
- /**
- * Override default cipher suites.
- *
- * See more at JSSE Reference Guide.
- *
- * @param cipherSuites SSL cipher suites.
- */
- public void setCipherSuites(String cipherSuites) {
- props.setSslCipherSuites(cipherSuites);
- }
-
- /**
- * Gets algorithm that will be used to create a key manager.
- *
- * @return Key manager algorithm.
- */
- public String getSslKeyAlgorithm() {
- return props.getSslKeyAlgorithm();
- }
-
- /**
- * Sets key manager algorithm that will be used to create a key manager. Notice that in most cased default value
- * suites well, however, on Android platform this value need to be set to X509.
- * Algorithms implementations supplied by JSEE: PKIX (X509 or SunPKIX), SunX509
- *
- * See more at JSSE Reference Guide.
- *
- * @param keyAlgorithm Key algorithm name.
- */
- public void setSslKeyAlgorithm(String keyAlgorithm) {
- props.setSslKeyAlgorithm(keyAlgorithm);
- }
-
- /**
- * Gets the key store URL.
- *
- * @return Client certificate KeyStore URL.
- */
- public String getSslClientCertificateKeyStoreUrl() {
- return props.getSslClientCertificateKeyStoreUrl();
- }
-
- /**
- * Sets path to the key store file. This is a mandatory parameter since
- * ssl context could not be initialized without key manager.
- *
- * In case {@link #getSslMode()} is {@code required} and key store URL isn't specified by Ignite properties
- * (e.g. at JDBC URL) the JSSE property {@code javax.net.ssl.keyStore} will be used.
- *
- * @param url Client certificate KeyStore URL.
- */
- public void setSslClientCertificateKeyStoreUrl(String url) {
- props.setSslClientCertificateKeyStoreUrl(url);
- }
-
- /**
- * Gets key store password.
- *
- * @return Client certificate KeyStore password.
- */
- public String getSslClientCertificateKeyStorePassword() {
- return props.getSslClientCertificateKeyStorePassword();
- }
-
- /**
- * Sets key store password.
- *
- * In case {@link #getSslMode()} is {@code required} and key store password isn't specified by Ignite properties
- * (e.g. at JDBC URL) the JSSE property {@code javax.net.ssl.keyStorePassword} will be used.
- *
- * @param passwd Client certificate KeyStore password.
- */
- public void setSslClientCertificateKeyStorePassword(String passwd) {
- props.setSslClientCertificateKeyStorePassword(passwd);
- }
-
- /**
- * Gets key store type used for context creation.
- *
- * @return Client certificate KeyStore type.
- */
- public String getSslClientCertificateKeyStoreType() {
- return props.getSslClientCertificateKeyStoreType();
- }
-
- /**
- * Sets key store type used in context initialization.
- *
- * In case {@link #getSslMode()} is {@code required} and key store type isn't specified by Ignite properties
- * (e.g. at JDBC URL)the JSSE property {@code javax.net.ssl.keyStoreType} will be used.
- * In case both Ignite properties and JSSE properties are not set the default 'JKS' type is used.
- *
- * See more at JSSE Reference Guide.
- *
- * @param ksType Client certificate KeyStore type.
- */
- public void setSslClientCertificateKeyStoreType(String ksType) {
- props.setSslClientCertificateKeyStoreType(ksType);
- }
-
- /**
- * Gets the trust store URL.
- *
- * @return Trusted certificate KeyStore URL.
- */
- public String getSslTrustCertificateKeyStoreUrl() {
- return props.getSslTrustCertificateKeyStoreUrl();
- }
-
- /**
- * Sets path to the trust store file. This is an optional parameter,
- * however one of the {@code setSslTrustCertificateKeyStoreUrl(String)}, {@link #setSslTrustAll(boolean)}
- * properties must be set.
- *
- * In case {@link #getSslMode()} is {@code required} and trust store URL isn't specified by Ignite properties
- * (e.g. at JDBC URL) the JSSE property {@code javax.net.ssl.trustStore} will be used.
- *
- * @param url Trusted certificate KeyStore URL.
- */
- public void setSslTrustCertificateKeyStoreUrl(String url) {
- props.setSslTrustCertificateKeyStoreUrl(url);
- }
-
- /**
- * Gets trust store password.
- *
- * @return Trusted certificate KeyStore password.
- */
- public String getSslTrustCertificateKeyStorePassword() {
- return props.getSslTrustCertificateKeyStorePassword();
- }
-
- /**
- * Sets trust store password.
- *
- * In case {@link #getSslMode()} is {@code required} and trust store password isn't specified by Ignite properties
- * (e.g. at JDBC URL) the JSSE property {@code javax.net.ssl.trustStorePassword} will be used.
- *
- * @param passwd Trusted certificate KeyStore password.
- */
- public void setSslTrustCertificateKeyStorePassword(String passwd) {
- props.setSslTrustCertificateKeyStorePassword(passwd);
- }
-
- /**
- * Gets trust store type.
- *
- * @return Trusted certificate KeyStore type.
- */
- public String getSslTrustCertificateKeyStoreType() {
- return props.getSslTrustCertificateKeyStoreType();
- }
-
- /**
- * Sets trust store type.
- *
- * In case {@link #getSslMode()} is {@code required} and trust store type isn't specified by Ignite properties
- * (e.g. at JDBC URL) the JSSE property {@code javax.net.ssl.trustStoreType} will be used.
- * In case both Ignite properties and JSSE properties are not set the default 'JKS' type is used.
- *
- * @param ksType Trusted certificate KeyStore type.
- */
- public void setSslTrustCertificateKeyStoreType(String ksType) {
- props.setSslTrustCertificateKeyStoreType(ksType);
- }
-
- /**
- * Gets trust any server certificate flag.
- *
- * @return Trust all certificates flag.
- */
- public boolean isSslTrustAll() {
- return props.isSslTrustAll();
- }
-
- /**
- * Sets to {@code true} to trust any server certificate (revoked, expired or self-signed SSL certificates).
- *
- * Defaults is {@code false}.
- *
- * Note: Do not enable this option in production you are ever going to use
- * on a network you do not entirely trust. Especially anything going over the public internet.
- *
- * @param trustAll Trust all certificates flag.
- */
- public void setSslTrustAll(boolean trustAll) {
- props.setSslTrustAll(trustAll);
- }
-
- /**
- * Gets the class name of the custom implementation of the Factory<SSLSocketFactory>.
- *
- * @return Custom class name that implements Factory<SSLSocketFactory>.
- */
- public String getSslFactory() {
- return props.getSslFactory();
- }
-
- /**
- * Sets the class name of the custom implementation of the Factory<SSLSocketFactory>.
- * If {@link #getSslMode()} is {@code required} and factory is specified the custom factory will be used
- * instead of JSSE socket factory. So, other SSL properties will be ignored.
- *
- * @param sslFactory Custom class name that implements Factory<SSLSocketFactory>.
- */
- public void setSslFactory(String sslFactory) {
- props.setSslFactory(sslFactory);
- }
-
- /**
- * @param name User name to authentication.
- */
- public void setUsername(String name) {
- props.setUsername(name);
- }
-
- /**
- * @return User name to authentication.
- */
- public String getUsername() {
- return props.getUsername();
- }
-
- /**
- * @param passwd User's password.
- */
- public void setPassword(String passwd) {
- props.setPassword(passwd);
- }
-
- /**
- * @return User's password.
- */
- public String getPassword() {
- return props.getPassword();
- }
-}
+/*
+ * 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;
+
+import java.io.PrintWriter;
+import java.io.Serializable;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.Properties;
+import java.util.logging.Logger;
+import javax.sql.DataSource;
+import org.apache.ignite.configuration.ClientConnectorConfiguration;
+import org.apache.ignite.internal.jdbc.thin.ConnectionPropertiesImpl;
+import org.apache.ignite.internal.processors.odbc.SqlStateCode;
+import org.apache.ignite.internal.util.HostAndPortRange;
+import org.apache.ignite.internal.util.typedef.F;
+
+/**
+ * JDBC thin DataSource implementation.
+ */
+public class IgniteJdbcThinDataSource implements DataSource, Serializable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Connection properties. */
+ private ConnectionPropertiesImpl props = new ConnectionPropertiesImpl();
+
+ /** Login timeout. */
+ private int loginTimeout;
+
+ /** {@inheritDoc} */
+ @Override public Connection getConnection() throws SQLException {
+ return getConnection(null, null);
+ }
+
+ /** {@inheritDoc} */
+ @Override public Connection getConnection(String username, String pwd) throws SQLException {
+ Properties props = this.props.storeToProperties();
+
+ if (!F.isEmpty(username))
+ props.put("user", username);
+
+ if (!F.isEmpty(pwd))
+ props.put("password", pwd);
+
+ return IgniteJdbcThinDriver.register().connect(getUrl(), props);
+ }
+
+ /** {@inheritDoc} */
+ @Override public See more at JSSE Reference Guide.
+ *
+ * @param sslProtocol SSL protocol name.
+ */
+ public void setSslProtocol(String sslProtocol) {
+ props.setSslProtocol(sslProtocol);
+ }
+
+ /**
+ * Gets cipher suites.
+ *
+ * @return SSL cipher suites.
+ */
+ public String getCipherSuites() {
+ return props.getSslCipherSuites();
+ }
+
+ /**
+ * Override default cipher suites.
+ *
+ * See more at JSSE Reference Guide.
+ *
+ * @param cipherSuites SSL cipher suites.
+ */
+ public void setCipherSuites(String cipherSuites) {
+ props.setSslCipherSuites(cipherSuites);
+ }
+
+ /**
+ * Gets algorithm that will be used to create a key manager.
+ *
+ * @return Key manager algorithm.
+ */
+ public String getSslKeyAlgorithm() {
+ return props.getSslKeyAlgorithm();
+ }
+
+ /**
+ * Sets key manager algorithm that will be used to create a key manager. Notice that in most cased default value
+ * suites well, however, on Android platform this value need to be set to X509.
+ * Algorithms implementations supplied by JSEE: PKIX (X509 or SunPKIX), SunX509
+ *
+ * See more at JSSE Reference Guide.
+ *
+ * @param keyAlgorithm Key algorithm name.
+ */
+ public void setSslKeyAlgorithm(String keyAlgorithm) {
+ props.setSslKeyAlgorithm(keyAlgorithm);
+ }
+
+ /**
+ * Gets the key store URL.
+ *
+ * @return Client certificate KeyStore URL.
+ */
+ public String getSslClientCertificateKeyStoreUrl() {
+ return props.getSslClientCertificateKeyStoreUrl();
+ }
+
+ /**
+ * Sets path to the key store file. This is a mandatory parameter since
+ * ssl context could not be initialized without key manager.
+ *
+ * In case {@link #getSslMode()} is {@code required} and key store URL isn't specified by Ignite properties
+ * (e.g. at JDBC URL) the JSSE property {@code javax.net.ssl.keyStore} will be used.
+ *
+ * @param url Client certificate KeyStore URL.
+ */
+ public void setSslClientCertificateKeyStoreUrl(String url) {
+ props.setSslClientCertificateKeyStoreUrl(url);
+ }
+
+ /**
+ * Gets key store password.
+ *
+ * @return Client certificate KeyStore password.
+ */
+ public String getSslClientCertificateKeyStorePassword() {
+ return props.getSslClientCertificateKeyStorePassword();
+ }
+
+ /**
+ * Sets key store password.
+ *
+ * In case {@link #getSslMode()} is {@code required} and key store password isn't specified by Ignite properties
+ * (e.g. at JDBC URL) the JSSE property {@code javax.net.ssl.keyStorePassword} will be used.
+ *
+ * @param passwd Client certificate KeyStore password.
+ */
+ public void setSslClientCertificateKeyStorePassword(String passwd) {
+ props.setSslClientCertificateKeyStorePassword(passwd);
+ }
+
+ /**
+ * Gets key store type used for context creation.
+ *
+ * @return Client certificate KeyStore type.
+ */
+ public String getSslClientCertificateKeyStoreType() {
+ return props.getSslClientCertificateKeyStoreType();
+ }
+
+ /**
+ * Sets key store type used in context initialization.
+ *
+ * In case {@link #getSslMode()} is {@code required} and key store type isn't specified by Ignite properties
+ * (e.g. at JDBC URL)the JSSE property {@code javax.net.ssl.keyStoreType} will be used.
+ * In case both Ignite properties and JSSE properties are not set the default 'JKS' type is used.
+ *
+ * See more at JSSE Reference Guide.
+ *
+ * @param ksType Client certificate KeyStore type.
+ */
+ public void setSslClientCertificateKeyStoreType(String ksType) {
+ props.setSslClientCertificateKeyStoreType(ksType);
+ }
+
+ /**
+ * Gets the trust store URL.
+ *
+ * @return Trusted certificate KeyStore URL.
+ */
+ public String getSslTrustCertificateKeyStoreUrl() {
+ return props.getSslTrustCertificateKeyStoreUrl();
+ }
+
+ /**
+ * Sets path to the trust store file. This is an optional parameter,
+ * however one of the {@code setSslTrustCertificateKeyStoreUrl(String)}, {@link #setSslTrustAll(boolean)}
+ * properties must be set.
+ *
+ * In case {@link #getSslMode()} is {@code required} and trust store URL isn't specified by Ignite properties
+ * (e.g. at JDBC URL) the JSSE property {@code javax.net.ssl.trustStore} will be used.
+ *
+ * @param url Trusted certificate KeyStore URL.
+ */
+ public void setSslTrustCertificateKeyStoreUrl(String url) {
+ props.setSslTrustCertificateKeyStoreUrl(url);
+ }
+
+ /**
+ * Gets trust store password.
+ *
+ * @return Trusted certificate KeyStore password.
+ */
+ public String getSslTrustCertificateKeyStorePassword() {
+ return props.getSslTrustCertificateKeyStorePassword();
+ }
+
+ /**
+ * Sets trust store password.
+ *
+ * In case {@link #getSslMode()} is {@code required} and trust store password isn't specified by Ignite properties
+ * (e.g. at JDBC URL) the JSSE property {@code javax.net.ssl.trustStorePassword} will be used.
+ *
+ * @param passwd Trusted certificate KeyStore password.
+ */
+ public void setSslTrustCertificateKeyStorePassword(String passwd) {
+ props.setSslTrustCertificateKeyStorePassword(passwd);
+ }
+
+ /**
+ * Gets trust store type.
+ *
+ * @return Trusted certificate KeyStore type.
+ */
+ public String getSslTrustCertificateKeyStoreType() {
+ return props.getSslTrustCertificateKeyStoreType();
+ }
+
+ /**
+ * Sets trust store type.
+ *
+ * In case {@link #getSslMode()} is {@code required} and trust store type isn't specified by Ignite properties
+ * (e.g. at JDBC URL) the JSSE property {@code javax.net.ssl.trustStoreType} will be used.
+ * In case both Ignite properties and JSSE properties are not set the default 'JKS' type is used.
+ *
+ * @param ksType Trusted certificate KeyStore type.
+ */
+ public void setSslTrustCertificateKeyStoreType(String ksType) {
+ props.setSslTrustCertificateKeyStoreType(ksType);
+ }
+
+ /**
+ * Gets trust any server certificate flag.
+ *
+ * @return Trust all certificates flag.
+ */
+ public boolean isSslTrustAll() {
+ return props.isSslTrustAll();
+ }
+
+ /**
+ * Sets to {@code true} to trust any server certificate (revoked, expired or self-signed SSL certificates).
+ *
+ * Defaults is {@code false}.
+ *
+ * Note: Do not enable this option in production you are ever going to use
+ * on a network you do not entirely trust. Especially anything going over the public internet.
+ *
+ * @param trustAll Trust all certificates flag.
+ */
+ public void setSslTrustAll(boolean trustAll) {
+ props.setSslTrustAll(trustAll);
+ }
+
+ /**
+ * Gets the class name of the custom implementation of the Factory<SSLSocketFactory>.
+ *
+ * @return Custom class name that implements Factory<SSLSocketFactory>.
+ */
+ public String getSslFactory() {
+ return props.getSslFactory();
+ }
+
+ /**
+ * Sets the class name of the custom implementation of the Factory<SSLSocketFactory>.
+ * If {@link #getSslMode()} is {@code required} and factory is specified the custom factory will be used
+ * instead of JSSE socket factory. So, other SSL properties will be ignored.
+ *
+ * @param sslFactory Custom class name that implements Factory<SSLSocketFactory>.
+ */
+ public void setSslFactory(String sslFactory) {
+ props.setSslFactory(sslFactory);
+ }
+
+ /**
+ * @param name User name to authentication.
+ */
+ public void setUsername(String name) {
+ props.setUsername(name);
+ }
+
+ /**
+ * @return User name to authentication.
+ */
+ public String getUsername() {
+ return props.getUsername();
+ }
+
+ /**
+ * @param passwd User's password.
+ */
+ public void setPassword(String passwd) {
+ props.setPassword(passwd);
+ }
+
+ /**
+ * @return User's password.
+ */
+ public String getPassword() {
+ return props.getPassword();
+ }
+}
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteLock.java b/modules/core/src/main/java/org/apache/ignite/IgniteLock.java
index b87a74a11488f..144c675f832fb 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteLock.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteLock.java
@@ -1,489 +1,489 @@
-/*
- * 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;
-
-import java.io.Closeable;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.Lock;
-
-/**
- * This interface provides a rich API for working with distributed reentrant locks.
- *
- * Acquires the lock if it is not held by another thread and returns
- * immediately, setting the lock hold count to one.
- *
- * If the current thread already holds this lock then the hold count
- * is incremented by one and the method returns immediately.
- *
- * If the lock is held by another thread then the
- * current thread becomes disabled for thread scheduling
- * purposes and lies dormant until one of four things happens:
- *
- * Acquires the lock if it is not held by another thread and returns
- * immediately, setting the lock hold count to one.
- *
- * If the current thread already holds this lock then the hold count
- * is incremented by one and the method returns immediately.
- *
- * If the lock is held by another thread then the
- * current thread becomes disabled for thread scheduling
- * purposes and lies dormant until one of four things happens:
- *
- * If the lock is acquired by the current thread then the lock hold
- * count is set to one.
- *
- * If the current thread:
- *
- * {@link IgniteException} is thrown in case:
- *
- * In this implementation, as this method is an explicit
- * interruption point, preference is given to responding to the
- * interrupt over normal or reentrant acquisition of the lock.
- *
- * @throws IgniteInterruptedException if the current thread is interrupted
- * @throws IgniteException if the lock is broken in non-failoverSafe mode (any node failed while owning this lock),
- * or local node is stopped
- */
- @Override public void lockInterruptibly() throws IgniteInterruptedException, IgniteException;
-
- /**
- * Acquires the lock only if it is free at the time of invocation.
- *
- * Acquires the lock if it is available and returns immediately
- * with the value {@code true}.
- * If the lock is not available then this method will return
- * immediately with the value {@code false}.
- *
- * A typical usage idiom for this method would be:
- * Acquires the lock if it is not held by another thread and returns
- * immediately with the value {@code true}, setting the lock hold count
- * to one.
- *
- * If the current thread
- * already holds this lock then the hold count is incremented by one and
- * the method returns {@code true}.
- *
- * If the lock is held by another thread then the
- * current thread becomes disabled for thread scheduling
- * purposes and lies dormant until one of five things happens:
- *
- * If the lock is acquired then the value {@code true} is returned and
- * the lock hold count is set to one.
- *
- * If the current thread:
- *
- * {@link IgniteException} is thrown in case:
- *
- * If the specified waiting time elapses then the value {@code false}
- * is returned. If the time is less than or equal to zero, the method
- * will not wait at all.
- *
- * In this implementation, as this method is an explicit
- * interruption point, preference is given to responding to the
- * interrupt over normal or reentrant acquisition of the lock, and
- * over reporting the elapse of the waiting time.
- *
- * @param timeout the time to wait for the lock
- * @param unit the time unit of the timeout argument
- * @return {@code true} if the lock was free and was acquired by the
- * current thread, or the lock was already held by the current
- * thread; and {@code false} if the waiting time elapsed before
- * the lock could be acquired
- * @throws IgniteInterruptedException if the current thread is interrupted
- * @throws IgniteException if node is stopped, or lock is already broken in non-failover safe mode
- * @throws NullPointerException if the time unit is null
- */
- @Override public boolean tryLock(long timeout, TimeUnit unit) throws IgniteInterruptedException, IgniteException;
-
- /**
- * Releases the lock.
- *
- * If lock is not owned by current thread, then an {@link
- * IllegalMonitorStateException} is thrown.
- * If lock is already broken prior to invocation of this method, and
- * lock is created in non-failover safe mode, then {@link IgniteException} is thrown.
- *
- * @throws IllegalMonitorStateException if not owned by current thread
- * @throws IgniteException if node is stopped, or lock is already broken in non-failover safe mode
- */
- @Override void unlock() throws IgniteInterruptedException;
-
- /**
- * Returns a {@link Condition} instance for use with this
- * {@link IgniteLock} instance.
- *
- *
+ * Acquires the lock if it is not held by another thread and returns
+ * immediately, setting the lock hold count to one.
+ *
+ * If the current thread already holds this lock then the hold count
+ * is incremented by one and the method returns immediately.
+ *
+ * If the lock is held by another thread then the
+ * current thread becomes disabled for thread scheduling
+ * purposes and lies dormant until one of four things happens:
+ *
+ * Acquires the lock if it is not held by another thread and returns
+ * immediately, setting the lock hold count to one.
+ *
+ * If the current thread already holds this lock then the hold count
+ * is incremented by one and the method returns immediately.
+ *
+ * If the lock is held by another thread then the
+ * current thread becomes disabled for thread scheduling
+ * purposes and lies dormant until one of four things happens:
+ *
+ * If the lock is acquired by the current thread then the lock hold
+ * count is set to one.
+ *
+ * If the current thread:
+ *
+ * {@link IgniteException} is thrown in case:
+ *
+ * In this implementation, as this method is an explicit
+ * interruption point, preference is given to responding to the
+ * interrupt over normal or reentrant acquisition of the lock.
+ *
+ * @throws IgniteInterruptedException if the current thread is interrupted
+ * @throws IgniteException if the lock is broken in non-failoverSafe mode (any node failed while owning this lock),
+ * or local node is stopped
+ */
+ @Override public void lockInterruptibly() throws IgniteInterruptedException, IgniteException;
+
+ /**
+ * Acquires the lock only if it is free at the time of invocation.
+ *
+ * Acquires the lock if it is available and returns immediately
+ * with the value {@code true}.
+ * If the lock is not available then this method will return
+ * immediately with the value {@code false}.
+ *
+ * A typical usage idiom for this method would be:
+ * Acquires the lock if it is not held by another thread and returns
+ * immediately with the value {@code true}, setting the lock hold count
+ * to one.
+ *
+ * If the current thread
+ * already holds this lock then the hold count is incremented by one and
+ * the method returns {@code true}.
+ *
+ * If the lock is held by another thread then the
+ * current thread becomes disabled for thread scheduling
+ * purposes and lies dormant until one of five things happens:
+ *
+ * If the lock is acquired then the value {@code true} is returned and
+ * the lock hold count is set to one.
+ *
+ * If the current thread:
+ *
+ * {@link IgniteException} is thrown in case:
+ *
+ * If the specified waiting time elapses then the value {@code false}
+ * is returned. If the time is less than or equal to zero, the method
+ * will not wait at all.
+ *
+ * In this implementation, as this method is an explicit
+ * interruption point, preference is given to responding to the
+ * interrupt over normal or reentrant acquisition of the lock, and
+ * over reporting the elapse of the waiting time.
+ *
+ * @param timeout the time to wait for the lock
+ * @param unit the time unit of the timeout argument
+ * @return {@code true} if the lock was free and was acquired by the
+ * current thread, or the lock was already held by the current
+ * thread; and {@code false} if the waiting time elapsed before
+ * the lock could be acquired
+ * @throws IgniteInterruptedException if the current thread is interrupted
+ * @throws IgniteException if node is stopped, or lock is already broken in non-failover safe mode
+ * @throws NullPointerException if the time unit is null
+ */
+ @Override public boolean tryLock(long timeout, TimeUnit unit) throws IgniteInterruptedException, IgniteException;
+
+ /**
+ * Releases the lock.
+ *
+ * If lock is not owned by current thread, then an {@link
+ * IllegalMonitorStateException} is thrown.
+ * If lock is already broken prior to invocation of this method, and
+ * lock is created in non-failover safe mode, then {@link IgniteException} is thrown.
+ *
+ * @throws IllegalMonitorStateException if not owned by current thread
+ * @throws IgniteException if node is stopped, or lock is already broken in non-failover safe mode
+ */
+ @Override void unlock() throws IgniteInterruptedException;
+
+ /**
+ * Returns a {@link Condition} instance for use with this
+ * {@link IgniteLock} instance.
+ *
+ *
- * Instance of {@code IgniteMessaging} is obtained from {@link Ignite} as follows:
- *
- * There are {@code 2} ways to subscribe to message listening, {@code local} and {@code remote}.
- *
- * Local subscription, defined by {@link #localListen(Object, IgniteBiPredicate)} method, will add
- * a listener for a given topic on local node only. This listener will be notified whenever any
- * node within the underlying cluster group will send a message for a given topic to this node. Local listen
- * subscription will happen regardless of whether the local node belongs to this cluster group or not.
- *
- * Remote subscription, defined by {@link #remoteListen(Object, IgniteBiPredicate)}, will add a
- * message listener for a given topic to all nodes in the underlying cluster group (possibly including this node if
- * it belongs to the cluster group as well). This means that any node within this cluster group can send
- * a message for a given topic and all nodes within the cluster group will receive listener notifications.
- *
- * By default all local listeners will be executed in the calling thread, or if you use
- * {@link #withAsync()}, listeners will execute in public thread pool (in this case it is user's
- * responsibility to implement back-pressure and limit number of concurrently executed async messages).
- *
- * @param topic Topic to send to, {@code null} for default topic.
- * @param msg Message to send.
- * @throws IgniteException If failed to send a message to any of the nodes.
- * @throws ClusterGroupEmptyException Thrown in case when cluster group is empty.
- */
- public void send(@Nullable Object topic, Object msg) throws IgniteException;
-
- /**
- * Sends given messages with the specified topic to the nodes in the underlying cluster group.
- *
- * By default all local listeners will be executed in the calling thread, or if you use
- * {@link #withAsync()}, listeners will execute in public thread pool (in this case it is user's
- * responsibility to implement back-pressure and limit number of concurrently executed async messages).
- *
- * @param topic Topic to send to, {@code null} for default topic.
- * @param msgs Messages to send. Order of the sending is undefined. If the method produces
- * the exception none or some messages could have been sent already.
- * @throws IgniteException If failed to send a message to any of the nodes.
- * @throws ClusterGroupEmptyException Thrown in case when cluster group is empty.
- */
- public void send(@Nullable Object topic, Collection> msgs) throws IgniteException;
-
- /**
- * Sends given message with specified topic to the nodes in the underlying cluster group. Messages sent with
- * this method will arrive in the same order they were sent. Note that if a topic is used
- * for ordered messages, then it cannot be reused for non-ordered messages. Note that local listeners
- * are always executed in public thread pool, no matter default or {@link #withAsync()} mode is used.
- *
- * The {@code timeout} parameter specifies how long an out-of-order message will stay in a queue,
- * waiting for messages that are ordered ahead of it to arrive. If timeout expires, then all ordered
- * messages that have not arrived before this message will be skipped. When (and if) expired messages
- * actually do arrive, they will be ignored.
- *
- * @param topic Topic to send to, {@code null} for default topic.
- * @param msg Message to send.
- * @param timeout Message timeout in milliseconds, {@code 0} for default
- * which is {@link IgniteConfiguration#getNetworkTimeout()}.
- * @throws IgniteException If failed to send a message to any of the nodes.
- * @throws ClusterGroupEmptyException Thrown in case when cluster group is empty.
- */
- public void sendOrdered(@Nullable Object topic, Object msg, long timeout) throws IgniteException;
-
- /**
- * Adds local listener for given topic on local node only. This listener will be notified whenever any
- * node within the cluster group will send a message for a given topic to this node. Local listen
- * subscription will happen regardless of whether local node belongs to this cluster group or not.
- *
- * @param topic Topic to subscribe to.
- * @param p Predicate that is called on each received message. If predicate returns {@code false},
- * then it will be unsubscribed from any further notifications.
- */
- public void localListen(@Nullable Object topic, IgniteBiPredicate
- * Supports asynchronous execution (see {@link IgniteAsyncSupport}).
- *
- * @param opId Listen ID that was returned from {@link #remoteListen(Object, IgniteBiPredicate)} method.
- * @throws IgniteException If failed to unregister listeners.
- */
- @IgniteAsyncSupported
- public void stopRemoteListen(UUID opId) throws IgniteException;
-
- /**
- * Asynchronously unregisters all listeners identified with provided operation ID on all nodes in the cluster group.
- *
- * @param opId Listen ID that was returned from {@link #remoteListen(Object, IgniteBiPredicate)} method.
- * @return a Future representing pending completion of the operation.
- * @throws IgniteException If failed to unregister listeners.
- */
- public IgniteFuture
+ * Instance of {@code IgniteMessaging} is obtained from {@link Ignite} as follows:
+ *
+ * There are {@code 2} ways to subscribe to message listening, {@code local} and {@code remote}.
+ *
+ * Local subscription, defined by {@link #localListen(Object, IgniteBiPredicate)} method, will add
+ * a listener for a given topic on local node only. This listener will be notified whenever any
+ * node within the underlying cluster group will send a message for a given topic to this node. Local listen
+ * subscription will happen regardless of whether the local node belongs to this cluster group or not.
+ *
+ * Remote subscription, defined by {@link #remoteListen(Object, IgniteBiPredicate)}, will add a
+ * message listener for a given topic to all nodes in the underlying cluster group (possibly including this node if
+ * it belongs to the cluster group as well). This means that any node within this cluster group can send
+ * a message for a given topic and all nodes within the cluster group will receive listener notifications.
+ *
+ * By default all local listeners will be executed in the calling thread, or if you use
+ * {@link #withAsync()}, listeners will execute in public thread pool (in this case it is user's
+ * responsibility to implement back-pressure and limit number of concurrently executed async messages).
+ *
+ * @param topic Topic to send to, {@code null} for default topic.
+ * @param msg Message to send.
+ * @throws IgniteException If failed to send a message to any of the nodes.
+ * @throws ClusterGroupEmptyException Thrown in case when cluster group is empty.
+ */
+ public void send(@Nullable Object topic, Object msg) throws IgniteException;
+
+ /**
+ * Sends given messages with the specified topic to the nodes in the underlying cluster group.
+ *
+ * By default all local listeners will be executed in the calling thread, or if you use
+ * {@link #withAsync()}, listeners will execute in public thread pool (in this case it is user's
+ * responsibility to implement back-pressure and limit number of concurrently executed async messages).
+ *
+ * @param topic Topic to send to, {@code null} for default topic.
+ * @param msgs Messages to send. Order of the sending is undefined. If the method produces
+ * the exception none or some messages could have been sent already.
+ * @throws IgniteException If failed to send a message to any of the nodes.
+ * @throws ClusterGroupEmptyException Thrown in case when cluster group is empty.
+ */
+ public void send(@Nullable Object topic, Collection> msgs) throws IgniteException;
+
+ /**
+ * Sends given message with specified topic to the nodes in the underlying cluster group. Messages sent with
+ * this method will arrive in the same order they were sent. Note that if a topic is used
+ * for ordered messages, then it cannot be reused for non-ordered messages. Note that local listeners
+ * are always executed in public thread pool, no matter default or {@link #withAsync()} mode is used.
+ *
+ * The {@code timeout} parameter specifies how long an out-of-order message will stay in a queue,
+ * waiting for messages that are ordered ahead of it to arrive. If timeout expires, then all ordered
+ * messages that have not arrived before this message will be skipped. When (and if) expired messages
+ * actually do arrive, they will be ignored.
+ *
+ * @param topic Topic to send to, {@code null} for default topic.
+ * @param msg Message to send.
+ * @param timeout Message timeout in milliseconds, {@code 0} for default
+ * which is {@link IgniteConfiguration#getNetworkTimeout()}.
+ * @throws IgniteException If failed to send a message to any of the nodes.
+ * @throws ClusterGroupEmptyException Thrown in case when cluster group is empty.
+ */
+ public void sendOrdered(@Nullable Object topic, Object msg, long timeout) throws IgniteException;
+
+ /**
+ * Adds local listener for given topic on local node only. This listener will be notified whenever any
+ * node within the cluster group will send a message for a given topic to this node. Local listen
+ * subscription will happen regardless of whether local node belongs to this cluster group or not.
+ *
+ * @param topic Topic to subscribe to.
+ * @param p Predicate that is called on each received message. If predicate returns {@code false},
+ * then it will be unsubscribed from any further notifications.
+ */
+ public void localListen(@Nullable Object topic, IgniteBiPredicate
+ * Supports asynchronous execution (see {@link IgniteAsyncSupport}).
+ *
+ * @param opId Listen ID that was returned from {@link #remoteListen(Object, IgniteBiPredicate)} method.
+ * @throws IgniteException If failed to unregister listeners.
+ */
+ @IgniteAsyncSupported
+ public void stopRemoteListen(UUID opId) throws IgniteException;
+
+ /**
+ * Asynchronously unregisters all listeners identified with provided operation ID on all nodes in the cluster group.
+ *
+ * @param opId Listen ID that was returned from {@link #remoteListen(Object, IgniteBiPredicate)} method.
+ * @return a Future representing pending completion of the operation.
+ * @throws IgniteException If failed to unregister listeners.
+ */
+ public IgniteFuture
- * Notification on this state will be fired only when segmentation policy is
- * set to {@link SegmentationPolicy#STOP} or {@link SegmentationPolicy#RESTART_JVM}
- * and node is stopped from internals of Ignite after segment becomes invalid.
- */
- STOPPED_ON_SEGMENTATION,
-
- /**
- * Grid factory stopped due to a critical failure.
- */
- STOPPED_ON_FAILURE;
-
- /** Enumerated values. */
- private static final IgniteState[] VALS = values();
-
- /**
- * Efficiently gets enumerated value from its ordinal.
- *
- * @param ord Ordinal value.
- * @return Enumerated value.
- */
- @Nullable public static IgniteState fromOrdinal(byte ord) {
- return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
- }
-}
+/*
+ * 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;
+
+import org.apache.ignite.plugin.segmentation.SegmentationPolicy;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Possible states of {@link org.apache.ignite.Ignition}. You can register a listener for
+ * state change notifications via {@link org.apache.ignite.Ignition#addListener(IgnitionListener)}
+ * method.
+ */
+public enum IgniteState {
+ /**
+ * Grid factory started.
+ */
+ STARTED,
+
+ /**
+ * Grid factory stopped.
+ */
+ STOPPED,
+
+ /**
+ * Grid factory stopped due to network segmentation issues.
+ *
+ * Notification on this state will be fired only when segmentation policy is
+ * set to {@link SegmentationPolicy#STOP} or {@link SegmentationPolicy#RESTART_JVM}
+ * and node is stopped from internals of Ignite after segment becomes invalid.
+ */
+ STOPPED_ON_SEGMENTATION,
+
+ /**
+ * Grid factory stopped due to a critical failure.
+ */
+ STOPPED_ON_FAILURE;
+
+ /** Enumerated values. */
+ private static final IgniteState[] VALS = values();
+
+ /**
+ * Efficiently gets enumerated value from its ordinal.
+ *
+ * @param ord Ordinal value.
+ * @return Enumerated value.
+ */
+ @Nullable public static IgniteState fromOrdinal(byte ord) {
+ return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
+ }
+}
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index b1c36a9015827..8e4148ebe2d07 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -662,8 +662,8 @@ public final class IgniteSystemProperties extends IgniteCommonsSystemProperties
*
* Default is {@code false}
*/
- @SystemProperty("Disable MBeans registration. This may be helpful if MBeans are not allowed " +
- "e.g. for security reasons")
+ @SystemProperty(value = "Disable MBeans registration. This may be helpful if MBeans are not allowed " +
+ "e.g. for security reasons", defaults= "true")
public static final String IGNITE_MBEANS_DISABLED = "IGNITE_MBEANS_DISABLED";
/**
@@ -679,7 +679,6 @@ public final class IgniteSystemProperties extends IgniteCommonsSystemProperties
*/
@SystemProperty(value = "Size of buffer holding last exception", type = Integer.class,
defaults = "" + DEFAULT_QUEUE_SIZE)
-
public static final String IGNITE_EXCEPTION_REGISTRY_MAX_SIZE = "IGNITE_EXCEPTION_REGISTRY_MAX_SIZE";
/**
diff --git a/modules/core/src/main/java/org/apache/ignite/IgnitionListener.java b/modules/core/src/main/java/org/apache/ignite/IgnitionListener.java
index 4154e81c8cd28..6714577665bb9 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgnitionListener.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgnitionListener.java
@@ -1,36 +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;
-
-import java.util.EventListener;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Listener for gird state change notifications. Use
- * {@link Ignition#addListener(IgnitionListener)} to register this
- * listener with grid factory.
- */
-public interface IgnitionListener extends EventListener {
- /**
- * Listener for grid factory state change notifications.
- *
- * @param name Ignite instance name ({@code null} for default un-named Ignite instance).
- * @param state New state.
- */
- public void onStateChange(@Nullable String name, IgniteState state);
-}
+/*
+ * 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;
+
+import java.util.EventListener;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Listener for gird state change notifications. Use
+ * {@link Ignition#addListener(IgnitionListener)} to register this
+ * listener with grid factory.
+ */
+public interface IgnitionListener extends EventListener {
+ /**
+ * Listener for grid factory state change notifications.
+ *
+ * @param name Ignite instance name ({@code null} for default un-named Ignite instance).
+ * @param state New state.
+ */
+ public void onStateChange(@Nullable String name, IgniteState state);
+}
diff --git a/modules/core/src/main/java/org/apache/ignite/MemoryMetrics.java b/modules/core/src/main/java/org/apache/ignite/MemoryMetrics.java
deleted file mode 100644
index c9cf1a41bd649..0000000000000
--- a/modules/core/src/main/java/org/apache/ignite/MemoryMetrics.java
+++ /dev/null
@@ -1,121 +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;
-
-import org.apache.ignite.configuration.DataRegionConfiguration;
-import org.apache.ignite.configuration.DataStorageConfiguration;
-import org.apache.ignite.spi.metric.ReadOnlyMetricRegistry;
-
-/**
- * This interface provides page memory related metrics of a specific Apache Ignite node. The overall page memory
- * architecture is covered in {@link DataStorageConfiguration}.
- *
- * Since there are can be several data regions configured with {@link DataRegionConfiguration} on an individual
- * Apache Ignite node, the metrics for every region will be collected and obtained separately.
- *
- * There are two ways to get the metrics of an Apache Ignite node.
- *
- * Memory metrics collection is not a free operation and might affect performance of an application. This is the reason
- * why the metrics are turned off by default. To enable the collection you can use both
- * {@link DataStorageConfiguration#setMetricsEnabled(boolean)} configuration property.
- *
- * @deprecated Check the {@link ReadOnlyMetricRegistry} with "name=io.dataregion.{data_region_name}" instead.
- */
-@Deprecated
-public interface MemoryMetrics {
- /**
- * A name of a memory region the metrics are collected for.
- *
- * @return Name of the memory region.
- */
- public String getName();
-
- /**
- * Gets a total number of allocated pages related to the memory policy. When persistence is disabled, this
- * metric shows the total number of pages in memory. When persistence is enabled, this metric shows the
- * total number of pages in memory and on disk.
- *
- * @return Total number of allocated pages.
- */
- public long getTotalAllocatedPages();
-
- /**
- * Gets pages allocation rate of a memory region.
- *
- * @return Number of allocated pages per second.
- */
- public float getAllocationRate();
-
- /**
- * Gets eviction rate of a given memory region.
- *
- * @return Number of evicted pages per second.
- */
- public float getEvictionRate();
-
- /**
- * Gets percentage of pages that are fully occupied by large entries that go beyond page size. The large entities
- * are split into fragments in a way so that each fragment can fit into a single page.
- *
- * @return Percentage of pages fully occupied by large entities.
- */
- public float getLargeEntriesPagesPercentage();
-
- /**
- * Gets the percentage of space that is still free and can be filled in.
- *
- * @return The percentage of space that is still free and can be filled in.
- */
- public float getPagesFillFactor();
-
- /**
- * Gets the number of dirty pages (pages which contents is different from the current persistent storage state).
- * This metric is enabled only for Ignite nodes with enabled persistence.
- *
- * @return Current number of dirty pages.
- */
- public long getDirtyPages();
-
- /**
- * Gets rate (pages per second) at which pages get replaced with other pages from persistent storage.
- * The rate effectively represents the rate at which pages get 'evicted' in favor of newly needed pages.
- * This metric is enabled only for Ignite nodes with enabled persistence.
- *
- * @return Pages per second replace rate.
- */
- public float getPagesReplaceRate();
-
- /**
- * Gets total number of pages currently loaded to the RAM. When persistence is disabled, this metric is equal
- * to {@link #getTotalAllocatedPages()}.
- *
- * @return Total number of pages loaded to RAM.
- */
- public long getPhysicalMemoryPages();
-}
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheEntry.java b/modules/core/src/main/java/org/apache/ignite/cache/CacheEntry.java
index 08184abe67079..8233bf29409ac 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/CacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/CacheEntry.java
@@ -1,84 +1,84 @@
-/*
- * 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.cache;
-
-import java.util.Set;
-import javax.cache.Cache;
-import javax.cache.processor.EntryProcessor;
-import org.apache.ignite.IgniteCache;
-
-/**
- * Cache entry that extends {@link javax.cache.Cache.Entry} by providing additional entry related information.
- *
- * To get an instance of {@code CacheEntry} from {@link javax.cache.Cache.Entry} use
- * {@link javax.cache.Cache.Entry#unwrap(Class)} method by passing {@code CacheEntry} class to it as the argument.
- *
- * {@code CacheEntry} is supported only for {@link javax.cache.Cache.Entry} returned by one of the following methods:
- *
- * To get an instance of {@code CacheEntry} directly use {@link IgniteCache#getEntry(Object)} or
- * {@link IgniteCache#getEntries(Set)} methods.
- *
- * {@code CacheEntry} is not supported for {@link javax.cache.Cache#iterator()} because of performance reasons.
- * {@link javax.cache.Cache#iterator()} loads entries from all the cluster nodes and to speed up the load additional
- * information, like entry's version, is ignored.
- *
- *
- * It is valid to compare cache entries' versions for the same key. In this case the latter update will be
- * represented by a higher version. The result of versions comparison of cache entries of different keys is
- * undefined.
- *
- * @return Version of this cache entry.
- */
- public Comparable version();
-}
+/*
+ * 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.cache;
+
+import java.util.Set;
+import javax.cache.Cache;
+import javax.cache.processor.EntryProcessor;
+import org.apache.ignite.IgniteCache;
+
+/**
+ * Cache entry that extends {@link javax.cache.Cache.Entry} by providing additional entry related information.
+ *
+ * To get an instance of {@code CacheEntry} from {@link javax.cache.Cache.Entry} use
+ * {@link javax.cache.Cache.Entry#unwrap(Class)} method by passing {@code CacheEntry} class to it as the argument.
+ *
+ * {@code CacheEntry} is supported only for {@link javax.cache.Cache.Entry} returned by one of the following methods:
+ *
+ * To get an instance of {@code CacheEntry} directly use {@link IgniteCache#getEntry(Object)} or
+ * {@link IgniteCache#getEntries(Set)} methods.
+ *
+ * {@code CacheEntry} is not supported for {@link javax.cache.Cache#iterator()} because of performance reasons.
+ * {@link javax.cache.Cache#iterator()} loads entries from all the cluster nodes and to speed up the load additional
+ * information, like entry's version, is ignored.
+ *
+ *
+ * It is valid to compare cache entries' versions for the same key. In this case the latter update will be
+ * represented by a higher version. The result of versions comparison of cache entries of different keys is
+ * undefined.
+ *
+ * @return Version of this cache entry.
+ */
+ public Comparable version();
+}
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheEntryEventSerializableFilter.java b/modules/core/src/main/java/org/apache/ignite/cache/CacheEntryEventSerializableFilter.java
index df5fd35fdd74f..87c81aa49eb65 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/CacheEntryEventSerializableFilter.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/CacheEntryEventSerializableFilter.java
@@ -1,28 +1,28 @@
-/*
- * 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.cache;
-
-import java.io.Serializable;
-import javax.cache.event.CacheEntryEventFilter;
-
-/**
- * This filter adds {@link Serializable} interface to {@link javax.cache.event.CacheEntryEventFilter} object.
- */
-public interface CacheEntryEventSerializableFilterFunctionality
- * Distributed atomic long includes the following main functionality:
- *
- *
- * Creating Distributed Atomic Long
- * Instance of distributed atomic long can be created by calling the following method:
- *
- *
- * @see Ignite#atomicLong(String, long, boolean)
- */
-public interface IgniteAtomicLong extends Closeable {
- /**
- * Name of atomic long.
- *
- * @return Name of atomic long.
- */
- public String name();
-
- /**
- * Gets current value of atomic long.
- *
- * @return Current value of atomic long.
- * @throws IgniteException If operation failed.
- */
- public long get() throws IgniteException;
-
- /**
- * Increments and gets current value of atomic long.
- *
- * @return Value.
- * @throws IgniteException If operation failed.
- */
- public long incrementAndGet() throws IgniteException;
-
- /**
- * Gets and increments current value of atomic long.
- *
- * @return Value.
- * @throws IgniteException If operation failed.
- */
- public long getAndIncrement() throws IgniteException;
-
- /**
- * Adds {@code l} and gets current value of atomic long.
- *
- * @param l Number which will be added.
- * @return Value.
- * @throws IgniteException If operation failed.
- */
- public long addAndGet(long l) throws IgniteException;
-
- /**
- * Gets current value of atomic long and adds {@code l}.
- *
- * @param l Number which will be added.
- * @return Value.
- * @throws IgniteException If operation failed.
- */
- public long getAndAdd(long l) throws IgniteException;
-
- /**
- * Decrements and gets current value of atomic long.
- *
- * @return Value.
- * @throws IgniteException If operation failed.
- */
- public long decrementAndGet() throws IgniteException;
-
- /**
- * Gets and decrements current value of atomic long.
- *
- * @return Value.
- * @throws IgniteException If operation failed.
- */
- public long getAndDecrement() throws IgniteException;
-
- /**
- * Gets current value of atomic long and sets new value {@code l} of atomic long.
- *
- * @param l New value of atomic long.
- * @return Value.
- * @throws IgniteException If operation failed.
- */
- public long getAndSet(long l) throws IgniteException;
-
- /**
- * Atomically compares current value to the expected value, and if they are equal, sets current value
- * to new value.
- *
- * @param expVal Expected atomic long's value.
- * @param newVal New atomic long's value to set if current value equal to expected value.
- * @return {@code True} if comparison succeeded, {@code false} otherwise.
- * @throws IgniteException If failed.
- */
- public boolean compareAndSet(long expVal, long newVal) throws IgniteException;
-
- /**
- * Gets status of atomic.
- *
- * @return {@code true} if atomic was removed from cache, {@code false} in other case.
- */
- public boolean removed();
-
- /**
- * Removes this atomic long.
- *
- * @throws IgniteException If operation failed.
- */
- @Override public void close();
-}
+/*
+ * 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;
+
+import java.io.Closeable;
+
+/**
+ * This interface provides a rich API for working with distributedly cached atomic long value.
+ * Functionality
+ * Distributed atomic long includes the following main functionality:
+ *
+ *
+ * Creating Distributed Atomic Long
+ * Instance of distributed atomic long can be created by calling the following method:
+ *
+ *
+ * @see Ignite#atomicLong(String, long, boolean)
+ */
+public interface IgniteAtomicLong extends Closeable {
+ /**
+ * Name of atomic long.
+ *
+ * @return Name of atomic long.
+ */
+ public String name();
+
+ /**
+ * Gets current value of atomic long.
+ *
+ * @return Current value of atomic long.
+ * @throws IgniteException If operation failed.
+ */
+ public long get() throws IgniteException;
+
+ /**
+ * Increments and gets current value of atomic long.
+ *
+ * @return Value.
+ * @throws IgniteException If operation failed.
+ */
+ public long incrementAndGet() throws IgniteException;
+
+ /**
+ * Gets and increments current value of atomic long.
+ *
+ * @return Value.
+ * @throws IgniteException If operation failed.
+ */
+ public long getAndIncrement() throws IgniteException;
+
+ /**
+ * Adds {@code l} and gets current value of atomic long.
+ *
+ * @param l Number which will be added.
+ * @return Value.
+ * @throws IgniteException If operation failed.
+ */
+ public long addAndGet(long l) throws IgniteException;
+
+ /**
+ * Gets current value of atomic long and adds {@code l}.
+ *
+ * @param l Number which will be added.
+ * @return Value.
+ * @throws IgniteException If operation failed.
+ */
+ public long getAndAdd(long l) throws IgniteException;
+
+ /**
+ * Decrements and gets current value of atomic long.
+ *
+ * @return Value.
+ * @throws IgniteException If operation failed.
+ */
+ public long decrementAndGet() throws IgniteException;
+
+ /**
+ * Gets and decrements current value of atomic long.
+ *
+ * @return Value.
+ * @throws IgniteException If operation failed.
+ */
+ public long getAndDecrement() throws IgniteException;
+
+ /**
+ * Gets current value of atomic long and sets new value {@code l} of atomic long.
+ *
+ * @param l New value of atomic long.
+ * @return Value.
+ * @throws IgniteException If operation failed.
+ */
+ public long getAndSet(long l) throws IgniteException;
+
+ /**
+ * Atomically compares current value to the expected value, and if they are equal, sets current value
+ * to new value.
+ *
+ * @param expVal Expected atomic long's value.
+ * @param newVal New atomic long's value to set if current value equal to expected value.
+ * @return {@code True} if comparison succeeded, {@code false} otherwise.
+ * @throws IgniteException If failed.
+ */
+ public boolean compareAndSet(long expVal, long newVal) throws IgniteException;
+
+ /**
+ * Gets status of atomic.
+ *
+ * @return {@code true} if atomic was removed from cache, {@code false} in other case.
+ */
+ public boolean removed();
+
+ /**
+ * Removes this atomic long.
+ *
+ * @throws IgniteException If operation failed.
+ */
+ @Override public void close();
+}
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteAtomicReference.java b/modules/core/src/main/java/org/apache/ignite/IgniteAtomicReference.java
index a9b98cf6f847e..d9d9fee770ab3 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteAtomicReference.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteAtomicReference.java
@@ -1,96 +1,96 @@
-/*
- * 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;
-
-import java.io.Closeable;
-
-/**
- * This interface provides a rich API for working with distributed atomic reference.
- * Functionality
- * Distributed atomic reference includes the following main functionality:
- *
- *
- * Creating Distributed Atomic Reference
- * Instance of distributed atomic reference can be created by calling the following method:
- *
- *
- * @see Ignite#atomicReference(String, Object, boolean)
- */
-public interface IgniteAtomicReferenceFunctionality
+ * Distributed atomic reference includes the following main functionality:
+ *
+ *
+ * Creating Distributed Atomic Reference
+ * Instance of distributed atomic reference can be created by calling the following method:
+ *
+ *
+ * @see Ignite#atomicReference(String, Object, boolean)
+ */
+public interface IgniteAtomicReferenceFunctionality
- * Distributed atomic sequence includes the following main functionality:
- *
- *
- * Creating Distributed Atomic Sequence
- * Instance of distributed atomic sequence can be created by calling the following method:
- *
- *
- * @see Ignite#atomicSequence(String, long, boolean)
- */
-public interface IgniteAtomicSequence extends Closeable {
- /**
- * Name of atomic sequence.
- *
- * @return Name of atomic sequence.
- */
- public String name();
-
- /**
- * Gets current value of atomic sequence.
- *
- * @return Value of atomic sequence.
- * @throws IgniteException If operation failed.
- */
- public long get() throws IgniteException;
-
- /**
- * Increments and returns the value of atomic sequence.
- *
- * @return Value of atomic sequence after increment.
- * @throws IgniteException If operation failed.
- */
- public long incrementAndGet() throws IgniteException;
-
- /**
- * Gets and increments current value of atomic sequence.
- *
- * @return Value of atomic sequence before increment.
- * @throws IgniteException If operation failed.
- */
- public long getAndIncrement() throws IgniteException;
-
- /**
- * Adds {@code l} elements to atomic sequence and gets value of atomic sequence.
- *
- * @param l Number of added elements.
- * @return Value of atomic sequence.
- * @throws IgniteException If operation failed.
- */
- public long addAndGet(long l) throws IgniteException;
-
- /**
- * Gets current value of atomic sequence and adds {@code l} elements.
- *
- * @param l Number of added elements.
- * @return Value of atomic sequence.
- * @throws IgniteException If operation failed.
- */
- public long getAndAdd(long l) throws IgniteException;
-
- /**
- * Gets local batch size for this atomic sequence.
- *
- * @return Sequence batch size.
- */
- public int batchSize();
-
- /**
- * Sets local batch size for atomic sequence.
- *
- * @param size Sequence batch size. Must be more then 0.
- */
- public void batchSize(int size);
-
- /**
- * Gets status of atomic sequence.
- *
- * @return {@code true} if atomic sequence was removed from cache, {@code false} otherwise.
- */
- public boolean removed();
-
- /**
- * Removes this atomic sequence.
- *
- * @throws IgniteException If operation failed.
- */
- @Override public void close();
-}
+/*
+ * 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;
+
+import java.io.Closeable;
+
+/**
+ * This interface provides a rich API for working with distributed atomic sequence.
+ * Functionality
+ * Distributed atomic sequence includes the following main functionality:
+ *
+ *
+ * Creating Distributed Atomic Sequence
+ * Instance of distributed atomic sequence can be created by calling the following method:
+ *
+ *
+ * @see Ignite#atomicSequence(String, long, boolean)
+ */
+public interface IgniteAtomicSequence extends Closeable {
+ /**
+ * Name of atomic sequence.
+ *
+ * @return Name of atomic sequence.
+ */
+ public String name();
+
+ /**
+ * Gets current value of atomic sequence.
+ *
+ * @return Value of atomic sequence.
+ * @throws IgniteException If operation failed.
+ */
+ public long get() throws IgniteException;
+
+ /**
+ * Increments and returns the value of atomic sequence.
+ *
+ * @return Value of atomic sequence after increment.
+ * @throws IgniteException If operation failed.
+ */
+ public long incrementAndGet() throws IgniteException;
+
+ /**
+ * Gets and increments current value of atomic sequence.
+ *
+ * @return Value of atomic sequence before increment.
+ * @throws IgniteException If operation failed.
+ */
+ public long getAndIncrement() throws IgniteException;
+
+ /**
+ * Adds {@code l} elements to atomic sequence and gets value of atomic sequence.
+ *
+ * @param l Number of added elements.
+ * @return Value of atomic sequence.
+ * @throws IgniteException If operation failed.
+ */
+ public long addAndGet(long l) throws IgniteException;
+
+ /**
+ * Gets current value of atomic sequence and adds {@code l} elements.
+ *
+ * @param l Number of added elements.
+ * @return Value of atomic sequence.
+ * @throws IgniteException If operation failed.
+ */
+ public long getAndAdd(long l) throws IgniteException;
+
+ /**
+ * Gets local batch size for this atomic sequence.
+ *
+ * @return Sequence batch size.
+ */
+ public int batchSize();
+
+ /**
+ * Sets local batch size for atomic sequence.
+ *
+ * @param size Sequence batch size. Must be more then 0.
+ */
+ public void batchSize(int size);
+
+ /**
+ * Gets status of atomic sequence.
+ *
+ * @return {@code true} if atomic sequence was removed from cache, {@code false} otherwise.
+ */
+ public boolean removed();
+
+ /**
+ * Removes this atomic sequence.
+ *
+ * @throws IgniteException If operation failed.
+ */
+ @Override public void close();
+}
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteAtomicStamped.java b/modules/core/src/main/java/org/apache/ignite/IgniteAtomicStamped.java
index 336f1d69a3db5..b969d80b1813a 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteAtomicStamped.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteAtomicStamped.java
@@ -1,124 +1,124 @@
-/*
- * 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;
-
-import java.io.Closeable;
-import org.apache.ignite.lang.IgniteBiTuple;
-
-/**
- * This interface provides a rich API for working with distributed atomic stamped value.
- * Functionality
- * Distributed atomic stamped includes the following main functionality:
- *
- *
- * Creating Distributed Atomic Stamped
- * Instance of distributed atomic stamped can be created by calling the following method:
- *
- *
- * @see Ignite#atomicStamped(String, Object, Object, boolean)
- */
-public interface IgniteAtomicStampedFunctionality
+ * Distributed atomic stamped includes the following main functionality:
+ *
+ *
+ * Creating Distributed Atomic Stamped
+ * Instance of distributed atomic stamped can be created by calling the following method:
+ *
+ *
+ * @see Ignite#atomicStamped(String, Object, Object, boolean)
+ */
+public interface IgniteAtomicStampedFunctionality
- * IgniteCondition provides functionality similar to {@code java.util.concurrent.locks.Condition}.
- */
-public interface IgniteCondition extends Condition {
- /**
- * Name of ignite condition.
- *
- * @return Name of ignite condition.
- */
- public String name();
-
- /**
- * Causes the current thread to wait until it is signalled or
- * {@linkplain Thread#interrupt interrupted}.
- *
- *
- *
- *
- *
- *
- * then {@link IgniteInterruptedException} is thrown and the current thread's
- * interrupted status is cleared. It is not specified, in the first
- * case, whether or not the test for interruption occurs before the lock
- * is released.
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * then {@link IgniteInterruptedException} is thrown and the current thread's
- * interrupted status is cleared. It is not specified, in the first
- * case, whether or not the test for interruption occurs before the lock
- * is released.
- *
- * {@code
- * boolean aMethod(long timeout, TimeUnit unit) {
- * long nanos = unit.toNanos(timeout);
- * lock.lock();
- * try {
- * while (!conditionBeingWaitedFor()) {
- * if (nanos <= 0L)
- * return false;
- * nanos = theCondition.awaitNanos(nanos);
- * }
- * // ...
- * } finally {
- * lock.unlock();
- * }
- * }}
- *
- * {@code awaitNanos(unit.toNanos(time)) > 0}
- *
- * @param time the maximum time to wait
- * @param unit the time unit of the {@code time} argument
- * @return {@code false} if the waiting time detectably elapsed
- * before return from the method, else {@code true}
- * @throws IgniteInterruptedException if the current thread is interrupted
- * @throws IgniteException if the node stopped, or
- * node owning the lock failed in non-failoversafe mode
- */
- @Override boolean await(long time, TimeUnit unit) throws IgniteInterruptedException, IgniteException;
-
- /**
- * Causes the current thread to wait until it is signalled or interrupted,
- * or the specified deadline elapses.
- *
- *
- *
- *
- *
- *
- * then {@link IgniteInterruptedException} is thrown and the current thread's
- * interrupted status is cleared. It is not specified, in the first
- * case, whether or not the test for interruption occurs before the lock
- * is released.
- *
- * {@code
- * boolean aMethod(Date deadline) {
- * boolean stillWaiting = true;
- * lock.lock();
- * try {
- * while (!conditionBeingWaitedFor()) {
- * if (!stillWaiting)
- * return false;
- * stillWaiting = theCondition.awaitUntil(deadline);
- * }
- * // ...
- * } finally {
- * lock.unlock();
- * }
- * }}
- *
- * Functionality
+ * IgniteCondition provides functionality similar to {@code java.util.concurrent.locks.Condition}.
+ */
+public interface IgniteCondition extends Condition {
+ /**
+ * Name of ignite condition.
+ *
+ * @return Name of ignite condition.
+ */
+ public String name();
+
+ /**
+ * Causes the current thread to wait until it is signalled or
+ * {@linkplain Thread#interrupt interrupted}.
+ *
+ *
+ *
+ *
+ *
+ *
+ * then {@link IgniteInterruptedException} is thrown and the current thread's
+ * interrupted status is cleared. It is not specified, in the first
+ * case, whether or not the test for interruption occurs before the lock
+ * is released.
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * then {@link IgniteInterruptedException} is thrown and the current thread's
+ * interrupted status is cleared. It is not specified, in the first
+ * case, whether or not the test for interruption occurs before the lock
+ * is released.
+ *
+ * {@code
+ * boolean aMethod(long timeout, TimeUnit unit) {
+ * long nanos = unit.toNanos(timeout);
+ * lock.lock();
+ * try {
+ * while (!conditionBeingWaitedFor()) {
+ * if (nanos <= 0L)
+ * return false;
+ * nanos = theCondition.awaitNanos(nanos);
+ * }
+ * // ...
+ * } finally {
+ * lock.unlock();
+ * }
+ * }}
+ *
+ * {@code awaitNanos(unit.toNanos(time)) > 0}
+ *
+ * @param time the maximum time to wait
+ * @param unit the time unit of the {@code time} argument
+ * @return {@code false} if the waiting time detectably elapsed
+ * before return from the method, else {@code true}
+ * @throws IgniteInterruptedException if the current thread is interrupted
+ * @throws IgniteException if the node stopped, or
+ * node owning the lock failed in non-failoversafe mode
+ */
+ @Override boolean await(long time, TimeUnit unit) throws IgniteInterruptedException, IgniteException;
+
+ /**
+ * Causes the current thread to wait until it is signalled or interrupted,
+ * or the specified deadline elapses.
+ *
+ *
+ *
+ *
+ *
+ *
+ * then {@link IgniteInterruptedException} is thrown and the current thread's
+ * interrupted status is cleared. It is not specified, in the first
+ * case, whether or not the test for interruption occurs before the lock
+ * is released.
+ *
+ * {@code
+ * boolean aMethod(Date deadline) {
+ * boolean stillWaiting = true;
+ * lock.lock();
+ * try {
+ * while (!conditionBeingWaitedFor()) {
+ * if (!stillWaiting)
+ * return false;
+ * stillWaiting = theCondition.awaitUntil(deadline);
+ * }
+ * // ...
+ * } finally {
+ * lock.unlock();
+ * }
+ * }}
+ *
+ * Functionality
- * Distributed count down latch provides functionality similar to {@code java.util.CountDownLatch}.
- * Note that you cannot remove count down latch having count greater that zero. It should be
- * counted down to zero first.
- * Creating Distributed Count Down Latch
- * Instance of cache count down latch can be created by calling the following method:
- * {@link Ignite#countDownLatch(String, int, boolean, boolean)}.
- */
-public interface IgniteCountDownLatch extends Closeable {
- /**
- * Gets name of the latch.
- *
- * @return Name of the latch.
- */
- public String name();
-
- /**
- * Gets current count value of the latch.
- *
- * @return Current count.
- */
- public int count();
-
- /**
- * Gets initial count value of the latch.
- *
- * @return Initial count.
- */
- public int initialCount();
-
- /**
- * Gets {@code autoDelete} flag. If this flag is {@code true} latch is removed
- * from cache when it has been counted down to 0.
- *
- * @return Value of {@code autoDelete} flag.
- */
- public boolean autoDelete();
-
- /**
- * Causes the current thread to wait until the latch has counted down to
- * zero, unless current thread is interrupted.
- *
- *
- *
- *
- * then {@link org.apache.ignite.internal.IgniteInterruptedCheckedException} is thrown and the current thread's
- * interrupted status is cleared.
- *
- * @throws IgniteException If operation failed.
- * @throws org.apache.ignite.IgniteInterruptedException if the current thread is interrupted
- * while waiting
- */
- public void await() throws IgniteException;
-
- /**
- * Causes the current thread to wait until the latch has counted down to
- * zero, unless the thread is interrupted, or the specified waiting time elapses.
- *
- *
- *
- *
- * then {@link org.apache.ignite.internal.IgniteInterruptedCheckedException} is thrown and the current thread's
- * interrupted status is cleared.
- *
- *
- *
- *
- * then {@link org.apache.ignite.internal.IgniteInterruptedCheckedException} is thrown and the current thread's
- * interrupted status is cleared.
- * Functionality
+ * Distributed count down latch provides functionality similar to {@code java.util.CountDownLatch}.
+ * Note that you cannot remove count down latch having count greater that zero. It should be
+ * counted down to zero first.
+ * Creating Distributed Count Down Latch
+ * Instance of cache count down latch can be created by calling the following method:
+ * {@link Ignite#countDownLatch(String, int, boolean, boolean)}.
+ */
+public interface IgniteCountDownLatch extends Closeable {
+ /**
+ * Gets name of the latch.
+ *
+ * @return Name of the latch.
+ */
+ public String name();
+
+ /**
+ * Gets current count value of the latch.
+ *
+ * @return Current count.
+ */
+ public int count();
+
+ /**
+ * Gets initial count value of the latch.
+ *
+ * @return Initial count.
+ */
+ public int initialCount();
+
+ /**
+ * Gets {@code autoDelete} flag. If this flag is {@code true} latch is removed
+ * from cache when it has been counted down to 0.
+ *
+ * @return Value of {@code autoDelete} flag.
+ */
+ public boolean autoDelete();
+
+ /**
+ * Causes the current thread to wait until the latch has counted down to
+ * zero, unless current thread is interrupted.
+ *
+ *
+ *
+ *
+ * then {@link org.apache.ignite.internal.IgniteInterruptedCheckedException} is thrown and the current thread's
+ * interrupted status is cleared.
+ *
+ * @throws IgniteException If operation failed.
+ * @throws org.apache.ignite.IgniteInterruptedException if the current thread is interrupted
+ * while waiting
+ */
+ public void await() throws IgniteException;
+
+ /**
+ * Causes the current thread to wait until the latch has counted down to
+ * zero, unless the thread is interrupted, or the specified waiting time elapses.
+ *
+ *
+ *
+ *
+ * then {@link org.apache.ignite.internal.IgniteInterruptedCheckedException} is thrown and the current thread's
+ * interrupted status is cleared.
+ *
+ *
+ *
+ *
+ * then {@link org.apache.ignite.internal.IgniteInterruptedCheckedException} is thrown and the current thread's
+ * interrupted status is cleared.
+ *
+ *
+ * The data of each file is split on separate data blocks and stored in the cache.
+ * You can access file's data with a standard Java streaming API. Moreover, for each part
+ * of the file you can calculate an affinity and process file's content on corresponding
+ * nodes to escape unnecessary networking.
+ *
+ * This API is fully thread-safe and you can use it from several threads.
+ * IGFS Configuration
+ * The simplest way to run a Ignite node with configured file system is to pass
+ * special configuration file included in Ignite distribution to {@code ignite.sh} or
+ * {@code ignite.bat} scripts, like this: {@code ignite.sh config/hadoop/default-config.xml}
+ * Integration With Hadoop
+ * In addition to direct file system API, {@code IGFS} can be integrated with {@code Hadoop} by
+ * plugging in as {@code Hadoop FileSystem}. Refer to
+ * {@code org.apache.ignite.hadoop.fs.v1.IgniteHadoopFileSystem} or
+ * {@code org.apache.ignite.hadoop.fs.v2.IgniteHadoopFileSystem} for more information.
+ *
+ *
+ *
+ * @param path File path to set properties for.
+ * @param props Properties to update.
+ * @return File information for specified path or {@code null} if such path does not exist.
+ * @throws IgniteException In case of error.
+ */
+ public IgfsFile update(IgfsPath path, Map
+ *
+ *
+ * @param src Source file path to rename.
+ * @param dest Destination file path. If destination path is a directory, then source file will be placed
+ * into destination directory with original name.
+ * @throws IgniteException In case of error.
+ * @throws IgfsPathNotFoundException If source file doesn't exist.
+ */
+ public void rename(IgfsPath src, IgfsPath dest) throws IgniteException;
+
+ /**
+ * Deletes file.
+ *
+ * @param path File path to delete.
+ * @param recursive Delete non-empty directories recursively.
+ * @return {@code True} in case of success, {@code false} otherwise.
+ * @throws IgniteException In case of error.
+ */
+ public boolean delete(IgfsPath path, boolean recursive) throws IgniteException;
+
+ /**
+ * Creates directories under specified path.
+ *
+ * @param path Path of directories chain to create.
+ * @throws IgniteException In case of error.
+ */
+ public void mkdirs(IgfsPath path) throws IgniteException;
+
+ /**
+ * Creates directories under specified path with the specified properties.
+ * Note that the properties are applied only to created directories, but never
+ * updated for existing ones.
+ *
+ * @param path Path of directories chain to create.
+ * @param props Metadata properties to set on created directories.
+ * @throws IgniteException In case of error.
+ */
+ public void mkdirs(IgfsPath path, @Nullable Map/backups/work" - such operation is restricted for directories.
- *
- *
- * @param addrsStr Ignite nodes addresses.
- * @throws SQLException On invalid addresses.
- */
- public void setAddresses(String... addrsStr) throws SQLException {
- HostAndPortRange[] addrs = new HostAndPortRange[addrsStr.length];
-
- for (int i = 0; i < addrs.length; ++i) {
- try {
- addrs[i] = HostAndPortRange.parse(addrsStr[i],
- ClientConnectorConfiguration.DFLT_PORT, ClientConnectorConfiguration.DFLT_PORT,
- "Invalid endpoint format (should be \"host[:portRangeFrom[..portRangeTo]]\")");
- }
- catch (IgniteCheckedException e) {
- throw new SQLException(e.getMessage(), SqlStateCode.CLIENT_CONNECTION_FAILED, e);
- }
- }
-
- props.setAddresses(addrs);
- }
-
- /**
- * @return Schema name of the connection.
- */
- public String getSchema() {
- return props.getSchema();
- }
-
- /**
- * @param schema Schema name of the connection.
- */
- public void setSchema(String schema) {
- props.setSchema(schema);
- }
-
- /**
- * @return The URL of the connection.
- */
- public String getUrl() {
- return props.getUrl();
- }
-
- /**
- * @param url The URL of the connection.
- * @throws SQLException On invalid URL.
- */
- public void setUrl(String url) throws SQLException {
- props = new ConnectionPropertiesImpl();
-
- props.setUrl(url);
- }
-
- /**
- * @return Distributed joins flag.
- */
- public boolean isDistributedJoins() {
- return props.isDistributedJoins();
- }
-
- /**
- * @param distributedJoins Distributed joins flag.
- */
- public void setDistributedJoins(boolean distributedJoins) {
- props.setDistributedJoins(distributedJoins);
- }
-
- /**
- * @return Enforce join order flag.
- */
- public boolean isEnforceJoinOrder() {
- return props.isEnforceJoinOrder();
- }
-
- /**
- * @param enforceJoinOrder Enforce join order flag.
- */
- public void setEnforceJoinOrder(boolean enforceJoinOrder) {
- props.setEnforceJoinOrder(enforceJoinOrder);
- }
-
- /**
- * @return Collocated flag.
- */
- public boolean isCollocated() {
- return props.isCollocated();
- }
-
- /**
- * @param collocated Collocated flag.
- */
- public void setCollocated(boolean collocated) {
- props.setCollocated(collocated);
- }
-
- /**
- * @return Replicated only flag.
- */
- public boolean isReplicatedOnly() {
- return props.isReplicatedOnly();
- }
-
- /**
- * @param replicatedOnly Replicated only flag.
- */
- public void setReplicatedOnly(boolean replicatedOnly) {
- props.setReplicatedOnly(replicatedOnly);
- }
-
- /**
- * @return Auto close server cursors flag.
- */
- public boolean isAutoCloseServerCursor() {
- return props.isAutoCloseServerCursor();
- }
-
- /**
- * @param autoCloseServerCursor Auto close server cursors flag.
- */
- public void setAutoCloseServerCursor(boolean autoCloseServerCursor) {
- props.setAutoCloseServerCursor(autoCloseServerCursor);
- }
-
- /**
- * @return Socket send buffer size.
- */
- public int getSocketSendBuffer() {
- return props.getSocketSendBuffer();
- }
-
- /**
- * @param size Socket send buffer size.
- * @throws SQLException On error.
- */
- public void setSocketSendBuffer(int size) throws SQLException {
- props.setSocketSendBuffer(size);
- }
-
- /**
- * @return Socket receive buffer size.
- */
- public int getSocketReceiveBuffer() {
- return props.getSocketReceiveBuffer();
- }
-
- /**
- * @param size Socket receive buffer size.
- * @throws SQLException On error.
- */
- public void setSocketReceiveBuffer(int size) throws SQLException {
- props.setSocketReceiveBuffer(size);
- }
-
- /**
- * @return TCP no delay flag.
- */
- public boolean isTcpNoDelay() {
- return props.isTcpNoDelay();
- }
-
- /**
- * @param tcpNoDelay TCP no delay flag.
- */
- public void setTcpNoDelay(boolean tcpNoDelay) {
- props.setTcpNoDelay(tcpNoDelay);
- }
-
- /**
- * @return Local query flag.
- */
- public boolean isLocal() {
- return props.isLocal();
- }
-
- /**
- * @param loc Local query flag.
- */
- public void setLocal(boolean loc) {
- props.setLocal(loc);
- }
-
- /**
- * @return Skip reducer on update flag.
- */
- public boolean isSkipReducerOnUpdate() {
- return props.isSkipReducerOnUpdate();
- }
-
- /**
- * @param skipReducerOnUpdate Skip reducer on update flag.
- */
- public void setSkipReducerOnUpdate(boolean skipReducerOnUpdate) {
- props.setSkipReducerOnUpdate(skipReducerOnUpdate);
- }
-
- /**
- * Gets SSL connection mode.
- *
- * @return Use SSL flag.
- * @see #setSslMode(String).
- */
- public String getSslMode() {
- return props.getSslMode();
- }
-
- /**
- * Use SSL connection to Ignite node. In case set to {@code "require"} SSL context must be configured.
- * {@link #setSslClientCertificateKeyStoreUrl} property and related properties must be set up
- * or JSSE properties must be set up (see {@code javax.net.ssl.keyStore} and other {@code javax.net.ssl.*}
- * properties)
- *
- * In case set to {@code "disable"} plain connection is used.
- * Available modes: {@code "disable", "require"}. Default value is {@code "disable"}
- *
- * @param mode SSL mode.
- */
- public void setSslMode(String mode) {
- props.setSslMode(mode);
- }
-
- /**
- * Gets protocol for secure transport.
- *
- * @return SSL protocol name.
- */
- public String getSslProtocol() {
- return props.getSslProtocol();
- }
-
- /**
- * Sets protocol for secure transport. If not specified, TLS protocol will be used.
- * Protocols implementations supplied by JSEE: SSLv3 (SSL), TLSv1 (TLS), TLSv1.1, TLSv1.2
- *
- *
+ *
+ *
+ * @param addrsStr Ignite nodes addresses.
+ * @throws SQLException On invalid addresses.
+ */
+ public void setAddresses(String... addrsStr) throws SQLException {
+ HostAndPortRange[] addrs = new HostAndPortRange[addrsStr.length];
+
+ for (int i = 0; i < addrs.length; ++i) {
+ try {
+ addrs[i] = HostAndPortRange.parse(addrsStr[i],
+ ClientConnectorConfiguration.DFLT_PORT, ClientConnectorConfiguration.DFLT_PORT,
+ "Invalid endpoint format (should be \"host[:portRangeFrom[..portRangeTo]]\")");
+ }
+ catch (IgniteCheckedException e) {
+ throw new SQLException(e.getMessage(), SqlStateCode.CLIENT_CONNECTION_FAILED, e);
+ }
+ }
+
+ props.setAddresses(addrs);
+ }
+
+ /**
+ * @return Schema name of the connection.
+ */
+ public String getSchema() {
+ return props.getSchema();
+ }
+
+ /**
+ * @param schema Schema name of the connection.
+ */
+ public void setSchema(String schema) {
+ props.setSchema(schema);
+ }
+
+ /**
+ * @return The URL of the connection.
+ */
+ public String getUrl() {
+ return props.getUrl();
+ }
+
+ /**
+ * @param url The URL of the connection.
+ * @throws SQLException On invalid URL.
+ */
+ public void setUrl(String url) throws SQLException {
+ props = new ConnectionPropertiesImpl();
+
+ props.setUrl(url);
+ }
+
+ /**
+ * @return Distributed joins flag.
+ */
+ public boolean isDistributedJoins() {
+ return props.isDistributedJoins();
+ }
+
+ /**
+ * @param distributedJoins Distributed joins flag.
+ */
+ public void setDistributedJoins(boolean distributedJoins) {
+ props.setDistributedJoins(distributedJoins);
+ }
+
+ /**
+ * @return Enforce join order flag.
+ */
+ public boolean isEnforceJoinOrder() {
+ return props.isEnforceJoinOrder();
+ }
+
+ /**
+ * @param enforceJoinOrder Enforce join order flag.
+ */
+ public void setEnforceJoinOrder(boolean enforceJoinOrder) {
+ props.setEnforceJoinOrder(enforceJoinOrder);
+ }
+
+ /**
+ * @return Collocated flag.
+ */
+ public boolean isCollocated() {
+ return props.isCollocated();
+ }
+
+ /**
+ * @param collocated Collocated flag.
+ */
+ public void setCollocated(boolean collocated) {
+ props.setCollocated(collocated);
+ }
+
+ /**
+ * @return Replicated only flag.
+ */
+ public boolean isReplicatedOnly() {
+ return props.isReplicatedOnly();
+ }
+
+ /**
+ * @param replicatedOnly Replicated only flag.
+ */
+ public void setReplicatedOnly(boolean replicatedOnly) {
+ props.setReplicatedOnly(replicatedOnly);
+ }
+
+ /**
+ * @return Auto close server cursors flag.
+ */
+ public boolean isAutoCloseServerCursor() {
+ return props.isAutoCloseServerCursor();
+ }
+
+ /**
+ * @param autoCloseServerCursor Auto close server cursors flag.
+ */
+ public void setAutoCloseServerCursor(boolean autoCloseServerCursor) {
+ props.setAutoCloseServerCursor(autoCloseServerCursor);
+ }
+
+ /**
+ * @return Socket send buffer size.
+ */
+ public int getSocketSendBuffer() {
+ return props.getSocketSendBuffer();
+ }
+
+ /**
+ * @param size Socket send buffer size.
+ * @throws SQLException On error.
+ */
+ public void setSocketSendBuffer(int size) throws SQLException {
+ props.setSocketSendBuffer(size);
+ }
+
+ /**
+ * @return Socket receive buffer size.
+ */
+ public int getSocketReceiveBuffer() {
+ return props.getSocketReceiveBuffer();
+ }
+
+ /**
+ * @param size Socket receive buffer size.
+ * @throws SQLException On error.
+ */
+ public void setSocketReceiveBuffer(int size) throws SQLException {
+ props.setSocketReceiveBuffer(size);
+ }
+
+ /**
+ * @return TCP no delay flag.
+ */
+ public boolean isTcpNoDelay() {
+ return props.isTcpNoDelay();
+ }
+
+ /**
+ * @param tcpNoDelay TCP no delay flag.
+ */
+ public void setTcpNoDelay(boolean tcpNoDelay) {
+ props.setTcpNoDelay(tcpNoDelay);
+ }
+
+ /**
+ * @return Local query flag.
+ */
+ public boolean isLocal() {
+ return props.isLocal();
+ }
+
+ /**
+ * @param loc Local query flag.
+ */
+ public void setLocal(boolean loc) {
+ props.setLocal(loc);
+ }
+
+ /**
+ * @return Skip reducer on update flag.
+ */
+ public boolean isSkipReducerOnUpdate() {
+ return props.isSkipReducerOnUpdate();
+ }
+
+ /**
+ * @param skipReducerOnUpdate Skip reducer on update flag.
+ */
+ public void setSkipReducerOnUpdate(boolean skipReducerOnUpdate) {
+ props.setSkipReducerOnUpdate(skipReducerOnUpdate);
+ }
+
+ /**
+ * Gets SSL connection mode.
+ *
+ * @return Use SSL flag.
+ * @see #setSslMode(String).
+ */
+ public String getSslMode() {
+ return props.getSslMode();
+ }
+
+ /**
+ * Use SSL connection to Ignite node. In case set to {@code "require"} SSL context must be configured.
+ * {@link #setSslClientCertificateKeyStoreUrl} property and related properties must be set up
+ * or JSSE properties must be set up (see {@code javax.net.ssl.keyStore} and other {@code javax.net.ssl.*}
+ * properties)
+ *
+ * In case set to {@code "disable"} plain connection is used.
+ * Available modes: {@code "disable", "require"}. Default value is {@code "disable"}
+ *
+ * @param mode SSL mode.
+ */
+ public void setSslMode(String mode) {
+ props.setSslMode(mode);
+ }
+
+ /**
+ * Gets protocol for secure transport.
+ *
+ * @return SSL protocol name.
+ */
+ public String getSslProtocol() {
+ return props.getSslProtocol();
+ }
+
+ /**
+ * Sets protocol for secure transport. If not specified, TLS protocol will be used.
+ * Protocols implementations supplied by JSEE: SSLv3 (SSL), TLSv1 (TLS), TLSv1.1, TLSv1.2
+ *
+ *
Functionality
- * Distributed reentrant lock provides functionality similar to {@code java.util.concurrent.ReentrantLock}.
- * Creating Distributed ReentrantLock
- * Instance of cache reentrant lock can be created by calling the following method:
- * {@link Ignite#reentrantLock(String, boolean, boolean, boolean)}.
- * Protection from failover
- * Ignite lock can automatically recover from node failure.
- *
- *
- *
- * Implementation issues
- * Ignite lock comes in two flavours: fair and non-fair. Non-fair lock assumes no ordering should be imposed
- * on acquiring threads; in case of contention, threads from all nodes compete for the lock once the lock is released.
- * In most cases this is the desired behaviour. However, in some cases, using the non-fair lock can lead to uneven load
- * distribution among nodes.
- * Fair lock solves this issue by imposing strict FIFO ordering policy at a cost of an additional transaction.
- * This ordering does not guarantee fairness of thread scheduling (similar to {@code java.util.concurrent.ReentrantLock}).
- * Thus, one of many threads on any node using a fair lock may obtain it multiple times in succession while other
- * active threads are not progressing and not currently holding the lock. Also note that the untimed tryLock method
- * does not honor the fairness setting. It will succeed if the lock is available even if other threads are waiting.
- *
- * {@code
- * while(someCondition){
- * // do anything
- * lock.lock();
- * try{
- * // ...
- * }
- * finally {
- * lock.unlock();
- * }
- * }
- * }
- *
- * If successive calls to release/acquire are following immediately,
- * e.g.
- *
- * {@code
- * while(someCondition){
- * lock.lock();
- * try {
- * // do something
- * }
- * finally {
- * lock.unlock();
- * }
- * }
- * }
- *
- * using the fair lock is reasonable in order to allow even distribution of load among nodes
- * (although overall throughput may be lower due to increased overhead).
- *
- */
-public interface IgniteLock extends Lock, Closeable {
- /**
- * Name of atomic reentrant lock.
- *
- * @return Name of atomic reentrant lock.
- */
- public String name();
-
- /**
- * Acquires the distributed reentrant lock.
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * {@code
- * Lock lock = ...;
- * if (lock.tryLock()) {
- * try {
- * // manipulate protected state
- * } finally {
- * lock.unlock();
- * }
- * } else {
- * // perform alternative actions
- * }}
- *
- * This usage ensures that the lock is unlocked if it was acquired, and
- * doesn't try to unlock if the lock was not acquired.
- *
- * If node is stopped, or any node failed while owning the lock in non-failoverSafe mode,
- * then {@link IgniteException} is thrown.
- *
- * @return {@code true} if the lock was acquired and
- * {@code false} otherwise
- *
- * @throws IgniteException if node is stopped, or lock is already broken in non-failover safe mode
- */
- @Override public boolean tryLock() throws IgniteException;
-
- /**
- * Acquires the lock if it is not held by another thread within the given
- * waiting time and the current thread has not been
- * {@linkplain Thread#interrupt interrupted}.
- *
- *
- *
- *
- *
- *
- *
- *
- * then {@link IgniteInterruptedException} is thrown and the current thread's
- * interrupted status is cleared.
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * @param name Name of the distributed condition object
- *
- * @return the Condition object
- * @throws IgniteException if the lock is not initialized or already removed
- */
- public IgniteCondition getOrCreateCondition(String name) throws IgniteException;
-
- /**
- * This method is not supported in IgniteLock,
- * Any invocation of this method will result in {@linkplain UnsupportedOperationException}.
- * Correct way to obtain Condition object is through method {@linkplain IgniteLock#getOrCreateCondition(String)}
- *
- */
- @Override public Condition newCondition();
-
- /**
- * Queries the number of holds on this lock by the current thread.
- *
- * @return the number of holds on this lock by the current thread,
- * or zero if this lock is not held by the current thread
- * @throws IgniteException if the lock is not initialized or already removed
- */
- public int getHoldCount() throws IgniteException;
-
- /**
- * Queries if this lock is held by the current thread.
- *
- * @return {@code true} if current thread holds this lock and
- * {@code false} otherwise
- * @throws IgniteException if the lock is not initialized or already removed
- */
- public boolean isHeldByCurrentThread() throws IgniteException;
-
- /**
- * Queries if this lock is held by any thread on any node. This method is
- * designed for use in monitoring of the system state,
- * not for synchronization control.
- *
- * @return {@code true} if any thread on this or any other node holds this lock and
- * {@code false} otherwise
- * @throws IgniteException if the lock is not initialized or already removed
- */
- public boolean isLocked() throws IgniteException;
-
- /**
- * Queries whether any threads on this node are waiting to acquire this lock. Note that
- * because cancellations may occur at any time, a {@code true}
- * return does not guarantee that any other thread will ever
- * acquire this lock. This method is designed primarily for use in
- * monitoring of the system state.
- *
- * @return {@code true} if there may be other threads on this node waiting to
- * acquire the lock
- * @throws IgniteException if the lock is not initialized or already removed
- */
- public boolean hasQueuedThreads() throws IgniteException;
-
- /**
- * Queries whether the given thread is waiting to acquire this
- * lock. Note that because cancellations may occur at any time, a
- * {@code true} return does not guarantee that this thread
- * will ever acquire this lock. This method is designed primarily for use
- * in monitoring of the system state.
- *
- * @param thread the thread
- * @return {@code true} if the given thread is queued waiting for this lock
- * @throws NullPointerException if the thread is null
- * @throws IgniteException if the lock is not initialized or already removed
- */
- public boolean hasQueuedThread(Thread thread) throws IgniteException;
-
- /**
- * Queries whether any threads on this node are waiting on the given condition
- * associated with this lock. Note that because timeouts and
- * interrupts may occur at any time, a {@code true} return does
- * not guarantee that a future {@code signal} will awaken any
- * threads. This method is designed primarily for use in
- * monitoring of the system state.
- *
- * @param condition the condition
- * @return {@code true} if there are any waiting threads on this node
- * @throws IllegalMonitorStateException if this lock is not held
- * @throws IllegalArgumentException if the given condition is
- * not associated with this lock
- * @throws NullPointerException if the condition is null
- * @throws IgniteException if the lock is not initialized or already removed
- */
- public boolean hasWaiters(IgniteCondition condition) throws IgniteException;
-
- /**
- * Returns an estimate of the number of threads on this node that are waiting on the
- * given condition associated with this lock. Note that because
- * timeouts and interrupts may occur at any time, the estimate
- * serves only as an upper bound on the actual number of waiters.
- * This method is designed for use in monitoring of the system
- * state, not for synchronization control.
- *
- * @param condition the condition
- * @return the estimated number of waiting threads on this node
- * @throws IllegalMonitorStateException if this lock is not held
- * @throws IllegalArgumentException if the given condition is
- * not associated with this lock
- * @throws NullPointerException if the condition is null
- * @throws IgniteException if the lock is not initialized or already removed
- */
- public int getWaitQueueLength(IgniteCondition condition) throws IgniteException;
-
- /**
- * Returns {@code true} if this lock is safe to use after node failure.
- * If not, IgniteInterruptedException is thrown on every other node after node failure.
- *
- * @return {@code true} if this reentrant lock has failoverSafe set true
- * @throws IgniteException if the lock is not initialized or already removed
- */
- public boolean isFailoverSafe();
-
- /**
- * Returns {@code true} if this lock is fair. Fairness flag can only be set on lock creation.
- *
- * @return {@code true} if this reentrant lock has fairness flag set true.
- * @throws IgniteException if the lock is not initialized or already removed
- */
- public boolean isFair();
-
- /**
- * Returns true if any node that owned the locked failed before releasing the lock.
- *
- * @return true if any node failed while owning the lock since the lock on this node was initialized.
- * @throws IgniteException if the lock is not initialized or already removed
- */
- public boolean isBroken() throws IgniteException;
-
- /**
- * Gets status of reentrant lock.
- *
- * @return {@code true} if reentrant lock was removed from cache, {@code false} in other case.
- */
- public boolean removed();
-
- /**
- * Removes reentrant lock.
- *
- * @throws IgniteException If operation failed.
- */
- @Override public void close();
-}
+/*
+ * 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;
+
+import java.io.Closeable;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+
+/**
+ * This interface provides a rich API for working with distributed reentrant locks.
+ * Functionality
+ * Distributed reentrant lock provides functionality similar to {@code java.util.concurrent.ReentrantLock}.
+ * Creating Distributed ReentrantLock
+ * Instance of cache reentrant lock can be created by calling the following method:
+ * {@link Ignite#reentrantLock(String, boolean, boolean, boolean)}.
+ * Protection from failover
+ * Ignite lock can automatically recover from node failure.
+ *
+ *
+ *
+ * Implementation issues
+ * Ignite lock comes in two flavours: fair and non-fair. Non-fair lock assumes no ordering should be imposed
+ * on acquiring threads; in case of contention, threads from all nodes compete for the lock once the lock is released.
+ * In most cases this is the desired behaviour. However, in some cases, using the non-fair lock can lead to uneven load
+ * distribution among nodes.
+ * Fair lock solves this issue by imposing strict FIFO ordering policy at a cost of an additional transaction.
+ * This ordering does not guarantee fairness of thread scheduling (similar to {@code java.util.concurrent.ReentrantLock}).
+ * Thus, one of many threads on any node using a fair lock may obtain it multiple times in succession while other
+ * active threads are not progressing and not currently holding the lock. Also note that the untimed tryLock method
+ * does not honor the fairness setting. It will succeed if the lock is available even if other threads are waiting.
+ *
+ * {@code
+ * while(someCondition){
+ * // do anything
+ * lock.lock();
+ * try{
+ * // ...
+ * }
+ * finally {
+ * lock.unlock();
+ * }
+ * }
+ * }
+ *
+ * If successive calls to release/acquire are following immediately,
+ * e.g.
+ *
+ * {@code
+ * while(someCondition){
+ * lock.lock();
+ * try {
+ * // do something
+ * }
+ * finally {
+ * lock.unlock();
+ * }
+ * }
+ * }
+ *
+ * using the fair lock is reasonable in order to allow even distribution of load among nodes
+ * (although overall throughput may be lower due to increased overhead).
+ *
+ */
+public interface IgniteLock extends Lock, Closeable {
+ /**
+ * Name of atomic reentrant lock.
+ *
+ * @return Name of atomic reentrant lock.
+ */
+ public String name();
+
+ /**
+ * Acquires the distributed reentrant lock.
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * {@code
+ * Lock lock = ...;
+ * if (lock.tryLock()) {
+ * try {
+ * // manipulate protected state
+ * } finally {
+ * lock.unlock();
+ * }
+ * } else {
+ * // perform alternative actions
+ * }}
+ *
+ * This usage ensures that the lock is unlocked if it was acquired, and
+ * doesn't try to unlock if the lock was not acquired.
+ *
+ * If node is stopped, or any node failed while owning the lock in non-failoverSafe mode,
+ * then {@link IgniteException} is thrown.
+ *
+ * @return {@code true} if the lock was acquired and
+ * {@code false} otherwise
+ *
+ * @throws IgniteException if node is stopped, or lock is already broken in non-failover safe mode
+ */
+ @Override public boolean tryLock() throws IgniteException;
+
+ /**
+ * Acquires the lock if it is not held by another thread within the given
+ * waiting time and the current thread has not been
+ * {@linkplain Thread#interrupt interrupted}.
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * then {@link IgniteInterruptedException} is thrown and the current thread's
+ * interrupted status is cleared.
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * @param name Name of the distributed condition object
+ *
+ * @return the Condition object
+ * @throws IgniteException if the lock is not initialized or already removed
+ */
+ public IgniteCondition getOrCreateCondition(String name) throws IgniteException;
+
+ /**
+ * This method is not supported in IgniteLock,
+ * Any invocation of this method will result in {@linkplain UnsupportedOperationException}.
+ * Correct way to obtain Condition object is through method {@linkplain IgniteLock#getOrCreateCondition(String)}
+ *
+ */
+ @Override public Condition newCondition();
+
+ /**
+ * Queries the number of holds on this lock by the current thread.
+ *
+ * @return the number of holds on this lock by the current thread,
+ * or zero if this lock is not held by the current thread
+ * @throws IgniteException if the lock is not initialized or already removed
+ */
+ public int getHoldCount() throws IgniteException;
+
+ /**
+ * Queries if this lock is held by the current thread.
+ *
+ * @return {@code true} if current thread holds this lock and
+ * {@code false} otherwise
+ * @throws IgniteException if the lock is not initialized or already removed
+ */
+ public boolean isHeldByCurrentThread() throws IgniteException;
+
+ /**
+ * Queries if this lock is held by any thread on any node. This method is
+ * designed for use in monitoring of the system state,
+ * not for synchronization control.
+ *
+ * @return {@code true} if any thread on this or any other node holds this lock and
+ * {@code false} otherwise
+ * @throws IgniteException if the lock is not initialized or already removed
+ */
+ public boolean isLocked() throws IgniteException;
+
+ /**
+ * Queries whether any threads on this node are waiting to acquire this lock. Note that
+ * because cancellations may occur at any time, a {@code true}
+ * return does not guarantee that any other thread will ever
+ * acquire this lock. This method is designed primarily for use in
+ * monitoring of the system state.
+ *
+ * @return {@code true} if there may be other threads on this node waiting to
+ * acquire the lock
+ * @throws IgniteException if the lock is not initialized or already removed
+ */
+ public boolean hasQueuedThreads() throws IgniteException;
+
+ /**
+ * Queries whether the given thread is waiting to acquire this
+ * lock. Note that because cancellations may occur at any time, a
+ * {@code true} return does not guarantee that this thread
+ * will ever acquire this lock. This method is designed primarily for use
+ * in monitoring of the system state.
+ *
+ * @param thread the thread
+ * @return {@code true} if the given thread is queued waiting for this lock
+ * @throws NullPointerException if the thread is null
+ * @throws IgniteException if the lock is not initialized or already removed
+ */
+ public boolean hasQueuedThread(Thread thread) throws IgniteException;
+
+ /**
+ * Queries whether any threads on this node are waiting on the given condition
+ * associated with this lock. Note that because timeouts and
+ * interrupts may occur at any time, a {@code true} return does
+ * not guarantee that a future {@code signal} will awaken any
+ * threads. This method is designed primarily for use in
+ * monitoring of the system state.
+ *
+ * @param condition the condition
+ * @return {@code true} if there are any waiting threads on this node
+ * @throws IllegalMonitorStateException if this lock is not held
+ * @throws IllegalArgumentException if the given condition is
+ * not associated with this lock
+ * @throws NullPointerException if the condition is null
+ * @throws IgniteException if the lock is not initialized or already removed
+ */
+ public boolean hasWaiters(IgniteCondition condition) throws IgniteException;
+
+ /**
+ * Returns an estimate of the number of threads on this node that are waiting on the
+ * given condition associated with this lock. Note that because
+ * timeouts and interrupts may occur at any time, the estimate
+ * serves only as an upper bound on the actual number of waiters.
+ * This method is designed for use in monitoring of the system
+ * state, not for synchronization control.
+ *
+ * @param condition the condition
+ * @return the estimated number of waiting threads on this node
+ * @throws IllegalMonitorStateException if this lock is not held
+ * @throws IllegalArgumentException if the given condition is
+ * not associated with this lock
+ * @throws NullPointerException if the condition is null
+ * @throws IgniteException if the lock is not initialized or already removed
+ */
+ public int getWaitQueueLength(IgniteCondition condition) throws IgniteException;
+
+ /**
+ * Returns {@code true} if this lock is safe to use after node failure.
+ * If not, IgniteInterruptedException is thrown on every other node after node failure.
+ *
+ * @return {@code true} if this reentrant lock has failoverSafe set true
+ * @throws IgniteException if the lock is not initialized or already removed
+ */
+ public boolean isFailoverSafe();
+
+ /**
+ * Returns {@code true} if this lock is fair. Fairness flag can only be set on lock creation.
+ *
+ * @return {@code true} if this reentrant lock has fairness flag set true.
+ * @throws IgniteException if the lock is not initialized or already removed
+ */
+ public boolean isFair();
+
+ /**
+ * Returns true if any node that owned the locked failed before releasing the lock.
+ *
+ * @return true if any node failed while owning the lock since the lock on this node was initialized.
+ * @throws IgniteException if the lock is not initialized or already removed
+ */
+ public boolean isBroken() throws IgniteException;
+
+ /**
+ * Gets status of reentrant lock.
+ *
+ * @return {@code true} if reentrant lock was removed from cache, {@code false} in other case.
+ */
+ public boolean removed();
+
+ /**
+ * Removes reentrant lock.
+ *
+ * @throws IgniteException If operation failed.
+ */
+ @Override public void close();
+}
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteMessaging.java b/modules/core/src/main/java/org/apache/ignite/IgniteMessaging.java
index 2f90eea71be4a..e48ec1d9caf7d 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteMessaging.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteMessaging.java
@@ -1,201 +1,201 @@
-/*
- * 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;
-
-import java.util.Collection;
-import java.util.UUID;
-import org.apache.ignite.cluster.ClusterGroup;
-import org.apache.ignite.cluster.ClusterGroupEmptyException;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.lang.IgniteAsyncSupport;
-import org.apache.ignite.lang.IgniteAsyncSupported;
-import org.apache.ignite.lang.IgniteBiPredicate;
-import org.apache.ignite.lang.IgniteFuture;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Provides functionality for topic-based message exchange among nodes defined by {@link #clusterGroup()}.
- * Users can send ordered and unordered messages to various topics. Note that same topic name
- * cannot be reused between ordered and unordered messages.
- *
- * Ignite ignite = Ignition.ignite();
- *
- * // Messaging instance spanning all cluster nodes.
- * IgniteMessaging m = ignite.message();
- *
- * You can also obtain an instance of messaging facade over a specific cluster group:
- *
- * // Cluster group over remote nodes (excluding the local node).
- * ClusterGroup remoteNodes = ignite.cluster().forRemotes();
- *
- * // Messaging instance spanning all remote cluster nodes.
- * IgniteMessaging m = ignite.message(remoteNodes);
- *
- * Ordered vs Unordered
- * Ignite allows for sending ordered messages (see {@link #sendOrdered(Object, Object, long)}), i.e.
- * messages will be received in the same order they were sent. Ordered messages have a {@code timeout}
- * parameter associated with them which specifies how long an out-of-order message will stay in a queue,
- * waiting for messages that are ordered ahead of it to arrive. If timeout expires, then all ordered
- * messages for a given topic that have not arrived yet will be skipped. When (and if) expired messages
- * actually do arrive, they will be ignored.
- */
-public interface IgniteMessaging extends IgniteAsyncSupport {
- /**
- * Gets the cluster group to which this {@code GridMessaging} instance belongs.
- *
- * @return Cluster group to which this {@code GridMessaging} instance belongs.
- */
- public ClusterGroup clusterGroup();
-
- /**
- * Sends given message with specified topic to the nodes in the underlying cluster group.
- *
+ * Ignite ignite = Ignition.ignite();
+ *
+ * // Messaging instance spanning all cluster nodes.
+ * IgniteMessaging m = ignite.message();
+ *
+ * You can also obtain an instance of messaging facade over a specific cluster group:
+ *
+ * // Cluster group over remote nodes (excluding the local node).
+ * ClusterGroup remoteNodes = ignite.cluster().forRemotes();
+ *
+ * // Messaging instance spanning all remote cluster nodes.
+ * IgniteMessaging m = ignite.message(remoteNodes);
+ *
+ * Ordered vs Unordered
+ * Ignite allows for sending ordered messages (see {@link #sendOrdered(Object, Object, long)}), i.e.
+ * messages will be received in the same order they were sent. Ordered messages have a {@code timeout}
+ * parameter associated with them which specifies how long an out-of-order message will stay in a queue,
+ * waiting for messages that are ordered ahead of it to arrive. If timeout expires, then all ordered
+ * messages for a given topic that have not arrived yet will be skipped. When (and if) expired messages
+ * actually do arrive, they will be ignored.
+ */
+public interface IgniteMessaging extends IgniteAsyncSupport {
+ /**
+ * Gets the cluster group to which this {@code GridMessaging} instance belongs.
+ *
+ * @return Cluster group to which this {@code GridMessaging} instance belongs.
+ */
+ public ClusterGroup clusterGroup();
+
+ /**
+ * Sends given message with specified topic to the nodes in the underlying cluster group.
+ *
- *
- *
- *
- * Java Example
- *
- * IgniteCache<Integer, String> cache = grid(0).cache(null);
- *
- * CacheEntry<String, Integer> entry1 = cache.invoke(100,
- * new EntryProcessor<Integer, String, CacheEntry<String, Integer>>() {
- * public CacheEntry<String, Integer> process(MutableEntry<Integer, String> entry,
- * Object... arguments) throws EntryProcessorException {
- * return entry.unwrap(CacheEntry.class);
- * }
- * });
- *
- * // Cache entry for the given key may be updated at some point later.
- *
- * CacheEntry<String, Integer> entry2 = cache.invoke(100,
- * new EntryProcessor<Integer, String, CacheEntry<String, Integer>>() {
- * public CacheEntry<String, Integer> process(MutableEntry<Integer, String> entry,
- * Object... arguments) throws EntryProcessorException {
- * return entry.unwrap(CacheEntry.class);
- * }
- * });
- *
- * // Comparing entries' versions.
- * if (entry1.version().compareTo(entry2.version()) < 0) {
- * // the entry has been updated
- * }
- *
- */
-public interface CacheEntry
+ *
+ * Java Example
+ *
+ * IgniteCache<Integer, String> cache = grid(0).cache(null);
+ *
+ * CacheEntry<String, Integer> entry1 = cache.invoke(100,
+ * new EntryProcessor<Integer, String, CacheEntry<String, Integer>>() {
+ * public CacheEntry<String, Integer> process(MutableEntry<Integer, String> entry,
+ * Object... arguments) throws EntryProcessorException {
+ * return entry.unwrap(CacheEntry.class);
+ * }
+ * });
+ *
+ * // Cache entry for the given key may be updated at some point later.
+ *
+ * CacheEntry<String, Integer> entry2 = cache.invoke(100,
+ * new EntryProcessor<Integer, String, CacheEntry<String, Integer>>() {
+ * public CacheEntry<String, Integer> process(MutableEntry<Integer, String> entry,
+ * Object... arguments) throws EntryProcessorException {
+ * return entry.unwrap(CacheEntry.class);
+ * }
+ * });
+ *
+ * // Comparing entries' versions.
+ * if (entry1.version().compareTo(entry2.version()) < 0) {
+ * // the entry has been updated
+ * }
+ *
+ */
+public interface CacheEntry