You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by bo...@apache.org on 2015/09/23 20:29:03 UTC
[1/3] qpid-proton git commit: NO-JIRA: Add Event.getRootHandler()
Repository: qpid-proton
Updated Branches:
refs/heads/master 705284bc4 -> 3cb935f1c
NO-JIRA: Add Event.getRootHandler()
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/3cb935f1
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/3cb935f1
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/3cb935f1
Branch: refs/heads/master
Commit: 3cb935f1c8523a9065665eb386a1c04d47b5397e
Parents: 7de6a18
Author: Bozo Dragojevic <bo...@digiverse.si>
Authored: Wed Sep 23 19:55:12 2015 +0200
Committer: Bozo Dragojevic <bo...@digiverse.si>
Committed: Wed Sep 23 20:04:03 2015 +0200
----------------------------------------------------------------------
.../java/org/apache/qpid/proton/engine/Event.java | 15 +++++++++++++--
.../apache/qpid/proton/engine/impl/EventImpl.java | 6 ++++++
.../apache/qpid/proton/reactor/impl/ReactorImpl.java | 11 +++++++++--
.../qpid/proton/engine/EventExtensibilityTest.java | 4 ++++
4 files changed, 32 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3cb935f1/proton-j/src/main/java/org/apache/qpid/proton/engine/Event.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/engine/Event.java b/proton-j/src/main/java/org/apache/qpid/proton/engine/Event.java
index 3929ba5..1fd2f4c 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/engine/Event.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/engine/Event.java
@@ -116,15 +116,26 @@ public interface Event extends Extendable
Object getContext();
+ /**
+ * The {@link Handler} at the root of the handler tree.
+ * <p>
+ * Set by the {@link Reactor} before dispatching the event.
+ * <p>
+ * @see #redispatch(EventType, Handler)
+ * @return The root handler
+ */
+ Handler getRootHandler();
+
void dispatch(Handler handler) throws HandlerException;
/**
* Synchronously redispatch the current event as a new {@link EventType} on the provided handler and it's children.
* <p>
- * Note: the redispatch will happen before children of the current handler have had the current event dispatched.
+ * Note: the <code>redispatch()</code> will complete before children of the current handler have had the current event dispatched, see {@link #delegate()}.
+ *
*
* @param as_type Type of event to dispatch
- * @param handler The handler where to start the dispatch
+ * @param handler The handler where to start the dispatch. Use {@link #getRootHandler()} to redispatch the new event to all handlers in the tree.
* @throws HandlerException A wrapper exception of any unhandled exception thrown by <code>handler</code>
*/
void redispatch(EventType as_type, Handler handler) throws HandlerException;
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3cb935f1/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/EventImpl.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/EventImpl.java b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/EventImpl.java
index 98d9265..40f2669 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/EventImpl.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/EventImpl.java
@@ -37,6 +37,7 @@ import org.apache.qpid.proton.engine.Transport;
import org.apache.qpid.proton.reactor.Reactor;
import org.apache.qpid.proton.reactor.Selectable;
import org.apache.qpid.proton.reactor.Task;
+import org.apache.qpid.proton.reactor.impl.ReactorImpl;
/**
* EventImpl
@@ -90,6 +91,11 @@ class EventImpl implements Event
return context;
}
+ @Override
+ public Handler getRootHandler() {
+ return ReactorImpl.ROOT.get(this);
+ }
+
private Handler delegated = null;
@Override
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3cb935f1/proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/ReactorImpl.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/ReactorImpl.java b/proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/ReactorImpl.java
index 8335ea7..0d5c429 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/ReactorImpl.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/ReactorImpl.java
@@ -36,6 +36,7 @@ import org.apache.qpid.proton.engine.Event;
import org.apache.qpid.proton.engine.Event.Type;
import org.apache.qpid.proton.engine.EventType;
import org.apache.qpid.proton.engine.Extendable;
+import org.apache.qpid.proton.engine.ExtendableAccessor;
import org.apache.qpid.proton.engine.Handler;
import org.apache.qpid.proton.engine.HandlerException;
import org.apache.qpid.proton.engine.Record;
@@ -51,6 +52,7 @@ import org.apache.qpid.proton.reactor.Selector;
import org.apache.qpid.proton.reactor.Task;
public class ReactorImpl implements Reactor, Extendable {
+ public static final ExtendableAccessor<Event, Handler> ROOT = new ExtendableAccessor<>(Handler.class);
private CollectorImpl collector;
private long now;
@@ -267,8 +269,8 @@ public class ReactorImpl implements Reactor, Extendable {
return true;
}
Handler handler = eventHandler(event);
- event.dispatch(handler);
- event.dispatch(global);
+ dispatch(event, handler);
+ dispatch(event, global);
if (event.getEventType() == Type.CONNECTION_FINAL) {
children.remove(event.getConnection());
@@ -297,6 +299,11 @@ public class ReactorImpl implements Reactor, Extendable {
}
}
+ private void dispatch(Event event, Handler handler) {
+ ROOT.set(event, handler);
+ event.dispatch(handler);
+ }
+
@Override
public void wakeup() {
try {
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3cb935f1/proton-j/src/test/java/org/apache/qpid/proton/engine/EventExtensibilityTest.java
----------------------------------------------------------------------
diff --git a/proton-j/src/test/java/org/apache/qpid/proton/engine/EventExtensibilityTest.java b/proton-j/src/test/java/org/apache/qpid/proton/engine/EventExtensibilityTest.java
index 53a247b..230788f 100644
--- a/proton-j/src/test/java/org/apache/qpid/proton/engine/EventExtensibilityTest.java
+++ b/proton-j/src/test/java/org/apache/qpid/proton/engine/EventExtensibilityTest.java
@@ -195,6 +195,10 @@ public class EventExtensibilityTest extends TestCase {
return impl.getContext();
}
+ public Handler getRootHandler() {
+ return impl.getRootHandler();
+ }
+
public void dispatch(Handler handler) throws HandlerException {
impl.dispatch(handler);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[2/3] qpid-proton git commit: NO-JIRA: Python: keep received encoded
bytes in the delivery
Posted by bo...@apache.org.
NO-JIRA: Python: keep received encoded bytes in the delivery
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/7de6a183
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/7de6a183
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/7de6a183
Branch: refs/heads/master
Commit: 7de6a183bd84e90a772ab622dbba04e749a97f44
Parents: 07ea651
Author: Bozo Dragojevic <bo...@digiverse.si>
Authored: Mon Sep 21 13:00:00 2015 +0200
Committer: Bozo Dragojevic <bo...@digiverse.si>
Committed: Wed Sep 23 20:04:03 2015 +0200
----------------------------------------------------------------------
proton-c/bindings/python/proton/__init__.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7de6a183/proton-c/bindings/python/proton/__init__.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/proton/__init__.py b/proton-c/bindings/python/proton/__init__.py
index c3890d4..fc26264 100644
--- a/proton-c/bindings/python/proton/__init__.py
+++ b/proton-c/bindings/python/proton/__init__.py
@@ -1134,13 +1134,13 @@ The group-id for any replies.
if link.is_sender: return None
dlv = link.current
if not dlv or dlv.partial: return None
- encoded = link.recv(dlv.pending)
+ dlv.encoded = link.recv(dlv.pending)
link.advance()
# the sender has already forgotten about the delivery, so we might
# as well too
if link.remote_snd_settle_mode == Link.SND_SETTLED:
dlv.settle()
- self.decode(encoded)
+ self.decode(dlv.encoded)
return dlv
def __repr2__(self):
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[3/3] qpid-proton git commit: NO-JIRA: Properly wrap subclassed
WrappedHandlers
Posted by bo...@apache.org.
NO-JIRA: Properly wrap subclassed WrappedHandlers
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/07ea6510
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/07ea6510
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/07ea6510
Branch: refs/heads/master
Commit: 07ea6510cf9f5c98ebb8f9a6815871b009f0fc71
Parents: 705284b
Author: Bozo Dragojevic <bo...@digiverse.si>
Authored: Mon Sep 21 11:54:26 2015 +0200
Committer: Bozo Dragojevic <bo...@digiverse.si>
Committed: Wed Sep 23 20:04:03 2015 +0200
----------------------------------------------------------------------
proton-c/bindings/python/proton/__init__.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/07ea6510/proton-c/bindings/python/proton/__init__.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/proton/__init__.py b/proton-c/bindings/python/proton/__init__.py
index 8bdb7a3..c3890d4 100644
--- a/proton-c/bindings/python/proton/__init__.py
+++ b/proton-c/bindings/python/proton/__init__.py
@@ -3895,12 +3895,12 @@ class WrappedHandler(Wrapper):
handlers = WrappedHandlersProperty()
- @staticmethod
- def wrap(impl, on_error=None):
+ @classmethod
+ def wrap(cls, impl, on_error=None):
if impl is None:
return None
else:
- handler = WrappedHandler(impl)
+ handler = cls(impl)
handler.__dict__["on_error"] = on_error
return handler
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org