feedback-to-code/mozzarella huggingface dataset:
Repository: iluwatar/java-design-patterns
Issue: half-sync-half-async pattern need to enhance
Labels: type: bug
info: help wanted

In the App class of half-sync-half-async pattern, the workers in threadpool is still running when the main thread has finished. This also makes the AppTest less effective (after the test, we expect to see task results, but we get nothing because junit will terminate jvm when the main thread has finished).  
To improve on it, we can add a close method to the AsynchronousService class and call the method at the end of the main thread. I can create a PR, if needed.

Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/App.java b/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/App.java
index 90cb5ecbfb0d..b24e29b6a55c 100644
--- a/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/App.java
+++ b/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/App.java
@@ -94,6 +94,8 @@ public static void main(String[] args) {
     service.execute(new ArithmeticSumTask(500));
     service.execute(new ArithmeticSumTask(2000));
     service.execute(new ArithmeticSumTask(1));
+
+    service.close();
   }
 
   /**
diff --git a/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/AsynchronousService.java b/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/AsynchronousService.java
index 4e2f9c23a6cd..3e64edd9894c 100644
--- a/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/AsynchronousService.java
+++ b/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/AsynchronousService.java
@@ -22,6 +22,9 @@
  */
 package com.iluwatar.halfsynchalfasync;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
@@ -38,6 +41,7 @@
  */
 public class AsynchronousService {
 
+  private static final Logger LOGGER = LoggerFactory.getLogger(AsynchronousService.class);
   /*
    * This represents the queuing layer as well as synchronous layer of the pattern. The thread pool
    * contains worker threads which execute the tasks in blocking/synchronous manner. Long running
@@ -95,4 +99,16 @@ protected void done() {
       }
     });
   }
+
+  /**
+   * Stops the pool of workers. This is a blocking call to wait for all tasks to be completed.
+   */
+  public void close() {
+    service.shutdown();
+    try {
+      service.awaitTermination(10, TimeUnit.SECONDS);
+    } catch (InterruptedException ie) {
+      LOGGER.error("Error waiting for executor service shutdown!");
+    }
+  }
 }


Test patch:
Repository: iluwatar/java-design-patterns
Issue: Java 11 support: Maven plugin upgrade
Labels: info: good first issue
epic: build issue
epic: dependencies

This task is part of the Java 11 transition plan https://github.com/iluwatar/java-design-patterns/wiki/16.-Java-11-Transition

We need to update the Maven plugins used in the build to versions that support Java 11. The plugins include at least

- maven-compiler-plugin
- jacoco-maven-plugin
- maven-checkstyle-plugin
- maven-surefire-plugin
- maven-pmd-plugin
- license-maven-plugin


Issue comments:
I'll fix..
Thanks @perwramdemark, go ahead

Pull request review comments:

Patch that resolved the issue:
diff --git a/pom.xml b/pom.xml
index 5dfb1fff4376..eb3b68c498fb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -38,7 +38,7 @@
         <junit-vintage.version>${junit.version}.2</junit-vintage.version>
         <junit-platform.version>1.0.2</junit-platform.version>
         <sping-test-junit5.version>1.0.2</sping-test-junit5.version>
-        <compiler.version>3.0</compiler.version>
+        <compiler.version>3.8.0</compiler.version>
         <jacoco.version>0.7.2.201409121644</jacoco.version>
         <commons-dbcp.version>1.4</commons-dbcp.version>
         <camel.version>2.16.1</camel.version>
@@ -357,15 +357,14 @@
         </pluginManagement>
 
         <plugins>
-            <!-- Tell maven to compile using Java 8 -->
+            <!-- Tell maven to compile using Java 11 -->
             <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
+			    <groupId>org.apache.maven.plugins</groupId>
+			    <artifactId>maven-compiler-plugin</artifactId>
                 <version>${compiler.version}</version>
-                <configuration>
-                    <source>1.8</source>
-                    <target>1.8</target>
-                </configuration>
+			    <configuration>
+			        <release>11</release>
+			    </configuration>            
             </plugin>
             <plugin>
                 <groupId>org.jacoco</groupId>
diff --git a/trampoline/pom.xml b/trampoline/pom.xml
index e6f2e620afac..1bd675c30576 100644
--- a/trampoline/pom.xml
+++ b/trampoline/pom.xml
@@ -51,7 +51,7 @@
         <dependency>
             <groupId>org.projectlombok</groupId>
             <artifactId>lombok</artifactId>
-            <version>1.16.18</version>
+            <version>1.18.2</version>
         </dependency>
 
 


Test patch:
Repository: iluwatar/java-design-patterns
Issue: Java 11 support: Get rid of compiler warnings
Labels: type: bug
info: help wanted
info: good first issue
epic: build issue

This task is part of the Java 11 transition plan https://github.com/iluwatar/java-design-patterns/wiki/16.-Java-11-Transition

In this task we run the regular build and inspect the compiler output for warnings. We are especially interested in deprecation warnings, those are going to break things when Java version is updated. The target of the task is to get rid of as many warnings as possible.

Issue comments:
@iluwatar compiling project with java 8 I don't get any other compiler warnings.
Yes, I can confirm. We can close this issue.

Pull request review comments:

Patch that resolved the issue:
diff --git a/pom.xml b/pom.xml
index 5dfb1fff4376..eb3b68c498fb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -38,7 +38,7 @@
         <junit-vintage.version>${junit.version}.2</junit-vintage.version>
         <junit-platform.version>1.0.2</junit-platform.version>
         <sping-test-junit5.version>1.0.2</sping-test-junit5.version>
-        <compiler.version>3.0</compiler.version>
+        <compiler.version>3.8.0</compiler.version>
         <jacoco.version>0.7.2.201409121644</jacoco.version>
         <commons-dbcp.version>1.4</commons-dbcp.version>
         <camel.version>2.16.1</camel.version>
@@ -357,15 +357,14 @@
         </pluginManagement>
 
         <plugins>
-            <!-- Tell maven to compile using Java 8 -->
+            <!-- Tell maven to compile using Java 11 -->
             <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
+			    <groupId>org.apache.maven.plugins</groupId>
+			    <artifactId>maven-compiler-plugin</artifactId>
                 <version>${compiler.version}</version>
-                <configuration>
-                    <source>1.8</source>
-                    <target>1.8</target>
-                </configuration>
+			    <configuration>
+			        <release>11</release>
+			    </configuration>            
             </plugin>
             <plugin>
                 <groupId>org.jacoco</groupId>
diff --git a/trampoline/pom.xml b/trampoline/pom.xml
index e6f2e620afac..1bd675c30576 100644
--- a/trampoline/pom.xml
+++ b/trampoline/pom.xml
@@ -51,7 +51,7 @@
         <dependency>
             <groupId>org.projectlombok</groupId>
             <artifactId>lombok</artifactId>
-            <version>1.16.18</version>
+            <version>1.18.2</version>
         </dependency>
 
 


Test patch:
Repository: iluwatar/java-design-patterns
Issue: Java 11 support: Maven version
Labels: info: help wanted
type: support
epic: developer wiki
info: good first issue
epic: build issue

This task is part of the Java 11 transition plan https://github.com/iluwatar/java-design-patterns/wiki/16.-Java-11-Transition

Find out what is the minimum Maven version that supports Java 11. Hopefully this information can be found on the Maven web site somewhere.

Issue comments:
![image](https://user-images.githubusercontent.com/582346/66183018-eb094880-e67f-11e9-84eb-a66b36b008b8.png)


Pull request review comments:

Patch that resolved the issue:
diff --git a/pom.xml b/pom.xml
index 5dfb1fff4376..eb3b68c498fb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -38,7 +38,7 @@
         <junit-vintage.version>${junit.version}.2</junit-vintage.version>
         <junit-platform.version>1.0.2</junit-platform.version>
         <sping-test-junit5.version>1.0.2</sping-test-junit5.version>
-        <compiler.version>3.0</compiler.version>
+        <compiler.version>3.8.0</compiler.version>
         <jacoco.version>0.7.2.201409121644</jacoco.version>
         <commons-dbcp.version>1.4</commons-dbcp.version>
         <camel.version>2.16.1</camel.version>
@@ -357,15 +357,14 @@
         </pluginManagement>
 
         <plugins>
-            <!-- Tell maven to compile using Java 8 -->
+            <!-- Tell maven to compile using Java 11 -->
             <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
+			    <groupId>org.apache.maven.plugins</groupId>
+			    <artifactId>maven-compiler-plugin</artifactId>
                 <version>${compiler.version}</version>
-                <configuration>
-                    <source>1.8</source>
-                    <target>1.8</target>
-                </configuration>
+			    <configuration>
+			        <release>11</release>
+			    </configuration>            
             </plugin>
             <plugin>
                 <groupId>org.jacoco</groupId>
diff --git a/trampoline/pom.xml b/trampoline/pom.xml
index e6f2e620afac..1bd675c30576 100644
--- a/trampoline/pom.xml
+++ b/trampoline/pom.xml
@@ -51,7 +51,7 @@
         <dependency>
             <groupId>org.projectlombok</groupId>
             <artifactId>lombok</artifactId>
-            <version>1.16.18</version>
+            <version>1.18.2</version>
         </dependency>
 
 


Test patch:
Repository: iluwatar/java-design-patterns
Issue: WARNING when building project
Labels: type: bug
info: good first issue
epic: build issue
epic: dependencies

When building project with mvn install you get below warning. You need to setup the JXR plugin to get ride of this for multi-module projects.

[INFO] --- maven-pmd-plugin:3.6:pmd (pmd) @ abstract-factory ---
[WARNING] Unable to locate Source XRef to link to - DISABLED
Unable to locate Source XRef to link to - DISABLED

Issue comments:
I can fix it!
Nice @perwramdemark, go ahead!
Related to https://github.com/iluwatar/java-design-patterns/issues/944

Pull request review comments:

Patch that resolved the issue:
diff --git a/pom.xml b/pom.xml
index d985b6c62fe2..874bf66dddee 100644
--- a/pom.xml
+++ b/pom.xml
@@ -465,6 +465,11 @@
                 <artifactId>maven-pmd-plugin</artifactId>
                 <version>${pmd.version}</version>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jxr-plugin</artifactId>
+                <version>3.0.0</version>
+            </plugin>
         </plugins>
     </reporting>
 


Test patch:
Repository: iluwatar/java-design-patterns
Issue: Java 11 support: Get rid of JavaEE, Corba and JavaFX
Labels: info: help wanted
info: good first issue
epic: dependencies

This task is part of the Java 11 transition plan https://github.com/iluwatar/java-design-patterns/wiki/16.-Java-11-Transition

Java EE, Corba and JavaFX have been deprecated in newer JDK versions. Are there any dependencies to those in this project? If there is, we should get rid of them. (see https://blog.codefx.org/java/java-9-migration-guide/)

Issue comments:
Hi, I have created a pull request for this issue. 
https://github.com/iluwatar/java-design-patterns/pull/957
A lot of this stuff has just been migrated to community projects...

Shouldn't J-EE move to Jakarta? I didn't think J-EE was truly deprecated.
JavaFX to https://openjfx.io/

@ryantheleach yes, I agree that stuff should be moved and not totally removed. Maybe an inaccurate term there in the issue subject..
Links:
https://blog.codefx.org/java/java-9-migration-guide/#Dependencies-On-Java-EE-Modules
https://jaxenter.com/jdk-11-java-ee-modules-140674.html

Pull request review comments:
Please specify the version numbers in the main `pom.xml` dependencyManagement section
I have moved the version numbers to main pom.xml's dependencyManagement section and updated the pull request.

Patch that resolved the issue:
diff --git a/pom.xml b/pom.xml
index f1a586eb8b34..acaaef6181c5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -55,6 +55,8 @@
         <aws-lambda-java-events.version>2.0.1</aws-lambda-java-events.version>
         <jackson.version>2.8.5</jackson.version>
         <pmd.version>3.12.0</pmd.version>
+        <jaxb-api.version>2.3.0</jaxb-api.version>
+        <annotation-api.version>1.3.1</annotation-api.version>
     </properties>
     <modules>
         <module>abstract-factory</module>
@@ -298,6 +300,16 @@
                 <artifactId>mongo-java-driver</artifactId>
                 <version>${mongo-java-driver.version}</version>
             </dependency>
+            <dependency>
+                <groupId>javax.xml.bind</groupId>
+                <artifactId>jaxb-api</artifactId>
+                <version>${jaxb-api.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>javax.annotation</groupId>
+                <artifactId>javax.annotation-api</artifactId>
+                <version>${annotation-api.version}</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 
diff --git a/repository/pom.xml b/repository/pom.xml
index 48bca0cf2ba8..2ccdc9da7ba5 100644
--- a/repository/pom.xml
+++ b/repository/pom.xml
@@ -63,5 +63,13 @@
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
         </dependency>
+        <dependency>
+            <groupId>javax.xml.bind</groupId>
+            <artifactId>jaxb-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>javax.annotation</groupId>
+            <artifactId>javax.annotation-api</artifactId>
+        </dependency>
     </dependencies>
 </project>


Test patch:
Repository: iluwatar/java-design-patterns
Issue: Intermittent test failure in Spatial Partition pattern
Labels: type: bug
info: good first issue
epic: build issue

![image](https://user-images.githubusercontent.com/582346/66769142-09134c00-eebd-11e9-9a90-e694dac91be5.png)


Issue comments:
Fixed intermittent issue #1001
Didn't see @afflato already took this, sorry!

Pull request review comments:

Patch that resolved the issue:
diff --git a/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Rect.java b/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Rect.java
index 3d2f01d77d3d..71d4eda5bfa7 100644
--- a/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Rect.java
+++ b/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Rect.java
@@ -28,14 +28,14 @@
  */
 
 public class Rect {
-  int x; 
-  int y; 
-  int width;
-  int height;
+  double x;
+  double y;
+  double width;
+  double height;
 
   //(x,y) - centre of rectangle
 
-  Rect(int x, int y, int width, int height) {
+  Rect(double x, double y, double width, double height) {
     this.x = x;
     this.y = y;
     this.width = width;


Test patch:
Repository: iluwatar/java-design-patterns
Issue: Error when building from submodule directories
Labels: type: bug
info: help wanted
info: good first issue
epic: build issue

When running `mvn clean install` from project's submodules, the following error message is outputted

```
Failed to execute goal com.mycila:license-maven-plugin:3.0:format (install-format) on project adapter: Resource license-plugin-header-style.xml not found in file system, classpath or URL: no protocol: license-plugin-header-style.xml
```

Building from the submodules should work as well as building from the multimodule root.

Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/pom.xml b/pom.xml
index b6c1b4472a88..1bcf73b8b4d5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -406,6 +406,31 @@
                 </executions>
             </plugin>
 
+            <!-- Resolves ${projectRoot} to the project root directory.
+                Used by the license-maven-plugin to find the correct location of
+                license-plugin-header-style.xml when built from a submodule directory. -->
+            <plugin>
+                <groupId>org.commonjava.maven.plugins</groupId>
+                <artifactId>directory-maven-plugin</artifactId>
+                <version>0.3.1</version>
+                <executions>
+                    <execution>
+                        <id>directories</id>
+                        <goals>
+                            <goal>directory-of</goal>
+                        </goals>
+                        <phase>initialize</phase>
+                        <configuration>
+                            <property>projectRoot</property>
+                            <project>
+                                <groupId>com.iluwatar</groupId>
+                                <artifactId>java-design-patterns</artifactId>
+                            </project>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
             <plugin>
                 <groupId>com.mycila</groupId>
                 <artifactId>license-maven-plugin</artifactId>
@@ -417,7 +442,7 @@
                     </properties>
                     <skipExistingHeaders>true</skipExistingHeaders>
                     <headerDefinitions>
-                        <headerDefinition>license-plugin-header-style.xml</headerDefinition>
+                        <headerDefinition>${projectRoot}${file.separator}license-plugin-header-style.xml</headerDefinition>
                     </headerDefinitions>
                     <mapping>
                         <java>SLASHSTAR_CUSTOM_STYLE</java>


Test patch:
Repository: iluwatar/java-design-patterns
Issue: Aggregator Microservices
Labels: type: bug
info: help wanted
epic: web site
info: good first issue

Credits link in Aggregator Microservices is responded with a blank page. 
The current link is http://blog.arungupta.me/microservice-design-patterns/

Issue comments:
Thanks for reporting @karthikmucheli. Would you like to create a pull request for that?

Pull request review comments:

Patch that resolved the issue:
diff --git a/aggregator-microservices/README.md b/aggregator-microservices/README.md
index 4d64178a66a5..74a411fc5cfb 100644
--- a/aggregator-microservices/README.md
+++ b/aggregator-microservices/README.md
@@ -27,4 +27,4 @@ Use the Aggregator Microservices pattern when you need a unified API for various
 
 ## Credits
 
-* [Microservice Design Patterns](http://blog.arungupta.me/microservice-design-patterns/)
+* [Microservice Design Patterns](http://web.archive.org/web/20190705163602/http://blog.arungupta.me/microservice-design-patterns/)


Test patch:
Repository: iluwatar/java-design-patterns
Issue: Service Layer logging broken
Labels: type: bug
info: help wanted
epic: pattern

At the moment the Service Layer pattern example does not produce log output at all.

Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/service-layer/src/main/resources/logback.xml b/service-layer/src/main/resources/logback.xml
index 47fe422366d8..e6678aff2e8f 100644
--- a/service-layer/src/main/resources/logback.xml
+++ b/service-layer/src/main/resources/logback.xml
@@ -43,6 +43,7 @@
     <logger name="com.iluwatar" additivity="false">
         <level value="DEBUG"/>
         <appender-ref ref="FILE"/>
+        <appender-ref ref="STDOUT"/>
     </logger>
 
     <logger name="org.hibernate" additivity="false">


Test patch:
Repository: iluwatar/java-design-patterns
Issue: Upgrade mockito
Labels: type: enhancement
epic: dependencies

The current version declared in the main `pom.xml` is very old:

```
<mockito.version>1.10.19</mockito.version>
```

Let's try to upgrade it to a newer version in this task.

Issue comments:
I can look into it if you can assign it to me please.
Ok @amit1307 
@amit1307 Can we get an update on the status of this issue?
Hey, sorry I was out of the town for few days and came back this week. Just catching up the stuff. I should get back with some progress soon. Hope that's fine.

Pull request review comments:

Patch that resolved the issue:
diff --git a/pom.xml b/pom.xml
index 56b95520435e..6d779700f9f5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -39,7 +39,7 @@
         <commons-dbcp.version>1.4</commons-dbcp.version>
         <camel.version>2.24.0</camel.version>
         <guava.version>19.0</guava.version>
-        <mockito.version>1.10.19</mockito.version>
+        <mockito.version>3.5.6</mockito.version>
         <htmlunit.version>2.22</htmlunit.version>
         <guice.version>4.0</guice.version>
         <mongo-java-driver.version>3.12.1</mongo-java-driver.version>
@@ -206,6 +206,18 @@
 
     <dependencyManagement>
         <dependencies>
+            <dependency>
+                <groupId>net.bytebuddy</groupId>
+                <artifactId>byte-buddy</artifactId>
+                <version>1.9.7</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>net.bytebuddy</groupId>
+                <artifactId>byte-buddy-agent</artifactId>
+                <version>1.9.7</version>
+                <scope>test</scope>
+            </dependency>
             <dependency>
                 <groupId>org.hibernate</groupId>
                 <artifactId>hibernate-core</artifactId>


Test patch:
Repository: iluwatar/java-design-patterns
Issue: Word mistake in factory/README.md
Labels: type: bug
epic: pattern
info: good first issue

![image](https://user-images.githubusercontent.com/48073115/100273344-f44e2680-2f9f-11eb-8f9f-393c4667932f.png)
Lines 83-84: Could not find CarSimpleFactory. Isn't it CarsFactory?

Issue comments:
I am new to this. Can I take up this?
@ohbus when handling issues set the correct labels and on close set the milestone
> @ohbus when handling issues set the correct labels and on close set the milestone

Thank you for this guiding me on this.

And Hacktoberfest is over, I guess we should remove this tag from the repository  or stop using it for the time being.
@ohbus before you know it, it will be the next Hactoberfest, so I would just leave it there :)

Pull request review comments:

Patch that resolved the issue:
diff --git a/factory/README.md b/factory/README.md
index a1b6208fd736..0112c92c0f06 100644
--- a/factory/README.md
+++ b/factory/README.md
@@ -81,7 +81,7 @@ public enum CarType {
 }
 ```
 Then we have the static method `getCar` to create car objects encapsulated in the factory class 
-`CarSimpleFactory`.
+`CarsFactory`.
 
 ```java
 public class CarsFactory {


Test patch: