mirror of
https://github.com/corda/corda.git
synced 2025-02-22 10:10:59 +00:00
CORDA-4120: Disable the URLConnection cache to prevent file handle leaks in ServiceLoader. (#6869)
This commit is contained in:
parent
20dbbf008d
commit
1a7401472f
@ -173,6 +173,7 @@ import org.jolokia.jvmagent.JolokiaServerConfig
|
|||||||
import org.slf4j.Logger
|
import org.slf4j.Logger
|
||||||
import rx.Scheduler
|
import rx.Scheduler
|
||||||
import java.lang.reflect.InvocationTargetException
|
import java.lang.reflect.InvocationTargetException
|
||||||
|
import java.net.URLConnection
|
||||||
import java.sql.Connection
|
import java.sql.Connection
|
||||||
import java.sql.Savepoint
|
import java.sql.Savepoint
|
||||||
import java.time.Clock
|
import java.time.Clock
|
||||||
@ -237,6 +238,7 @@ abstract class AbstractNode<S>(val configuration: NodeConfiguration,
|
|||||||
}
|
}
|
||||||
|
|
||||||
quasarExcludePackages(configuration)
|
quasarExcludePackages(configuration)
|
||||||
|
disableURLConnectionCache()
|
||||||
|
|
||||||
if (allowHibernateToManageAppSchema && !configuration.devMode) {
|
if (allowHibernateToManageAppSchema && !configuration.devMode) {
|
||||||
throw ConfigurationException("Hibernate can only be used to manage app schema in development while using dev mode. " +
|
throw ConfigurationException("Hibernate can only be used to manage app schema in development while using dev mode. " +
|
||||||
@ -425,6 +427,13 @@ abstract class AbstractNode<S>(val configuration: NodeConfiguration,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun disableURLConnectionCache() {
|
||||||
|
object : URLConnection(null) {
|
||||||
|
override fun connect() {
|
||||||
|
}
|
||||||
|
}.defaultUseCaches = false
|
||||||
|
}
|
||||||
|
|
||||||
private fun quasarExcludePackages(nodeConfiguration: NodeConfiguration) {
|
private fun quasarExcludePackages(nodeConfiguration: NodeConfiguration) {
|
||||||
val quasarInstrumentor = Retransform.getInstrumentor()
|
val quasarInstrumentor = Retransform.getInstrumentor()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user