use of com.swiftmq.tools.dump.Dumpable in project swiftmq-ce by iitsoftware.
the class InboundReader method dataAvailable.
public void dataAvailable(Connection c, InputStream inputStream) throws IOException {
if (compression) {
dbis.reset();
dbos.rewind();
dis.setInputStream(inputStream);
int len = dis.readInt();
byte[] b = new byte[len];
dis.readFully(b);
dbis.setBuffer(b);
decompress();
dbis.setBuffer(dbos.getBuffer(), 0, dbos.getCount());
dis.setInputStream(dbis);
} else
dis.setInputStream(inputStream);
Dumpable obj = Dumpalizer.construct(dis, dumpableFactory);
if (traceSpace.enabled)
traceSpace.trace("smqr", toString() + ": read object: " + obj);
if (obj.getDumpId() != SMQRFactory.KEEPALIVE_REQ) {
if (obj.getDumpId() == SMQRFactory.BULK_REQ) {
BulkRequest bulkRequest = (BulkRequest) obj;
for (int i = 0; i < bulkRequest.len; i++) {
Request req = (Request) bulkRequest.dumpables[i];
if (req.getDumpId() != SMQRFactory.KEEPALIVE_REQ) {
dispatch(req);
} else {
keepaliveCount++;
if (traceSpace.enabled)
traceSpace.trace("smqr", toString() + ": incrementing keepaliveCount to: " + keepaliveCount);
}
}
} else {
dispatch((Request) obj);
}
} else {
keepaliveCount = 5;
if (traceSpace.enabled)
traceSpace.trace("smqr", toString() + ": setting keepaliveCount to: " + keepaliveCount);
}
}
use of com.swiftmq.tools.dump.Dumpable in project swiftmq-ce by iitsoftware.
the class TopicInfoFactory method createDumpable.
protected Dumpable createDumpable(Versioned versioned) throws VersionedException {
int version = versioned.getVersion();
Dumpable d = null;
switch(version) {
case 400:
d = new com.swiftmq.impl.topic.standard.announce.v400.TopicInfoImpl();
break;
}
if (d != null) {
try {
dis.reset();
dis.setBuffer(versioned.getPayload(), 0, versioned.getLength());
// dumpid
dis.readInt();
d.readContent(dis);
} catch (IOException e) {
throw new VersionedException(e.toString());
}
}
return d;
}
use of com.swiftmq.tools.dump.Dumpable in project swiftmq-client by iitsoftware.
the class StreamMessageImpl method writeBody.
protected void writeBody(DataOutput out) throws IOException {
out.writeInt(nElements);
if (nElements > 0) {
for (int i = 0; i < nElements; i++) {
Dumpable d = (Dumpable) elements[i];
out.writeInt(d.getDumpId());
d.writeContent(out);
}
}
}
Aggregations