Skip to content

Commit

Permalink
[Pubsub] Add cleanup of background threads (GoogleCloudPlatform#1247)
Browse files Browse the repository at this point in the history
* Shut down daemon threads

Adding `-Dexec.cleanupDaemonThreads=false` in `mvn exec:java` fixes `java.lang.IllegalThreadStateException`.

* Undo changes in commands

* Add cleanupDaemonThreads in pom
  • Loading branch information
anguillanneuf authored and kurtisvg committed Nov 2, 2018
1 parent fd030d1 commit 099b582
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pubsub/cloud-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Publishes 5 messages to the topic `my-topic`.
```
mvn exec:java -Dexec.mainClass=com.example.pubsub.SubscriberExample -Dexec.args=my-sub
```
Subscriber will continue to listen on the topic and print out message id and data as messages are received. Press `Ctrl+C` to exit the application.
Subscriber will continue to listen on the topic and print out message id and data as messages are received. Press `Ctrl+C` to exit the application.

#### Testing
Run the test with Maven.
Expand Down
25 changes: 25 additions & 0 deletions pubsub/cloud-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,30 @@
<version>0.42</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.3.3</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<cleanupDaemonThreads>false</cleanupDaemonThreads>
</configuration>
</plugin>
</plugins>
</build>
</project>

0 comments on commit 099b582

Please sign in to comment.