Search in sources :

Example 1 with BulkRequest

use of com.swiftmq.impl.routing.single.smqpr.BulkRequest 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);
    }
}
Also used : BulkRequest(com.swiftmq.impl.routing.single.smqpr.BulkRequest) Request(com.swiftmq.tools.requestreply.Request) BulkRequest(com.swiftmq.impl.routing.single.smqpr.BulkRequest) Dumpable(com.swiftmq.tools.dump.Dumpable)

Aggregations

BulkRequest (com.swiftmq.impl.routing.single.smqpr.BulkRequest)1 Dumpable (com.swiftmq.tools.dump.Dumpable)1 Request (com.swiftmq.tools.requestreply.Request)1