karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject [2/3] karaf git commit: Cache branding properties to avoiding reloading them each time the prompt is retrieved
Date Wed, 06 Sep 2017 06:18:23 GMT
Cache branding properties to avoiding reloading them each time the prompt is retrieved

Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/41efcf1c
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/41efcf1c
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/41efcf1c

Branch: refs/heads/master
Commit: 41efcf1ca75042ddfd7e7b2422021cc137b45bad
Parents: 2e5ba17
Author: Guillaume Nodet <gnodet@apache.org>
Authored: Tue Sep 5 17:41:42 2017 +0200
Committer: Guillaume Nodet <gnodet@apache.org>
Committed: Wed Sep 6 08:17:55 2017 +0200

----------------------------------------------------------------------
 .../apache/karaf/shell/impl/console/ConsoleSessionImpl.java | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/41efcf1c/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
----------------------------------------------------------------------
diff --git a/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
b/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
index 2a4a516..01986e2 100644
--- a/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
+++ b/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
@@ -106,6 +106,7 @@ public class ConsoleSessionImpl implements Session {
     final LineReader reader;
 
     private Thread thread;
+    private Properties brandingProps;
 
     public ConsoleSessionImpl(SessionFactory factory,
                               CommandProcessor processor,
@@ -142,6 +143,8 @@ public class ConsoleSessionImpl implements Session {
             }
         }
 
+        brandingProps = Branding.loadBrandingProperties(terminal);
+
         // Create session
         session = processor.createSession(jlineTerminal.input(),
                 jlineTerminal.output(),
@@ -390,7 +393,6 @@ public class ConsoleSessionImpl implements Session {
      */
     private void welcomeBanner() {
         if (!isLocal() || System.getProperty(SUPPRESS_WELCOME) == null) {
-            Properties brandingProps = Branding.loadBrandingProperties(terminal);
             welcome(brandingProps);
             setSessionProperties(brandingProps);
             if (isLocal()) {
@@ -578,9 +580,8 @@ public class ConsoleSessionImpl implements Session {
                     if (p != null) {
                         prompt = p.toString();
                     } else {
-                        Properties properties = Branding.loadBrandingProperties(terminal);
-                        if (properties.getProperty(var) != null) {
-                            prompt = properties.getProperty(var);
+                        if (brandingProps.getProperty(var) != null) {
+                            prompt = brandingProps.getProperty(var);
                             // we put the PROMPT in ConsoleSession to avoid to read
                             // the properties file each time.
                             session.put(var, prompt);


Mime
View raw message