use of com.swiftmq.tools.dump.Dumpable in project swiftmq-client by iitsoftware.
the class MessageProperties method writeContent.
public void writeContent(DataOutput out) throws IOException {
out.writeInt(map.size());
for (Map.Entry<String, Dumpable> stringDumpableEntry : map.entrySet()) {
out.writeUTF(stringDumpableEntry.getKey());
Dumpable d = stringDumpableEntry.getValue();
out.writeInt(d.getDumpId());
d.writeContent(out);
}
}
use of com.swiftmq.tools.dump.Dumpable in project swiftmq-client by iitsoftware.
the class StreamMessageImpl method readBody.
protected void readBody(DataInput in) throws IOException {
nElements = in.readInt();
if (nElements > 0) {
elements = new Primitive[nElements];
for (int i = 0; i < elements.length; i++) {
Dumpable d = (Dumpable) PrimitiveFactory.createInstance(in.readInt());
d.readContent(in);
elements[i] = (Primitive) d;
}
}
}
use of com.swiftmq.tools.dump.Dumpable in project swiftmq-ce by iitsoftware.
the class InboundReader method dataAvailable.
public void dataAvailable(Connection connection, InputStream inputStream) throws IOException {
dis.setInputStream(inputStream);
Dumpable obj = Dumpalizer.construct(dis, dumpableFactory);
if (traceSpace.enabled)
traceSpace.trace("smqp", "read object: " + obj);
if (obj.getDumpId() != SMQPFactory.DID_KEEP_ALIVE_REQ) {
if (obj.getDumpId() == SMQPFactory.DID_BULK_REQ) {
SMQPBulkRequest bulkRequest = (SMQPBulkRequest) obj;
for (int i = 0; i < bulkRequest.len; i++) {
Request req = (Request) bulkRequest.dumpables[i];
if (req.getDumpId() != SMQPFactory.DID_KEEP_ALIVE_REQ)
dispatch(req);
}
} else
dispatch((Request) obj);
}
}
use of com.swiftmq.tools.dump.Dumpable in project swiftmq-ce by iitsoftware.
the class InboundReader method dataAvailable.
public void dataAvailable(Connection connection, InputStream inputStream) throws IOException {
dis.setInputStream(inputStream);
Dumpable obj = Dumpalizer.construct(dis, dumpableFactory);
if (traceSpace.enabled)
traceSpace.trace("smqp", "read object: " + obj);
if (obj.getDumpId() != SMQPFactory.DID_KEEP_ALIVE_REQ) {
if (obj.getDumpId() == SMQPFactory.DID_BULK_REQ) {
SMQPBulkRequest bulkRequest = (SMQPBulkRequest) obj;
for (int i = 0; i < bulkRequest.len; i++) {
Request req = (Request) bulkRequest.dumpables[i];
if (req.getDumpId() != SMQPFactory.DID_KEEP_ALIVE_REQ)
dispatch(req);
}
} else
dispatch((Request) obj);
}
}
use of com.swiftmq.tools.dump.Dumpable in project swiftmq-client by iitsoftware.
the class Connector method visit.
public void visit(PODataAvailable po) {
if (debug)
System.out.println(toString() + ", visit, po=" + po + " ...");
DataInput in = po.getIn();
try {
Dumpable obj = Dumpalizer.construct(in, dumpableFactory);
if (debug)
System.out.println(toString() + ", dataAvailable, obj=" + obj);
if (obj == null || obj.getDumpId() == SMQPFactory.DID_KEEPALIVE_REQ) {
return;
}
if (!recreateStarted) {
if (obj.getDumpId() == SMQPFactory.DID_BULK_REQ) {
SMQPBulkRequest bulkRequest = (SMQPBulkRequest) obj;
for (int i = 0; i < bulkRequest.len; i++) {
Dumpable dumpable = (Dumpable) bulkRequest.dumpables[i];
if (dumpable.getDumpId() != SMQPFactory.DID_KEEPALIVE_REQ)
setReply(dumpable);
}
} else
setReply(obj);
current = null;
} else if (obj.getDumpId() == SMQPFactory.DID_BULK_REQ) {
SMQPBulkRequest bulkRequest = (SMQPBulkRequest) obj;
for (int i = 0; i < bulkRequest.len; i++) {
Dumpable dumpable = (Dumpable) bulkRequest.dumpables[i];
if (dumpable.getDumpId() != SMQPFactory.DID_KEEPALIVE_REQ) {
currentRecreatePO.getRecreatable().setRecreateReply((Reply) dumpable);
currentRecreatePO.setSuccess(true);
if (currentRecreatePO.getSemaphore() != null)
currentRecreatePO.getSemaphore().notifySingleWaiter();
}
}
} else {
currentRecreatePO.getRecreatable().setRecreateReply((Reply) obj);
currentRecreatePO.setSuccess(true);
if (currentRecreatePO.getSemaphore() != null)
currentRecreatePO.getSemaphore().notifySingleWaiter();
}
currentRecreatePO = null;
requestTime = -1;
} catch (Exception e) {
if (debug)
System.out.println(toString() + ", visit, po=" + po + ", exception=" + e);
if (currentRecreatePO != null) {
currentRecreatePO.setSuccess(false);
currentRecreatePO.setException(e.toString());
if (currentRecreatePO.getSemaphore() != null)
currentRecreatePO.getSemaphore().notifySingleWaiter();
currentRecreatePO = null;
}
reconnector.invalidateConnection();
connection = null;
reconnectInProgress = false;
currentRecreatePO = null;
requestTime = -1;
dispatch(new POReconnect(sem, recreatableConnection, true));
}
if (debug)
System.out.println(toString() + ", visit, po=" + po + " done");
}
Aggregations