Package com.taobao.metamorphosis.utils.test

Examples of com.taobao.metamorphosis.utils.test.ConcurrentTestTask


    @Test
    public void testConcurrentAppendMessages() throws Exception {
        System.out.println("Begin concurrent test....");
        this.metaConfig.setMaxSegmentSize(1024 * 1024 * 16);
        ConcurrentTestCase testCase = new ConcurrentTestCase(80, 1000, new ConcurrentTestTask() {

            @Override
            public void run(int index, int times) throws Exception {
                final PutCommand cmd =
                        new PutCommand(MessageStoreUnitTest.this.topic, MessageStoreUnitTest.this.partition,
View Full Code Here


    }


    private static long testSystem() {
        final AtomicLong result = new AtomicLong(0);
        final ConcurrentTestCase testCase = new ConcurrentTestCase(50, 400000, new ConcurrentTestTask() {

            public void run(final int index, final int times) throws Exception {
                result.addAndGet(System.currentTimeMillis());

            }
View Full Code Here

    }


    private static long testSystemTimer() {
        final AtomicLong result = new AtomicLong(0);
        final ConcurrentTestCase testCase = new ConcurrentTestCase(50, 400000, new ConcurrentTestTask() {

            public void run(final int index, final int times) throws Exception {
                result.addAndGet(SystemTimer.currentTimeMillis());

            }
View Full Code Here

    @Test
    public void concurrentTest() throws Exception {
        final Random rand = new Random();
        final AtomicInteger gen = new AtomicInteger();
        final ConcurrentTestCase testCase = new ConcurrentTestCase(100, 1000, new ConcurrentTestTask() {

            @Override
            public void run(final int index, final int times) throws Exception {
                final int id = gen.incrementAndGet();
                final LocalTransactionId xid = new LocalTransactionId("test", id);
View Full Code Here


    @Test
    public void concurrentTest() {
        final AtomicLong counter = new AtomicLong(0);
        ConcurrentTestCase testCase = new ConcurrentTestCase(100, 100000, new ConcurrentTestTask() {

            @Override
            public void run(int index, int times) throws Exception {
                long v = counter.incrementAndGet();
                ConcurrentLRUHashMapUnitTest.this.map.put(String.valueOf(v), (byte) 1);
View Full Code Here

                }
            }

        }.start();

        final ConcurrentTestCase testCase = new ConcurrentTestCase(500, 10000, new ConcurrentTestTask() {

            @Override
            public void run(final int index, final int times) throws Exception {
                FetchRequestQueueUnitTest.this.fetchRequestQueue.offer(new FetchRequest(times % 3));
                try {
View Full Code Here


    @Test
    public void concurrentTest() {
        final AtomicLong ids = new AtomicLong();
        final ConcurrentTestCase testCase = new ConcurrentTestCase(100, 10000, new ConcurrentTestTask() {

            @Override
            public void run(final int index, final int times) throws Exception {
                final long id = IdWorkerUnitTest.this.idWorker1.nextId();
                if (id < 0) {
View Full Code Here

TOP

Related Classes of com.taobao.metamorphosis.utils.test.ConcurrentTestTask

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.