Revision d81181d8
Added by Andreas Kohlbecker over 4 years ago
src/main/java/eu/etaxonomy/cdm/server/Bootloader.java | ||
---|---|---|
31 | 31 |
import java.io.InputStreamReader; |
32 | 32 |
import java.io.OutputStream; |
33 | 33 |
import java.lang.management.ManagementFactory; |
34 |
import java.net.MalformedURLException; |
|
34 | 35 |
import java.net.URL; |
35 | 36 |
import java.util.ArrayList; |
36 | 37 |
import java.util.List; |
... | ... | |
469 | 470 |
// QueuedThreadPool threadPool = new QueuedThreadPool(JvmManager.availableProcessors() + + 200); |
470 | 471 |
// server = new Server(threadPool); |
471 | 472 |
server = new Server(); |
473 |
|
|
474 |
jdk8MemleakFix(); |
|
475 |
|
|
472 | 476 |
server.addLifeCycleListener(instanceManager); |
473 | 477 |
ServerConnector connector=new ServerConnector(server); |
474 | 478 |
connector.setPort(httpPort); |
... | ... | |
563 | 567 |
} |
564 | 568 |
} |
565 | 569 |
|
570 |
/** |
|
571 |
* jdk8 memleak workaround: disable url caching |
|
572 |
* see https://dev.e-taxonomy.eu/redmine/issues/5048 |
|
573 |
* |
|
574 |
* @throws IOException |
|
575 |
* @throws MalformedURLException |
|
576 |
*/ |
|
577 |
private void jdk8MemleakFix() throws IOException, MalformedURLException { |
|
578 |
String javaVersion = System.getProperty("java.version"); |
|
579 |
if(javaVersion.startsWith("1.8")){ |
|
580 |
logger.info("jdk8 detected (" + javaVersion + ") disabling url caching to avoid memory leak."); |
|
581 |
org.eclipse.jetty.util.resource.Resource.setDefaultUseCaches(false); |
|
582 |
File tmpio = new File(System.getProperty("java.io.tmpdir")); |
|
583 |
tmpio.toURI().toURL().openConnection().setDefaultUseCaches(false); |
|
584 |
} |
|
585 |
} |
|
586 |
|
|
566 | 587 |
/** |
567 | 588 |
* @param classpath |
568 | 589 |
*/ |
Also available in: Unified diff
fix #5048 disabling url caching for jdk1.8 to avoid memleak