Repository: oozie Updated Branches: refs/heads/master d4ea14f85 -> d7b2a28e5
OOZIE-2542 Option to disable OpenJPA BrokerImpl finalization Project: http://git-wip-us.apache.org/repos/asf/oozie/repo Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/d7b2a28e Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/d7b2a28e Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/d7b2a28e Branch: refs/heads/master Commit: d7b2a28e5315907de0aa30fbd5e0c8a1cec3f05a Parents: d4ea14f Author: Purshotam Shah <[email protected]> Authored: Fri Jun 3 11:39:31 2016 -0700 Committer: Purshotam Shah <[email protected]> Committed: Fri Jun 3 11:39:31 2016 -0700 ---------------------------------------------------------------------- .../main/java/org/apache/oozie/service/JPAService.java | 8 ++++++++ core/src/main/resources/oozie-default.xml | 13 +++++++++++++ release-log.txt | 1 + 3 files changed, 22 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/oozie/blob/d7b2a28e/core/src/main/java/org/apache/oozie/service/JPAService.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/service/JPAService.java b/core/src/main/java/org/apache/oozie/service/JPAService.java index 5d9da1a..fd3f6cb 100644 --- a/core/src/main/java/org/apache/oozie/service/JPAService.java +++ b/core/src/main/java/org/apache/oozie/service/JPAService.java @@ -32,6 +32,7 @@ import javax.persistence.PersistenceException; import javax.persistence.Query; import org.apache.commons.dbcp.BasicDataSource; +import org.apache.commons.lang.StringUtils; import org.apache.hadoop.conf.Configuration; import org.apache.oozie.BundleActionBean; import org.apache.oozie.BundleJobBean; @@ -77,6 +78,8 @@ public class JPAService implements Service, Instrumentable { public static final String CONF_VALIDATE_DB_CONN = CONF_PREFIX + "validate.db.connection"; public static final String CONF_VALIDATE_DB_CONN_EVICTION_INTERVAL = CONF_PREFIX + "validate.db.connection.eviction.interval"; public static final String CONF_VALIDATE_DB_CONN_EVICTION_NUM = CONF_PREFIX + "validate.db.connection.eviction.num"; + public static final String CONF_OPENJPA_BROKER_IMPL = CONF_PREFIX + "openjpa.BrokerImpl"; + private EntityManagerFactory factory; @@ -145,6 +148,7 @@ public class JPAService implements Service, Instrumentable { String maxConn = ConfigurationService.get(conf, CONF_MAX_ACTIVE_CONN).trim(); String dataSource = ConfigurationService.get(conf, CONF_CONN_DATA_SOURCE); String connPropsConfig = ConfigurationService.get(conf, CONF_CONN_PROPERTIES); + String brokerImplConfig = ConfigurationService.get(conf, CONF_OPENJPA_BROKER_IMPL); boolean autoSchemaCreation = ConfigurationService.getBoolean(conf, CONF_CREATE_DB_SCHEMA); boolean validateDbConn = ConfigurationService.getBoolean(conf, CONF_VALIDATE_DB_CONN); String evictionInterval = ConfigurationService.get(conf, CONF_VALIDATE_DB_CONN_EVICTION_INTERVAL).trim(); @@ -195,6 +199,10 @@ public class JPAService implements Service, Instrumentable { props.setProperty("openjpa.ConnectionProperties", connProps); props.setProperty("openjpa.ConnectionDriverName", dataSource); + if (!StringUtils.isEmpty(brokerImplConfig)) { + props.setProperty("openjpa.BrokerImpl", brokerImplConfig); + LOG.info("Setting openjpa.BrokerImpl to {0}", brokerImplConfig); + } factory = Persistence.createEntityManagerFactory(persistentUnit, props); http://git-wip-us.apache.org/repos/asf/oozie/blob/d7b2a28e/core/src/main/resources/oozie-default.xml ---------------------------------------------------------------------- diff --git a/core/src/main/resources/oozie-default.xml b/core/src/main/resources/oozie-default.xml index 2a2822b..8c268d6 100644 --- a/core/src/main/resources/oozie-default.xml +++ b/core/src/main/resources/oozie-default.xml @@ -1490,6 +1490,19 @@ will be the requeue interval for the actions which are waiting for a long time w </description> </property> + <property> + <name>oozie.service.JPAService.openjpa.BrokerImpl</name> + <value>non-finalizing</value> + <description> + The default OpenJPAEntityManager implementation automatically closes itself during instance finalization. + This guards against accidental resource leaks that may occur if a developer fails to explicitly close + EntityManagers when finished with them, but it also incurs a scalability bottleneck, since the JVM must + perform synchronization during instance creation, and since the finalizer thread will have more instances to monitor. + To avoid this overhead, set the openjpa.BrokerImpl configuration property to non-finalizing. + To use default implementation set it to empty space. + </description> + </property> + <!-- SchemaService --> <property> http://git-wip-us.apache.org/repos/asf/oozie/blob/d7b2a28e/release-log.txt ---------------------------------------------------------------------- diff --git a/release-log.txt b/release-log.txt index 74ffe57..af207dc 100644 --- a/release-log.txt +++ b/release-log.txt @@ -1,5 +1,6 @@ -- Oozie 4.3.0 release (trunk - unreleased) +OOZIE-2542 Option to disable OpenJPA BrokerImpl finalization (puru) OOZIE-2447 Illegal character 0x0 oozie client (satishsaley via puru) OOZIE-2548 Flaky test TestZKLocksService.testLockReaper (pbacsko via puru) OOZIE-2546 Improperly closed resources in OozieDBCLI (pbacsko via rkanter)
