Skip to content

Commit

Permalink
Java 11 .bat fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
antkr committed Feb 25, 2019
1 parent 119978c commit 8a7a415
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 24 deletions.
4 changes: 2 additions & 2 deletions examples/config/example-default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
to our documentation: http://apacheignite.readme.io/docs/cluster-config
-->
<!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
<!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
<!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">-->
<property name="addresses">
<list>
<!-- In distributed environment, replace with actual host IP address. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@

package org.apache.ignite.examples.datagrid;

import java.util.HashMap;
import java.util.Map;
import javax.cache.CacheException;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteClientDisconnectedException;
import org.apache.ignite.IgniteDataStreamer;
import org.apache.ignite.IgniteException;
import org.apache.ignite.Ignition;
Expand All @@ -42,7 +46,7 @@ public class CacheDataStreamerExample {
private static final String CACHE_NAME = CacheDataStreamerExample.class.getSimpleName();

/** Number of entries to load. */
private static final int ENTRY_COUNT = 500000;
private static final int ENTRY_COUNT = 5000000;

/** Heap size required to run this example. */
public static final int MIN_MEMORY = 512 * 1024 * 1024;
Expand All @@ -56,36 +60,61 @@ public class CacheDataStreamerExample {
public static void main(String[] args) throws IgniteException {
ExamplesUtils.checkMinMemory(MIN_MEMORY);

Ignition.setClientMode(true);
Map<Integer, Integer> map = new HashMap<>();
//map.entrySet().parallelStream().forEach();

try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
System.out.println();
System.out.println(">>> Cache data streamer example started.");

boolean cancelled = false;
while (!cancelled) {
// Auto-close cache at the end of the example.
try (IgniteCache<Integer, String> cache = ignite.getOrCreateCache(CACHE_NAME)) {
long start = System.currentTimeMillis();

try (IgniteDataStreamer<Integer, String> stmr = ignite.dataStreamer(CACHE_NAME)) {
// Configure loader.
stmr.perNodeBufferSize(1024);
stmr.perNodeParallelOperations(8);

for (int i = 0; i < ENTRY_COUNT; i++) {
stmr.addData(i, Integer.toString(i));
try (IgniteDataStreamer<Integer, String> stmr = ignite.dataStreamer(CACHE_NAME)) {
// Configure loader.
stmr.perNodeBufferSize(1024);
stmr.perNodeParallelOperations(8);

for (int i = 0; i < ENTRY_COUNT; i++) {
stmr.addData(i, Integer.toString(i));

//Thread.sleep(1000)
// Print out progress while loading cache.
if (i > 0 && i % 10000 == 0)
System.out.println("Loaded " + i + " keys.");

// Print out progress while loading cache.
if (i > 0 && i % 10000 == 0)
System.out.println("Loaded " + i + " keys.");
if ( i + 1 == ENTRY_COUNT)
cancelled = true;

stmr.flush();
}
}
catch (CacheException e) {
if (e.getCause() instanceof IgniteClientDisconnectedException) {
IgniteClientDisconnectedException exc = (IgniteClientDisconnectedException)e.getCause();
exc.reconnectFuture().get();
}
else
throw e;
}
}


long end = System.currentTimeMillis();

System.out.println(">>> Loaded " + ENTRY_COUNT + " keys in " + (end - start) + "ms.");
}
finally {
// Distributed cache could be removed from cluster only by #destroyCache() call.
ignite.destroyCache(CACHE_NAME);

}

}
finally {
// Distributed cache could be removed from cluster only by #destroyCache() call.
//ignite.destroyCache(CACHE_NAME);
}
}
}
51 changes: 43 additions & 8 deletions modules/sqlline/bin/sqlline.bat
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,12 @@ if exist "%JAVA_HOME%\bin\java.exe" goto checkJdkVersion
goto error_finish

:checkJdkVersion
"%JAVA_HOME%\bin\java.exe" -version 2>&1 | findstr /R /c:"version .9\..*" /c:"version .1\.8\..*" > nul
if %ERRORLEVEL% equ 0 goto checkIgniteHome1
echo %0, ERROR:
echo The version of JAVA installed in %JAVA_HOME% is incorrect.
echo Please point JAVA_HOME variable to installation of JDK 1.8 or later.
echo You can also download latest JDK at http://java.com/download.
goto error_finish
set cmd="%JAVA_HOME%\bin\java.exe"
for /f "tokens=* USEBACKQ" %%f in (`%cmd% -version 2^>^&1`) do (
set var=%%f
goto :LoopEscape
)
:LoopEscape

:: Check IGNITE_HOME.
:checkIgniteHome1
Expand Down Expand Up @@ -103,9 +102,45 @@ if "%OS%" == "Windows_NT" set PROG_NAME=%~nx0%
::
call "%SCRIPTS_HOME%\include\setenv.bat"

for /f "tokens=1-3 delims= " %%a in ("%var%") do set JAVA_VER_STR=%%c
set JAVA_VER_STR=%JAVA_VER_STR:"=%

for /f "tokens=1,2 delims=." %%a in ("%JAVA_VER_STR%.x") do set MAJOR_JAVA_VER=%%a& set MINOR_JAVA_VER=%%b

if %MAJOR_JAVA_VER% == 8 (
set JVM_OPTS= ^
-XX:+AggressiveOpts ^
%JVM_OPTS%
)

if %MAJOR_JAVA_VER% GEQ 9 if %MAJOR_JAVA_VER% LSS 11 (
set JVM_OPTS= ^
-XX:+AggressiveOpts ^
--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED ^
--add-exports=java.base/sun.nio.ch=ALL-UNNAMED ^
--add-exports=java.management/com.sun.jmx.mbeanserver=ALL-UNNAMED ^
--add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED ^
--add-exports=java.base/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED ^
--illegal-access=permit ^
--add-modules=java.transaction ^
--add-modules=java.xml.bind ^
%JVM_OPTS%
)

if %MAJOR_JAVA_VER% == 11 (
set JVM_OPTS= ^
--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED ^
--add-exports=java.base/sun.nio.ch=ALL-UNNAMED ^
--add-exports=java.management/com.sun.jmx.mbeanserver=ALL-UNNAMED ^
--add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED ^
--add-exports=java.base/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED ^
--illegal-access=permit ^
%JVM_OPTS%
)

set CP=%IGNITE_LIBS%
set CP=%CP%;%IGNITE_HOME%\bin\include\sqlline\*

"%JAVA_HOME%\bin\java.exe" -cp "%CP%" sqlline.SqlLine -d org.apache.ignite.IgniteJdbcThinDriver %*
"%JAVA_HOME%\bin\java.exe" %JVM_OPTS% -cp "%CP%" sqlline.SqlLine -d org.apache.ignite.IgniteJdbcThinDriver %*

:error_finish

0 comments on commit 8a7a415

Please sign in to comment.