You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by "Andrei Pozolotin (JIRA)" <ji...@apache.org> on 2011/05/14 18:28:47 UTC
[jira] [Created] (PIVOT-742) pluggable classloader
pluggable classloader
---------------------
Key: PIVOT-742
URL: https://issues.apache.org/jira/browse/PIVOT-742
Project: Pivot
Issue Type: Improvement
Reporter: Andrei Pozolotin
pluggable classloader:
1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
motivation:
https://issues.apache.org/jira/browse/PIVOT-22
https://issues.apache.org/jira/browse/FELIX-2951
http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Andrei Pozolotin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13048926#comment-13048926 ]
Andrei Pozolotin commented on PIVOT-742:
----------------------------------------
workaround:
final BXMLSerializer bxml = new BXMLSerializer(loader) {
@Override
protected Serializer<?> newIncludeSerializer(
Class<? extends Serializer<?>> type)
throws InstantiationException, IllegalAccessException {
log.debug("type : {}", type.getName());
if (type == BXMLSerializer.class) {
return new BXMLSerializer(loader);
}
return type.newInstance();
}
};
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Attachments: CLPlugin.java, CLPluginTCCL.java, CLProvider.java, UseCase.java
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Andrei Pozolotin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13048928#comment-13048928 ]
Andrei Pozolotin commented on PIVOT-742:
----------------------------------------
1) removes this constructor:
new BXMLSerializer(loader)
2) replaces places like this:
if (classLoader == null) {
propertyClass = Class.forName(propertyClassName);
} else {
propertyClass = Class.forName(propertyClassName, true, classLoader);
}
with "normal" TCCL:
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
propertyClass = Class.forName(propertyClassName, true, classLoader);
which is consistent with 100 and 5 other places pivot uses TCCL? :-)
thanks,
Andrei.
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Attachments: CLPlugin.java, CLPluginTCCL.java, CLProvider.java, UseCase.java
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Andrei Pozolotin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13049837#comment-13049837 ]
Andrei Pozolotin commented on PIVOT-742:
----------------------------------------
Greg, Sandro:
please review and apply:
patch_2011-06-15_bxml-classloader.patch
thank you;
Andrei.
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Attachments: CLPlugin.java, CLPluginTCCL.java, CLProvider.java, UseCase.java, patch_2011-06-15_bxml-classloader.patch
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Issue Comment Edited] (PIVOT-742) pluggable classloader
Posted by "Andrei Pozolotin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13049325#comment-13049325 ]
Andrei Pozolotin edited comment on PIVOT-742 at 6/14/11 6:37 PM:
-----------------------------------------------------------------
actually, should also repalce Class.forName(loader) with Class type = loader.loadClass(className);
was (Author: andrei.pozolotin):
actually, should also repalce Class.forName(loader) with Class appenderClass = loader.loadClass(className);
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Attachments: CLPlugin.java, CLPluginTCCL.java, CLProvider.java, UseCase.java, patch_2011-06-15_bxml-classloader.patch
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (PIVOT-742) pluggable classloader
Posted by "Andrei Pozolotin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andrei Pozolotin updated PIVOT-742:
-----------------------------------
Attachment: RunTCCL.java
RunResult.java
RunEnque.java
BeanUtil.java
in case you DO want to include this in pivot util, here is how I use it now:
attached:
BeanUtil.java
RunEnque.java
RunResult.java
RunTCCL.java
example:
new RunEnque() {
@Override
protected void runEnque() throws Exception {
window = BeanUtil.loadBxml(SpaceWindow.class);
window.open(hostApp.getDisplay());
}
}.await();
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Assignee: Sandro Martini
> Fix For: 2.0.1
>
> Attachments: BeanUtil.java, CLPlugin.java, CLPluginTCCL.java, CLProvider.java, RunEnque.java, RunResult.java, RunTCCL.java, UseCase.java, patch_2011-06-15_bxml-classloader.patch
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Andrei Pozolotin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13051079#comment-13051079 ]
Andrei Pozolotin commented on PIVOT-742:
----------------------------------------
@Greg: thank you.
@Sandro:
re: "this issue is not closed, right ", no, this issue (PIVOT-742) is NOT closed;
the patch_2011-06-15_bxml-classloader.patch is just a step towards unification of all class loading in pivot via TCCL;
later TCCL should be replaced with "actual pluggable classloader", which this issue (PIVOT-742) is tracking.
(note that there are still about 10 other places in pivot that do not use TCCL for classloading, and they will produce problems in osgi; I just did not run into them yet.)
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Assignee: Sandro Martini
> Fix For: 2.0.1
>
> Attachments: BeanUtil.java, CLPlugin.java, CLPluginTCCL.java, CLProvider.java, RunEnque.java, RunResult.java, RunTCCL.java, UseCase.java, patch_2011-06-15_bxml-classloader.patch
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Andrei Pozolotin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13051116#comment-13051116 ]
Andrei Pozolotin commented on PIVOT-742:
----------------------------------------
re: "we are Ok, right ? " YES. :-)
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Assignee: Sandro Martini
> Fix For: 2.1
>
> Attachments: BeanUtil.java, CLPlugin.java, CLPluginTCCL.java, CLProvider.java, RunEnque.java, RunResult.java, RunTCCL.java, UseCase.java, patch_2011-06-15_bxml-classloader.patch
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Issue Comment Edited] (PIVOT-742) pluggable classloader
Posted by "Andrei Pozolotin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13048928#comment-13048928 ]
Andrei Pozolotin edited comment on PIVOT-742 at 6/14/11 1:12 AM:
-----------------------------------------------------------------
Greg, hi;
re: https://issues.apache.org/jira/browse/PIVOT-742
do you think you could accept a patch for BXMLSerializer that:
1) removes this constructor:
new BXMLSerializer(loader)
2) replaces places like this:
if (classLoader == null) {
propertyClass = Class.forName(propertyClassName);
} else {
propertyClass = Class.forName(propertyClassName, true, classLoader);
}
with "normal" TCCL:
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
propertyClass = Class.forName(propertyClassName, true, classLoader);
which is consistent with 100 and 5 other places pivot uses TCCL? :-)
thanks,
Andrei.
was (Author: andrei.pozolotin):
1) removes this constructor:
new BXMLSerializer(loader)
2) replaces places like this:
if (classLoader == null) {
propertyClass = Class.forName(propertyClassName);
} else {
propertyClass = Class.forName(propertyClassName, true, classLoader);
}
with "normal" TCCL:
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
propertyClass = Class.forName(propertyClassName, true, classLoader);
which is consistent with 100 and 5 other places pivot uses TCCL? :-)
thanks,
Andrei.
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Attachments: CLPlugin.java, CLPluginTCCL.java, CLProvider.java, UseCase.java
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Andrei Pozolotin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13033580#comment-13033580 ]
Andrei Pozolotin commented on PIVOT-742:
----------------------------------------
note that currenlty this classloader:
public BXMLSerializer(final ClassLoader classLoader) {
this();
this.classLoader = classLoader;
}
is not used for any TCCL
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Chris Bartlett (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13051089#comment-13051089 ]
Chris Bartlett commented on PIVOT-742:
--------------------------------------
Andrei - Can you please post a quick summary of the state of this ticket?
What else needs to be done after the patch_2011-06-15_bxml-classloader.patch?
And as Sandro suggested, I agree that adding subtasks might help to track the various issues better.
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Assignee: Sandro Martini
> Fix For: 2.0.1
>
> Attachments: BeanUtil.java, CLPlugin.java, CLPluginTCCL.java, CLProvider.java, RunEnque.java, RunResult.java, RunTCCL.java, UseCase.java, patch_2011-06-15_bxml-classloader.patch
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Sandro Martini (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13051083#comment-13051083 ]
Sandro Martini commented on PIVOT-742:
--------------------------------------
Andrei, with the subtask we can keep track that something on this issue has already been fixed in the 2.0.1, because I think for the full solution it's better to do in the 2.1 release (even from what I've read in previous comments here), the 2.0.1 is only a bug fix release so I'd prefer in this way ... to avoid regressions.
But if you find other problems (but testable even by us) we can try to push even them in the 2.0.1.
Greg do you agree with me ?
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Assignee: Sandro Martini
> Fix For: 2.0.1
>
> Attachments: BeanUtil.java, CLPlugin.java, CLPluginTCCL.java, CLProvider.java, RunEnque.java, RunResult.java, RunTCCL.java, UseCase.java, patch_2011-06-15_bxml-classloader.patch
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Sandro Martini (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13051104#comment-13051104 ]
Sandro Martini commented on PIVOT-742:
--------------------------------------
Ok, I'll create the subtask (and after the commit of the patch I'll mark it as resolved), and move the current issue to 2.1 .
Andrei, for the massive patch thank you very much, but I'd wait until we close the 2.0.1 (now could be too early for that patch) ... at the moment the 2.0.1 is in trunk, but after freezing the 2.0.1 it will be moved in a maintenance branch and we can really start developments for the 2.1. I'll keep you updated on when this will be necessary.
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Assignee: Sandro Martini
> Fix For: 2.1
>
> Attachments: BeanUtil.java, CLPlugin.java, CLPluginTCCL.java, CLProvider.java, RunEnque.java, RunResult.java, RunTCCL.java, UseCase.java, patch_2011-06-15_bxml-classloader.patch
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Andrei Pozolotin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13049390#comment-13049390 ]
Andrei Pozolotin commented on PIVOT-742:
----------------------------------------
advice from Richard:
https://issues.apache.org/jira/browse/FELIX-2951
#################################################
* Bracket calls into libraries using TCCL to set/unset it to the
desired value.
* Modify libraries using TCCL to better guess which class loader to use.
o Maybe the client passes a client-side object which has the
correct class loader.
o Explicitly ask for a class loader in the library method.
* Use services.
* Use own context finder.
#################################################
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Attachments: CLPlugin.java, CLPluginTCCL.java, CLProvider.java, UseCase.java, patch_2011-06-15_bxml-classloader.patch
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Andrei Pozolotin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13049183#comment-13049183 ]
Andrei Pozolotin commented on PIVOT-742:
----------------------------------------
re: "eliminate all references to TCCL" - yes. long term;
last request above
https://issues.apache.org/jira/browse/PIVOT-742?focusedCommentId=13048928&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13048928
is just a step in that direction:
a) NOW: normalize all Class.forName to use TCCL
b) LATER: replace TCCL with pluggable classloader
the current need is this:
https://issues.apache.org/jira/browse/PIVOT-742?focusedCommentId=13048840&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13048840
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Attachments: CLPlugin.java, CLPluginTCCL.java, CLProvider.java, UseCase.java
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Andrei Pozolotin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13033583#comment-13033583 ]
Andrei Pozolotin commented on PIVOT-742:
----------------------------------------
short term cheap fix is to replace all BXMLSerializer.readObject(...) to something like this:
public class Util {
private static Logger log = LoggerFactory.getLogger(Util.class);
@SuppressWarnings("unchecked")
public static <T> T loadBXML(final Class<?> reference, final String resource) {
final Thread thread = Thread.currentThread();
final ClassLoader tccl = thread.getContextClassLoader();
T result = null;
try {
ClassLoader loader = reference.getClassLoader();
thread.setContextClassLoader(loader);
BXMLSerializer bxml = new BXMLSerializer(loader);
URL url = reference.getResource(resource);
result = (T) bxml.readObject(url);
} catch (Exception e) {
log.error("", e);
} finally {
thread.setContextClassLoader(tccl);
}
return result;
}
}
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (PIVOT-742) pluggable classloader
Posted by "Sandro Martini (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sandro Martini updated PIVOT-742:
---------------------------------
Fix Version/s: 2.0.1
Assignee: Sandro Martini
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Assignee: Sandro Martini
> Fix For: 2.0.1
>
> Attachments: CLPlugin.java, CLPluginTCCL.java, CLProvider.java, UseCase.java, patch_2011-06-15_bxml-classloader.patch
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Greg Brown (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13049164#comment-13049164 ]
Greg Brown commented on PIVOT-742:
----------------------------------
I don't remember exactly where we landed on this, but I thought we had decided that it would be best to eliminate all references to TCCL.
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Attachments: CLPlugin.java, CLPluginTCCL.java, CLProvider.java, UseCase.java
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Andrei Pozolotin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13051093#comment-13051093 ]
Andrei Pozolotin commented on PIVOT-742:
----------------------------------------
@Chris, @Sandro:
1) re:"adding subtasks might help" --- YES, patch_2011-06-15_bxml-classloader.patch should be a subtask for 2.0.1
2) re: "What else needs to be done after" --- a massive patch to replace TCCL in pivot with the proposed "pluggable classloader",
affects some 100 places in pivot, conceptually simple, but scary due to its scope; better to keep for 2.1.0-SNAPSHOT
I can produce it now, if anyone is willing to take a look :-)
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Assignee: Sandro Martini
> Fix For: 2.0.1
>
> Attachments: BeanUtil.java, CLPlugin.java, CLPluginTCCL.java, CLProvider.java, RunEnque.java, RunResult.java, RunTCCL.java, UseCase.java, patch_2011-06-15_bxml-classloader.patch
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Andrei Pozolotin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13050102#comment-13050102 ]
Andrei Pozolotin commented on PIVOT-742:
----------------------------------------
Sandro:
great! thanks for looking into this; yes, I will setup osgi test project and let you know;
Andrei.
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Assignee: Sandro Martini
> Fix For: 2.0.1
>
> Attachments: CLPlugin.java, CLPluginTCCL.java, CLProvider.java, UseCase.java, patch_2011-06-15_bxml-classloader.patch
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Sandro Martini (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13051056#comment-13051056 ]
Sandro Martini commented on PIVOT-742:
--------------------------------------
Ok, I'll commit the patch before the end of this week ... but I'll reopen the other issue and see how to solve Classloaders problems there ...
Only one thing: one time committed this patch, this issue is not closed, right ?
So probably could be good to create a sub-task of this and close it in the 2.0.1, and move this for the 2.1 to be solved in a general way, Ok ? Tell me.
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Assignee: Sandro Martini
> Fix For: 2.0.1
>
> Attachments: BeanUtil.java, CLPlugin.java, CLPluginTCCL.java, CLProvider.java, RunEnque.java, RunResult.java, RunTCCL.java, UseCase.java, patch_2011-06-15_bxml-classloader.patch
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Andrei Pozolotin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13050855#comment-13050855 ]
Andrei Pozolotin commented on PIVOT-742:
----------------------------------------
Greg:
Sandro says the patch is good enough. can you please sign off? thank you;
Andrei.
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Assignee: Sandro Martini
> Fix For: 2.0.1
>
> Attachments: BeanUtil.java, CLPlugin.java, CLPluginTCCL.java, CLProvider.java, RunEnque.java, RunResult.java, RunTCCL.java, UseCase.java, patch_2011-06-15_bxml-classloader.patch
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Greg Brown (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13051016#comment-13051016 ]
Greg Brown commented on PIVOT-742:
----------------------------------
I don't need to sign off. Sandro has commit rights as well. :-)
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Assignee: Sandro Martini
> Fix For: 2.0.1
>
> Attachments: BeanUtil.java, CLPlugin.java, CLPluginTCCL.java, CLProvider.java, RunEnque.java, RunResult.java, RunTCCL.java, UseCase.java, patch_2011-06-15_bxml-classloader.patch
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (PIVOT-742) pluggable classloader
Posted by "Andrei Pozolotin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andrei Pozolotin updated PIVOT-742:
-----------------------------------
Attachment: UseCase.java
CLProvider.java
CLPluginTCCL.java
CLPlugin.java
basic idea
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Attachments: CLPlugin.java, CLPluginTCCL.java, CLProvider.java, UseCase.java
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Sandro Martini (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13033926#comment-13033926 ]
Sandro Martini commented on PIVOT-742:
--------------------------------------
As written here ( https://issues.apache.org/jira/browse/PIVOT-22?focusedCommentId=13033922&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13033922 ) I think it's a good solution, even in the short-time period using some workaround.
And on the Util class, maybe we could put this in a static (Ok, I know it's not the best) method or in a new, support class, or maybe inside the BXMLSerializer ...
Greg, what do you think ?
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Attachments: CLPlugin.java, CLPluginTCCL.java, CLProvider.java, UseCase.java
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Andrei Pozolotin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13049325#comment-13049325 ]
Andrei Pozolotin commented on PIVOT-742:
----------------------------------------
actually, should also repalce Class.forName(loader) with Class appenderClass = loader.loadClass(className);
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Attachments: CLPlugin.java, CLPluginTCCL.java, CLProvider.java, UseCase.java, patch_2011-06-15_bxml-classloader.patch
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (PIVOT-742) pluggable classloader
Posted by "Andrei Pozolotin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andrei Pozolotin updated PIVOT-742:
-----------------------------------
Attachment: patch_2011-06-15_bxml-classloader.patch
Greg, Sandro:
please review and apply:
patch_2011-06-15_bxml-classloader.patch
thank you;
Andrei.
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Attachments: CLPlugin.java, CLPluginTCCL.java, CLProvider.java, UseCase.java, patch_2011-06-15_bxml-classloader.patch
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Andrei Pozolotin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13033712#comment-13033712 ]
Andrei Pozolotin commented on PIVOT-742:
----------------------------------------
but should avoid static in provider: https://issues.apache.org/jira/browse/PIVOT-743
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Attachments: CLPlugin.java, CLPluginTCCL.java, CLProvider.java, UseCase.java
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Greg Brown (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13049843#comment-13049843 ]
Greg Brown commented on PIVOT-742:
----------------------------------
I don't currently have time to review and consider the implications of this patch. Is someone else willing to take a look at this?
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Attachments: CLPlugin.java, CLPluginTCCL.java, CLProvider.java, UseCase.java, patch_2011-06-15_bxml-classloader.patch
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Sandro Martini (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13050392#comment-13050392 ]
Sandro Martini commented on PIVOT-742:
--------------------------------------
Hi all,
patch applied and all my tests (executing many of our Demos) were successful (even with Web Start), so if there aren't objections, in a few days I'll apply it. Thank you again to Andrei.
BUT wait a minute:
after applying this patch I see that it's no more possible to set an arbitrary classloader so this could reopen the issue 687 ( https://issues.apache.org/jira/browse/PIVOT-687 ), so at this point I think we should leave both ways open:
if used the (new but deprecated ? :-) ) constructor, set a private final classloader, and in all places here if not null use it, otherwise fallback on the classloader of this patch ... what do you think ?
In the meantime I'll try to contact Gerrick Bivins (who ask to us the feature of the issue 687) and ask if the proposed solution could work even for him (under NetBeans Platform) ...
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Assignee: Sandro Martini
> Fix For: 2.0.1
>
> Attachments: CLPlugin.java, CLPluginTCCL.java, CLProvider.java, UseCase.java, patch_2011-06-15_bxml-classloader.patch
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Andrei Pozolotin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13050537#comment-13050537 ]
Andrei Pozolotin commented on PIVOT-742:
----------------------------------------
re: "only we have to see where to put that code"
the TCCL bracket example is not to be made a part of pivot itself; it is for use by pivot clients only,
in cases when they need to manage class loader context switch like my osgi host;
"normal" people will not be even aware :-)
re: "could be safe even to remove the BXMLSerializer with the Classloader as parameter"
YES.
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Assignee: Sandro Martini
> Fix For: 2.0.1
>
> Attachments: CLPlugin.java, CLPluginTCCL.java, CLProvider.java, UseCase.java, patch_2011-06-15_bxml-classloader.patch
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (PIVOT-742) pluggable classloader
Posted by "Andrei Pozolotin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andrei Pozolotin updated PIVOT-742:
-----------------------------------
Fix Version/s: (was: 2.0.1)
2.1
changing version to 2.1 for main ticket
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Assignee: Sandro Martini
> Fix For: 2.1
>
> Attachments: BeanUtil.java, CLPlugin.java, CLPluginTCCL.java, CLProvider.java, RunEnque.java, RunResult.java, RunTCCL.java, UseCase.java, patch_2011-06-15_bxml-classloader.patch
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Sandro Martini (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13051111#comment-13051111 ]
Sandro Martini commented on PIVOT-742:
--------------------------------------
Andrei, I think that for now here we are Ok, right ?
For anything related to the 2.1 we could write here (or maybe in the other subtask for the 2.1, this is already very long), and write in the subtask for the 2.0.1 if you find other bugs (or small-impact issues) related to 2.0.1 release (or be free to create others but as subtask).
Thank you again.
Bye
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Assignee: Sandro Martini
> Fix For: 2.1
>
> Attachments: BeanUtil.java, CLPlugin.java, CLPluginTCCL.java, CLProvider.java, RunEnque.java, RunResult.java, RunTCCL.java, UseCase.java, patch_2011-06-15_bxml-classloader.patch
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Sandro Martini (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13050095#comment-13050095 ]
Sandro Martini commented on PIVOT-742:
--------------------------------------
Hi all,
I can try to look at it in next days, but to test that is will not break something I could only run some of our test applications (even under Web Start, important for me) ... while for tests in more complex environments (like OSGi) probably we could think to set-up a mavenized test project for this (or ask Andrei if has something like this) that could go under /skunk ...
And to not forget this, assign to the 2.0.1 release (but probably it will be fixed with a full solution in 2.1) and to me, but if someone has more time than me is welcome to take over.
I'll keep you updated.
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Fix For: 2.0.1
>
> Attachments: CLPlugin.java, CLPluginTCCL.java, CLProvider.java, UseCase.java, patch_2011-06-15_bxml-classloader.patch
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Andrei Pozolotin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13040604#comment-13040604 ]
Andrei Pozolotin commented on PIVOT-742:
----------------------------------------
another note: TCCL would be good if it were not limited to a single field. something like thread loacal map would be better:
@SuppressWarnings("serial")
public class PivotContext extends HashMap<String, Object> {
private static final ThreadLocal<PivotContext> CURRENT = new ThreadLocal<PivotContext>();
public static PivotContext getCurrent() {
return CURRENT.get();
}
static {
CURRENT.set(new PivotContext());
}
}
class UseCase {
static final String PROP_PREFIX = UseCase.class.getName();
static final String PROP_CLASLOADER = PROP_PREFIX + ".classloader";
{
ClassLoader classloader = (ClassLoader) PivotContext.getCurrent().get(
PROP_CLASLOADER);
}
}
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Attachments: CLPlugin.java, CLPluginTCCL.java, CLProvider.java, UseCase.java
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Sandro Martini (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13050524#comment-13050524 ]
Sandro Martini commented on PIVOT-742:
--------------------------------------
Hi Andrei,
don't get me wrong, your solution is more useful than my (little hack) in PIVOT-687 ... probably you have reason, and it's better to handle the case of PIVOT-687 (that's not a common use case) in another way (like you proposed in your previous comment, only we have to see where to put that code ... not in BXMLSerializer, maybe in another utility class).
So could be safe even to remove the BXMLSerializer with the Classloader as parameter (new in 2.0.1).
And then update the PIVOT-687 ticket with the latest changes.
Greg, what do you think ?
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Assignee: Sandro Martini
> Fix For: 2.0.1
>
> Attachments: CLPlugin.java, CLPluginTCCL.java, CLProvider.java, UseCase.java, patch_2011-06-15_bxml-classloader.patch
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Re: [jira] [Commented] (PIVOT-742) pluggable classloader
Posted by Andrei Pozolotin <an...@gmail.com>.
Greg, hi;
re: https://issues.apache.org/jira/browse/PIVOT-742
do you think you could accept a patch for BXMLSerializer that:
1) removes this constructor:
new BXMLSerializer(loader)
2) replaces places like this:
if (classLoader == null) {
propertyClass =
Class.forName(propertyClassName);
} else {
propertyClass =
Class.forName(propertyClassName, true, classLoader);
}
with "normal" TCCL:
ClassLoader classLoader =
Thread.currentThread().getContextClassLoader();
propertyClass = Class.forName(propertyClassName, true, classLoader);
which is consistent with 100 and 5 other places pivot uses TCCL? :-)
thanks,
Andrei.
-------- Original Message --------
Subject: [jira] [Commented] (PIVOT-742) pluggable classloader
From: Andrei Pozolotin (JIRA) <ji...@apache.org>
To: dev@pivot.apache.org
Date: Mon 13 Jun 2011 05:35:49 PM CDT
> [ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13048840#comment-13048840 ]
>
> Andrei Pozolotin commented on PIVOT-742:
> ----------------------------------------
>
> one more place that ignores both TCCL & and loader provided via BXMLSerializer(final ClassLoader classLoader) :
>
> public class BXMLSerializer implements Serializer<Object>, Resolvable {
>
> protected Serializer<?> newIncludeSerializer(Class<? extends Serializer<?>> type)
> throws InstantiationException, IllegalAccessException {
> return type.newInstance();
> }
>
>
> protected Object newTypedObject(Class<?> type)
> throws InstantiationException, IllegalAccessException {
> return type.newInstance();
> }
>
>
>
>> pluggable classloader
>> ---------------------
>>
>> Key: PIVOT-742
>> URL: https://issues.apache.org/jira/browse/PIVOT-742
>> Project: Pivot
>> Issue Type: Improvement
>> Reporter: Andrei Pozolotin
>> Attachments: CLPlugin.java, CLPluginTCCL.java, CLProvider.java, UseCase.java
>>
>>
>> pluggable classloader:
>> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
>> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
>> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
>> motivation:
>> https://issues.apache.org/jira/browse/PIVOT-22
>> https://issues.apache.org/jira/browse/FELIX-2951
>> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
>> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
>> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
>> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
>>
>
> --
> This message is automatically generated by JIRA.
> For more information on JIRA, see: http://www.atlassian.com/software/jira
>
>
>
>
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Andrei Pozolotin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13048840#comment-13048840 ]
Andrei Pozolotin commented on PIVOT-742:
----------------------------------------
one more place that ignores both TCCL & and loader provided via BXMLSerializer(final ClassLoader classLoader) :
public class BXMLSerializer implements Serializer<Object>, Resolvable {
protected Serializer<?> newIncludeSerializer(Class<? extends Serializer<?>> type)
throws InstantiationException, IllegalAccessException {
return type.newInstance();
}
protected Object newTypedObject(Class<?> type)
throws InstantiationException, IllegalAccessException {
return type.newInstance();
}
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Attachments: CLPlugin.java, CLPluginTCCL.java, CLProvider.java, UseCase.java
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (PIVOT-742) pluggable classloader
Posted by "Andrei Pozolotin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIVOT-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13050479#comment-13050479 ]
Andrei Pozolotin commented on PIVOT-742:
----------------------------------------
Sandro:
1) the original solution PIVOT-687
had an error, namely, it ignored proper class loader in this part of BXMLSerializer:
protected Serializer<?> newIncludeSerializer(Class<? extends Serializer<?>> type)
throws InstantiationException, IllegalAccessException {
return type.newInstance();
}
this error results, in my case, that in osgi environment, I can not load nested bxml at all;
(since the snippet above ignores the classloader set via BXMLSerializer(loader) constructor)
2) instead of trying to retain compatibility PIVOT-687, I suggest to drop it completely;
also, patch_2011-06-15_bxml-classloader.patch is more consistent with how pivot-wtk
is using TCCL now all over the place, for example:
http://svn.apache.org/repos/asf/pivot/trunk/wtk/src/org/apache/pivot/wtk/ImageView.java
public final void setImage(String imageName) {
if (imageName == null) {
throw new IllegalArgumentException("imageName is null.");
}
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
setImage(classLoader.getResource(imageName.substring(1)));
}
the use of TCCL in pivot-wtk and BXMLSerializer(loader) in pivot-core is totally misleading & confusing :-)
3) so with patch_2011-06-15_bxml-classloader.patch there is only one way to deal with class loaders, not two;
and the current code which is using PIVOT-687 must be re-written to use what Richard above calls a "TCCL bracket", like this:
@Override
public final void run() {
final Thread thread = Thread.currentThread();
final ClassLoader pastLoader = thread.getContextClassLoader();
final ClassLoader thisLoader = getClass().getClassLoader();
try {
thread.setContextClassLoader(thisLoader);
/* INIT YOUR BXML HERE; BOTH PIVOT-CORE & PIVOT-WTK WILL USE thisLoader NOW */
} catch (Throwable e) {
log.error("", e);
} finally {
thread.setContextClassLoader(pastLoader);
}
}
am I making sense? :-)
Andrei.
> pluggable classloader
> ---------------------
>
> Key: PIVOT-742
> URL: https://issues.apache.org/jira/browse/PIVOT-742
> Project: Pivot
> Issue Type: Improvement
> Reporter: Andrei Pozolotin
> Assignee: Sandro Martini
> Fix For: 2.0.1
>
> Attachments: CLPlugin.java, CLPluginTCCL.java, CLProvider.java, UseCase.java, patch_2011-06-15_bxml-classloader.patch
>
>
> pluggable classloader:
> 1) in current pivot trunk, TCCL, Thread.currentThread().getContextClassLoader().... is mentioned 105 times
> I suggest to centralize it and replace with pluggable classloader (which can use TCCL by default);
> 2) review all other uses of Class.getResource(), which are not using TCCL, and convert when possible;
> motivation:
> https://issues.apache.org/jira/browse/PIVOT-22
> https://issues.apache.org/jira/browse/FELIX-2951
> http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements
> http://stackoverflow.com/questions/2198928/better-handling-of-thread-context-classloader-in-osgi
> http://mail-archives.apache.org/mod_mbox/pivot-user/201105.mbox/%3C4DCDF889.10506@gmail.com%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira