You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by ve...@apache.org on 2008/03/12 23:56:09 UTC
svn commit: r636564 -
/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/ThreadSafeDelegatingVariableContext.java
Author: veithen
Date: Wed Mar 12 15:56:05 2008
New Revision: 636564
URL: http://svn.apache.org/viewvc?rev=636564&view=rev
Log:
Added a delegating VariableContext implementation to make SynapseXPath thread safe (see SYNAPSE-235).
Added:
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/ThreadSafeDelegatingVariableContext.java
Added: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/ThreadSafeDelegatingVariableContext.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/ThreadSafeDelegatingVariableContext.java?rev=636564&view=auto
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/ThreadSafeDelegatingVariableContext.java (added)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/ThreadSafeDelegatingVariableContext.java Wed Mar 12 15:56:05 2008
@@ -0,0 +1,35 @@
+/*
+ * 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.apache.synapse.util;
+
+import org.jaxen.UnresolvableException;
+import org.jaxen.VariableContext;
+
+public class ThreadSafeDelegatingVariableContext implements VariableContext {
+ private final ThreadLocal<VariableContext> delegate = new ThreadLocal<VariableContext>();
+
+ public void setDelegate(VariableContext delegate) {
+ this.delegate.set(delegate);
+ }
+
+ public Object getVariableValue(String namespaceURI, String prefix, String localName)
+ throws UnresolvableException {
+ return delegate.get().getVariableValue(namespaceURI, prefix, localName);
+ }
+}