BAEL-835 - code rerfactor
This commit is contained in:
parent
97acf0c90e
commit
342c356b89
@ -327,6 +327,22 @@
|
|||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>exec-maven-plugin</artifactId>
|
||||||
|
<version>1.6.0</version>
|
||||||
|
<configuration>
|
||||||
|
<executable>java</executable>
|
||||||
|
<mainClass>com.baeldung.outofmemoryerror.OutOfMemoryGCLimitExceed</mainClass>
|
||||||
|
<arguments>
|
||||||
|
<argument>-Xmx300m</argument>
|
||||||
|
<argument>-XX:+UseParallelGC</argument>
|
||||||
|
<argument>-classpath</argument>
|
||||||
|
<classpath/>
|
||||||
|
<argument>com.baeldung.outofmemoryerror.OutOfMemoryGCLimitExceed</argument>
|
||||||
|
</arguments>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
|
||||||
</build>
|
</build>
|
||||||
|
@ -1,15 +1,19 @@
|
|||||||
package com.baeldung.outofmemoryerror.java_outofmemoryerror_demo;
|
package com.baeldung.outofmemoryerror;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class OutOfMemoryGCLimitExceed {
|
public class OutOfMemoryGCLimitExceed {
|
||||||
public static void addRandomDataToMap() {
|
public static void addRandomDataToMap() {
|
||||||
Map<Integer, String> dataMap = new HashMap<Integer,String>();
|
Map<Integer, String> dataMap = new HashMap<>();
|
||||||
Random r = new Random();
|
Random r = new Random();
|
||||||
while (true) {
|
while (true) {
|
||||||
dataMap.put(r.nextInt(), String.valueOf(r.nextInt()));
|
dataMap.put(r.nextInt(), String.valueOf(r.nextInt()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
OutOfMemoryGCLimitExceed.addRandomDataToMap();
|
||||||
|
}
|
||||||
|
}
|
@ -1,44 +0,0 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<groupId>com.baeldung.outofmemoryerror</groupId>
|
|
||||||
<artifactId>java-outofmemoryerror-demo</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<name>java-outofmemoryerror-demo</name>
|
|
||||||
<url>http://maven.apache.org</url>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
|
||||||
<artifactId>exec-maven-plugin</artifactId>
|
|
||||||
<version>1.2</version>
|
|
||||||
<configuration>
|
|
||||||
<executable>java</executable>
|
|
||||||
<arguments>
|
|
||||||
<argument>-Xmx100m</argument>
|
|
||||||
<argument>-XX:+UseParallelGC</argument>
|
|
||||||
<argument>-classpath</argument>
|
|
||||||
<classpath/>
|
|
||||||
<argument>com.baeldung.outofmemoryerror.java_outofmemoryerror_demo.Test</argument>
|
|
||||||
</arguments>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>junit</groupId>
|
|
||||||
<artifactId>junit</artifactId>
|
|
||||||
<version>3.8.1</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
@ -1,8 +0,0 @@
|
|||||||
package com.baeldung.outofmemoryerror.java_outofmemoryerror_demo;
|
|
||||||
|
|
||||||
public class Test {
|
|
||||||
public static void main( String[] args )
|
|
||||||
{
|
|
||||||
OutOfMemoryGCLimitExceed.addRandomDataToMap();
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user