Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gemini » Inefficient locking on OSGiInitialContextFactoryBuilder(Bug)
Inefficient locking on OSGiInitialContextFactoryBuilder [message #1619447] Mon, 16 February 2015 15:36 Go to next message
Daniel Simeonov is currently offline Daniel SimeonovFriend
Messages: 1
Registered: February 2015
Junior Member
Hello,
There is the following problem.
Thread 1 does the following :

JMXConnectorFactory.connect(jmxurl, null);


Which leads to :
	at org.eclipse.gemini.naming.ServiceAwareContextFactory$DefaultServiceAwareInvocationHandler.invoke(Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;(ServiceAwareContextFactory.java:76)
	- locked <0x0000000049af1e10> (a org.eclipse.gemini.naming.OSGiInitialContextFactoryBuilder)
	[b]- locked <0x00000003b39435e0> (a org.eclipse.gemini.naming.ServiceAwareContextFactory$DefaultServiceAwareInvocationHandler)[/b]
	at com.sun.proxy.$Proxy0.lookup(Ljava/lang/String;)Ljava/lang/Object;(Unknown Source)
	at sun.reflect.GeneratedMethodAccessor251.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;(Method.java:597)
	at org.eclipse.gemini.naming.ReflectionUtils.invokeMethodOnObject(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;(ReflectionUtils.java:77)
	at org.eclipse.gemini.naming.ReflectionUtils.invokeMethodOnContext(Ljava/lang/reflect/Method;Ljavax/naming/Context;[Ljava/lang/Object;)Ljava/lang/Object;(ReflectionUtils.java:58)
	at org.eclipse.gemini.naming.TraditionalInitialContextFactoryBuilder$TraditionalContextInvocationHandler.invoke(Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;(TraditionalInitialContextFactoryBuilder.java:142)
	at com.sun.proxy.$Proxy0.lookup(Ljava/lang/String;)Ljava/lang/Object;(Unknown Source)
	at javax.naming.InitialContext.lookup(Ljava/lang/String;)Ljava/lang/Object;(InitialContext.java:392)
	at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(Ljava/lang/String;Ljava/util/Map;Z)Ljavax/management/remote/rmi/RMIServer;(RMIConnector.java:1888)
	at javax.management.remote.rmi.RMIConnector.findRMIServer(Ljavax/management/remote/JMXServiceURL;Ljava/util/Map;)Ljavax/management/remote/rmi/RMIServer;(RMIConnector.java:1858)
	at javax.management.remote.rmi.RMIConnector.connect(Ljava/util/Map;)V(RMIConnector.java:257)
	- locked <0x0000000079a0f5d8> (a javax.management.remote.rmi.RMIConnector)
	at javax.management.remote.JMXConnectorFactory.connect(Ljavax/management/remote/JMXServiceURL;Ljava/util/Map;)Ljavax/management/remote/JMXConnector;(JMXConnectorFactory.java:249)



On the other hand in another thread
new InitialContext()
is called which leads to the following :

- waiting to lock <0x0000000049af1e10> (a org.eclipse.gemini.naming.OSGiInitialContextFactoryBuilder)
	at org.eclipse.gemini.naming.SecurityAwareContextManagerImpl$NewInitialContextWithEnvironmentAction.run()Ljava/lang/Object;(SecurityAwareContextManagerImpl.java:122)
	at java.security.AccessController.doPrivileged(Ljava/security/PrivilegedExceptionAction;)Ljava/lang/Object;(Native Method)
	at org.eclipse.gemini.naming.SecurityUtils.invokePrivilegedAction(Ljava/security/PrivilegedExceptionAction;)Ljava/lang/Object;(SecurityUtils.java:45)
	at org.eclipse.gemini.naming.SecurityAwareContextManagerImpl.invokePrivilegedAction(Ljava/security/PrivilegedExceptionAction;)Ljava/lang/Object;(SecurityAwareContextManagerImpl.java:73)
	at org.eclipse.gemini.naming.SecurityAwareContextManagerImpl.newInitialContext(Ljava/util/Map;)Ljavax/naming/Context;(SecurityAwareContextManagerImpl.java:53)
	at org.eclipse.gemini.naming.TraditionalInitialContextFactoryBuilder$TraditionalInitialContextFactory.getInitialContext(Ljava/util/Hashtable;)Ljavax/naming/Context;(TraditionalInitialContextFactoryBuilder.java:98)
	at javax.naming.spi.NamingManager.getInitialContext(Ljava/util/Hashtable;)Ljavax/naming/Context;(NamingManager.java:667)
	at javax.naming.InitialContext.getDefaultInitCtx()Ljavax/naming/Context;(InitialContext.java:288)
	at javax.naming.InitialContext.init(Ljava/util/Hashtable;)V(InitialContext.java:223)
	at javax.naming.InitialContext.<init>()V(InitialContext.java:175)


So we hit the same lock just to get InitialContext . But the first thread is doing a remote network operation.
Please advise us how to proceed?

Best regards, Daniel.
Re: Inefficient locking on OSGiInitialContextFactoryBuilder [message #1623961 is a reply to message #1619447] Thu, 19 February 2015 12:58 Go to previous message
Violeta Georgieva is currently offline Violeta GeorgievaFriend
Messages: 276
Registered: October 2010
Senior Member
Hi,

Bug report is created [1].

Regards,
Violeta

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=460335
Previous Topic:Spring MVC with Blueprint Web?
Next Topic:ClassCastException when accessing reference-list ServiceReference
Goto Forum:
  


Current Time: Mon Sep 24 10:29:43 GMT 2018

Powered by FUDForum. Page generated in 0.02145 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top