You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pekko.apache.org by fa...@apache.org on 2024/01/20 21:12:50 UTC

(incubator-pekko-management) branch main updated: performance change to loadCertificates (#152)

This is an automated email from the ASF dual-hosted git repository.

fanningpj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-pekko-management.git


The following commit(s) were added to refs/heads/main by this push:
     new 76591c9f performance change to loadCertificates (#152)
76591c9f is described below

commit 76591c9fd6f2515578c9adb91887afba3ef5c4d9
Author: PJ Fanning <pj...@users.noreply.github.com>
AuthorDate: Sat Jan 20 22:12:44 2024 +0100

    performance change to loadCertificates (#152)
    
    * performance change to loadCertificates
    
    * Update PemManagersProvider.scala
    
    * Update PemManagersProvider.scala
---
 .../scala/org/apache/pekko/pki/kubernetes/PemManagersProvider.scala  | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/management-pki/src/main/scala/org/apache/pekko/pki/kubernetes/PemManagersProvider.scala b/management-pki/src/main/scala/org/apache/pekko/pki/kubernetes/PemManagersProvider.scala
index d9377b01..56a835da 100644
--- a/management-pki/src/main/scala/org/apache/pekko/pki/kubernetes/PemManagersProvider.scala
+++ b/management-pki/src/main/scala/org/apache/pekko/pki/kubernetes/PemManagersProvider.scala
@@ -13,7 +13,7 @@
 
 package org.apache.pekko.pki.kubernetes
 
-import java.io.{ ByteArrayInputStream, File }
+import java.io.File
 import java.nio.charset.StandardCharsets
 import java.nio.file.Files
 import java.security.{ KeyStore, PrivateKey }
@@ -67,8 +67,7 @@ private[pekko] object PemManagersProvider {
    * INTERNAL API
    */
   @InternalApi def loadCertificates(filename: String): Iterable[Certificate] = blocking {
-    val bytes = Files.readAllBytes(new File(filename).toPath)
-    certFactory.generateCertificates(new ByteArrayInputStream(bytes)).asScala
+    certFactory.generateCertificates(Files.newInputStream(new File(filename).toPath)).asScala
   }
 
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org