[MAGNOLIA-6523] Refactor ClasspathResourceOrigin and stabilise its hot resource modification support Created: 01/Feb/16 Updated: 04/Apr/16 Resolved: 16/Feb/16 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 5.4.5 |
| Type: | Task | Priority: | Neutral |
| Reporter: | Michael Mühlebach | Assignee: | Aleksandr Pchelintcev |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | 0d | ||
| Time Spent: | 6.5d | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Template: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Acceptance criteria: |
Empty
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Task DoR: |
Empty
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Release notes required: |
Yes
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Date of First Response: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Epic Link: | Resource reloading without restart | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Sprint: | Basel 31 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Story Points: | 13 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
ClasspathResourceOrigin suffers from several problems which are very hard to overcome without significant modifications of current implementation. The list of topics which needs attention includes:
Main issue as it appears is related to how classpath resources are retrieved at the moment. We heavily rely on the context ClassLoader to provide resource URLs, last modified dates and InputStreams. While such an approach works well for the case of production mode (i.e. classloader doesn't do and never needs to do any reloading), in dev mode when we can deliberately update, remove or add a resource - class loader may or may not be able to resolve it (similar how IDE's support class reloading - a new/deleted/modified class support is there, but limited and somewhat unreliable => such tools as JRebel exist and bloom). Attempt to obtain via classloader a URL or contents of the resource which e.g. has been detected as a new by Reflections library (which looks into re-deployed jar files and doesn't rely on classloader itself) may lead to all sorts of IO/Runtime exceptions. The idea which could help in such case is to obviously stop unconditionally relying on the classloader but rather maintain the ability to point the classpath resources directly into the deployed jars and should file stream be needed - refer to jar file itself. Hereby it is proposed to take the following actions to improve the situation with the classpath resources support:
|