Author: rhuijben
Date: Fri Aug  5 13:54:06 2011
New Revision: 1154215

URL: http://svn.apache.org/viewvc?rev=1154215&view=rev
Log:
In JavaHL: Make ClientContext cache the user settings. On Windows this somehow

seems to have more performance impact than keeping the SQLite databases open.
(Guess: probably filesystem cache behavior. Performance tested with SharpSvn;
 not JavaHL)

* subversion/bindings/javahl/native/ClientContext.cpp
  (ClientContext::ClientContext): Initialize m_pool.
  (ClientContext::getContext): Only when the config wasn't loaded before, load
    the config in the client pool and store a reference in the backup location.
  (ClientContext::setConfigDirectory): Clear the reference to the configuration
    hash to force reloading.

* subversion/bindings/javahl/native/ClientContext.h
  (ClientContext): Add pool reference.

Modified:
    subversion/trunk/subversion/bindings/javahl/native/ClientContext.cpp
    subversion/trunk/subversion/bindings/javahl/native/ClientContext.h

Modified: subversion/trunk/subversion/bindings/javahl/native/ClientContext.cpp
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/ClientContext.cpp?rev=1154215&r1=1154214&r2=1154215&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/ClientContext.cpp 
(original)
+++ subversion/trunk/subversion/bindings/javahl/native/ClientContext.cpp Fri 
Aug  5 13:54:06 2011
@@ -96,6 +96,7 @@ ClientContext::ClientContext(jobject jsv
     m_context->conflict_baton2 = m_jctx;
 
     m_context->client_name = "javahl";
+    m_pool = &pool;
 }
 
 ClientContext::~ClientContext()
@@ -154,14 +155,22 @@ ClientContext::getContext(CommitMessage 
                               clear_ctx_ptrs);
 
 
-    const char *configDir = m_configDir.c_str();
-    if (m_configDir.length() == 0)
-        configDir = NULL;
-    SVN_JNI_ERR(svn_config_get_config(&(ctx->config), configDir, pool), NULL);
+    if (!ctx->config)
+      {
+        const char *configDir = m_configDir.c_str();
+        if (m_configDir.length() == 0)
+            configDir = NULL;
+        SVN_JNI_ERR(svn_config_get_config(&(ctx->config), configDir,
+                                          m_pool->getPool()),
+                    NULL);
+
+        bt->backup->config = ctx->config;
+      }
     svn_config_t *config = (svn_config_t *) apr_hash_get(ctx->config,
                                                          
SVN_CONFIG_CATEGORY_CONFIG,
                                                          APR_HASH_KEY_STRING);
 
+
     /* The whole list of registered providers */
     apr_array_header_t *providers;
 
@@ -289,6 +298,7 @@ ClientContext::setConfigDirectory(const 
     SVN_JNI_ERR(svn_config_ensure(configDir, requestPool.getPool()), );
 
     m_configDir = (configDir == NULL ? "" : configDir);
+    m_context->config = NULL;
 }
 
 const char *

Modified: subversion/trunk/subversion/bindings/javahl/native/ClientContext.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/ClientContext.h?rev=1154215&r1=1154214&r2=1154215&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/ClientContext.h 
(original)
+++ subversion/trunk/subversion/bindings/javahl/native/ClientContext.h Fri Aug  
5 13:54:06 2011
@@ -48,6 +48,7 @@ class ClientContext
 {
  private:
   svn_client_ctx_t *m_context;
+  const SVN::Pool *m_pool;
   jobject m_jctx;
 
   std::string m_userName;


Reply via email to