Package org.jscsi.initiator.connection.state

Examples of org.jscsi.initiator.connection.state.WriteRequestState


        if (LOGGER.isInfoEnabled()) {
            LOGGER.info("Now sending sequences of length " + blocks + " blocks.");
        }

        int expectedDataTransferLength = (int) Math.min(bytes2Process, blocks * blockSize);
        connection.nextState(new WriteRequestState(connection, src, bufferPosition, TaskAttributes.SIMPLE, expectedDataTransferLength, startAddress, blocks));
        startAddress += blocks;
        totalBlocks -= blocks;
        bytes2Process -= blocks * blockSize;
        bufferPosition += expectedDataTransferLength;

        // second stage
        blocks = (short) Math.min(WRITE_SECOND_STAGE_BLOCKS, totalBlocks);

        if (blocks > 0) {

            if (LOGGER.isInfoEnabled()) {
                LOGGER.info("Now sending sequences of length " + blocks + " blocks.");
                LOGGER.info("Remaining, DataSegmentLength: " + bytes2Process + ", " + expectedDataTransferLength);
            }

            expectedDataTransferLength = (int) Math.min(bytes2Process, blocks * blockSize);
            connection.nextState(new WriteRequestState(connection, src, bufferPosition, TaskAttributes.SIMPLE, expectedDataTransferLength, startAddress, blocks));
            startAddress += blocks;
            totalBlocks -= blocks;
            bytes2Process -= blocks * blockSize;
            bufferPosition += expectedDataTransferLength;
        }

        // third stage
        blocks = (short) Math.min(WRITE_THIRD_STAGE_BLOCKS, totalBlocks);

        while (blocks > 0) {

            if (LOGGER.isInfoEnabled()) {
                LOGGER.info("Now sending sequences of length " + blocks + " blocks.");
            }

            expectedDataTransferLength = (int) Math.min(bytes2Process, blocks * blockSize);
            connection.nextState(new WriteRequestState(connection, src, bufferPosition, TaskAttributes.SIMPLE, expectedDataTransferLength, startAddress, blocks));
            startAddress += blocks;
            totalBlocks -= blocks;
            blocks = (short) Math.min(READ_THIRD_STAGE_BLOCKS, totalBlocks);
            bufferPosition += expectedDataTransferLength;
        }
View Full Code Here

TOP

Related Classes of org.jscsi.initiator.connection.state.WriteRequestState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.