You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2010/01/12 23:45:46 UTC
svn commit: r898560 - in
/ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context:
ExecutionContextFactory.java ThreadContext.java
Author: adrianc
Date: Tue Jan 12 22:45:46 2010
New Revision: 898560
URL: http://svn.apache.org/viewvc?rev=898560&view=rev
Log:
Implemented an ExecutionContext factory.
Added:
ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ExecutionContextFactory.java (with props)
Modified:
ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ThreadContext.java
Added: ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ExecutionContextFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ExecutionContextFactory.java?rev=898560&view=auto
==============================================================================
--- ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ExecutionContextFactory.java (added)
+++ ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ExecutionContextFactory.java Tue Jan 12 22:45:46 2010
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.ofbiz.api.context;
+
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilProperties;
+
+/** An <code>ExecutionContext</code> factory.
+ */
+public class ExecutionContextFactory {
+
+ protected static final String module = ExecutionContextFactory.class.getName();
+
+ public static ExecutionContext getInstance() {
+ ExecutionContext result = null;
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ String className = UtilProperties.getPropertyValue("api.properties", "executionContext.class");
+ try {
+ result = (ExecutionContext) loader.loadClass(className).newInstance();
+ } catch (Exception e) {
+ Debug.logError(e, module);
+ }
+ return result;
+ }
+}
Propchange: ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ExecutionContextFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ExecutionContextFactory.java
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author URL Id"
Propchange: ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ExecutionContextFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ThreadContext.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ThreadContext.java?rev=898560&r1=898559&r2=898560&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ThreadContext.java (original)
+++ ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ThreadContext.java Tue Jan 12 22:45:46 2010
@@ -24,8 +24,6 @@
import org.ofbiz.api.authorization.AccessController;
import org.ofbiz.api.authorization.AuthorizationManager;
-import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.UtilProperties;
/** A convenience class for accessing the current thread's <code>ExecutionContext</code>.
* @see {@link org.ofbiz.service.ExecutionContext}
@@ -36,15 +34,7 @@
protected static final ThreadLocal<ExecutionContext> executionContext = new ThreadLocal<ExecutionContext>() {
protected synchronized ExecutionContext initialValue() {
- ExecutionContext result = null;
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- String className = UtilProperties.getPropertyValue("api.properties", "executionContext.class");
- try {
- result = (ExecutionContext) loader.loadClass(className).newInstance();
- } catch (Exception e) {
- Debug.logError(e, module);
- }
- return result;
+ return ExecutionContextFactory.getInstance();
}
};