Package com.alibaba.rocketmq.research.store

Examples of com.alibaba.rocketmq.research.store.MessageStoreTestObject


            final int ThreadSize = args.length >= 2 ? Integer.parseInt(args[1]) : 128;

            MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
            messageStoreConfig.setBrokerRole(brokerRole);

            final MessageStoreTestObject storeTestObject = new MessageStoreTestObject(messageStoreConfig);

            if (!storeTestObject.load()) {
                System.out.println("load store failed");
                System.exit(-1);
            }

            storeTestObject.start();

            System.out.println("waiting 5s for slave connect....");
            Thread.sleep(1000 * 5);
            System.out.println("wait over");

            // Thread pool
            final ThreadPoolExecutor executorSend =
                    (ThreadPoolExecutor) Executors.newFixedThreadPool(ThreadSize);

            final AtomicLong maxResponseTime = new AtomicLong(0);
            final AtomicLong sendTotalCnt = new AtomicLong(0);

            for (int i = 0; i < ThreadSize; i++) {
                executorSend.execute(new Runnable() {

                    @Override
                    public void run() {
                        for (long k = 1;; k++) {
                            try {
                                long beginTime = System.currentTimeMillis();
                                boolean result = storeTestObject.sendMessage();
                                long rt = System.currentTimeMillis() - beginTime;
                                if (rt > maxResponseTime.get()) {
                                    maxResponseTime.set(rt);
                                }

View Full Code Here


    public static void main(String[] args) {
        try {
            MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
            messageStoreConfig.setBrokerRole(BrokerRole.SLAVE);

            final MessageStoreTestObject storeTestObject = new MessageStoreTestObject(messageStoreConfig);

            storeTestObject.updateMasterAddress("10.235.170.21:10912");

            if (!storeTestObject.load()) {
                System.out.println("load store failed");
                System.exit(-1);
            }

            storeTestObject.start();

            System.out.println("start OK, " + messageStoreConfig.getBrokerRole());
        }
        catch (Exception e) {
            e.printStackTrace();
View Full Code Here

TOP

Related Classes of com.alibaba.rocketmq.research.store.MessageStoreTestObject

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.