1 18 package org.apache.activemq.kaha.impl.async; 19 20 import java.io.File ; 21 22 import java.io.IOException ; 23 24 import org.apache.activeio.journal.Journal; 25 import org.apache.activeio.journal.JournalRWPerfToolSupport; 26 import org.apache.activemq.kaha.impl.async.AsyncDataManager; 27 28 33 public class JournalRWPerfTool extends JournalRWPerfToolSupport { 34 35 private int logFileSize = 1024*1024*50; 36 37 public static void main(String [] args) throws Exception { 38 JournalRWPerfTool tool = new JournalRWPerfTool(); 39 40 tool.initialWriteWorkers=10; 41 tool.syncFrequency=15; 42 tool.writeWorkerIncrement=0; 43 tool.writeWorkerThinkTime=0; 44 tool.verbose=false; 45 tool.incrementDelay=5*1000; 46 47 if( args.length > 0 ) { 48 tool.journalDirectory = new File (args[0]); 49 } 50 if( args.length > 1 ) { 51 tool.writeWorkerIncrement = Integer.parseInt(args[1]); 52 } 53 if( args.length > 2 ) { 54 tool.incrementDelay = Long.parseLong(args[2]); 55 } 56 if( args.length > 3 ) { 57 tool.verbose = Boolean.getBoolean(args[3]); 58 } 59 if( args.length > 4 ) { 60 tool.recordSize = Integer.parseInt(args[4]); 61 } 62 if( args.length > 5 ) { 63 tool.syncFrequency = Integer.parseInt(args[5]); 64 } 65 if( args.length > 6 ) { 66 tool.writeWorkerThinkTime = Integer.parseInt(args[6]); 67 } 68 tool.exec(); 69 } 70 71 75 public Journal createJournal() throws IOException { 76 AsyncDataManager dm = new AsyncDataManager(); 77 dm.setMaxFileLength(logFileSize); 78 dm.setDirectory(this.journalDirectory); 79 dm.start(); 80 return new JournalFacade(dm); 81 } 82 83 } 84 | Popular Tags |