You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@juneau.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/10/13 14:18:00 UTC

[jira] [Commented] (JUNEAU-72) Offer an option to disable console IO from org.apache.juneau.microservice.Microservice.start()

    [ https://issues.apache.org/jira/browse/JUNEAU-72?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16648969#comment-16648969 ] 

ASF GitHub Bot commented on JUNEAU-72:
--------------------------------------

jamesbognar closed pull request #4: [JUNEAU-72] Offer an option to disable console IO from
URL: https://github.com/apache/juneau/pull/4
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/Microservice.java b/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/Microservice.java
index f31b8af0e..920b4fdda 100755
--- a/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/Microservice.java
+++ b/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/Microservice.java
@@ -582,23 +582,25 @@ public void onChange(ConfigFile cf, Set<String> changes) {
 		// --------------------------------------------------------------------------------
 		// Add exit listeners.
 		// --------------------------------------------------------------------------------
-		new Thread() {
-			@Override /* Thread */
-			public void run() {
-				Console c = System.console();
-				if (c == null)
-					System.out.println("No available console.");
-				else {
-					while (true) {
-						String l = c.readLine("\nEnter 'exit' to exit.\n");
-						if (l == null || l.equals("exit")) {
-							Microservice.this.stop();
-							break;
+		if (cf.getBoolean("Console/enableIO", true)) {
+			new Thread() {
+				@Override /* Thread */
+				public void run() {
+					Console c = System.console();
+					if (c == null)
+						System.out.println("No available console.");
+					else {
+						while (true) {
+							String l = c.readLine("\nEnter 'exit' to exit.\n");
+							if (l == null || l.equals("exit")) {
+								Microservice.this.stop();
+								break;
+							}
 						}
 					}
 				}
-			}
-		}.start();
+			}.start();
+		}
 		Runtime.getRuntime().addShutdownHook(
 			new Thread() {
 				@Override /* Thread */


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Offer an option to disable console IO from org.apache.juneau.microservice.Microservice.start()
> ----------------------------------------------------------------------------------------------
>
>                 Key: JUNEAU-72
>                 URL: https://issues.apache.org/jira/browse/JUNEAU-72
>             Project: Juneau
>          Issue Type: Improvement
>          Components: Code
>    Affects Versions: 7.0.0
>            Reporter: Gary Gregory
>            Assignee: James Bognar
>            Priority: Major
>             Fix For: 7.0.1
>
>
> The method org.apache.juneau.microservice.Microservice.start() always reads and writes to the console. The confuses our users because we embed Juneau in our own server.
> PR: https://github.com/apache/juneau/pull/4
> Note that my branch in GitHub is called "JUNEAU72". My older branch "JUNEAU-72" has messed up line-endings.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)