Kaydet (Commit) bb59742b authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Confine JDBC driver to thread-affine apartment for Java 6 performance

... so that the massive number of the JDBC driver's calls to JNI Attach/Detach-
CurrentThread are guaranteed not to happen on the main thread (where they are
extremely expensive, see
<http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6978641> "Fix for 6929067
introduces additional overhead in thread creation/termination paths").
üst 1b8b6ecf
component_getImplementationEnvironment
component_getFactory component_getFactory
...@@ -83,7 +83,21 @@ struct ProviderRequest ...@@ -83,7 +83,21 @@ struct ProviderRequest
void* getProvider() const { return xRet.get(); } void* getProvider() const { return xRet.get(); }
}; };
//--------------------------------------------------------------------------------------- extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL
component_getImplementationEnvironment(
char const ** ppEnvTypeName, uno_Environment **)
{
// Recent Java 6 VMs make calls to JNI Attach/DetachCurrentThread (which
// this code does extensively) very expensive. A follow-up JVM fix reduced
// the overhead significantly again for all threads but the main thread. So
// a quick hack to improve performance of this component again is to confine
// it in the affine apartment (where all code will run on a single,
// dedicated thread that is guaranteed no to be the main thread). However,
// a better fix would still be to redesign the code so that it does not call
// Attach/DetachCurrentThread so frequently:
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ":affine";
}
extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
const sal_Char* pImplementationName, const sal_Char* pImplementationName,
void* pServiceManager, void* pServiceManager,
......
...@@ -78,8 +78,6 @@ SLOFILES=\ ...@@ -78,8 +78,6 @@ SLOFILES=\
$(SLO)$/tools.obj \ $(SLO)$/tools.obj \
$(SLO)$/ContextClassLoader.obj $(SLO)$/ContextClassLoader.obj
SHL1VERSIONMAP=$(SOLARENV)/src/component.map
# --- Library ----------------------------------- # --- Library -----------------------------------
SHL1TARGET= $(JDBC_TARGET)$(DLLPOSTFIX) SHL1TARGET= $(JDBC_TARGET)$(DLLPOSTFIX)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment