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