You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/05/16 09:07:43 UTC
[8/8] incubator-ignite git commit: Revert "ignite-471: fixed NPE in
PortableMarshaller"
Revert "ignite-471: fixed NPE in PortableMarshaller"
This reverts commit b84cef7dcebb6f949d89af2c3c424aa182b6c315, reversing
changes made to 095e3f9b924279d1220d5ad8542ea4df728eba97.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/8a6dd007
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/8a6dd007
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/8a6dd007
Branch: refs/heads/ignite-471
Commit: 8a6dd007d79e6bd62fb288f1c38310860949ca45
Parents: 477dea6
Author: dmagda <ma...@gmail.com>
Authored: Sat May 16 10:05:16 2015 +0300
Committer: dmagda <ma...@gmail.com>
Committed: Sat May 16 10:05:16 2015 +0300
----------------------------------------------------------------------
assembly/release-base.xml | 4 +-
bin/ignite-schema-import.bat | 2 +-
bin/ignite-schema-import.sh | 2 +-
bin/ignite.bat | 2 +-
bin/ignite.sh | 2 +-
bin/ignitevisorcmd.bat | 2 +-
bin/ignitevisorcmd.sh | 2 +-
bin/include/build-classpath.bat | 46 -
bin/include/build-classpath.sh | 71 --
bin/include/functions.sh | 2 +-
bin/include/target-classpath.bat | 46 +
bin/include/target-classpath.sh | 71 ++
.../streaming/StreamTransformerExample.java | 4 +-
.../streaming/StreamVisitorExample.java | 4 +-
.../ignite/examples/streaming/package-info.java | 1 +
.../streaming/wordcount/CacheConfig.java | 2 +-
.../streaming/wordcount/QueryWords.java | 12 +-
.../streaming/wordcount/StreamWords.java | 12 +-
.../streaming/wordcount/package-info.java | 1 +
.../socket/WordsSocketStreamerClient.java | 82 --
.../socket/WordsSocketStreamerServer.java | 124 ---
.../wordcount/socket/package-info.java | 21 -
.../org/apache/ignite/internal/IgnitionEx.java | 136 ++-
.../internal/direct/DirectByteBufferStream.java | 4 +-
.../internal/interop/InteropBootstrap.java | 34 -
.../interop/InteropBootstrapFactory.java | 39 -
.../internal/interop/InteropIgnition.java | 103 --
.../internal/interop/InteropProcessor.java | 25 -
.../eventstorage/GridEventStorageManager.java | 5 +-
.../processors/cache/GridCacheAdapter.java | 127 ++-
.../processors/cache/GridCacheContext.java | 7 -
.../processors/cache/GridCacheMapEntry.java | 106 +-
.../processors/cache/GridCacheMvccManager.java | 4 +-
.../GridDistributedCacheAdapter.java | 210 ++--
.../distributed/GridDistributedLockRequest.java | 111 +-
.../GridDistributedTxFinishRequest.java | 70 +-
.../GridDistributedTxPrepareRequest.java | 112 +-
.../GridDistributedTxRemoteAdapter.java | 20 +-
.../distributed/dht/GridDhtCacheAdapter.java | 16 +-
.../distributed/dht/GridDhtLockFuture.java | 2 +
.../distributed/dht/GridDhtLockRequest.java | 45 +-
.../dht/GridDhtOffHeapCacheEntry.java | 63 --
.../dht/GridDhtTransactionalCacheAdapter.java | 15 +-
.../distributed/dht/GridDhtTxFinishFuture.java | 3 +
.../distributed/dht/GridDhtTxFinishRequest.java | 43 +-
.../cache/distributed/dht/GridDhtTxLocal.java | 38 +-
.../distributed/dht/GridDhtTxLocalAdapter.java | 95 +-
.../cache/distributed/dht/GridDhtTxMapping.java | 2 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 99 +-
.../dht/GridDhtTxPrepareRequest.java | 60 +-
.../cache/distributed/dht/GridDhtTxRemote.java | 8 +-
.../distributed/dht/GridNoStorageCacheMap.java | 4 +-
.../dht/atomic/GridDhtAtomicCache.java | 3 -
.../atomic/GridDhtAtomicOffHeapCacheEntry.java | 63 --
.../dht/colocated/GridDhtColocatedCache.java | 5 +-
.../colocated/GridDhtColocatedLockFuture.java | 31 +-
.../GridDhtColocatedOffHeapCacheEntry.java | 63 --
.../colocated/GridDhtDetachedCacheEntry.java | 4 +-
.../GridDhtPartitionsExchangeFuture.java | 2 +-
.../distributed/near/GridNearCacheAdapter.java | 3 -
.../distributed/near/GridNearCacheEntry.java | 4 +-
.../distributed/near/GridNearLockFuture.java | 11 +
.../distributed/near/GridNearLockRequest.java | 61 +-
.../near/GridNearOffHeapCacheEntry.java | 60 -
.../near/GridNearOptimisticTxPrepareFuture.java | 768 -------------
.../GridNearPessimisticTxPrepareFuture.java | 347 ------
.../near/GridNearTransactionalCache.java | 4 +
.../near/GridNearTxFinishRequest.java | 28 +-
.../cache/distributed/near/GridNearTxLocal.java | 104 +-
.../near/GridNearTxPrepareFuture.java | 1050 ++++++++++++++++++
.../near/GridNearTxPrepareFutureAdapter.java | 226 ----
.../near/GridNearTxPrepareRequest.java | 52 +-
.../distributed/near/GridNearTxRemote.java | 24 +-
.../cache/local/GridLocalCacheEntry.java | 18 -
.../cache/transactions/IgniteInternalTx.java | 14 +-
.../transactions/IgniteTransactionsImpl.java | 4 +-
.../cache/transactions/IgniteTxAdapter.java | 74 +-
.../cache/transactions/IgniteTxEntry.java | 48 +-
.../cache/transactions/IgniteTxHandler.java | 74 +-
.../transactions/IgniteTxLocalAdapter.java | 167 ++-
.../cache/transactions/IgniteTxLocalEx.java | 21 +-
.../cache/transactions/IgniteTxManager.java | 74 +-
.../processors/resource/GridResourceField.java | 16 +-
.../processors/resource/GridResourceIoc.java | 389 ++++---
.../processors/resource/GridResourceMethod.java | 13 -
.../resource/GridResourceProcessor.java | 20 +-
.../ignite/internal/util/IgniteUtils.java | 22 +-
.../util/lang/GridComputeJobWrapper.java | 96 ++
.../internal/util/nio/GridBufferedParser.java | 4 +
.../internal/util/nio/GridDelimitedParser.java | 91 --
.../util/nio/GridNioDelimitedBuffer.java | 106 --
.../communication/tcp/TcpCommunicationSpi.java | 2 +-
.../spi/discovery/tcp/TcpDiscoverySpi.java | 48 +-
.../discovery/tcp/TcpDiscoverySpiAdapter.java | 8 +-
.../org/apache/ignite/stream/StreamAdapter.java | 111 --
.../ignite/stream/StreamTupleExtractor.java | 33 -
.../stream/socket/SocketMessageConverter.java | 31 -
.../ignite/stream/socket/SocketStreamer.java | 218 ----
.../ignite/stream/socket/package-info.java | 21 -
.../resources/META-INF/classnames.properties | 1 +
.../cache/CacheOffheapMapEntrySelfTest.java | 168 ---
.../cache/CacheRemoveAllSelfTest.java | 81 --
.../GridCacheAbstractFailoverSelfTest.java | 8 +-
.../GridCacheAbstractNodeRestartSelfTest.java | 11 +-
.../distributed/GridCacheLockAbstractTest.java | 2 +
.../distributed/IgniteTxGetAfterStopTest.java | 131 ---
...achePartitionedNearDisabledLockSelfTest.java | 47 -
...ePrimaryNodeFailureRecoveryAbstractTest.java | 4 +-
...idCacheAtomicReplicatedFailoverSelfTest.java | 6 -
.../GridCachePartitionedTxSalvageSelfTest.java | 25 +-
.../near/NoneRebalanceModeSelfTest.java | 67 --
.../GridCacheReplicatedFailoverSelfTest.java | 6 -
.../GridCacheReplicatedLockSelfTest.java | 5 -
.../GridCacheReplicatedNodeRestartSelfTest.java | 80 --
.../GridCacheLocalIsolatedNodesSelfTest.java | 18 +-
.../util/nio/GridNioDelimitedBufferTest.java | 112 --
.../discovery/tcp/TcpDiscoveryRestartTest.java | 199 ----
.../stream/socket/SocketStreamerSelfTest.java | 316 ------
.../ignite/stream/socket/package-info.java | 21 -
.../IgniteCacheFailoverTestSuite.java | 10 +-
.../testsuites/IgniteCacheRestartTestSuite.java | 8 +-
.../testsuites/IgniteCacheTestSuite2.java | 2 -
.../testsuites/IgniteCacheTestSuite3.java | 2 -
.../testsuites/IgniteCacheTestSuite4.java | 4 -
.../testsuites/IgniteStreamTestSuite.java | 39 -
.../testsuites/IgniteUtilSelfTestSuite.java | 1 -
.../cache/GridCacheOffheapIndexGetSelfTest.java | 111 --
.../IgniteCacheWithIndexingTestSuite.java | 2 -
.../processors/cache/jta/CacheJtaManager.java | 4 +-
.../scalar/tests/ScalarCacheQueriesSpec.scala | 154 +--
.../ignite/scalar/tests/ScalarCacheSpec.scala | 23 +-
.../scalar/tests/ScalarConversionsSpec.scala | 43 +-
.../scalar/tests/ScalarProjectionSpec.scala | 128 +--
.../scalar/tests/ScalarReturnableSpec.scala | 41 +-
modules/visor-console/pom.xml | 2 +-
.../ignite/visor/VisorRuntimeBaseSpec.scala | 2 +-
.../visor/commands/VisorArgListSpec.scala | 60 +-
.../commands/VisorFileNameCompleterSpec.scala | 34 +-
.../commands/ack/VisorAckCommandSpec.scala | 20 +-
.../commands/alert/VisorAlertCommandSpec.scala | 68 +-
.../cache/VisorCacheClearCommandSpec.scala | 48 +-
.../commands/cache/VisorCacheCommandSpec.scala | 66 +-
.../config/VisorConfigurationCommandSpec.scala | 8 +-
.../cswap/VisorCacheSwapCommandSpec.scala | 24 +-
.../deploy/VisorDeployCommandSpec.scala | 10 +-
.../disco/VisorDiscoveryCommandSpec.scala | 46 +-
.../events/VisorEventsCommandSpec.scala | 28 +-
.../visor/commands/gc/VisorGcCommandSpec.scala | 30 +-
.../commands/help/VisorHelpCommandSpec.scala | 57 +-
.../commands/kill/VisorKillCommandSpec.scala | 58 +-
.../commands/log/VisorLogCommandSpec.scala | 10 +-
.../commands/mem/VisorMemoryCommandSpec.scala | 77 +-
.../commands/node/VisorNodeCommandSpec.scala | 22 +-
.../commands/open/VisorOpenCommandSpec.scala | 16 +-
.../commands/ping/VisorPingCommandSpec.scala | 16 +-
.../commands/start/VisorStartCommandSpec.scala | 126 +--
.../commands/tasks/VisorTasksCommandSpec.scala | 112 +-
.../commands/top/VisorTopologyCommandSpec.scala | 52 +-
.../commands/vvm/VisorVvmCommandSpec.scala | 30 +-
parent/pom.xml | 2 -
pom.xml | 85 +-
161 files changed, 3836 insertions(+), 5910 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/assembly/release-base.xml
----------------------------------------------------------------------
diff --git a/assembly/release-base.xml b/assembly/release-base.xml
index 88f1d10..6d6465e 100644
--- a/assembly/release-base.xml
+++ b/assembly/release-base.xml
@@ -71,7 +71,7 @@
<excludes>
<exclude>**/*hadoop*.bat</exclude>
<exclude>igniterouter.bat</exclude>
- <exclude>**/build-classpath.bat</exclude>
+ <exclude>**/target-classpath.bat</exclude>
<exclude>ignitevisorcmd.bat</exclude>
<exclude>ignite-schema-import.bat</exclude>
</excludes>
@@ -87,7 +87,7 @@
<excludes>
<exclude>**/*hadoop*.sh</exclude>
<exclude>igniterouter.sh</exclude>
- <exclude>**/build-classpath.sh</exclude>
+ <exclude>**/target-classpath.sh</exclude>
<exclude>**/service.sh</exclude>
<exclude>ignitevisorcmd.sh</exclude>
<exclude>ignite-schema-import.sh</exclude>
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/bin/ignite-schema-import.bat
----------------------------------------------------------------------
diff --git a/bin/ignite-schema-import.bat b/bin/ignite-schema-import.bat
index a4ec86b..4731105 100644
--- a/bin/ignite-schema-import.bat
+++ b/bin/ignite-schema-import.bat
@@ -91,7 +91,7 @@ if /i "%SCRIPTS_HOME%\" == "%~dp0" goto run
:: Set IGNITE_LIBS
::
call "%SCRIPTS_HOME%\include\setenv.bat"
-call "%SCRIPTS_HOME%\include\build-classpath.bat" &:: Will be removed in the binary release.
+call "%SCRIPTS_HOME%\include\target-classpath.bat" &:: Will be removed in release.
set CP=%JAVA_HOME%\jre\lib\jfxrt.jar;%IGNITE_HOME%\bin\include\schema-import\*;%IGNITE_LIBS%
::
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/bin/ignite-schema-import.sh
----------------------------------------------------------------------
diff --git a/bin/ignite-schema-import.sh b/bin/ignite-schema-import.sh
index 1029882..0a70d54 100755
--- a/bin/ignite-schema-import.sh
+++ b/bin/ignite-schema-import.sh
@@ -57,7 +57,7 @@ setIgniteHome
# Set IGNITE_LIBS.
#
. "${SCRIPTS_HOME}"/include/setenv.sh
-. "${SCRIPTS_HOME}"/include/build-classpath.sh # Will be removed in the binary release.
+. "${SCRIPTS_HOME}"/include/target-classpath.sh # Will be removed in release.
CP="${JAVA_HOME}/jre/lib/jfxrt.jar${SEP}${IGNITE_HOME}/bin/include/schema-import/*${SEP}${IGNITE_LIBS}"
#
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/bin/ignite.bat
----------------------------------------------------------------------
diff --git a/bin/ignite.bat b/bin/ignite.bat
index 1a4a58c..687db60 100644
--- a/bin/ignite.bat
+++ b/bin/ignite.bat
@@ -102,7 +102,7 @@ if "%OS%" == "Windows_NT" set PROG_NAME=%~nx0%
:: Set IGNITE_LIBS
::
call "%SCRIPTS_HOME%\include\setenv.bat"
-call "%SCRIPTS_HOME%\include\build-classpath.bat" &:: Will be removed in the binary release.
+call "%SCRIPTS_HOME%\include\target-classpath.bat" &:: Will be removed in release.
set CP=%IGNITE_LIBS%
::
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/bin/ignite.sh
----------------------------------------------------------------------
diff --git a/bin/ignite.sh b/bin/ignite.sh
index 660a80f..a246613 100755
--- a/bin/ignite.sh
+++ b/bin/ignite.sh
@@ -58,7 +58,7 @@ fi
# Set IGNITE_LIBS.
#
. "${SCRIPTS_HOME}"/include/setenv.sh
-. "${SCRIPTS_HOME}"/include/build-classpath.sh # Will be removed in the binary release.
+. "${SCRIPTS_HOME}"/include/target-classpath.sh # Will be removed in release.
CP="${IGNITE_LIBS}"
RANDOM_NUMBER=$("$JAVA" -cp "${CP}" org.apache.ignite.startup.cmdline.CommandLineRandomNumberGenerator)
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/bin/ignitevisorcmd.bat
----------------------------------------------------------------------
diff --git a/bin/ignitevisorcmd.bat b/bin/ignitevisorcmd.bat
index 4a1aafd..1cf2b26 100644
--- a/bin/ignitevisorcmd.bat
+++ b/bin/ignitevisorcmd.bat
@@ -100,7 +100,7 @@ if "%OS%" == "Windows_NT" set PROG_NAME=%~nx0%
:: Set IGNITE_LIBS
::
call "%SCRIPTS_HOME%\include\setenv.bat"
-call "%SCRIPTS_HOME%\include\build-classpath.bat" &:: Will be removed in the binary release.
+call "%SCRIPTS_HOME%\include\target-classpath.bat" &:: Will be removed in release.
set CP=%IGNITE_HOME%\bin\include\visor-common\*;%IGNITE_HOME%\bin\include\visorcmd\*;%IGNITE_LIBS%
::
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/bin/ignitevisorcmd.sh
----------------------------------------------------------------------
diff --git a/bin/ignitevisorcmd.sh b/bin/ignitevisorcmd.sh
index fe74f6a..6118560 100755
--- a/bin/ignitevisorcmd.sh
+++ b/bin/ignitevisorcmd.sh
@@ -53,7 +53,7 @@ setIgniteHome
# Set IGNITE_LIBS.
#
. "${SCRIPTS_HOME}"/include/setenv.sh
-. "${SCRIPTS_HOME}"/include/build-classpath.sh # Will be removed in the binary release.
+. "${SCRIPTS_HOME}"/include/target-classpath.sh # Will be removed in release.
CP="${IGNITE_HOME}/bin/include/visor-common/*${SEP}${IGNITE_HOME}/bin/include/visorcmd/*${SEP}${IGNITE_LIBS}"
#
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/bin/include/build-classpath.bat
----------------------------------------------------------------------
diff --git a/bin/include/build-classpath.bat b/bin/include/build-classpath.bat
deleted file mode 100644
index 5f932d3..0000000
--- a/bin/include/build-classpath.bat
+++ /dev/null
@@ -1,46 +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.
-::
-
-:: Target class path resolver.
-::
-:: Can be used like:
-:: call "%IGNITE_HOME%\bin\include\build-classpath.bat"
-:: in other scripts to set classpath using libs from target folder.
-::
-:: Will be excluded in release.
-
-@echo off
-
-for /D %%F in (modules\*) do if not %%F == "modules" call :includeToClassPath %%F
-
-for /D %%F in (%IGNITE_HOME%\modules\*) do if not %%F == "%IGNITE_HOME%\modules" call :includeToClassPath %%F
-
-goto :eof
-
-:includeToClassPath
-if exist "%1\target\" (
- if exist "%1\target\classes\" call :concat %1\target\classes
-
- if exist "%1\target\test-classes\" call :concat %1\target\test-classes
-
- if exist "%1\target\libs\" call :concat %1\target\libs\*
-)
-goto :eof
-
-:concat
-set IGNITE_LIBS=%IGNITE_LIBS%;%1
-goto :eof
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/bin/include/build-classpath.sh
----------------------------------------------------------------------
diff --git a/bin/include/build-classpath.sh b/bin/include/build-classpath.sh
deleted file mode 100644
index 9f0c878..0000000
--- a/bin/include/build-classpath.sh
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/bin/sh
-#
-# 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.
-#
-
-# Target class path resolver.
-#
-# Can be used like:
-# . "${IGNITE_HOME}"/bin/include/build-classpath.sh
-# in other scripts to set classpath using libs from target folder.
-#
-# Will be excluded in release.
-
-
-#
-# OS specific support.
-#
-SEP=":";
-
-case "`uname`" in
- MINGW*)
- SEP=";";
- export IGNITE_HOME=`echo $IGNITE_HOME | sed -e 's/^\/\([a-zA-Z]\)/\1:/'`
- ;;
- CYGWIN*)
- SEP=";";
- export IGNITE_HOME=`echo $IGNITE_HOME | sed -e 's/^\/\([a-zA-Z]\)/\1:/'`
- ;;
-esac
-
-includeToClassPath() {
- for file in $1/*
- do
- if [ -d ${file} ] && [ -d "${file}/target" ]; then
- if [ -d "${file}/target/classes" ]; then
- IGNITE_LIBS=${IGNITE_LIBS}${SEP}${file}/target/classes
- fi
-
- if [ -d "${file}/target/test-classes" ]; then
- IGNITE_LIBS=${IGNITE_LIBS}${SEP}${file}/target/test-classes
- fi
-
- if [ -d "${file}/target/libs" ]; then
- IGNITE_LIBS=${IGNITE_LIBS}${SEP}${file}/target/libs/*
- fi
- fi
- done
-}
-
-#
-# Include target libraries for enterprise modules to classpath.
-#
-includeToClassPath modules
-
-#
-# Include target libraries for opensourse modules to classpath.
-#
-includeToClassPath ${IGNITE_HOME}/modules
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/bin/include/functions.sh
----------------------------------------------------------------------
diff --git a/bin/include/functions.sh b/bin/include/functions.sh
index b18b150..f0430c1 100755
--- a/bin/include/functions.sh
+++ b/bin/include/functions.sh
@@ -34,7 +34,7 @@
checkJava() {
# Check JAVA_HOME.
if [ "$JAVA_HOME" = "" ]; then
- JAVA=`type -p java`
+ JAVA=`which java`
RETCODE=$?
if [ $RETCODE -ne 0 ]; then
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/bin/include/target-classpath.bat
----------------------------------------------------------------------
diff --git a/bin/include/target-classpath.bat b/bin/include/target-classpath.bat
new file mode 100644
index 0000000..4416557
--- /dev/null
+++ b/bin/include/target-classpath.bat
@@ -0,0 +1,46 @@
+::
+:: 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.
+::
+
+:: Target class path resolver.
+::
+:: Can be used like:
+:: call "%IGNITE_HOME%\bin\include\target-classpath.bat"
+:: in other scripts to set classpath using libs from target folder.
+::
+:: Will be excluded in release.
+
+@echo off
+
+for /D %%F in (modules\*) do if not %%F == "modules" call :includeToClassPath %%F
+
+for /D %%F in (%IGNITE_HOME%\modules\*) do if not %%F == "%IGNITE_HOME%\modules" call :includeToClassPath %%F
+
+goto :eof
+
+:includeToClassPath
+if exist "%1\target\" (
+ if exist "%1\target\classes\" call :concat %1\target\classes
+
+ if exist "%1\target\test-classes\" call :concat %1\target\test-classes
+
+ if exist "%1\target\libs\" call :concat %1\target\libs\*
+)
+goto :eof
+
+:concat
+set IGNITE_LIBS=%IGNITE_LIBS%;%1
+goto :eof
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/bin/include/target-classpath.sh
----------------------------------------------------------------------
diff --git a/bin/include/target-classpath.sh b/bin/include/target-classpath.sh
new file mode 100644
index 0000000..871d517
--- /dev/null
+++ b/bin/include/target-classpath.sh
@@ -0,0 +1,71 @@
+#!/bin/sh
+#
+# 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.
+#
+
+# Target class path resolver.
+#
+# Can be used like:
+# . "${IGNITE_HOME}"/bin/include/target-classpath.sh
+# in other scripts to set classpath using libs from target folder.
+#
+# Will be excluded in release.
+
+
+#
+# OS specific support.
+#
+SEP=":";
+
+case "`uname`" in
+ MINGW*)
+ SEP=";";
+ export IGNITE_HOME=`echo $IGNITE_HOME | sed -e 's/^\/\([a-zA-Z]\)/\1:/'`
+ ;;
+ CYGWIN*)
+ SEP=";";
+ export IGNITE_HOME=`echo $IGNITE_HOME | sed -e 's/^\/\([a-zA-Z]\)/\1:/'`
+ ;;
+esac
+
+includeToClassPath() {
+ for file in $1/*
+ do
+ if [ -d ${file} ] && [ -d "${file}/target" ]; then
+ if [ -d "${file}/target/classes" ]; then
+ IGNITE_LIBS=${IGNITE_LIBS}${SEP}${file}/target/classes
+ fi
+
+ if [ -d "${file}/target/test-classes" ]; then
+ IGNITE_LIBS=${IGNITE_LIBS}${SEP}${file}/target/test-classes
+ fi
+
+ if [ -d "${file}/target/libs" ]; then
+ IGNITE_LIBS=${IGNITE_LIBS}${SEP}${file}/target/libs/*
+ fi
+ fi
+ done
+}
+
+#
+# Include target libraries for enterprise modules to classpath.
+#
+includeToClassPath modules
+
+#
+# Include target libraries for opensourse modules to classpath.
+#
+includeToClassPath ${IGNITE_HOME}/modules
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/examples/src/main/java/org/apache/ignite/examples/streaming/StreamTransformerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/StreamTransformerExample.java b/examples/src/main/java/org/apache/ignite/examples/streaming/StreamTransformerExample.java
index 966fce2..5e95892 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/StreamTransformerExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/StreamTransformerExample.java
@@ -30,9 +30,11 @@ import java.util.*;
* Stream random numbers into the streaming cache.
* To start the example, you should:
* <ul>
- * <li>Start a few nodes using {@link ExampleNodeStartup}.</li>
+ * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
* <li>Start streaming using {@link StreamTransformerExample}.</li>
* </ul>
+ * <p>
+ * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
*/
public class StreamTransformerExample {
/** Random number generator. */
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/examples/src/main/java/org/apache/ignite/examples/streaming/StreamVisitorExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/StreamVisitorExample.java b/examples/src/main/java/org/apache/ignite/examples/streaming/StreamVisitorExample.java
index baae5af..0fbce68 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/StreamVisitorExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/StreamVisitorExample.java
@@ -31,9 +31,11 @@ import java.util.*;
* Stream random numbers into the streaming cache.
* To start the example, you should:
* <ul>
- * <li>Start a few nodes using {@link ExampleNodeStartup}.</li>
+ * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
* <li>Start streaming using {@link StreamVisitorExample}.</li>
* </ul>
+ * <p>
+ * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
*/
public class StreamVisitorExample {
/** Random number generator. */
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/examples/src/main/java/org/apache/ignite/examples/streaming/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/package-info.java b/examples/src/main/java/org/apache/ignite/examples/streaming/package-info.java
index 43fbab3..43dea13 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/package-info.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/package-info.java
@@ -16,6 +16,7 @@
*/
/**
+ * <!-- Package description. -->
* Demonstrates usage of data streamer.
*/
package org.apache.ignite.examples.streaming;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/CacheConfig.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/CacheConfig.java b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/CacheConfig.java
index d17b97d..58704ca 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/CacheConfig.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/CacheConfig.java
@@ -26,7 +26,7 @@ import javax.cache.expiry.*;
import static java.util.concurrent.TimeUnit.*;
/**
- * Configuration for the streaming cache to store the stream of words.
+ * Configuration for the streaming cache to store the stream of random numbers.
* This cache is configured with sliding window of 1 second, which means that
* data older than 1 second will be automatically removed from the cache.
*/
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/QueryWords.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/QueryWords.java b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/QueryWords.java
index 58c6ef2..3bd9d3d 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/QueryWords.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/QueryWords.java
@@ -28,18 +28,14 @@ import java.util.*;
* Periodically query popular numbers from the streaming cache.
* To start the example, you should:
* <ul>
- * <li>Start a few nodes using {@link ExampleNodeStartup}.</li>
+ * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
* <li>Start streaming using {@link StreamWords}.</li>
- * <li>Start querying popular words using {@link QueryWords}.</li>
+ * <li>Start querying popular numbers using {@link QueryWords}.</li>
* </ul>
+ * <p>
+ * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
*/
public class QueryWords {
- /**
- * Schedules words query execution.
- *
- * @param args Command line arguments (none required).
- * @throws Exception If failed.
- */
public static void main(String[] args) throws Exception {
// Mark this cluster member as client.
Ignition.setClientMode(true);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/StreamWords.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/StreamWords.java b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/StreamWords.java
index 6024c4b..c59fa51 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/StreamWords.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/StreamWords.java
@@ -27,18 +27,14 @@ import java.io.*;
* Stream words into Ignite cache.
* To start the example, you should:
* <ul>
- * <li>Start a few nodes using {@link ExampleNodeStartup}.</li>
+ * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
* <li>Start streaming using {@link StreamWords}.</li>
- * <li>Start querying popular words using {@link QueryWords}.</li>
+ * <li>Start querying popular numbers using {@link QueryWords}.</li>
* </ul>
+ * <p>
+ * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
*/
public class StreamWords {
- /**
- * Starts words streaming.
- *
- * @param args Command line arguments (none required).
- * @throws Exception If failed.
- */
public static void main(String[] args) throws Exception {
// Mark this cluster member as client.
Ignition.setClientMode(true);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/package-info.java b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/package-info.java
index 5d48ae3..010f86a 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/package-info.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/package-info.java
@@ -16,6 +16,7 @@
*/
/**
+ * <!-- Package description. -->
* Streaming word count example.
*/
package org.apache.ignite.examples.streaming.wordcount;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerClient.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerClient.java b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerClient.java
deleted file mode 100644
index c4d7b8c..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerClient.java
+++ /dev/null
@@ -1,82 +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.streaming.wordcount.socket;
-
-import org.apache.ignite.examples.*;
-import org.apache.ignite.examples.streaming.wordcount.*;
-import org.apache.ignite.stream.socket.*;
-
-import java.io.*;
-import java.net.*;
-
-/**
- * Example demonstrates streaming of data from external components into Ignite cache.
- * <p>
- * {@code WordsSocketStreamerClient} is simple socket streaming client implementation that sends words to socket server
- * based on {@link SocketStreamer} using message delimiter based protocol. Example illustrates usage of TCP socket
- * streamer in case of non-Java clients. In this example words are zero-terminated strings.
- * <p>
- * To start the example, you should:
- * <ul>
- * <li>Start a few nodes using {@link ExampleNodeStartup}.</li>
- * <li>Start socket server using {@link WordsSocketStreamerServer}.</li>
- * <li>Start a few socket clients using {@link WordsSocketStreamerClient}.</li>
- * <li>Start querying popular words using {@link QueryWords}.</li>
- * </ul>
- */
-public class WordsSocketStreamerClient {
- /** Port. */
- private static final int PORT = 5555;
-
- /** Delimiter. */
- private static final byte[] DELIM = new byte[] {0};
-
- /**
- * @param args Args.
- */
- public static void main(String[] args) throws IOException {
- InetAddress addr = InetAddress.getLocalHost();
-
- try (
- Socket sock = new Socket(addr, PORT);
- OutputStream oos = new BufferedOutputStream(sock.getOutputStream())
- ) {
- System.out.println("Words streaming started.");
-
- while (true) {
- try (InputStream in = WordsSocketStreamerClient.class.getResourceAsStream("../alice-in-wonderland.txt");
- LineNumberReader rdr = new LineNumberReader(new InputStreamReader(in))) {
- for (String line = rdr.readLine(); line != null; line = rdr.readLine()) {
- for (String word : line.split(" ")) {
- if (!word.isEmpty()) {
- // Stream words into Ignite through socket.
- byte[] arr = word.getBytes("ASCII");
-
- // Write message
- oos.write(arr);
-
- // Write message delimiter
- oos.write(DELIM);
- }
- }
- }
- }
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerServer.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerServer.java b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerServer.java
deleted file mode 100644
index 9e68096..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerServer.java
+++ /dev/null
@@ -1,124 +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.streaming.wordcount.socket;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.affinity.*;
-import org.apache.ignite.examples.*;
-import org.apache.ignite.examples.streaming.wordcount.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.stream.*;
-import org.apache.ignite.stream.socket.*;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-/**
- * Example demonstrates streaming of data from external components into Ignite cache.
- * <p>
- * {@code WordsSocketStreamerServer} is simple socket streaming server implementation that
- * receives words from socket using {@link SocketStreamer} and message delimiter based protocol
- * and streams them into Ignite cache. Example illustrates usage of TCP socket streamer in case of non-Java clients.
- * In this example words are zero-terminated strings.
- * <p>
- * To start the example, you should:
- * <ul>
- * <li>Start a few nodes using {@link ExampleNodeStartup}.</li>
- * <li>Start socket server using {@link WordsSocketStreamerServer}.</li>
- * <li>Start a few socket clients using {@link WordsSocketStreamerClient}.</li>
- * <li>Start querying popular words using {@link QueryWords}.</li>
- * </ul>
- */
-public class WordsSocketStreamerServer {
- /** Port. */
- private static final int PORT = 5555;
-
- /** Delimiter. */
- private static final byte[] DELIM = new byte[] {0};
-
- /**
- * Starts socket streaming server.
- *
- * @param args Command line arguments (none required).
- * @throws Exception If failed.
- */
- public static void main(String[] args) throws Exception {
- // Mark this cluster member as client.
- Ignition.setClientMode(true);
-
- Ignite ignite = Ignition.start("examples/config/example-ignite.xml");
-
- if (!ExamplesUtils.hasServerNodes(ignite)) {
- ignite.close();
-
- return;
- }
-
- // The cache is configured with sliding window holding 1 second of the streaming data.
- IgniteCache<AffinityUuid, String> stmCache = ignite.getOrCreateCache(CacheConfig.wordCache());
-
- IgniteDataStreamer<AffinityUuid, String> stmr = ignite.dataStreamer(stmCache.getName());
-
- InetAddress addr = InetAddress.getLocalHost();
-
- // Configure socket streamer
- SocketStreamer<String, AffinityUuid, String> sockStmr = new SocketStreamer<>();
-
- sockStmr.setAddr(addr);
-
- sockStmr.setPort(PORT);
-
- sockStmr.setDelimiter(DELIM);
-
- sockStmr.setIgnite(ignite);
-
- sockStmr.setStreamer(stmr);
-
- // Converter from zero-terminated string to Java strings.
- sockStmr.setConverter(new SocketMessageConverter<String>() {
- @Override public String convert(byte[] msg) {
- try {
- return new String(msg, "ASCII");
- }
- catch (UnsupportedEncodingException e) {
- throw new IgniteException(e);
- }
- }
- });
-
- sockStmr.setTupleExtractor(new StreamTupleExtractor<String, AffinityUuid, String>() {
- @Override public Map.Entry<AffinityUuid, String> extract(String word) {
- // By using AffinityUuid we ensure that identical
- // words are processed on the same cluster node.
- return new IgniteBiTuple<>(new AffinityUuid(word), word);
- }
- });
-
- try {
- sockStmr.start();
- }
- catch (IgniteException e) {
- System.err.println("Streaming server didn't start due to an error: ");
-
- e.printStackTrace();
-
- ignite.close();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/package-info.java b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/package-info.java
deleted file mode 100644
index 048299f..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/package-info.java
+++ /dev/null
@@ -1,21 +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.
- */
-
-/**
- * Contains {@link org.apache.ignite.stream.socket.SocketStreamer} usage examples.
- */
-package org.apache.ignite.examples.streaming.wordcount.socket;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
index d54e06f..8d88677 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
@@ -532,6 +532,22 @@ public class IgnitionEx {
}
/**
+ * Start Grid passing a closure which will modify configuration before it is passed to start routine.
+ *
+ * @param springCfgPath Spring config path.
+ * @param gridName Grid name.
+ * @param cfgClo Configuration closure.
+ * @return Started Grid.
+ * @throws IgniteCheckedException If failed.
+ */
+ public static Ignite startWithClosure(@Nullable String springCfgPath, @Nullable String gridName,
+ IgniteClosure<IgniteConfiguration, IgniteConfiguration> cfgClo) throws IgniteCheckedException {
+ URL url = U.resolveSpringUrl(springCfgPath);
+
+ return start(url, gridName, null, cfgClo);
+ }
+
+ /**
* Loads all grid configurations specified within given Spring XML configuration file.
* <p>
* Usually Spring XML configuration file will contain only one Grid definition. Note that
@@ -718,40 +734,7 @@ public class IgnitionEx {
*/
public static Ignite start(URL springCfgUrl, @Nullable String gridName,
@Nullable GridSpringResourceContext springCtx) throws IgniteCheckedException {
- A.notNull(springCfgUrl, "springCfgUrl");
-
- boolean isLog4jUsed = U.gridClassLoader().getResource("org/apache/log4j/Appender.class") != null;
-
- IgniteBiTuple<Object, Object> t = null;
-
- if (isLog4jUsed) {
- try {
- t = U.addLog4jNoOpLogger();
- }
- catch (IgniteCheckedException ignore) {
- isLog4jUsed = false;
- }
- }
-
- Collection<Handler> savedHnds = null;
-
- if (!isLog4jUsed)
- savedHnds = U.addJavaNoOpLogger();
-
- IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> cfgMap;
-
- try {
- cfgMap = loadConfigurations(springCfgUrl);
- }
- finally {
- if (isLog4jUsed && t != null)
- U.removeLog4jNoOpLogger(t);
-
- if (!isLog4jUsed)
- U.removeJavaNoOpLogger(savedHnds);
- }
-
- return startConfigurations(cfgMap, springCfgUrl, gridName, springCtx);
+ return start(springCfgUrl, gridName, springCtx, null);
}
/**
@@ -797,6 +780,73 @@ public class IgnitionEx {
*/
public static Ignite start(InputStream springCfgStream, @Nullable String gridName,
@Nullable GridSpringResourceContext springCtx) throws IgniteCheckedException {
+ return start(springCfgStream, gridName, springCtx, null);
+ }
+
+ /**
+ * Internal Spring-based start routine.
+ *
+ * @param springCfgUrl Spring XML configuration file URL. This cannot be {@code null}.
+ * @param gridName Grid name that will override default.
+ * @param springCtx Optional Spring application context.
+ * @param cfgClo Optional closure to change configuration before it is used to start the grid.
+ * @return Started grid.
+ * @throws IgniteCheckedException If failed.
+ */
+ private static Ignite start(final URL springCfgUrl, @Nullable String gridName,
+ @Nullable GridSpringResourceContext springCtx,
+ @Nullable IgniteClosure<IgniteConfiguration, IgniteConfiguration> cfgClo)
+ throws IgniteCheckedException {
+ A.notNull(springCfgUrl, "springCfgUrl");
+
+ boolean isLog4jUsed = U.gridClassLoader().getResource("org/apache/log4j/Appender.class") != null;
+
+ IgniteBiTuple<Object, Object> t = null;
+
+ if (isLog4jUsed) {
+ try {
+ t = U.addLog4jNoOpLogger();
+ }
+ catch (IgniteCheckedException ignore) {
+ isLog4jUsed = false;
+ }
+ }
+
+ Collection<Handler> savedHnds = null;
+
+ if (!isLog4jUsed)
+ savedHnds = U.addJavaNoOpLogger();
+
+ IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> cfgMap;
+
+ try {
+ cfgMap = loadConfigurations(springCfgUrl);
+ }
+ finally {
+ if (isLog4jUsed && t != null)
+ U.removeLog4jNoOpLogger(t);
+
+ if (!isLog4jUsed)
+ U.removeJavaNoOpLogger(savedHnds);
+ }
+
+ return startConfigurations(cfgMap, springCfgUrl, gridName, springCtx, cfgClo);
+ }
+
+ /**
+ * Internal Spring-based start routine.
+ *
+ * @param springCfgStream Input stream containing Spring XML configuration. This cannot be {@code null}.
+ * @param gridName Grid name that will override default.
+ * @param springCtx Optional Spring application context.
+ * @param cfgClo Optional closure to change configuration before it is used to start the grid.
+ * @return Started grid.
+ * @throws IgniteCheckedException If failed.
+ */
+ private static Ignite start(final InputStream springCfgStream, @Nullable String gridName,
+ @Nullable GridSpringResourceContext springCtx,
+ @Nullable IgniteClosure<IgniteConfiguration, IgniteConfiguration> cfgClo)
+ throws IgniteCheckedException {
A.notNull(springCfgStream, "springCfgUrl");
boolean isLog4jUsed = U.gridClassLoader().getResource("org/apache/log4j/Appender.class") != null;
@@ -830,7 +880,7 @@ public class IgnitionEx {
U.removeJavaNoOpLogger(savedHnds);
}
- return startConfigurations(cfgMap, null, gridName, springCtx);
+ return startConfigurations(cfgMap, null, gridName, springCtx, cfgClo);
}
/**
@@ -840,6 +890,7 @@ public class IgnitionEx {
* @param springCfgUrl Spring XML configuration file URL.
* @param gridName Grid name that will override default.
* @param springCtx Optional Spring application context.
+ * @param cfgClo Optional closure to change configuration before it is used to start the grid.
* @return Started grid.
* @throws IgniteCheckedException If failed.
*/
@@ -847,7 +898,8 @@ public class IgnitionEx {
IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> cfgMap,
URL springCfgUrl,
@Nullable String gridName,
- @Nullable GridSpringResourceContext springCtx)
+ @Nullable GridSpringResourceContext springCtx,
+ @Nullable IgniteClosure<IgniteConfiguration, IgniteConfiguration> cfgClo)
throws IgniteCheckedException {
List<IgniteNamedInstance> grids = new ArrayList<>(cfgMap.size());
@@ -858,6 +910,12 @@ public class IgnitionEx {
if (cfg.getGridName() == null && !F.isEmpty(gridName))
cfg.setGridName(gridName);
+ if (cfgClo != null) {
+ cfg = cfgClo.apply(cfg);
+
+ assert cfg != null;
+ }
+
// Use either user defined context or our one.
IgniteNamedInstance grid = start0(
new GridStartContext(cfg, springCfgUrl, springCtx == null ? cfgMap.get2() : springCtx));
@@ -1542,9 +1600,9 @@ public class IgnitionEx {
igfsExecSvc, restExecSvc,
new CA() {
@Override public void apply() {
- startLatch.countDown();
- }
- });
+ startLatch.countDown();
+ }
+ });
state = STARTED;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectByteBufferStream.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectByteBufferStream.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectByteBufferStream.java
index 4ca318e..64c895b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectByteBufferStream.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectByteBufferStream.java
@@ -66,10 +66,10 @@ public class DirectByteBufferStream {
private static final short[] SHORT_ARR_EMPTY = new short[0];
/** */
- private static final int[] INT_ARR_EMPTY = U.EMPTY_INTS;
+ private static final int[] INT_ARR_EMPTY = new int[0];
/** */
- private static final long[] LONG_ARR_EMPTY = U.EMPTY_LONGS;
+ private static final long[] LONG_ARR_EMPTY = new long[0];
/** */
private static final float[] FLOAT_ARR_EMPTY = new float[0];
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropBootstrap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropBootstrap.java b/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropBootstrap.java
deleted file mode 100644
index 820bef9..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropBootstrap.java
+++ /dev/null
@@ -1,34 +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.internal.interop;
-
-import org.apache.ignite.configuration.*;
-
-/**
- * Interop bootstrap. Responsible for starting Ignite node in interop mode.
- */
-public interface InteropBootstrap {
- /**
- * Start Ignite node.
- *
- * @param cfg Configuration.
- * @param envPtr Environment pointer.
- * @return Ignite node.
- */
- public InteropProcessor start(IgniteConfiguration cfg, long envPtr);
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropBootstrapFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropBootstrapFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropBootstrapFactory.java
deleted file mode 100644
index b61ca89..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropBootstrapFactory.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.internal.interop;
-
-import java.io.*;
-
-/**
- * Interop bootstrap factory.
- */
-public interface InteropBootstrapFactory extends Serializable {
- /**
- * Get bootstrap factory ID.
- *
- * @return ID.
- */
- public int id();
-
- /**
- * Create bootstrap instance.
- *
- * @return Bootstrap instance.
- */
- public InteropBootstrap create();
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropIgnition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropIgnition.java b/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropIgnition.java
deleted file mode 100644
index f245122..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropIgnition.java
+++ /dev/null
@@ -1,103 +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.internal.interop;
-
-import org.apache.ignite.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.processors.resource.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.lang.*;
-import org.jetbrains.annotations.*;
-
-import java.net.*;
-import java.security.*;
-import java.util.*;
-
-/**
- * Entry point for interop nodes.
- */
-@SuppressWarnings("UnusedDeclaration")
-public class InteropIgnition {
- /**
- * Start Ignite node in interop mode.
- *
- * @param springCfgPath Spring configuration path.
- * @param gridName Grid name.
- * @param factoryId Factory ID.
- * @param envPtr Environment pointer.
- * @return Ignite instance.
- */
- public static InteropProcessor start(@Nullable String springCfgPath, @Nullable String gridName, int factoryId,
- long envPtr) {
- IgniteConfiguration cfg = configuration(springCfgPath);
-
- if (gridName != null)
- cfg.setGridName(gridName);
-
- InteropBootstrap bootstrap = bootstrap(factoryId);
-
- return bootstrap.start(cfg, envPtr);
- }
-
- private static IgniteConfiguration configuration(@Nullable String springCfgPath) {
- try {
- URL url = springCfgPath == null ? U.resolveIgniteUrl(IgnitionEx.DFLT_CFG) :
- U.resolveSpringUrl(springCfgPath);
-
- IgniteBiTuple<IgniteConfiguration, GridSpringResourceContext> t = IgnitionEx.loadConfiguration(url);
-
- return t.get1();
- }
- catch (IgniteCheckedException e) {
- throw new IgniteException("Failed to instantiate configuration from Spring XML: " + springCfgPath, e);
- }
- }
-
- /**
- * Create bootstrap for the given factory ID.
- *
- * @param factoryId Factory ID.
- * @return Bootstrap.
- */
- private static InteropBootstrap bootstrap(final int factoryId) {
- InteropBootstrapFactory factory = AccessController.doPrivileged(
- new PrivilegedAction<InteropBootstrapFactory>() {
- @Override public InteropBootstrapFactory run() {
- for (InteropBootstrapFactory factory : ServiceLoader.load(InteropBootstrapFactory.class)) {
- if (factory.id() == factoryId)
- return factory;
- }
-
- return null;
- }
- });
-
- if (factory == null)
- throw new IgniteException("Interop factory is not found (did you put into the classpath?): " + factoryId);
-
- return factory.create();
- }
-
- /**
- * Private constructor.
- */
- private InteropIgnition() {
- // No-op.
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropProcessor.java
deleted file mode 100644
index 6c55296..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropProcessor.java
+++ /dev/null
@@ -1,25 +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.internal.interop;
-
-/**
- * Interop processor.
- */
-public interface InteropProcessor {
- // No-op.
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java
index 010aab4..4b969d7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java
@@ -51,6 +51,9 @@ import static org.apache.ignite.internal.managers.communication.GridIoPolicy.*;
* Grid event storage SPI manager.
*/
public class GridEventStorageManager extends GridManagerAdapter<EventStorageSpi> {
+ /** */
+ private static final int[] EMPTY = new int[0];
+
/** Local event listeners. */
private final ConcurrentMap<Integer, Set<GridLocalEventListener>> lsnrs = new ConcurrentHashMap8<>();
@@ -104,7 +107,7 @@ public class GridEventStorageManager extends GridManagerAdapter<EventStorageSpi>
int[] cfgInclEvtTypes0 = ctx.config().getIncludeEventTypes();
if (F.isEmpty(cfgInclEvtTypes0))
- cfgInclEvtTypes = U.EMPTY_INTS;
+ cfgInclEvtTypes = EMPTY;
else {
cfgInclEvtTypes0 = copy(cfgInclEvtTypes0);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index b972da8..dc13d17 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -1133,8 +1133,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
ctx.kernalContext().task().setThreadContext(TC_SUBGRID, nodes);
- ctx.kernalContext().task().execute(
- new ClearTask(ctx.name(), ctx.affinity().affinityTopologyVersion(), keys), null).get();
+ ctx.kernalContext().task().execute(new ClearTask(ctx, keys), null).get();
}
}
@@ -1153,8 +1152,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
if (!nodes.isEmpty()) {
ctx.kernalContext().task().setThreadContext(TC_SUBGRID, nodes);
- return ctx.kernalContext().task().execute(
- new ClearTask(ctx.name(), ctx.affinity().affinityTopologyVersion(), keys), null);
+ return ctx.kernalContext().task().execute(new ClearTask(ctx, keys), null);
}
else
return new GridFinishedFuture<>();
@@ -3573,8 +3571,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
ctx.kernalContext().task().setThreadContext(TC_SUBGRID, nodes);
- return ctx.kernalContext().task().execute(
- new SizeTask(ctx.name(), ctx.affinity().affinityTopologyVersion(), peekModes), null);
+ return ctx.kernalContext().task().execute(new SizeTask(ctx, peekModes), null);
}
/** {@inheritDoc} */
@@ -3906,7 +3903,9 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
READ_COMMITTED,
tCfg.getDefaultTxTimeout(),
!ctx.skipStore(),
- 0
+ 0,
+ /** group lock keys */null,
+ /** partition lock */false
);
assert tx != null;
@@ -3975,7 +3974,9 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
READ_COMMITTED,
ctx.kernalContext().config().getTransactionConfiguration().getDefaultTxTimeout(),
!ctx.skipStore(),
- 0);
+ 0,
+ null,
+ false);
return asyncOp(tx, op);
}
@@ -4826,6 +4827,13 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
private static final long serialVersionUID = 0L;
/**
+ * Empty constructor for serialization.
+ */
+ public GlobalClearAllJob() {
+ // No-op.
+ }
+
+ /**
* @param cacheName Cache name.
* @param topVer Affinity topology version.
*/
@@ -4851,7 +4859,14 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
private static final long serialVersionUID = 0L;
/** Keys to remove. */
- private final Set<? extends K> keys;
+ private Set<? extends K> keys;
+
+ /**
+ * Empty constructor for serialization.
+ */
+ public GlobalClearKeySetJob() {
+ // No-op.
+ }
/**
* @param cacheName Cache name.
@@ -4882,7 +4897,14 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
private static final long serialVersionUID = 0L;
/** Peek modes. */
- private final CachePeekMode[] peekModes;
+ private CachePeekMode[] peekModes;
+
+ /**
+ * Required by {@link Externalizable}.
+ */
+ public SizeJob() {
+ // No-op.
+ }
/**
* @param cacheName Cache name.
@@ -5493,10 +5515,17 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
protected Ignite ignite;
/** Affinity topology version. */
- protected final AffinityTopologyVersion topVer;
+ protected AffinityTopologyVersion topVer;
/** Cache name. */
- protected final String cacheName;
+ protected String cacheName;
+
+ /**
+ * Empty constructor for serialization.
+ */
+ public TopologyVersionAwareJob() {
+ // No-op.
+ }
/**
* @param cacheName Cache name.
@@ -5555,23 +5584,24 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/** */
private static final long serialVersionUID = 0L;
- /** Cache name. */
- private final String cacheName;
-
- /** Affinity topology version. */
- private final AffinityTopologyVersion topVer;
+ /** Cache context. */
+ private GridCacheContext ctx;
/** Peek modes. */
- private final CachePeekMode[] peekModes;
+ private CachePeekMode[] peekModes;
/**
- * @param cacheName Cache name.
- * @param topVer Affinity topology version.
- * @param peekModes Cache peek modes.
+ * Empty constructor for serialization.
*/
- public SizeTask(String cacheName, AffinityTopologyVersion topVer, CachePeekMode[] peekModes) {
- this.cacheName = cacheName;
- this.topVer = topVer;
+ public SizeTask() {
+ // No-op.
+ }
+
+ /**
+ * @param ctx Cache context.
+ */
+ public SizeTask(GridCacheContext ctx, CachePeekMode[] peekModes) {
+ this.ctx = ctx;
this.peekModes = peekModes;
}
@@ -5581,22 +5611,13 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
Map<ComputeJob, ClusterNode> jobs = new HashMap();
for (ClusterNode node : subgrid)
- jobs.put(new SizeJob(cacheName, topVer, peekModes), node);
+ jobs.put(new SizeJob(ctx.name(), ctx.affinity().affinityTopologyVersion(), peekModes), node);
return jobs;
}
/** {@inheritDoc} */
@Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd) {
- IgniteException e = res.getException();
-
- if (e != null) {
- if (e instanceof ClusterTopologyException)
- return ComputeJobResultPolicy.WAIT;
-
- throw new IgniteException("Remote job threw exception.", e);
- }
-
return ComputeJobResultPolicy.WAIT;
}
@@ -5620,23 +5641,25 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/** */
private static final long serialVersionUID = 0L;
- /** Cache name. */
- private final String cacheName;
-
- /** Affinity topology version. */
- private final AffinityTopologyVersion topVer;
+ /** Cache context. */
+ private GridCacheContext ctx;
/** Keys to clear. */
- private final Set<? extends K> keys;
+ private Set<? extends K> keys;
/**
- * @param cacheName Cache name.
- * @param topVer Affinity topology version.
+ * Empty constructor for serialization.
+ */
+ public ClearTask() {
+ // No-op.
+ }
+
+ /**
+ * @param ctx Cache context.
* @param keys Keys to clear.
*/
- public ClearTask(String cacheName, AffinityTopologyVersion topVer, Set<? extends K> keys) {
- this.cacheName = cacheName;
- this.topVer = topVer;
+ public ClearTask(GridCacheContext ctx, Set<? extends K> keys) {
+ this.ctx = ctx;
this.keys = keys;
}
@@ -5646,8 +5669,9 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
Map<ComputeJob, ClusterNode> jobs = new HashMap();
for (ClusterNode node : subgrid) {
- jobs.put(keys == null ? new GlobalClearAllJob(cacheName, topVer) :
- new GlobalClearKeySetJob<K>(cacheName, topVer, keys),
+ jobs.put(keys == null ?
+ new GlobalClearAllJob(ctx.name(), ctx.affinity().affinityTopologyVersion()) :
+ new GlobalClearKeySetJob<K>(ctx.name(), ctx.affinity().affinityTopologyVersion(), keys),
node);
}
@@ -5656,15 +5680,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/** {@inheritDoc} */
@Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd) {
- IgniteException e = res.getException();
-
- if (e != null) {
- if (e instanceof ClusterTopologyException)
- return ComputeJobResultPolicy.WAIT;
-
- throw new IgniteException("Remote job threw exception.", e);
- }
-
return ComputeJobResultPolicy.WAIT;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index 6f9099f..9bee148 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -1656,13 +1656,6 @@ public class GridCacheContext<K, V> implements Externalizable {
}
/**
- * @return {@code True} if should use entry with offheap value pointer.
- */
- public boolean useOffheapEntry() {
- return cacheCfg.getMemoryMode() == OFFHEAP_TIERED || cacheCfg.getMemoryMode() == OFFHEAP_VALUES;
- }
-
- /**
* Converts temporary offheap object to heap-based.
*
* @param obj Object.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index cbb78e7..1c2f8d5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -115,6 +115,9 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
@GridToStringInclude
private final int hash;
+ /** Off-heap value pointer. */
+ protected long valPtr;
+
/** Extras */
@GridToStringInclude
private GridCacheEntryExtras extras;
@@ -185,7 +188,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
if (cctx.cache().isIgfsDataCache() &&
cctx.kernalContext().igfsHelper().isIgfsBlockKey(key.value(cctx.cacheObjectContext(), false))) {
int newSize = valueLength0(val, null);
- int oldSize = valueLength0(this.val, (this.val == null && hasOffHeapPointer()) ? valueBytes0() : null);
+ int oldSize = valueLength0(this.val, (this.val == null && valPtr != 0) ? valueBytes0() : null);
int delta = newSize - oldSize;
@@ -196,7 +199,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
if (!isOffHeapValuesOnly()) {
this.val = val;
- offHeapPointer(0);
+ valPtr = 0;
}
else {
try {
@@ -224,13 +227,12 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
if (val != null) {
byte type = val.type();
- offHeapPointer(mem.putOffHeap(offHeapPointer(), U.toArray(val.valueBytes(cctx.cacheObjectContext())),
- type));
+ valPtr = mem.putOffHeap(valPtr, U.toArray(val.valueBytes(cctx.cacheObjectContext())), type);
}
else {
- mem.removeOffHeap(offHeapPointer());
+ mem.removeOffHeap(valPtr);
- offHeapPointer(0);
+ valPtr = 0;
}
}
catch (IgniteCheckedException e) {
@@ -268,7 +270,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
CacheObject val0 = val;
- if (val0 == null && hasOffHeapPointer()) {
+ if (val0 == null && valPtr != 0) {
IgniteBiTuple<ByteBuffer, Byte> t = valueBytes0();
return cctx.cacheObjects().toCacheObject(cctx.cacheObjectContext(), t.get2(), t.get1());
@@ -432,16 +434,16 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
if (e != null) {
if (e.offheapPointer() > 0) {
- offHeapPointer(e.offheapPointer());
+ valPtr = e.offheapPointer();
if (needVal) {
- CacheObject val = cctx.fromOffheap(offHeapPointer(), false);
+ CacheObject val = cctx.fromOffheap(valPtr, false);
e.value(val);
}
}
else // Read from swap.
- offHeapPointer(0);
+ valPtr = 0;
}
}
else
@@ -466,7 +468,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
// Must update valPtr again since update() will reset it.
if (cctx.offheapTiered() && e.offheapPointer() > 0)
- offHeapPointer(e.offheapPointer());
+ valPtr = e.offheapPointer();
return val;
}
@@ -493,13 +495,13 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
if (cctx.offheapTiered()) {
cctx.swap().removeOffheap(key);
- offHeapPointer(0);
+ valPtr = 0;
}
return;
}
- if (val == null && cctx.offheapTiered() && hasOffHeapPointer()) {
+ if (val == null && cctx.offheapTiered() && valPtr != 0) {
if (log.isDebugEnabled())
log.debug("Value did not change, skip write swap entry: " + this);
@@ -538,10 +540,10 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
protected IgniteBiTuple<ByteBuffer, Byte> valueBytes0() {
assert Thread.holdsLock(this);
- if (hasOffHeapPointer()) {
+ if (valPtr != 0) {
assert isOffHeapValuesOnly() || cctx.offheapTiered();
- IgniteBiTuple<byte[], Byte> t = cctx.unsafeMemory().get(offHeapPointer());
+ IgniteBiTuple<byte[], Byte> t = cctx.unsafeMemory().get(valPtr);
return F.t(ByteBuffer.wrap(t.get1()), t.get2());
}
@@ -672,7 +674,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
CacheObject val = this.val;
- hasOldBytes = hasOffHeapPointer();
+ hasOldBytes = valPtr != 0;
if ((unmarshal || isOffHeapValuesOnly()) && !expired && val == null && hasOldBytes)
val = rawGetOrUnmarshalUnlocked(tmp);
@@ -816,7 +818,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
// Update indexes before actual write to entry.
updateIndex(ret, expTime, nextVer, prevVal);
- boolean hadValPtr = hasOffHeapPointer();
+ boolean hadValPtr = valPtr != 0;
// Don't change version for read-through.
update(ret, expTime, ttl, nextVer);
@@ -964,8 +966,13 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
synchronized (this) {
checkObsolete();
- assert tx == null || (!tx.local() && tx.onePhaseCommit()) || tx.ownsLock(this) :
- "Transaction does not own lock for update [entry=" + this + ", tx=" + tx + ']';
+ if (cctx.kernalContext().config().isCacheSanityCheckEnabled()) {
+ if (tx != null && tx.groupLock())
+ groupLockSanityCheck(tx);
+ else
+ assert tx == null || (!tx.local() && tx.onePhaseCommit()) || tx.ownsLock(this) :
+ "Transaction does not own lock for update [entry=" + this + ", tx=" + tx + ']';
+ }
// Load and remove from swap if it is new.
boolean startVer = isStartVersion();
@@ -1123,7 +1130,10 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
synchronized (this) {
checkObsolete();
- assert tx == null || (!tx.local() && tx.onePhaseCommit()) || tx.ownsLock(this) :
+ if (tx != null && tx.groupLock() && cctx.kernalContext().config().isCacheSanityCheckEnabled())
+ groupLockSanityCheck(tx);
+ else
+ assert tx == null || (!tx.local() && tx.onePhaseCommit()) || tx.ownsLock(this) :
"Transaction does not own lock for remove[entry=" + this + ", tx=" + tx + ']';
boolean startVer = isStartVersion();
@@ -1156,7 +1166,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
// can be updated without actually holding entry lock.
clearIndex(old);
- boolean hadValPtr = hasOffHeapPointer();
+ boolean hadValPtr = valPtr != 0;
update(null, 0, 0, newVer);
@@ -1190,7 +1200,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
obsoleteVer = newVer;
else {
// Only delete entry if the lock is not explicit.
- if (lockedBy(tx.xidVersion()))
+ if (tx.groupLock() || lockedBy(tx.xidVersion()))
obsoleteVer = tx.xidVersion();
else if (log.isDebugEnabled())
log.debug("Obsolete version was not set because lock was explicit: " + this);
@@ -1513,7 +1523,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
// Must persist inside synchronization in non-tx mode.
cctx.store().remove(null, keyValue(false));
- boolean hasValPtr = hasOffHeapPointer();
+ boolean hasValPtr = valPtr != 0;
// Update index inside synchronization since it can be updated
// in load methods without actually holding entry lock.
@@ -2114,7 +2124,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
enqueueVer = newVer;
- boolean hasValPtr = hasOffHeapPointer();
+ boolean hasValPtr = valPtr != 0;
// Clear value on backup. Entry will be removed from cache when it got evicted from queue.
update(null, CU.TTL_ETERNAL, CU.EXPIRE_TIME_ETERNAL, newVer);
@@ -2791,6 +2801,25 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
}
/**
+ * Checks that entries in group locks transactions are not locked during commit.
+ *
+ * @param tx Transaction to check.
+ * @throws GridCacheEntryRemovedException If entry is obsolete.
+ * @throws IgniteCheckedException If entry was externally locked.
+ */
+ private void groupLockSanityCheck(IgniteInternalTx tx) throws GridCacheEntryRemovedException, IgniteCheckedException {
+ assert tx.groupLock();
+
+ IgniteTxEntry txEntry = tx.entry(txKey());
+
+ if (txEntry.groupLockEntry()) {
+ if (lockedByAny())
+ throw new IgniteCheckedException("Failed to update cache entry (entry was externally locked while " +
+ "accessing entry within group lock transaction) [entry=" + this + ", tx=" + tx + ']');
+ }
+ }
+
+ /**
* @param failFast Fail fast flag.
* @param topVer Topology version.
* @param filter Filter.
@@ -2902,8 +2931,8 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
if (val != null)
return val;
- if (hasOffHeapPointer()) {
- CacheObject val0 = cctx.fromOffheap(offHeapPointer(), tmp);
+ if (valPtr != 0) {
+ CacheObject val0 = cctx.fromOffheap(valPtr, tmp);
if (!tmp && cctx.kernalContext().config().isPeerClassLoadingEnabled())
val0.finishUnmarshal(cctx.cacheObjectContext(), cctx.deploy().globalLoader());
@@ -2925,7 +2954,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
protected boolean hasValueUnlocked() {
assert Thread.holdsLock(this);
- return val != null || hasOffHeapPointer();
+ return val != null || valPtr != 0;
}
/** {@inheritDoc} */
@@ -3271,7 +3300,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
synchronized (this) {
CacheObject expiredVal = saveValueForIndexUnlocked();
- boolean hasOldBytes = hasOffHeapPointer();
+ boolean hasOldBytes = valPtr != 0;
boolean expired = checkExpired();
@@ -4075,27 +4104,6 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
}
/**
- * @return True if entry has off-heap value pointer.
- */
- protected boolean hasOffHeapPointer() {
- return false;
- }
-
- /**
- * @return Off-heap value pointer.
- */
- protected long offHeapPointer() {
- return 0;
- }
-
- /**
- * @param valPtr Off-heap value pointer.
- */
- protected void offHeapPointer(long valPtr) {
- // No-op.
- }
-
- /**
* @return Size of extras object.
*/
private int extrasSize() {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a6dd007/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
index c05e4b4..0bb97a9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
@@ -510,7 +510,7 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
* @return Future.
*/
@SuppressWarnings({"unchecked"})
- @Nullable public GridCacheFuture future(GridCacheVersion ver, IgniteUuid futId) {
+ @Nullable public <T> GridCacheFuture<T> future(GridCacheVersion ver, IgniteUuid futId) {
Collection<? extends GridCacheFuture> futs = this.futs.get(ver);
if (futs != null)
@@ -519,7 +519,7 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
if (log.isDebugEnabled())
log.debug("Found future in futures map: " + fut);
- return fut;
+ return (GridCacheFuture<T>)fut;
}
if (log.isDebugEnabled())