Package org.jscsi.initiator

Examples of org.jscsi.initiator.Initiator


     * @throws Exception
     *             if any error occurs
     */
    public JSCSIDevice(final String targetName) throws Exception {

        initiator = new Initiator(Configuration.create());
        target = targetName;
    }
View Full Code Here


        random.nextBytes(writeData2.array());

        // init of initiator and the session
        String target1 = "testing-xen2-disk1";
        String target2 = "testing-xen2-disk2";
        Initiator initiator = new Initiator(Configuration.create());
        initiator.createSession(target1);
        initiator.createSession(target2);

        // writing the first target multithreaded
        final Future<Void> write1 = initiator.multiThreadedWrite(target1, writeData1, address, writeData1.capacity());
        // writing the second target multithreaded
        final Future<Void> write2 = initiator.multiThreadedWrite(target2, writeData2, address, writeData2.capacity());

        // Blocking until writes are concluded
        write1.get();
        write2.get();

        // Getting the data from the first target multithreaded
        final Future<Void> read1 = initiator.multiThreadedRead(target1, readData1, address, readData1.capacity());
        // Getting the data from the second target multithreaded
        final Future<Void> read2 = initiator.multiThreadedRead(target2, readData2, address, readData2.capacity());

        // Blocking until reads are concluded
        read1.get();
        read2.get();

        // closing the targets
        initiator.closeSession(target1);
        initiator.closeSession(target2);

        // correctness check
        if (!Arrays.equals(writeData1.array(), readData1.array()) || !Arrays.equals(writeData2.array(), readData2.array())) { throw new IllegalStateException("Data read must be equal to the data written"); }
    }
View Full Code Here

        Random random = new Random(System.currentTimeMillis());
        random.nextBytes(writeData.array());

        // init of initiator and the session
        String target = "testing-xen2-disk1";
        Initiator initiator = new Initiator(Configuration.create());
        initiator.createSession(target);

        // writing the data single threaded
        initiator.write(target, writeData, address, writeData.capacity());

        // reading the data single threaded
        initiator.read(target, readData, address, readData.capacity());

        // closing the session
        initiator.closeSession(target);

        // correctness check
        if (!Arrays.equals(writeData.array(), readData.array())) { throw new IllegalStateException("Data read must be equal to the data written"); }
    }
View Full Code Here

public class SimpleLoginLogout {

    public static void main (final String[] args) throws NoSuchSessionException , TaskExecutionException , ConfigurationException {
        // init of the target
        String target = "testing-xen2-disk1";
        Initiator initiator = new Initiator(Configuration.create());
        // creating session, performing login on target
        initiator.createSession(target);
        // closing the session
        initiator.closeSession(target);
    }
View Full Code Here

    public static final void initialize () throws Exception {
        CallableStart.start();

        configuration = Configuration.create(new File(CONFIG_DIR, "jscsi.xsd"), new File(CONFIG_DIR, "jscsi.xml"));

        initiator = new Initiator(configuration);

        readBuffer = ByteBuffer.allocate(BUFFER_SIZE);
        writeBuffer = ByteBuffer.allocate(BUFFER_SIZE);

        randomGenerator = new Random(System.currentTimeMillis());
View Full Code Here

TOP

Related Classes of org.jscsi.initiator.Initiator

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.