OOZIE-1890 Make oozie-site empty and reconcile defaults between oozie-default and the code (seoeun25 via rkanter)
Project: http://git-wip-us.apache.org/repos/asf/oozie/repo Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/2fc2fc9e Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/2fc2fc9e Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/2fc2fc9e Branch: refs/heads/master Commit: 2fc2fc9ec5eb9d14edc449284c9e07090a8ece9a Parents: 9f48c1e Author: Robert Kanter <[email protected]> Authored: Wed Nov 5 17:19:02 2014 -0800 Committer: Robert Kanter <[email protected]> Committed: Wed Nov 5 17:19:02 2014 -0800 ---------------------------------------------------------------------- core/src/main/conf/oozie-site.xml | 303 ------------------- .../org/apache/oozie/CoordinatorEngine.java | 6 - .../main/java/org/apache/oozie/DagEngine.java | 7 +- .../org/apache/oozie/action/ActionExecutor.java | 4 +- .../action/hadoop/CredentialsProvider.java | 45 ++- .../action/hadoop/DistcpActionExecutor.java | 18 +- .../oozie/action/hadoop/FsActionExecutor.java | 4 +- .../oozie/action/hadoop/JavaActionExecutor.java | 22 +- .../action/hadoop/MapReduceActionExecutor.java | 4 +- .../oozie/action/hadoop/OozieJobInfo.java | 4 +- .../action/oozie/SubWorkflowActionExecutor.java | 3 +- .../oozie/action/ssh/SshActionExecutor.java | 9 +- .../java/org/apache/oozie/command/XCommand.java | 3 +- .../coord/CoordActionInputCheckXCommand.java | 13 +- .../coord/CoordActionNotificationXCommand.java | 6 +- .../CoordMaterializeTransitionXCommand.java | 9 +- .../coord/CoordPushDependencyCheckXCommand.java | 9 +- .../command/coord/CoordSubmitXCommand.java | 27 +- .../apache/oozie/command/wf/JobXCommand.java | 5 +- .../oozie/command/wf/NotificationXCommand.java | 5 +- .../apache/oozie/event/MemoryEventQueue.java | 5 +- .../event/listener/ZKConnectionListener.java | 3 +- .../jpa/CoordActionGetForInfoJPAExecutor.java | 3 +- .../apache/oozie/jms/JMSJobEventListener.java | 3 +- .../service/AbandonedCoordCheckerService.java | 40 +-- .../oozie/service/ActionCheckerService.java | 10 +- .../org/apache/oozie/service/ActionService.java | 6 +- .../oozie/service/AuthorizationService.java | 2 +- .../oozie/service/CallableQueueService.java | 12 +- .../apache/oozie/service/CallbackService.java | 2 +- .../oozie/service/ConfigurationService.java | 175 ++++++++++- .../service/CoordMaterializeTriggerService.java | 15 +- .../service/DBLiteWorkflowStoreService.java | 4 +- .../org/apache/oozie/service/ELService.java | 6 +- .../oozie/service/EventHandlerService.java | 13 +- .../oozie/service/HCatAccessorService.java | 2 +- .../oozie/service/HadoopAccessorService.java | 23 +- .../oozie/service/InstrumentationService.java | 2 +- .../oozie/service/JMSAccessorService.java | 2 +- .../apache/oozie/service/JMSTopicService.java | 2 +- .../org/apache/oozie/service/JPAService.java | 24 +- .../oozie/service/JvmPauseMonitorService.java | 12 +- .../oozie/service/LiteWorkflowStoreService.java | 14 +- .../oozie/service/PauseTransitService.java | 8 +- .../org/apache/oozie/service/PurgeService.java | 12 +- .../apache/oozie/service/RecoveryService.java | 12 +- .../apache/oozie/service/SchedulerService.java | 2 +- .../org/apache/oozie/service/SchemaService.java | 3 +- .../java/org/apache/oozie/service/Service.java | 7 +- .../java/org/apache/oozie/service/Services.java | 12 +- .../apache/oozie/service/ShareLibService.java | 17 +- .../oozie/service/StatusTransitService.java | 2 +- .../apache/oozie/service/URIHandlerService.java | 2 +- .../org/apache/oozie/service/UUIDService.java | 4 +- .../oozie/service/WorkflowAppService.java | 2 +- .../oozie/service/XLogStreamingService.java | 2 +- .../apache/oozie/service/ZKLocksService.java | 5 +- .../org/apache/oozie/servlet/AuthFilter.java | 2 +- .../apache/oozie/servlet/CallbackServlet.java | 3 +- .../org/apache/oozie/servlet/V1JobServlet.java | 3 +- .../apache/oozie/sla/SLACalculatorMemory.java | 5 +- .../sla/listener/SLAEmailEventListener.java | 5 +- .../apache/oozie/sla/service/SLAService.java | 9 +- .../java/org/apache/oozie/util/ConfigUtils.java | 19 +- .../java/org/apache/oozie/util/DateUtils.java | 3 +- .../java/org/apache/oozie/util/StatusUtils.java | 23 +- .../java/org/apache/oozie/util/XLogFilter.java | 5 +- .../java/org/apache/oozie/util/ZKUtils.java | 12 +- .../workflow/lite/LiteWorkflowAppParser.java | 4 +- core/src/main/resources/oozie-default.xml | 219 ++++++++++---- .../action/email/TestEmailActionExecutor.java | 6 - .../action/hadoop/TestDistCpActionExecutor.java | 6 - .../action/hadoop/TestShellActionExecutor.java | 7 - .../TestCoordActionNotificationXCommand.java | 2 +- .../command/wf/TestNotificationXCommand.java | 2 +- .../oozie/command/wf/TestReRunXCommand.java | 1 - .../oozie/service/TestConfigurationService.java | 159 +++++++++- .../service/TestJobsConcurrencyService.java | 2 +- .../oozie/sla/TestSLACalculatorMemory.java | 32 +- .../lite/TestLiteWorkflowAppParser.java | 15 +- .../test/resources/wf-unsupported-action.xml | 17 +- release-log.txt | 1 + .../action/hadoop/TestHiveActionExecutor.java | 6 - .../oozie/action/hadoop/LauncherMapper.java | 6 +- .../action/hadoop/TestSqoopActionExecutor.java | 6 - 85 files changed, 803 insertions(+), 753 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/conf/oozie-site.xml ---------------------------------------------------------------------- diff --git a/core/src/main/conf/oozie-site.xml b/core/src/main/conf/oozie-site.xml index c028ca2..a882715 100644 --- a/core/src/main/conf/oozie-site.xml +++ b/core/src/main/conf/oozie-site.xml @@ -23,309 +23,6 @@ Oozie configuration properties and their default values. --> - <property> - <name>oozie.service.ActionService.executor.ext.classes</name> - <value> - org.apache.oozie.action.email.EmailActionExecutor, - org.apache.oozie.action.hadoop.HiveActionExecutor, - org.apache.oozie.action.hadoop.ShellActionExecutor, - org.apache.oozie.action.hadoop.SqoopActionExecutor, - org.apache.oozie.action.hadoop.DistcpActionExecutor, - org.apache.oozie.action.hadoop.Hive2ActionExecutor - </value> - </property> - - <property> - <name>oozie.service.SchemaService.wf.ext.schemas</name> - <value> - shell-action-0.1.xsd,shell-action-0.2.xsd,shell-action-0.3.xsd,email-action-0.1.xsd,email-action-0.2.xsd, - hive-action-0.2.xsd,hive-action-0.3.xsd,hive-action-0.4.xsd,hive-action-0.5.xsd,sqoop-action-0.2.xsd, - sqoop-action-0.3.xsd,sqoop-action-0.4.xsd,ssh-action-0.1.xsd,ssh-action-0.2.xsd,distcp-action-0.1.xsd, - distcp-action-0.2.xsd,oozie-sla-0.1.xsd,oozie-sla-0.2.xsd,hive2-action-0.1.xsd - </value> - </property> - - <property> - <name>oozie.system.id</name> - <value>oozie-${user.name}</value> - <description> - The Oozie system ID. - </description> - </property> - - <property> - <name>oozie.systemmode</name> - <value>NORMAL</value> - <description> - System mode for Oozie at startup. - </description> - </property> - - <property> - <name>oozie.service.AuthorizationService.security.enabled</name> - <value>false</value> - <description> - Specifies whether security (user name/admin role) is enabled or not. - If disabled any user can manage Oozie system and manage any job. - </description> - </property> - - <property> - <name>oozie.service.PurgeService.older.than</name> - <value>30</value> - <description> - Jobs older than this value, in days, will be purged by the PurgeService. - </description> - </property> - - <property> - <name>oozie.service.PurgeService.purge.interval</name> - <value>3600</value> - <description> - Interval at which the purge service will run, in seconds. - </description> - </property> - - <property> - <name>oozie.service.CallableQueueService.queue.size</name> - <value>10000</value> - <description>Max callable queue size</description> - </property> - - <property> - <name>oozie.service.CallableQueueService.threads</name> - <value>10</value> - <description>Number of threads used for executing callables</description> - </property> - - <property> - <name>oozie.service.CallableQueueService.callable.concurrency</name> - <value>3</value> - <description> - Maximum concurrency for a given callable type. - Each command is a callable type (submit, start, run, signal, job, jobs, suspend,resume, etc). - Each action type is a callable type (Map-Reduce, Pig, SSH, FS, sub-workflow, etc). - All commands that use action executors (action-start, action-end, action-kill and action-check) use - the action type as the callable type. - </description> - </property> - - <property> - <name>oozie.service.coord.normal.default.timeout - </name> - <value>120</value> - <description>Default timeout for a coordinator action input check (in minutes) for normal job. - -1 means infinite timeout</description> - </property> - - <property> - <name>oozie.db.schema.name</name> - <value>oozie</value> - <description> - Oozie DataBase Name - </description> - </property> - - <property> - <name>oozie.service.JPAService.create.db.schema</name> - <value>false</value> - <description> - Creates Oozie DB. - - If set to true, it creates the DB schema if it does not exist. If the DB schema exists is a NOP. - If set to false, it does not create the DB schema. If the DB schema does not exist it fails start up. - </description> - </property> - - <property> - <name>oozie.service.JPAService.jdbc.driver</name> - <value>org.apache.derby.jdbc.EmbeddedDriver</value> - <description> - JDBC driver class. - </description> - </property> - - <property> - <name>oozie.service.JPAService.jdbc.url</name> - <value>jdbc:derby:${oozie.data.dir}/${oozie.db.schema.name}-db;create=true</value> - <description> - JDBC URL. - </description> - </property> - - <property> - <name>oozie.service.JPAService.jdbc.username</name> - <value>sa</value> - <description> - DB user name. - </description> - </property> - - <property> - <name>oozie.service.JPAService.jdbc.password</name> - <value> </value> - <description> - DB user password. - - IMPORTANT: if password is emtpy leave a 1 space string, the service trims the value, - if empty Configuration assumes it is NULL. - </description> - </property> - - <property> - <name>oozie.service.JPAService.pool.max.active.conn</name> - <value>10</value> - <description> - Max number of connections. - </description> - </property> - - <property> - <name>oozie.service.HadoopAccessorService.kerberos.enabled</name> - <value>false</value> - <description> - Indicates if Oozie is configured to use Kerberos. - </description> - </property> - - <property> - <name>local.realm</name> - <value>LOCALHOST</value> - <description> - Kerberos Realm used by Oozie and Hadoop. Using 'local.realm' to be aligned with Hadoop configuration - </description> - </property> - - <property> - <name>oozie.service.HadoopAccessorService.keytab.file</name> - <value>${user.home}/oozie.keytab</value> - <description> - Location of the Oozie user keytab file. - </description> - </property> - - <property> - <name>oozie.service.HadoopAccessorService.kerberos.principal</name> - <value>${user.name}/localhost@${local.realm}</value> - <description> - Kerberos principal for Oozie service. - </description> - </property> - - <property> - <name>oozie.service.HadoopAccessorService.jobTracker.whitelist</name> - <value> </value> - <description> - Whitelisted job tracker for Oozie service. - </description> - </property> - - <property> - <name>oozie.service.HadoopAccessorService.nameNode.whitelist</name> - <value> </value> - <description> - Whitelisted job tracker for Oozie service. - </description> - </property> - - <property> - <name>oozie.service.HadoopAccessorService.hadoop.configurations</name> - <value>*=hadoop-conf</value> - <description> - Comma separated AUTHORITY=HADOOP_CONF_DIR, where AUTHORITY is the HOST:PORT of - the Hadoop service (JobTracker, HDFS). The wildcard '*' configuration is - used when there is no exact match for an authority. The HADOOP_CONF_DIR contains - the relevant Hadoop *-site.xml files. If the path is relative is looked within - the Oozie configuration directory; though the path can be absolute (i.e. to point - to Hadoop client conf/ directories in the local filesystem. - </description> - </property> - - <property> - <name>oozie.service.WorkflowAppService.system.libpath</name> - <value>/user/${user.name}/share/lib</value> - <description> - System library path to use for workflow applications. - This path is added to workflow application if their job properties sets - the property 'oozie.use.system.libpath' to true. - </description> - </property> - - <property> - <name>use.system.libpath.for.mapreduce.and.pig.jobs</name> - <value>false</value> - <description> - If set to true, submissions of MapReduce and Pig jobs will include - automatically the system library path, thus not requiring users to - specify where the Pig JAR files are. Instead, the ones from the system - library path are used. - </description> - </property> - - <property> - <name>oozie.authentication.type</name> - <value>simple</value> - <description> - Defines authentication used for Oozie HTTP endpoint. - Supported values are: simple | kerberos | #AUTHENTICATION_HANDLER_CLASSNAME# - </description> - </property> - - <property> - <name>oozie.authentication.token.validity</name> - <value>36000</value> - <description> - Indicates how long (in seconds) an authentication token is valid before it has - to be renewed. - </description> - </property> - - <property> - <name>oozie.authentication.cookie.domain</name> - <value></value> - <description> - The domain to use for the HTTP cookie that stores the authentication token. - In order to authentiation to work correctly across multiple hosts - the domain must be correctly set. - </description> - </property> - - <property> - <name>oozie.authentication.simple.anonymous.allowed</name> - <value>true</value> - <description> - Indicates if anonymous requests are allowed. - This setting is meaningful only when using 'simple' authentication. - </description> - </property> - - <property> - <name>oozie.authentication.kerberos.principal</name> - <value>HTTP/localhost@${local.realm}</value> - <description> - Indicates the Kerberos principal to be used for HTTP endpoint. - The principal MUST start with 'HTTP/' as per Kerberos HTTP SPNEGO specification. - </description> - </property> - - <property> - <name>oozie.authentication.kerberos.keytab</name> - <value>${oozie.service.HadoopAccessorService.keytab.file}</value> - <description> - Location of the keytab file with the credentials for the principal. - Referring to the same keytab file Oozie uses for its Kerberos credentials for Hadoop. - </description> - </property> - - <property> - <name>oozie.authentication.kerberos.name.rules</name> - <value>DEFAULT</value> - <description> - The kerberos names rules is to resolve kerberos principal names, refer to Hadoop's - KerberosName for more details. - </description> - </property> - <!-- Proxyuser Configuration --> <!-- http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/CoordinatorEngine.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/CoordinatorEngine.java b/core/src/main/java/org/apache/oozie/CoordinatorEngine.java index 8591d63..a893e0c 100644 --- a/core/src/main/java/org/apache/oozie/CoordinatorEngine.java +++ b/core/src/main/java/org/apache/oozie/CoordinatorEngine.java @@ -99,12 +99,6 @@ public class CoordinatorEngine extends BaseEngine { * Create a system Coordinator engine, with no user and no group. */ public CoordinatorEngine() { - if (!Services.get().getConf().getBoolean(USE_XCOMMAND, true)) { - LOG.debug("Oozie CoordinatorEngine is not using XCommands."); - } - else { - LOG.debug("Oozie CoordinatorEngine is using XCommands."); - } maxNumActionsForLog = Services.get().getConf() .getInt(COORD_ACTIONS_LOG_MAX_COUNT, COORD_ACTIONS_LOG_MAX_COUNT_DEFAULT); } http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/DagEngine.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/DagEngine.java b/core/src/main/java/org/apache/oozie/DagEngine.java index bea312f..70ddd44 100644 --- a/core/src/main/java/org/apache/oozie/DagEngine.java +++ b/core/src/main/java/org/apache/oozie/DagEngine.java @@ -80,12 +80,7 @@ public class DagEngine extends BaseEngine { * Create a system Dag engine, with no user and no group. */ public DagEngine() { - if (Services.get().getConf().getBoolean(USE_XCOMMAND, true) == false) { - LOG.debug("Oozie DagEngine is not using XCommands."); - } - else { - LOG.debug("Oozie DagEngine is using XCommands."); - } + } /** http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/action/ActionExecutor.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/action/ActionExecutor.java b/core/src/main/java/org/apache/oozie/action/ActionExecutor.java index 2053f32..ff836fb 100644 --- a/core/src/main/java/org/apache/oozie/action/ActionExecutor.java +++ b/core/src/main/java/org/apache/oozie/action/ActionExecutor.java @@ -23,6 +23,7 @@ import org.apache.hadoop.fs.Path; import org.apache.hadoop.conf.Configuration; import org.apache.oozie.client.WorkflowAction; import org.apache.oozie.client.WorkflowJob; +import org.apache.oozie.service.ConfigurationService; import org.apache.oozie.util.ELEvaluator; import org.apache.oozie.util.ParamChecker; import org.apache.oozie.util.XLog; @@ -228,12 +229,11 @@ public abstract class ActionExecutor { * Create an action executor. * * @param type action executor type. - * @param retryAttempts retry attempts. * @param retryInterval retry interval, in seconds. */ protected ActionExecutor(String type, long retryInterval) { this.type = ParamChecker.notEmpty(type, "type"); - this.maxRetries = getOozieConf().getInt(MAX_RETRIES, 3); + this.maxRetries = ConfigurationService.getInt(MAX_RETRIES); this.retryInterval = retryInterval; } http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/action/hadoop/CredentialsProvider.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/action/hadoop/CredentialsProvider.java b/core/src/main/java/org/apache/oozie/action/hadoop/CredentialsProvider.java index 9c66e58..ddf7fd4 100644 --- a/core/src/main/java/org/apache/oozie/action/hadoop/CredentialsProvider.java +++ b/core/src/main/java/org/apache/oozie/action/hadoop/CredentialsProvider.java @@ -20,13 +20,14 @@ package org.apache.oozie.action.hadoop; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.util.ReflectionUtils; +import org.apache.oozie.service.ConfigurationService; import org.apache.oozie.service.Services; import org.apache.oozie.util.XLog; public class CredentialsProvider { Credentials cred; String type; - private static final String CRED_KEY = "oozie.credentials.credentialclasses"; + public static final String CRED_KEY = "oozie.credentials.credentialclasses"; private static final XLog LOG = XLog.getLog(CredentialsProvider.class); public CredentialsProvider(String type) { @@ -42,32 +43,28 @@ public class CredentialsProvider { * @throws Exception */ public Credentials createCredentialObject() throws Exception { - Configuration conf; String type; String classname; - conf = Services.get().getConf(); - if (conf.get(CRED_KEY, "").trim().length() > 0) { - for (String function : conf.getStrings(CRED_KEY)) { - function = Trim(function); - LOG.debug("Creating Credential class for : " + function); - String[] str = function.split("="); - if (str.length > 0) { - type = str[0]; - classname = str[1]; - if (classname != null) { - LOG.debug("Creating Credential type : '" + type + "', class Name : '" + classname + "'"); - if (this.type.equalsIgnoreCase(str[0])) { - Class<?> klass = null; - try { - klass = Thread.currentThread().getContextClassLoader().loadClass(classname); - } - catch (ClassNotFoundException ex) { - LOG.warn("Exception while loading the class", ex); - throw ex; - } - - cred = (Credentials) ReflectionUtils.newInstance(klass, null); + for (String function : ConfigurationService.getStrings(CRED_KEY)) { + function = Trim(function); + LOG.debug("Creating Credential class for : " + function); + String[] str = function.split("="); + if (str.length > 0) { + type = str[0]; + classname = str[1]; + if (classname != null) { + LOG.debug("Creating Credential type : '" + type + "', class Name : '" + classname + "'"); + if (this.type.equalsIgnoreCase(str[0])) { + Class<?> klass = null; + try { + klass = Thread.currentThread().getContextClassLoader().loadClass(classname); + } + catch (ClassNotFoundException ex) { + LOG.warn("Exception while loading the class", ex); + throw ex; } + + cred = (Credentials) ReflectionUtils.newInstance(klass, null); } } } http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/action/hadoop/DistcpActionExecutor.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/action/hadoop/DistcpActionExecutor.java b/core/src/main/java/org/apache/oozie/action/hadoop/DistcpActionExecutor.java index 4d2f7b2..42f2965 100644 --- a/core/src/main/java/org/apache/oozie/action/hadoop/DistcpActionExecutor.java +++ b/core/src/main/java/org/apache/oozie/action/hadoop/DistcpActionExecutor.java @@ -24,6 +24,7 @@ import java.util.List; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.oozie.action.ActionExecutorException; +import org.apache.oozie.service.ConfigurationService; import org.apache.oozie.service.Services; import org.apache.oozie.util.XLog; import org.jdom.Element; @@ -71,17 +72,14 @@ public class DistcpActionExecutor extends JavaActionExecutor{ * @return Name of the class from the configuration */ public static String getClassNamebyType(String type){ - Configuration conf = Services.get().getConf(); String classname = null; - if (conf.get(CLASS_NAMES, "").trim().length() > 0) { - for (String function : conf.getStrings(CLASS_NAMES)) { - function = DistcpActionExecutor.Trim(function); - LOG.debug("class for Distcp Action: " + function); - String[] str = function.split("="); - if (str.length > 0) { - if(type.equalsIgnoreCase(str[0])){ - classname = new String(str[1]); - } + for (String function : ConfigurationService.getStrings(CLASS_NAMES)) { + function = DistcpActionExecutor.Trim(function); + LOG.debug("class for Distcp Action: " + function); + String[] str = function.split("="); + if (str.length > 0) { + if(type.equalsIgnoreCase(str[0])){ + classname = new String(str[1]); } } } http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/action/hadoop/FsActionExecutor.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/action/hadoop/FsActionExecutor.java b/core/src/main/java/org/apache/oozie/action/hadoop/FsActionExecutor.java index 6a7f817..fed1d7a 100644 --- a/core/src/main/java/org/apache/oozie/action/hadoop/FsActionExecutor.java +++ b/core/src/main/java/org/apache/oozie/action/hadoop/FsActionExecutor.java @@ -35,6 +35,7 @@ import org.apache.hadoop.mapred.JobConf; import org.apache.oozie.action.ActionExecutor; import org.apache.oozie.action.ActionExecutorException; import org.apache.oozie.client.WorkflowAction; +import org.apache.oozie.service.ConfigurationService; import org.apache.oozie.service.HadoopAccessorException; import org.apache.oozie.service.HadoopAccessorService; import org.apache.oozie.service.Services; @@ -51,8 +52,7 @@ public class FsActionExecutor extends ActionExecutor { public FsActionExecutor() { super("fs"); - maxGlobCount = getOozieConf().getInt(LauncherMapper.CONF_OOZIE_ACTION_FS_GLOB_MAX, - LauncherMapper.GLOB_MAX_DEFAULT); + maxGlobCount = ConfigurationService.getInt(LauncherMapper.CONF_OOZIE_ACTION_FS_GLOB_MAX); } Path getPath(Element element, String attribute) { http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java b/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java index 201cfa3..7349d3f 100644 --- a/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java +++ b/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java @@ -59,6 +59,7 @@ import org.apache.oozie.action.ActionExecutor; import org.apache.oozie.action.ActionExecutorException; import org.apache.oozie.client.OozieClient; import org.apache.oozie.client.WorkflowAction; +import org.apache.oozie.service.ConfigurationService; import org.apache.oozie.service.HadoopAccessorException; import org.apache.oozie.service.HadoopAccessorService; import org.apache.oozie.service.Services; @@ -89,7 +90,6 @@ public class JavaActionExecutor extends ActionExecutor { public static final String HADOOP_NAME_NODE = "fs.default.name"; private static final String HADOOP_JOB_NAME = "mapred.job.name"; public static final String OOZIE_COMMON_LIBDIR = "oozie"; - public static final int MAX_EXTERNAL_STATS_SIZE_DEFAULT = Integer.MAX_VALUE; private static final Set<String> DISALLOWED_PROPERTIES = new HashSet<String>(); public final static String MAX_EXTERNAL_STATS_SIZE = "oozie.external.stats.max.size"; public static final String ACL_VIEW_JOB = "mapreduce.job.acl-view-job"; @@ -114,6 +114,7 @@ public class JavaActionExecutor extends ActionExecutor { private static final String FAILED_KILLED = "FAILED/KILLED"; protected XLog LOG = XLog.getLog(getClass()); private static final Pattern heapPattern = Pattern.compile("-Xmx(([0-9]+)[mMgG])"); + public static final String CONF_HADOOP_YARN_UBER_MODE = "oozie.action.launcher." + HADOOP_YARN_UBER_MODE; static { DISALLOWED_PROPERTIES.add(HADOOP_USER); @@ -155,19 +156,12 @@ public class JavaActionExecutor extends ActionExecutor { @Override public void initActionType() { super.initActionType(); - maxActionOutputLen = getOozieConf() - .getInt(LauncherMapper.CONF_OOZIE_ACTION_MAX_OUTPUT_DATA, - // TODO: Remove the below config get in a subsequent release.. - // This other irrelevant property is only used to - // preserve backwards compatibility cause of a typo. - // See OOZIE-4. - getOozieConf().getInt(CallbackServlet.CONF_MAX_DATA_LEN, - 2 * 1024)); + maxActionOutputLen = ConfigurationService.getInt(LauncherMapper.CONF_OOZIE_ACTION_MAX_OUTPUT_DATA); //Get the limit for the maximum allowed size of action stats - maxExternalStatsSize = getOozieConf().getInt(JavaActionExecutor.MAX_EXTERNAL_STATS_SIZE, MAX_EXTERNAL_STATS_SIZE_DEFAULT); + maxExternalStatsSize = ConfigurationService.getInt(JavaActionExecutor.MAX_EXTERNAL_STATS_SIZE); maxExternalStatsSize = (maxExternalStatsSize == -1) ? Integer.MAX_VALUE : maxExternalStatsSize; //Get the limit for the maximum number of globbed files/dirs for FS operation - maxFSGlobMax = getOozieConf().getInt(LauncherMapper.CONF_OOZIE_ACTION_FS_GLOB_MAX, LauncherMapper.GLOB_MAX_DEFAULT); + maxFSGlobMax = ConfigurationService.getInt(LauncherMapper.CONF_OOZIE_ACTION_FS_GLOB_MAX); registerError(UnknownHostException.class.getName(), ActionExecutorException.ErrorType.TRANSIENT, "JA001"); registerError(AccessControlException.class.getName(), ActionExecutorException.ErrorType.NON_TRANSIENT, @@ -267,7 +261,7 @@ public class JavaActionExecutor extends ActionExecutor { void injectLauncherUseUberMode(Configuration launcherConf) { // Set Uber Mode for the launcher (YARN only, ignored by MR1) if not set by action conf and not disabled in oozie-site if (launcherConf.get(HADOOP_YARN_UBER_MODE) == null) { - if (getOozieConf().getBoolean("oozie.action.launcher.mapreduce.job.ubertask.enable", false)) { + if (ConfigurationService.getBoolean(getOozieConf(), CONF_HADOOP_YARN_UBER_MODE)) { launcherConf.setBoolean(HADOOP_YARN_UBER_MODE, true); } } @@ -798,9 +792,7 @@ public class JavaActionExecutor extends ActionExecutor { LauncherMapperHelper.setupLauncherURIHandlerConf(launcherJobConf); LauncherMapperHelper.setupMaxOutputData(launcherJobConf, maxActionOutputLen); LauncherMapperHelper.setupMaxExternalStatsSize(launcherJobConf, maxExternalStatsSize); - if (getOozieConf().get(LauncherMapper.CONF_OOZIE_ACTION_FS_GLOB_MAX) != null) { - LauncherMapperHelper.setupMaxFSGlob(launcherJobConf, maxFSGlobMax); - } + LauncherMapperHelper.setupMaxFSGlob(launcherJobConf, maxFSGlobMax); List<Element> list = actionXml.getChildren("arg", ns); String[] args = new String[list.size()]; http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/action/hadoop/MapReduceActionExecutor.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/action/hadoop/MapReduceActionExecutor.java b/core/src/main/java/org/apache/oozie/action/hadoop/MapReduceActionExecutor.java index 5cba732..65a4ed2 100644 --- a/core/src/main/java/org/apache/oozie/action/hadoop/MapReduceActionExecutor.java +++ b/core/src/main/java/org/apache/oozie/action/hadoop/MapReduceActionExecutor.java @@ -33,7 +33,7 @@ import org.apache.hadoop.mapred.JobID; import org.apache.hadoop.mapred.RunningJob; import org.apache.oozie.action.ActionExecutorException; import org.apache.oozie.client.WorkflowAction; -import org.apache.oozie.service.Services; +import org.apache.oozie.service.ConfigurationService; import org.apache.oozie.util.XConfiguration; import org.apache.oozie.util.XLog; import org.apache.oozie.util.XmlUtils; @@ -136,7 +136,7 @@ public class MapReduceActionExecutor extends JavaActionExecutor { // Resolve uber jar path (has to be done after super because oozie.mapreduce.uber.jar is under <configuration>) String uberJar = actionConf.get(MapReduceMain.OOZIE_MAPREDUCE_UBER_JAR); if (uberJar != null) { - if (!Services.get().getConf().getBoolean(OOZIE_MAPREDUCE_UBER_JAR_ENABLE, false)) { + if (!ConfigurationService.getBoolean(OOZIE_MAPREDUCE_UBER_JAR_ENABLE)){ throw new ActionExecutorException(ActionExecutorException.ErrorType.ERROR, "MR003", "{0} property is not allowed. Set {1} to true in oozie-site to enable.", MapReduceMain.OOZIE_MAPREDUCE_UBER_JAR, OOZIE_MAPREDUCE_UBER_JAR_ENABLE); http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/action/hadoop/OozieJobInfo.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/action/hadoop/OozieJobInfo.java b/core/src/main/java/org/apache/oozie/action/hadoop/OozieJobInfo.java index e8733a1..4b13daa 100644 --- a/core/src/main/java/org/apache/oozie/action/hadoop/OozieJobInfo.java +++ b/core/src/main/java/org/apache/oozie/action/hadoop/OozieJobInfo.java @@ -28,6 +28,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.oozie.action.ActionExecutor.Context; import org.apache.oozie.client.OozieClient; import org.apache.oozie.client.WorkflowAction; +import org.apache.oozie.service.ConfigurationService; import org.apache.oozie.service.Services; import org.apache.oozie.util.XConfiguration; @@ -52,12 +53,11 @@ public class OozieJobInfo { XConfiguration contextConf; private WorkflowAction action; private Configuration actionConf; - private static boolean jobInfo = Services.get().getConf().getBoolean(OozieJobInfo.CONF_JOB_INFO, false); + private static boolean jobInfo = ConfigurationService.getBoolean(OozieJobInfo.CONF_JOB_INFO); /** * Instantiates a new oozie job info. * - * @param jobconf the jobconf * @param actionConf the action conf * @param context the context * @param action the action http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/action/oozie/SubWorkflowActionExecutor.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/action/oozie/SubWorkflowActionExecutor.java b/core/src/main/java/org/apache/oozie/action/oozie/SubWorkflowActionExecutor.java index b8c7e57..bda34b5 100644 --- a/core/src/main/java/org/apache/oozie/action/oozie/SubWorkflowActionExecutor.java +++ b/core/src/main/java/org/apache/oozie/action/oozie/SubWorkflowActionExecutor.java @@ -24,6 +24,7 @@ import org.apache.oozie.action.ActionExecutorException; import org.apache.oozie.DagEngine; import org.apache.oozie.LocalOozieClient; import org.apache.oozie.WorkflowJobBean; +import org.apache.oozie.service.ConfigurationService; import org.apache.oozie.service.DagEngineService; import org.apache.oozie.client.WorkflowAction; import org.apache.oozie.client.OozieClient; @@ -124,7 +125,7 @@ public class SubWorkflowActionExecutor extends ActionExecutor { protected void verifyAndInjectSubworkflowDepth(Configuration parentConf, Configuration conf) throws ActionExecutorException { int depth = conf.getInt(SUBWORKFLOW_DEPTH, 0); - int maxDepth = Services.get().getConf().getInt(SUBWORKFLOW_MAX_DEPTH, 50); + int maxDepth = ConfigurationService.getInt(SUBWORKFLOW_MAX_DEPTH); if (depth >= maxDepth) { throw new ActionExecutorException(ActionExecutorException.ErrorType.ERROR, "SUBWF001", "Depth [{0}] cannot exceed maximum subworkflow depth [{1}]", (depth + 1), maxDepth); http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/action/ssh/SshActionExecutor.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/action/ssh/SshActionExecutor.java b/core/src/main/java/org/apache/oozie/action/ssh/SshActionExecutor.java index 734fce9..99288a6 100644 --- a/core/src/main/java/org/apache/oozie/action/ssh/SshActionExecutor.java +++ b/core/src/main/java/org/apache/oozie/action/ssh/SshActionExecutor.java @@ -34,6 +34,7 @@ import org.apache.oozie.client.WorkflowAction.Status; import org.apache.oozie.action.ActionExecutor; import org.apache.oozie.action.ActionExecutorException; import org.apache.oozie.service.CallbackService; +import org.apache.oozie.service.ConfigurationService; import org.apache.oozie.servlet.CallbackServlet; import org.apache.oozie.service.Services; import org.apache.oozie.util.IOUtils; @@ -96,7 +97,7 @@ public class SshActionExecutor extends ActionExecutor { public void initActionType() { super.initActionType(); maxLen = getOozieConf().getInt(CallbackServlet.CONF_MAX_DATA_LEN, 2 * 1024); - allowSshUserAtHost = getOozieConf().getBoolean(CONF_SSH_ALLOW_USER_AT_HOST, true); + allowSshUserAtHost = ConfigurationService.getBoolean(CONF_SSH_ALLOW_USER_AT_HOST); registerError(InterruptedException.class.getName(), ActionExecutorException.ErrorType.ERROR, "SH001"); registerError(JDOMException.class.getName(), ActionExecutorException.ErrorType.ERROR, "SH002"); initSshScripts(); @@ -401,13 +402,13 @@ public class SshActionExecutor extends ActionExecutor { throws IOException, InterruptedException { XLog log = XLog.getLog(getClass()); Runtime runtime = Runtime.getRuntime(); - String callbackPost = ignoreOutput ? "_" : getOozieConf().get(HTTP_COMMAND_OPTIONS).replace(" ", "%%%"); + String callbackPost = ignoreOutput ? "_" : ConfigurationService.get(HTTP_COMMAND_OPTIONS).replace(" ", "%%%"); String preserveArgsS = preserveArgs ? "PRESERVE_ARGS" : "FLATTEN_ARGS"; // TODO check String callBackUrl = Services.get().get(CallbackService.class) .createCallBackUrl(action.getId(), EXT_STATUS_VAR); String command = XLog.format("{0}{1} {2}ssh-base.sh {3} {4} \"{5}\" \"{6}\" {7} {8} ", SSH_COMMAND_BASE, host, dirLocation, - preserveArgsS, getOozieConf().get(HTTP_COMMAND), callBackUrl, callbackPost, recoveryId, cmnd) + preserveArgsS, ConfigurationService.get(HTTP_COMMAND), callBackUrl, callbackPost, recoveryId, cmnd) .toString(); String[] commandArray = command.split("\\s"); String[] finalCommand; @@ -452,7 +453,7 @@ public class SshActionExecutor extends ActionExecutor { else { context.setEndData(WorkflowAction.Status.ERROR, WorkflowAction.Status.ERROR.toString()); } - boolean deleteTmpDir = getOozieConf().getBoolean(DELETE_TMP_DIR, true); + boolean deleteTmpDir = ConfigurationService.getBoolean(DELETE_TMP_DIR); if (deleteTmpDir) { String tmpDir = getRemoteFileName(context, action, null, true, false); String removeTmpDirCmd = SSH_COMMAND_BASE + action.getTrackerUri() + " rm -rf " + tmpDir; http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/command/XCommand.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/command/XCommand.java b/core/src/main/java/org/apache/oozie/command/XCommand.java index 7f850cb..655670d 100644 --- a/core/src/main/java/org/apache/oozie/command/XCommand.java +++ b/core/src/main/java/org/apache/oozie/command/XCommand.java @@ -22,6 +22,7 @@ import org.apache.oozie.ErrorCode; import org.apache.oozie.FaultInjection; import org.apache.oozie.XException; import org.apache.oozie.service.CallableQueueService; +import org.apache.oozie.service.ConfigurationService; import org.apache.oozie.service.EventHandlerService; import org.apache.oozie.service.InstrumentationService; import org.apache.oozie.service.MemoryLocksService; @@ -512,7 +513,7 @@ public abstract class XCommand<T> implements XCallable<T> { * @return delay time when requeue itself */ protected long getRequeueDelay() { - return Services.get().getConf().getLong(DEFAULT_REQUEUE_DELAY, 10 * 1000L); + return ConfigurationService.getLong(DEFAULT_REQUEUE_DELAY); } /** http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java index b26c1e2..a975f6e 100644 --- a/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java +++ b/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java @@ -49,6 +49,7 @@ import org.apache.oozie.executor.jpa.CoordJobQueryExecutor; import org.apache.oozie.executor.jpa.CoordJobQueryExecutor.CoordJobQuery; import org.apache.oozie.executor.jpa.JPAExecutorException; import org.apache.oozie.service.CallableQueueService; +import org.apache.oozie.service.ConfigurationService; import org.apache.oozie.service.EventHandlerService; import org.apache.oozie.service.JPAService; import org.apache.oozie.service.Service; @@ -69,6 +70,8 @@ import org.jdom.Element; */ public class CoordActionInputCheckXCommand extends CoordinatorXCommand<Void> { + public static final String COORD_EXECUTION_NONE_TOLERANCE = "oozie.coord.execution.none.tolerance"; + private final String actionId; /** * Property name of command re-queue interval for coordinator action input check in @@ -76,11 +79,6 @@ public class CoordActionInputCheckXCommand extends CoordinatorXCommand<Void> { */ public static final String CONF_COORD_INPUT_CHECK_REQUEUE_INTERVAL = Service.CONF_PREFIX + "coord.input.check.requeue.interval"; - /** - * Default re-queue interval in ms. It is applied when no value defined in - * the oozie configuration. - */ - private final int DEFAULT_COMMAND_REQUEUE_INTERVAL = 60000; // 1 minute private CoordinatorActionBean coordAction = null; private CoordinatorJobBean coordJob = null; private JPAService jpaService = null; @@ -179,7 +177,7 @@ public class CoordActionInputCheckXCommand extends CoordinatorXCommand<Void> { // should be started; so set it to SKIPPED Calendar cal = Calendar.getInstance(DateUtils.getTimeZone(coordJob.getTimeZone())); cal.setTime(nominalTime); - cal.add(Calendar.MINUTE, Services.get().getConf().getInt("oozie.coord.execution.none.tolerance", 1)); + cal.add(Calendar.MINUTE, ConfigurationService.getInt(COORD_EXECUTION_NONE_TOLERANCE)); nominalTime = cal.getTime(); if (now.after(nominalTime)) { LOG.info("NONE execution: Preparing to skip action [{0}] because the current time [{1}] is later than " @@ -333,8 +331,7 @@ public class CoordActionInputCheckXCommand extends CoordinatorXCommand<Void> { * @return re-queue interval in ms */ public long getCoordInputCheckRequeueInterval() { - long requeueInterval = Services.get().getConf().getLong(CONF_COORD_INPUT_CHECK_REQUEUE_INTERVAL, - DEFAULT_COMMAND_REQUEUE_INTERVAL); + long requeueInterval = ConfigurationService.getLong(CONF_COORD_INPUT_CHECK_REQUEUE_INTERVAL); return requeueInterval; } http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/command/coord/CoordActionNotificationXCommand.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordActionNotificationXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordActionNotificationXCommand.java index d220434..2556152 100644 --- a/core/src/main/java/org/apache/oozie/command/coord/CoordActionNotificationXCommand.java +++ b/core/src/main/java/org/apache/oozie/command/coord/CoordActionNotificationXCommand.java @@ -30,6 +30,7 @@ import org.apache.oozie.client.OozieClient; import org.apache.oozie.command.CommandException; import org.apache.oozie.command.PreconditionException; import org.apache.oozie.command.wf.NotificationXCommand; +import org.apache.oozie.service.ConfigurationService; import org.apache.oozie.service.Services; import org.apache.oozie.util.LogUtils; import org.apache.oozie.util.ParamChecker; @@ -79,9 +80,8 @@ public class CoordActionNotificationXCommand extends CoordinatorXCommand<Void> { url = url.replaceAll(STATUS_PATTERN, actionBean.getStatus().toString()); LOG.debug("Notification URL :" + url); try { - int timeout = Services.get().getConf().getInt( - NotificationXCommand.NOTIFICATION_URL_CONNECTION_TIMEOUT_KEY, - NotificationXCommand.NOTIFICATION_URL_CONNECTION_TIMEOUT_DEFAULT); + int timeout = ConfigurationService.getInt(NotificationXCommand + .NOTIFICATION_URL_CONNECTION_TIMEOUT_KEY); URL urlObj = new URL(url); HttpURLConnection urlConn = (HttpURLConnection) urlObj.openConnection(); urlConn.setConnectTimeout(timeout); http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/command/coord/CoordMaterializeTransitionXCommand.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordMaterializeTransitionXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordMaterializeTransitionXCommand.java index 05b7a62..e2d63bb 100644 --- a/core/src/main/java/org/apache/oozie/command/coord/CoordMaterializeTransitionXCommand.java +++ b/core/src/main/java/org/apache/oozie/command/coord/CoordMaterializeTransitionXCommand.java @@ -39,6 +39,7 @@ import org.apache.oozie.executor.jpa.CoordActionsActiveCountJPAExecutor; import org.apache.oozie.executor.jpa.CoordJobQueryExecutor; import org.apache.oozie.executor.jpa.CoordJobQueryExecutor.CoordJobQuery; import org.apache.oozie.executor.jpa.JPAExecutorException; +import org.apache.oozie.service.ConfigurationService; import org.apache.oozie.service.CoordMaterializeTriggerService; import org.apache.oozie.service.EventHandlerService; import org.apache.oozie.service.JPAService; @@ -78,11 +79,8 @@ public class CoordMaterializeTransitionXCommand extends MaterializeTransitionXCo private int lastActionNumber = 1; // over-ride by DB value private CoordinatorJob.Status prevStatus = null; - static final private int lookAheadWindow = Services - .get() - .getConf() - .getInt(CoordMaterializeTriggerService.CONF_LOOKUP_INTERVAL, - CoordMaterializeTriggerService.CONF_LOOKUP_INTERVAL_DEFAULT); + static final private int lookAheadWindow = ConfigurationService.getInt(CoordMaterializeTriggerService + .CONF_LOOKUP_INTERVAL); /** * Default MAX timeout in minutes, after which coordinator input check will timeout @@ -94,7 +92,6 @@ public class CoordMaterializeTransitionXCommand extends MaterializeTransitionXCo * * @param jobId coordinator job id * @param materializationWindow materialization window to calculate end time - * @param lookahead window */ public CoordMaterializeTransitionXCommand(String jobId, int materializationWindow) { super("coord_mater", "coord_mater", 1); http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/command/coord/CoordPushDependencyCheckXCommand.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordPushDependencyCheckXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordPushDependencyCheckXCommand.java index 68597b0..cc34627 100644 --- a/core/src/main/java/org/apache/oozie/command/coord/CoordPushDependencyCheckXCommand.java +++ b/core/src/main/java/org/apache/oozie/command/coord/CoordPushDependencyCheckXCommand.java @@ -43,6 +43,7 @@ import org.apache.oozie.executor.jpa.CoordActionQueryExecutor.CoordActionQuery; import org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor; import org.apache.oozie.executor.jpa.JPAExecutorException; import org.apache.oozie.service.CallableQueueService; +import org.apache.oozie.service.ConfigurationService; import org.apache.oozie.service.EventHandlerService; import org.apache.oozie.service.JPAService; import org.apache.oozie.service.PartitionDependencyManagerService; @@ -68,11 +69,6 @@ public class CoordPushDependencyCheckXCommand extends CoordinatorXCommand<Void> */ public static final String CONF_COORD_PUSH_CHECK_REQUEUE_INTERVAL = Service.CONF_PREFIX + "coord.push.check.requeue.interval"; - /** - * Default re-queue interval in ms. It is applied when no value defined in - * the oozie configuration. - */ - private final int DEFAULT_COMMAND_REQUEUE_INTERVAL = 600000; private boolean registerForNotification; private boolean removeAvailDependencies; @@ -195,8 +191,7 @@ public class CoordPushDependencyCheckXCommand extends CoordinatorXCommand<Void> * @return */ public long getCoordPushCheckRequeueInterval() { - long requeueInterval = Services.get().getConf().getLong(CONF_COORD_PUSH_CHECK_REQUEUE_INTERVAL, - DEFAULT_COMMAND_REQUEUE_INTERVAL); + long requeueInterval = ConfigurationService.getLong(CONF_COORD_PUSH_CHECK_REQUEUE_INTERVAL); return requeueInterval; } http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/command/coord/CoordSubmitXCommand.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordSubmitXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordSubmitXCommand.java index aec7199..0843f28 100644 --- a/core/src/main/java/org/apache/oozie/command/coord/CoordSubmitXCommand.java +++ b/core/src/main/java/org/apache/oozie/command/coord/CoordSubmitXCommand.java @@ -58,7 +58,7 @@ import org.apache.oozie.coord.TimeUnit; import org.apache.oozie.executor.jpa.CoordJobQueryExecutor; import org.apache.oozie.executor.jpa.JPAExecutorException; import org.apache.oozie.service.CoordMaterializeTriggerService; -import org.apache.oozie.service.DagXLogInfoService; +import org.apache.oozie.service.ConfigurationService; import org.apache.oozie.service.HadoopAccessorException; import org.apache.oozie.service.HadoopAccessorService; import org.apache.oozie.service.JPAService; @@ -80,7 +80,6 @@ import org.apache.oozie.util.ParameterVerifier; import org.apache.oozie.util.ParameterVerifierException; import org.apache.oozie.util.PropertiesUtils; import org.apache.oozie.util.XConfiguration; -import org.apache.oozie.util.XLog; import org.apache.oozie.util.XmlUtils; import org.jdom.Attribute; import org.jdom.Element; @@ -293,8 +292,8 @@ public class CoordSubmitXCommand extends SubmitTransitionXCommand { * @throws Exception the exception */ protected String getDryRun(CoordinatorJobBean coordJob) throws Exception{ - int materializationWindow = conf.getInt(CoordMaterializeTriggerService.CONF_MATERIALIZATION_WINDOW, - CoordMaterializeTriggerService.CONF_MATERIALIZATION_WINDOW_DEFAULT); + int materializationWindow = ConfigurationService.getInt(conf, CoordMaterializeTriggerService + .CONF_MATERIALIZATION_WINDOW); Date startTime = coordJob.getStartTime(); long startTimeMilli = startTime.getTime(); long endTimeMilli = startTimeMilli + (materializationWindow * 1000); @@ -325,8 +324,8 @@ public class CoordSubmitXCommand extends SubmitTransitionXCommand { * Queue MaterializeTransitionXCommand */ protected void queueMaterializeTransitionXCommand(String jobId) { - int materializationWindow = conf.getInt(CoordMaterializeTriggerService.CONF_MATERIALIZATION_WINDOW, - CoordMaterializeTriggerService.CONF_MATERIALIZATION_WINDOW_DEFAULT); + int materializationWindow = ConfigurationService.getInt(conf, CoordMaterializeTriggerService + .CONF_MATERIALIZATION_WINDOW); queue(new CoordMaterializeTransitionXCommand(jobId, materializationWindow), 100); } @@ -344,7 +343,7 @@ public class CoordSubmitXCommand extends SubmitTransitionXCommand { int freq = Integer.parseInt(coordJob.getFrequency()); // Check if the frequency is faster than 5 min if enabled - if (Services.get().getConf().getBoolean(CONF_CHECK_MAX_FREQUENCY, true)) { + if (ConfigurationService.getBoolean(CONF_CHECK_MAX_FREQUENCY)) { CoordinatorJob.Timeunit unit = coordJob.getTimeUnit(); if (freq == 0 || (freq < 5 && unit == CoordinatorJob.Timeunit.MINUTE)) { throw new IllegalArgumentException("Coordinator job with frequency [" + freq + @@ -744,32 +743,32 @@ public class CoordSubmitXCommand extends SubmitTransitionXCommand { } } else { - val = Services.get().getConf().get(CONF_DEFAULT_TIMEOUT_NORMAL); + val = ConfigurationService.get(CONF_DEFAULT_TIMEOUT_NORMAL); } ival = ParamChecker.checkInteger(val, "timeout"); - if (ival < 0 || ival > Services.get().getConf().getInt(CONF_DEFAULT_MAX_TIMEOUT, 129600)) { - ival = Services.get().getConf().getInt(CONF_DEFAULT_MAX_TIMEOUT, 129600); + if (ival < 0 || ival > ConfigurationService.getInt(CONF_DEFAULT_MAX_TIMEOUT)) { + ival = ConfigurationService.getInt(CONF_DEFAULT_MAX_TIMEOUT); } coordJob.setTimeout(ival); val = resolveTagContents("concurrency", eAppXml.getChild("controls", eAppXml.getNamespace()), evalNofuncs); if (val == null || val.isEmpty()) { - val = Services.get().getConf().get(CONF_DEFAULT_CONCURRENCY, "1"); + val = ConfigurationService.get(CONF_DEFAULT_CONCURRENCY); } ival = ParamChecker.checkInteger(val, "concurrency"); coordJob.setConcurrency(ival); val = resolveTagContents("throttle", eAppXml.getChild("controls", eAppXml.getNamespace()), evalNofuncs); if (val == null || val.isEmpty()) { - int defaultThrottle = Services.get().getConf().getInt(CONF_DEFAULT_THROTTLE, 12); + int defaultThrottle = ConfigurationService.getInt(CONF_DEFAULT_THROTTLE); ival = defaultThrottle; } else { ival = ParamChecker.checkInteger(val, "throttle"); } - int maxQueue = Services.get().getConf().getInt(CONF_QUEUE_SIZE, 10000); - float factor = Services.get().getConf().getFloat(CONF_MAT_THROTTLING_FACTOR, 0.10f); + int maxQueue = ConfigurationService.getInt(CONF_QUEUE_SIZE); + float factor = ConfigurationService.getFloat(CONF_MAT_THROTTLING_FACTOR); int maxThrottle = (int) (maxQueue * factor); if (ival > maxThrottle || ival < 1) { ival = maxThrottle; http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/command/wf/JobXCommand.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/command/wf/JobXCommand.java b/core/src/main/java/org/apache/oozie/command/wf/JobXCommand.java index 747d935..3b6cb35 100644 --- a/core/src/main/java/org/apache/oozie/command/wf/JobXCommand.java +++ b/core/src/main/java/org/apache/oozie/command/wf/JobXCommand.java @@ -24,6 +24,7 @@ import org.apache.oozie.command.CommandException; import org.apache.oozie.command.PreconditionException; import org.apache.oozie.executor.jpa.JPAExecutorException; import org.apache.oozie.executor.jpa.WorkflowInfoWithActionsSubsetGetJPAExecutor; +import org.apache.oozie.service.ConfigurationService; import org.apache.oozie.service.JPAService; import org.apache.oozie.service.Services; import org.apache.oozie.util.ParamChecker; @@ -37,6 +38,8 @@ public class JobXCommand extends WorkflowXCommand<WorkflowJobBean> { private int len = Integer.MAX_VALUE; private WorkflowJobBean workflow; + public static final String CONF_CONSOLE_URL = "oozie.JobCommand.job.console.url"; + public JobXCommand(String id) { this(id, 1, Integer.MAX_VALUE); } @@ -85,7 +88,7 @@ public class JobXCommand extends WorkflowXCommand<WorkflowJobBean> { * @return console URL */ public static String getJobConsoleUrl(String jobId) { - String consoleUrl = Services.get().getConf().get("oozie.JobCommand.job.console.url", null); + String consoleUrl = ConfigurationService.get(CONF_CONSOLE_URL); return (consoleUrl != null) ? consoleUrl + jobId : null; } http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/command/wf/NotificationXCommand.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/command/wf/NotificationXCommand.java b/core/src/main/java/org/apache/oozie/command/wf/NotificationXCommand.java index 73ce9a7..0fc3d65 100644 --- a/core/src/main/java/org/apache/oozie/command/wf/NotificationXCommand.java +++ b/core/src/main/java/org/apache/oozie/command/wf/NotificationXCommand.java @@ -23,6 +23,7 @@ import org.apache.oozie.WorkflowActionBean; import org.apache.oozie.WorkflowJobBean; import org.apache.oozie.command.CommandException; import org.apache.oozie.command.PreconditionException; +import org.apache.oozie.service.ConfigurationService; import org.apache.oozie.service.Services; import org.apache.oozie.util.LogUtils; import org.apache.oozie.util.ParamChecker; @@ -35,7 +36,6 @@ import java.net.URL; public class NotificationXCommand extends WorkflowXCommand<Void> { public static final String NOTIFICATION_URL_CONNECTION_TIMEOUT_KEY = "oozie.notification.url.connection.timeout"; - public static final int NOTIFICATION_URL_CONNECTION_TIMEOUT_DEFAULT = 10 * 1000; // 10 seconds private static final String STATUS_PATTERN = "\\$status"; private static final String JOB_ID_PATTERN = "\\$jobId"; @@ -102,8 +102,7 @@ public class NotificationXCommand extends WorkflowXCommand<Void> { @Override protected Void execute() throws CommandException { if (url != null) { - int timeout = Services.get().getConf().getInt(NOTIFICATION_URL_CONNECTION_TIMEOUT_KEY, - NOTIFICATION_URL_CONNECTION_TIMEOUT_DEFAULT); + int timeout = ConfigurationService.getInt(NOTIFICATION_URL_CONNECTION_TIMEOUT_KEY); try { URL url = new URL(this.url); HttpURLConnection urlConn = (HttpURLConnection) url.openConnection(); http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/event/MemoryEventQueue.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/event/MemoryEventQueue.java b/core/src/main/java/org/apache/oozie/event/MemoryEventQueue.java index 205dbb6..b9e31ef 100644 --- a/core/src/main/java/org/apache/oozie/event/MemoryEventQueue.java +++ b/core/src/main/java/org/apache/oozie/event/MemoryEventQueue.java @@ -26,6 +26,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.apache.hadoop.conf.Configuration; import org.apache.oozie.client.event.Event; +import org.apache.oozie.service.ConfigurationService; import org.apache.oozie.service.EventHandlerService; import org.apache.oozie.util.XLog; @@ -44,9 +45,9 @@ public class MemoryEventQueue implements EventQueue { @Override public void init(Configuration conf) { eventQueue = new ConcurrentLinkedQueue<EventQueueElement>(); - maxSize = conf.getInt(EventHandlerService.CONF_QUEUE_SIZE, 10000); + maxSize = ConfigurationService.getInt(conf, EventHandlerService.CONF_QUEUE_SIZE); currentSize = new AtomicInteger(); - batchSize = conf.getInt(EventHandlerService.CONF_BATCH_SIZE, 10); + batchSize = ConfigurationService.getInt(conf, EventHandlerService.CONF_BATCH_SIZE); LOG = XLog.getLog(getClass()); LOG.info("Memory Event Queue initialized with Max size = [{0}], Batch drain size = [{1}]", maxSize, batchSize); } http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/event/listener/ZKConnectionListener.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/event/listener/ZKConnectionListener.java b/core/src/main/java/org/apache/oozie/event/listener/ZKConnectionListener.java index a5d22c0..c6415b1 100644 --- a/core/src/main/java/org/apache/oozie/event/listener/ZKConnectionListener.java +++ b/core/src/main/java/org/apache/oozie/event/listener/ZKConnectionListener.java @@ -21,6 +21,7 @@ package org.apache.oozie.event.listener; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.state.ConnectionState; import org.apache.curator.framework.state.ConnectionStateListener; +import org.apache.oozie.service.ConfigurationService; import org.apache.oozie.service.Services; import org.apache.oozie.util.XLog; import org.apache.oozie.util.ZKUtils; @@ -57,7 +58,7 @@ public class ZKConnectionListener implements ConnectionStateListener { if (newState == ConnectionState.LOST) { LOG.fatal("ZK is not reconnected in " + ZKUtils.getZKConnectionTimeout()); - if (Services.get().getConf().getBoolean(CONF_SHUTDOWN_ON_TIMEOUT, true)) { + if (ConfigurationService.getBoolean(CONF_SHUTDOWN_ON_TIMEOUT)) { LOG.fatal("Shutting down Oozie server"); Services.get().destroy(); System.exit(1); http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionGetForInfoJPAExecutor.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionGetForInfoJPAExecutor.java b/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionGetForInfoJPAExecutor.java index 319a49b..a9cf0ff 100644 --- a/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionGetForInfoJPAExecutor.java +++ b/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionGetForInfoJPAExecutor.java @@ -28,6 +28,7 @@ import org.apache.oozie.CoordinatorActionBean; import org.apache.oozie.ErrorCode; import org.apache.oozie.StringBlob; import org.apache.oozie.client.CoordinatorAction; +import org.apache.oozie.service.ConfigurationService; import org.apache.oozie.service.Services; import org.apache.oozie.util.DateUtils; import org.apache.oozie.util.ParamChecker; @@ -60,7 +61,7 @@ public class CoordActionGetForInfoJPAExecutor implements JPAExecutor<Coordinator @SuppressWarnings("unchecked") public CoordinatorActionBean execute(EntityManager em) throws JPAExecutorException { // Maintain backward compatibility for action info cmd - if (!(Services.get().getConf().getBoolean(COORD_GET_ALL_COLS_FOR_ACTION, false))) { + if (!ConfigurationService.getBoolean(COORD_GET_ALL_COLS_FOR_ACTION)) { List<Object[]> actionObjects; try { Query q = em.createNamedQuery("GET_COORD_ACTION_FOR_INFO"); http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/jms/JMSJobEventListener.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/jms/JMSJobEventListener.java b/core/src/main/java/org/apache/oozie/jms/JMSJobEventListener.java index a458165..7691a06 100644 --- a/core/src/main/java/org/apache/oozie/jms/JMSJobEventListener.java +++ b/core/src/main/java/org/apache/oozie/jms/JMSJobEventListener.java @@ -39,6 +39,7 @@ import org.apache.oozie.event.WorkflowJobEvent; import org.apache.oozie.event.listener.JobEventListener; import org.apache.oozie.event.messaging.MessageFactory; import org.apache.oozie.event.messaging.MessageSerializer; +import org.apache.oozie.service.ConfigurationService; import org.apache.oozie.service.JMSAccessorService; import org.apache.oozie.service.JMSTopicService; import org.apache.oozie.service.Services; @@ -65,7 +66,7 @@ public class JMSJobEventListener extends JobEventListener { @Override public void init(Configuration conf) { LOG = XLog.getLog(getClass()); - String jmsProps = conf.get(JMS_CONNECTION_PROPERTIES); + String jmsProps = ConfigurationService.get(conf, JMS_CONNECTION_PROPERTIES); LOG.info("JMS producer connection properties [{0}]", jmsProps); connInfo = new JMSConnectionInfo(jmsProps); jmsSessionOpts = conf.getInt(JMS_SESSION_OPTS, Session.AUTO_ACKNOWLEDGE); http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/service/AbandonedCoordCheckerService.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/service/AbandonedCoordCheckerService.java b/core/src/main/java/org/apache/oozie/service/AbandonedCoordCheckerService.java index b082567..ec8cf71 100644 --- a/core/src/main/java/org/apache/oozie/service/AbandonedCoordCheckerService.java +++ b/core/src/main/java/org/apache/oozie/service/AbandonedCoordCheckerService.java @@ -45,21 +45,15 @@ import com.google.common.annotations.VisibleForTesting; public class AbandonedCoordCheckerService implements Service { private static final String CONF_PREFIX = Service.CONF_PREFIX + "AbandonedCoordCheckerService."; - private static final String TO_ADDRESS = CONF_PREFIX + "email.address"; + public static final String TO_ADDRESS = CONF_PREFIX + "email.address"; private static final String CONTENT_TYPE = "text/html"; private static final String SUBJECT = "Abandoned Coordinators report"; - private static final String CONF_CHECK_INTERVAL = CONF_PREFIX + "check.interval"; - private static final String CONF_CHECK_DELAY = CONF_PREFIX + "check.delay"; - private static final String CONF_FAILURE_LEN = CONF_PREFIX + "failure.limit"; - private static final String CONF_JOB_OLDER_THAN = CONF_PREFIX + "job.older.than"; - - private static final int DEFAULT_FAILURE_LEN = 20; - private static final int DEFAULT_CHECK_INTERVAL = 24 * 60; // Once a day - private static final int DEFAULT_CHECK_DELAY = 1 * 60; // One hour. - private static final int DEFAULT_CONF_JOB_OLDER_THAN = 2880; // One days - - private static final String CONF_JOB_KILL = CONF_PREFIX + "kill.jobs"; - private static final boolean DEFAULT_JOB_KILL = false; + public static final String CONF_CHECK_INTERVAL = CONF_PREFIX + "check.interval"; + public static final String CONF_CHECK_DELAY = CONF_PREFIX + "check.delay"; + public static final String CONF_FAILURE_LEN = CONF_PREFIX + "failure.limit"; + public static final String CONF_JOB_OLDER_THAN = CONF_PREFIX + "job.older.than"; + + public static final String CONF_JOB_KILL = CONF_PREFIX + "kill.jobs"; public static final String OOZIE_BASE_URL = "oozie.base.url"; private static String[] to; private static String serverURL; @@ -68,7 +62,7 @@ public class AbandonedCoordCheckerService implements Service { private StringBuilder msg; final int failureLimit; XLog LOG = XLog.getLog(getClass()); - private boolean shouldKill = DEFAULT_JOB_KILL; + private boolean shouldKill = false; public AbandonedCoordCheckerRunnable(int failureLimit) { this(failureLimit, false); @@ -110,8 +104,7 @@ public class AbandonedCoordCheckerService implements Service { try { Timestamp createdTS = new Timestamp( System.currentTimeMillis() - - (Services.get().getConf() - .getInt(CONF_JOB_OLDER_THAN, DEFAULT_CONF_JOB_OLDER_THAN) * 60 * 1000)); + - (ConfigurationService.getInt(CONF_JOB_OLDER_THAN) * 60 * 1000)); jobs = CoordJobQueryExecutor.getInstance().getList(CoordJobQuery.GET_COORD_FOR_ABANDONEDCHECK, failureLimit, createdTS); @@ -177,17 +170,16 @@ public class AbandonedCoordCheckerService implements Service { @Override public void init(Services services) { - Configuration conf = services.getConf(); - to = conf.getStrings(TO_ADDRESS); - int failureLen = conf.getInt(CONF_FAILURE_LEN, DEFAULT_FAILURE_LEN); - boolean shouldKill = conf.getBoolean(CONF_JOB_KILL, DEFAULT_JOB_KILL); - serverURL = conf.get(OOZIE_BASE_URL); + to = ConfigurationService.getStrings(TO_ADDRESS); + int failureLen = ConfigurationService.getInt(CONF_FAILURE_LEN); + boolean shouldKill = ConfigurationService.getBoolean(CONF_JOB_KILL); + serverURL = ConfigurationService.get(OOZIE_BASE_URL); - int delay = conf.getInt(CONF_CHECK_DELAY, DEFAULT_CHECK_DELAY); + int delay = ConfigurationService.getInt(CONF_CHECK_DELAY); Runnable actionCheckRunnable = new AbandonedCoordCheckerRunnable(failureLen, shouldKill); services.get(SchedulerService.class).schedule(actionCheckRunnable, delay, - conf.getInt(CONF_CHECK_INTERVAL, DEFAULT_CHECK_INTERVAL), SchedulerService.Unit.MIN); + ConfigurationService.getInt(CONF_CHECK_INTERVAL), SchedulerService.Unit.MIN); } @@ -199,4 +191,4 @@ public class AbandonedCoordCheckerService implements Service { public Class<? extends Service> getInterface() { return AbandonedCoordCheckerService.class; } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/service/ActionCheckerService.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/service/ActionCheckerService.java b/core/src/main/java/org/apache/oozie/service/ActionCheckerService.java index b085014..1afd01b 100644 --- a/core/src/main/java/org/apache/oozie/service/ActionCheckerService.java +++ b/core/src/main/java/org/apache/oozie/service/ActionCheckerService.java @@ -21,7 +21,6 @@ package org.apache.oozie.service; import java.util.ArrayList; import java.util.List; -import org.apache.hadoop.conf.Configuration; import org.apache.oozie.ErrorCode; import org.apache.oozie.WorkflowActionBean; import org.apache.oozie.command.CommandException; @@ -194,7 +193,7 @@ public class ActionCheckerService implements Service { callables = new ArrayList<XCallable<Void>>(); } callables.add(callable); - if (callables.size() == Services.get().getConf().getInt(CONF_CALLABLE_BATCH_SIZE, 10)) { + if (callables.size() == ConfigurationService.getInt(CONF_CALLABLE_BATCH_SIZE)) { boolean ret = Services.get().get(CallableQueueService.class).queueSerial(callables); if (ret == false) { XLog.getLog(getClass()).warn( @@ -222,10 +221,11 @@ public class ActionCheckerService implements Service { */ @Override public void init(Services services) { - Configuration conf = services.getConf(); - Runnable actionCheckRunnable = new ActionCheckRunnable(conf.getInt(CONF_ACTION_CHECK_DELAY, 600)); + Runnable actionCheckRunnable = new ActionCheckRunnable(ConfigurationService.getInt + (services.getConf(), CONF_ACTION_CHECK_DELAY)); services.get(SchedulerService.class).schedule(actionCheckRunnable, 10, - conf.getInt(CONF_ACTION_CHECK_INTERVAL, 60), SchedulerService.Unit.SEC); + ConfigurationService.getInt(services.getConf(), CONF_ACTION_CHECK_INTERVAL), + SchedulerService.Unit.SEC); } /** http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/service/ActionService.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/service/ActionService.java b/core/src/main/java/org/apache/oozie/service/ActionService.java index ebfe299..c8ed265 100644 --- a/core/src/main/java/org/apache/oozie/service/ActionService.java +++ b/core/src/main/java/org/apache/oozie/service/ActionService.java @@ -57,10 +57,12 @@ public class ActionService implements Service { EndActionExecutor.class, KillActionExecutor.class, ForkActionExecutor.class, JoinActionExecutor.class }; registerExecutors(classes); - classes = (Class<? extends ActionExecutor>[]) services.getConf().getClasses(CONF_ACTION_EXECUTOR_CLASSES); + classes = (Class<? extends ActionExecutor>[]) ConfigurationService.getClasses + (services.getConf(), CONF_ACTION_EXECUTOR_CLASSES); registerExecutors(classes); - classes = (Class<? extends ActionExecutor>[]) services.getConf().getClasses(CONF_ACTION_EXECUTOR_EXT_CLASSES); + classes = (Class<? extends ActionExecutor>[]) ConfigurationService.getClasses + (services.getConf(), CONF_ACTION_EXECUTOR_EXT_CLASSES); registerExecutors(classes); } http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/service/AuthorizationService.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/service/AuthorizationService.java b/core/src/main/java/org/apache/oozie/service/AuthorizationService.java index 293de3f..9ce0640 100644 --- a/core/src/main/java/org/apache/oozie/service/AuthorizationService.java +++ b/core/src/main/java/org/apache/oozie/service/AuthorizationService.java @@ -108,7 +108,7 @@ public class AuthorizationService implements Service { CONF_SECURITY_ENABLED, false); if (authorizationEnabled) { log.info("Oozie running with authorization enabled"); - useDefaultGroupAsAcl = Services.get().getConf().getBoolean(CONF_DEFAULT_GROUP_AS_ACL, false); + useDefaultGroupAsAcl = ConfigurationService.getBoolean(CONF_DEFAULT_GROUP_AS_ACL); String[] str = getTrimmedStrings(Services.get().getConf().get(CONF_ADMIN_GROUPS)); if (str.length > 0) { log.info("Admin users will be checked against the defined admin groups"); http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/service/CallableQueueService.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/service/CallableQueueService.java b/core/src/main/java/org/apache/oozie/service/CallableQueueService.java index 25fed7d..fd7b55f 100644 --- a/core/src/main/java/org/apache/oozie/service/CallableQueueService.java +++ b/core/src/main/java/org/apache/oozie/service/CallableQueueService.java @@ -437,11 +437,11 @@ public class CallableQueueService implements Service, Instrumentable { public void init(Services services) { Configuration conf = services.getConf(); - queueSize = conf.getInt(CONF_QUEUE_SIZE, 10000); - int threads = conf.getInt(CONF_THREADS, 10); - boolean callableNextEligible = conf.getBoolean(CONF_CALLABLE_NEXT_ELIGIBLE, true); + queueSize = ConfigurationService.getInt(conf, CONF_QUEUE_SIZE); + int threads = ConfigurationService.getInt(conf, CONF_THREADS); + boolean callableNextEligible = ConfigurationService.getBoolean(conf, CONF_CALLABLE_NEXT_ELIGIBLE); - for (String type : conf.getStringCollection(CONF_CALLABLE_INTERRUPT_TYPES)) { + for (String type : ConfigurationService.getStrings(conf, CONF_CALLABLE_INTERRUPT_TYPES)) { log.debug("Adding interrupt type [{0}]", type); INTERRUPT_TYPES.add(type); } @@ -480,7 +480,7 @@ public class CallableQueueService implements Service, Instrumentable { }; } - interruptMapMaxSize = conf.getInt(CONF_CALLABLE_INTERRUPT_MAP_MAX_SIZE, 100); + interruptMapMaxSize = ConfigurationService.getInt(conf, CONF_CALLABLE_INTERRUPT_MAP_MAX_SIZE); // IMPORTANT: The ThreadPoolExecutor does not always the execute // commands out of the queue, there are @@ -513,7 +513,7 @@ public class CallableQueueService implements Service, Instrumentable { }); } - maxCallableConcurrency = conf.getInt(CONF_CALLABLE_CONCURRENCY, 3); + maxCallableConcurrency = ConfigurationService.getInt(conf, CONF_CALLABLE_CONCURRENCY); } /** http://git-wip-us.apache.org/repos/asf/oozie/blob/2fc2fc9e/core/src/main/java/org/apache/oozie/service/CallbackService.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/service/CallbackService.java b/core/src/main/java/org/apache/oozie/service/CallbackService.java index e7463cf..7fa07f1 100644 --- a/core/src/main/java/org/apache/oozie/service/CallbackService.java +++ b/core/src/main/java/org/apache/oozie/service/CallbackService.java @@ -77,7 +77,7 @@ public class CallbackService implements Service { ParamChecker.notEmpty(actionId, "actionId"); ParamChecker.notEmpty(externalStatusVar, "externalStatusVar"); //TODO: figure out why double encoding is happening in case of hadoop callbacks. - String baseCallbackUrl = oozieConf.get(CONF_BASE_URL, "http://localhost:8080/oozie/v0/callback"); + String baseCallbackUrl = ConfigurationService.get(oozieConf, CONF_BASE_URL); return MessageFormat.format(CALL_BACK_QUERY_STRING, baseCallbackUrl, actionId, externalStatusVar); }
