Repository: camel
Updated Branches:
  refs/heads/camel-2.16.x ea29c9572 -> 58e8125d6


Optimize toString on camel-ftp consumer/producer


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/58e8125d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/58e8125d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/58e8125d

Branch: refs/heads/camel-2.16.x
Commit: 58e8125d6861d2ee5581c3c6c2be53b5e22f3c12
Parents: ea29c95
Author: Andrea Cosentino <anco...@gmail.com>
Authored: Sat Feb 13 12:04:09 2016 +0100
Committer: Andrea Cosentino <anco...@gmail.com>
Committed: Sat Feb 13 12:05:38 2016 +0100

----------------------------------------------------------------------
 .../org/apache/camel/component/file/remote/FtpConsumer.java   | 7 ++++++-
 .../camel/component/file/remote/RemoteFileProducer.java       | 7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/58e8125d/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java
----------------------------------------------------------------------
diff --git 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java
 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java
index 820fc28..c0a37fe 100644
--- 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java
+++ 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java
@@ -34,6 +34,8 @@ import org.apache.commons.net.ftp.FTPFile;
 public class FtpConsumer extends RemoteFileConsumer<FTPFile> {
 
     protected String endpointPath;
+   
+    private transient String ftpConsumerToString;
 
     public FtpConsumer(RemoteFileEndpoint<FTPFile> endpoint, Processor 
processor, RemoteFileOperations<FTPFile> fileOperations) {
         super(endpoint, processor, fileOperations);
@@ -263,6 +265,9 @@ public class FtpConsumer extends 
RemoteFileConsumer<FTPFile> {
 
     @Override
     public String toString() {
-        return "FtpConsumer[" + 
URISupport.sanitizeUri(getEndpoint().getEndpointUri()) + "]";
+        if (ftpConsumerToString == null) {
+            ftpConsumerToString = "FtpConsumer[" + 
URISupport.sanitizeUri(getEndpoint().getEndpointUri()) + "]";
+        }
+        return ftpConsumerToString;
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/58e8125d/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java
----------------------------------------------------------------------
diff --git 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java
 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java
index 7ad27fa..32a8a62 100644
--- 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java
+++ 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java
@@ -30,6 +30,8 @@ public class RemoteFileProducer<T> extends 
GenericFileProducer<T> implements Ser
 
     private boolean loggedIn;
     
+    private transient String remoteFileProducerToString;
+    
     protected RemoteFileProducer(RemoteFileEndpoint<T> endpoint, 
RemoteFileOperations<T> operations) {
         super(endpoint, operations);
     }
@@ -219,6 +221,9 @@ public class RemoteFileProducer<T> extends 
GenericFileProducer<T> implements Ser
 
     @Override
     public String toString() {
-        return "RemoteFileProducer[" + 
URISupport.sanitizeUri(getEndpoint().getEndpointUri()) + "]";
+        if (remoteFileProducerToString == null) {
+            remoteFileProducerToString = "RemoteFileProducer[" + 
URISupport.sanitizeUri(getEndpoint().getEndpointUri()) + "]";
+        }
+        return remoteFileProducerToString;
     }
 }

Reply via email to