Created
December 9, 2016 14:59
-
-
Save TuxCoding/d61927af33ae8a15e36e2e9f1d1a318e to your computer and use it in GitHub Desktop.
Disable jar resources cache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Disable or enable the use of class caching. Workaround for linking to an | |
| * old jar version while the plugin jar was changed during a reload. | |
| * | |
| * @param status should the cache be activated | |
| * @return if the process succeed. | |
| */ | |
| public static boolean setClassCache(boolean status) { | |
| try { | |
| Field cacheField = URLConnection.class.getDeclaredField("defaultUseCaches"); | |
| cacheField.setAccessible(true); | |
| cacheField.setBoolean(null, status); | |
| return true; | |
| } catch (Exception ex) { | |
| Logger.getLogger("").log(Level.SEVERE, null, ex); | |
| return false; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment