Package voldemort.utils.ConsistencyFix

Examples of voldemort.utils.ConsistencyFix.BadKeyWriter


        // Set up bad key writer
        BlockingQueue<BadKeyStatus> bq = new ArrayBlockingQueue<BadKeyStatus>(5);
        ExecutorService badKeyWriterService = Executors.newSingleThreadExecutor();

        BadKeyWriter badKeyWriter = new BadKeyWriter(fileName, bq);
        badKeyWriterService.submit(badKeyWriter);

        // Enqueue stuff for bad key writer to write
        try {
            for(int i = 0; i < 100; ++i) {
                BadKey badKey = new BadKey(Integer.toHexString(i), Integer.toHexString(i) + "\n");

                bq.put(new BadKeyStatus(badKey, ConsistencyFix.Status.REPAIR_EXCEPTION));
            }
            // Poison bad key writer
            bq.put(new BadKeyStatus());
        } catch(InterruptedException e) {
            e.printStackTrace();
            fail("Unexpected exception");
        }

        // wait for bad key writer to shutdown
        badKeyWriterService.shutdown();
        try {
            badKeyWriterService.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
        } catch(InterruptedException e) {
            e.printStackTrace();
            fail("Unexpected exception");
        }

        assertFalse(badKeyWriter.hasException());

        // Read output file & verify.
        try {
            BufferedReader fileReader = new BufferedReader(new FileReader(fileName));
View Full Code Here

TOP

Related Classes of voldemort.utils.ConsistencyFix.BadKeyWriter

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.