ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1734157 - in /webservices/axiom/trunk/aspects: core-aspects/src/main/java/org/apache/axiom/core/ core-aspects/src/main/java/org/apache/axiom/core/impl/ core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/ om-aspects/src/main/java/o...
Date Tue, 08 Mar 2016 21:07:16 GMT
Author: veithen
Date: Tue Mar  8 21:07:16 2016
New Revision: 1734157

URL: http://svn.apache.org/viewvc?rev=1734157&view=rev
Log:
Introduce an additional state indicating that a request has been made to discard a node, but
that the corresponding events have not been consumed yet.

Modified:
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreParentNode.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/TreeWalkerImpl.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreChildNodeSupport.aj
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreParentNodeSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Context.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreParentNode.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreParentNode.java?rev=1734157&r1=1734156&r2=1734157&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreParentNode.java
(original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreParentNode.java
Tue Mar  8 21:07:16 2016
@@ -25,8 +25,19 @@ public interface CoreParentNode extends
     int COMPLETE = 0;
     int ATTRIBUTES_PENDING = 1;
     int INCOMPLETE = 2;
-    int DISCARDED = 3;
-    int COMPACT = 4;
+    
+    /**
+     * A request was made to discard the node, but some of the events corresponding to this
node
+     * have not been consumed yet.
+     */
+    int DISCARDING = 3;
+    
+    /**
+     * The node has been discarded and all corresponding events have been consumed.
+     */
+    int DISCARDED = 4;
+    
+    int COMPACT = 5;
     
     Builder coreGetBuilder();
     InputContext coreGetInputContext();

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/TreeWalkerImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/TreeWalkerImpl.java?rev=1734157&r1=1734156&r2=1734157&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/TreeWalkerImpl.java
(original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/TreeWalkerImpl.java
Tue Mar  8 21:07:16 2016
@@ -145,7 +145,7 @@ public final class TreeWalkerImpl implem
                     CoreChildNode child = parent.coreGetFirstChildIfAvailable();
                     if (child == null) {
                         nextNode = parent;
-                        if (nodeState == CoreParentNode.DISCARDED) {
+                        if (nodeState == CoreParentNode.DISCARDING || nodeState == CoreParentNode.DISCARDED)
{
                             throw new NodeConsumedException();
                         }
                         parent.coreGetInputContext().setPassThroughHandler(handler);
@@ -181,7 +181,7 @@ public final class TreeWalkerImpl implem
                         
                         if (nodeState == CoreParentNode.COMPLETE) {
                             state = STATE_VISITED;
-                        } else if (nodeState == CoreParentNode.DISCARDED) {
+                        } else if (nodeState == CoreParentNode.DISCARDING || nodeState ==
CoreParentNode.DISCARDED) {
                             throw new NodeConsumedException();
                         } else {
                             parent.coreGetInputContext().setPassThroughHandler(handler);

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreChildNodeSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreChildNodeSupport.aj?rev=1734157&r1=1734156&r2=1734157&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreChildNodeSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreChildNodeSupport.aj
Tue Mar  8 21:07:16 2016
@@ -119,6 +119,7 @@ public aspect CoreChildNodeSupport {
             CoreParentNode parent = coreGetParent();
             if (parent != null && parent.coreGetBuilder() != null) {
                 switch (parent.getState()) {
+                    case CoreParentNode.DISCARDING:
                     case CoreParentNode.DISCARDED:
                         throw new NodeConsumedException();
                     case CoreParentNode.INCOMPLETE:

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreParentNodeSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreParentNodeSupport.aj?rev=1734157&r1=1734156&r2=1734157&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreParentNodeSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreParentNodeSupport.aj
Tue Mar  8 21:07:16 2016
@@ -144,6 +144,7 @@ public aspect CoreParentNodeSupport {
         CoreChildNode firstChild = coreGetFirstChildIfAvailable();
         if (firstChild == null) {
             switch (getState()) {
+                case CoreParentNode.DISCARDING:
                 case CoreParentNode.DISCARDED:
                     throw new NodeConsumedException();
                 case CoreParentNode.INCOMPLETE:
@@ -256,6 +257,7 @@ public aspect CoreParentNodeSupport {
             }
             content = null;
             if (updateState) {
+                // TODO: need to check that the builder will not modify the state to DISCARDED
later
                 coreSetState(COMPLETE);
             }
         }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Context.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Context.java?rev=1734157&r1=1734156&r2=1734157&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Context.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Context.java
Tue Mar  8 21:07:16 2016
@@ -78,7 +78,7 @@ public final class Context implements In
         if (this.passThroughHandler != null) {
             throw new IllegalStateException("A pass-through handler has already been set
for this context");
         }
-        target.coreSetState(CoreParentNode.DISCARDED);
+        target.coreSetState(CoreParentNode.DISCARDING);
         this.passThroughHandler = passThroughHandler;
         if (passThroughHandler == NullXmlHandler.INSTANCE) {
             builderHandler.decrementActiveContextCount();
@@ -87,7 +87,7 @@ public final class Context implements In
     
     @Override
     public void discard() {
-        target.coreSetState(CoreParentNode.DISCARDED);
+        target.coreSetState(CoreParentNode.DISCARDING);
         passThroughHandler = NullXmlHandler.INSTANCE;
         builderHandler.decrementActiveContextCount();
     }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj?rev=1734157&r1=1734156&r2=1734157&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj
Tue Mar  8 21:07:16 2016
@@ -168,7 +168,7 @@ public aspect AxiomContainerSupport {
                 omNode.build();
             }
         } else {
-            if (getState() == AxiomContainer.DISCARDED) {
+            if (getState() == AxiomContainer.DISCARDING || getState() == AxiomContainer.DISCARDED)
{
                 throw new NodeUnavailableException();
             }
             if (builder != null && builder.isCompleted()) {



Mime
View raw message