diff options
Diffstat (limited to 'qpid/java/common/src/main/java/org/apache/qpid/transport/Method.java')
-rw-r--r-- | qpid/java/common/src/main/java/org/apache/qpid/transport/Method.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/Method.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/Method.java index e1e1f846cb..4b7f711bff 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/transport/Method.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/transport/Method.java @@ -35,6 +35,7 @@ import static org.apache.qpid.transport.util.Functions.*; public abstract class Method extends Struct implements ProtocolEvent { + public static final Method create(int type) { // XXX: should generate separate factories for separate @@ -43,12 +44,18 @@ public abstract class Method extends Struct implements ProtocolEvent } // XXX: command subclass? + public static interface CompletionListener + { + public void onComplete(Method method); + } + private int id; private int channel; private boolean idSet = false; private boolean sync = false; private boolean batch = false; private boolean unreliable = false; + private CompletionListener completionListener; public final int getId() { @@ -61,6 +68,11 @@ public abstract class Method extends Struct implements ProtocolEvent this.idSet = true; } + boolean idSet() + { + return idSet; + } + public final int getChannel() { return channel; @@ -152,6 +164,21 @@ public abstract class Method extends Struct implements ProtocolEvent } } + + public void setCompletionListener(CompletionListener completionListener) + { + this.completionListener = completionListener; + } + + public void complete() + { + if(completionListener!= null) + { + completionListener.onComplete(this); + completionListener = null; + } + } + public String toString() { StringBuilder str = new StringBuilder(); |