diff options
| author | Rafael H. Schloming <rhs@apache.org> | 2008-08-05 19:33:11 +0000 |
|---|---|---|
| committer | Rafael H. Schloming <rhs@apache.org> | 2008-08-05 19:33:11 +0000 |
| commit | 2c5100e6829529ea0df4463c5d914d613e45c1c8 (patch) | |
| tree | c27e316d892edf5ac42348825a0ba2079f7f80a7 /java/common/Composite.tpl | |
| parent | b5f8cf1bd9b5652e2691d6bc5b9b1c3228f53d68 (diff) | |
| download | qpid-python-2c5100e6829529ea0df4463c5d914d613e45c1c8.tar.gz | |
Profiling driven changes:
- made AMQShortString cache the toString() value
- added static initializer to IoTransport to disable use of pooled
byte buffers
- modified IoSender to permit buffering
- removed OutputHandler and eliminated intermediate Frame generation
between Disassembler and Sender<ByteBuffer> (IoSender)
- made Disassembler take advantage of IoSender's buffering
- removed Header and Data as distinct protocol events, added Header
and Body members to MessageTransfer
- modified Assembler and Disassembler to decode/encode Header and
Data directly to/from MessageTransfer
- modified Disassembler to only write data if encoding of headers is
successful
- added Strings.toUTF8(String) -> byte[] to do proper UTF-8 encoding
that is also fast for 7-bit ascii
- modified JMSTextMessage to use the Strings.toUTF8
- modified QpidBench to only generate 7-bit ascii when using
TextMessage
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@682887 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/common/Composite.tpl')
| -rw-r--r-- | java/common/Composite.tpl | 53 |
1 files changed, 50 insertions, 3 deletions
diff --git a/java/common/Composite.tpl b/java/common/Composite.tpl index 37e3bf8853..283fa24641 100644 --- a/java/common/Composite.tpl +++ b/java/common/Composite.tpl @@ -1,5 +1,6 @@ package org.apache.qpid.transport; +import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; @@ -9,7 +10,6 @@ import java.util.UUID; import org.apache.qpid.transport.codec.Decoder; import org.apache.qpid.transport.codec.Encodable; import org.apache.qpid.transport.codec.Encoder; -import org.apache.qpid.transport.codec.Validator; import org.apache.qpid.transport.network.Frame; @@ -18,11 +18,13 @@ from genutil import * cls = klass(type)["@name"] +segments = type["segments"] + if type.name in ("control", "command"): base = "Method" size = 0 pack = 2 - if type["segments"]: + if segments: payload = "true" else: payload = "false" @@ -86,6 +88,10 @@ options = get_options(fields) for f in fields: if not f.empty: out(" private $(f.type) $(f.name);\n") + +if segments: + out(" private Header header;\n") + out(" private ByteBuffer body;\n") } ${ @@ -99,6 +105,10 @@ for f in fields: if f.option: continue out(" $(f.set)($(f.name));\n") +if segments: + out(" setHeader(header);\n") + out(" setBody(body);\n") + if options or base == "Method": out(""" for (int i=0; i < _options.length; i++) { @@ -154,7 +164,6 @@ else: } public final $name $(f.set)($(f.type) value) { - $(f.check) ${ if not f.empty: out(" this.$(f.name) = value;") @@ -173,6 +182,44 @@ if pack > 0: """) } +${ +if segments: + out(""" public final Header getHeader() { + return this.header; + } + + public final void setHeader(Header header) { + this.header = header; + } + + public final $name header(Header header) { + setHeader(header); + return this; + } + + public final ByteBuffer getBody() { + if (this.body == null) + { + return null; + } + else + { + return this.body.slice(); + } + } + + public final void setBody(ByteBuffer body) { + this.body = body; + } + + public final $name body(ByteBuffer body) + { + setBody(body); + return this; + } +""") +} + public void write(Encoder enc) { ${ |
