[
https://issues.apache.org/jira/browse/FELIX-3553?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13507183#comment-13507183
]
Ulf Lilleengen edited comment on FELIX-3553 at 11/30/12 8:31 AM:
-----------------------------------------------------------------
Ah, right. I made an assumption that it was not recursive on the same class
loader. Maybe the logic could be changed to something like this:
synchronized (m_classLocks) {
Thread me = Thread.currentThread();
while (m_classLocks.containsKey(name) &&
m_classLocks.get(name) != me) {
try {
m_classLocks.wait();
} catch (InterruptedException e) {
// TODO: WHAT TO DO HERE?
}
}
// Lock released, try loading class
clazz = findLoadedClass(name);
if (clazz == null) {
// Not found, we should try load it
m_classLocks.put(name, me);
}
Here I assume its ok to call findLoadedClass recursively though. Regarding the
InterruptedException, I'm not sure how to handle it other than rethrow as
runtimeexception.
Good point regarding java 7. I will try to rework it to work with older jvms
and add the recursive locking and attach a new patch. Thanks.
was (Author: lulf):
Ah, right. I made an assumption that it was not recursive on the same class
loader. Maybe the logic could be changed to something like this:
synchronized (m_classLocks) {
Thread me = Thread.currentThread();
while (m_classLocks.get(name) != me) {
try {
m_classLocks.wait();
} catch (InterruptedException e) {
// TODO: WHAT TO DO HERE?
}
}
// Lock released, try loading class
clazz = findLoadedClass(name);
if (clazz == null) {
// Not found, we should try load it
m_classLocks.put(name, me);
}
Here I assume its ok to call findLoadedClass recursively though. Regarding the
InterruptedException, I'm not sure how to handle it other than rethrow as
runtimeexception.
Good point regarding java 7. I will try to rework it to work with older jvms
and add the recursive locking and attach a new patch. Thanks.
> Use of parallel class loading capability of JDK7
> ------------------------------------------------
>
> Key: FELIX-3553
> URL: https://issues.apache.org/jira/browse/FELIX-3553
> Project: Felix
> Issue Type: Improvement
> Components: Framework
> Reporter: Sahoo
> Fix For: framework-4.2.0
>
> Attachments: FELIX-3553.txt, felix_parallel_classload_lock.patch,
> felix_parallel_classload.patch
>
>
> Is there any plan to make use of this feature [1] in Felix?
> [1]
> http://download.java.net/jdk7/archive/b124/docs/technotes/guides/lang/cl-mt.html
>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira