From ded4a3926f291e1928764e2f32c7db0be180d70d Mon Sep 17 00:00:00 2001 From: agibert Date: Tue, 11 Dec 2007 16:46:37 +0000 Subject: [PATCH] Add sleep time option "-st". --- MQSLoad.java | 61 +++++++++++++++++++++++++++++++++++++++++------- ReadMe.txt | 8 +++---- ReleaseNotes.txt | 24 ++++++++++++------- 3 files changed, 72 insertions(+), 21 deletions(-) diff --git a/MQSLoad.java b/MQSLoad.java index fd5c1e0..7700812 100644 --- a/MQSLoad.java +++ b/MQSLoad.java @@ -1,7 +1,7 @@ // $RCSfile: MQSLoad.java,v $ -// $Revision: 1.9 $ +// $Revision: 1.10 $ // $Name: $ -// $Date: 2007/06/05 09:22:43 $ +// $Date: 2007/12/11 16:46:37 $ // $Author: agibert $ /* @@ -45,11 +45,12 @@ public class MQSLoad private String Message_Break = "\r\n"; private String Message_Tail = ""; private boolean Keep_Message_Break = false; - private String MQSLoad_Revision = "$Revision: 1.9 $"; + private String MQSLoad_Revision = "$Revision: 1.10 $"; private String MQSLoad_Tag = "$Name: $"; - private String MQSLoad_Date = "$Date: 2007/06/05 09:22:43 $"; + private String MQSLoad_Date = "$Date: 2007/12/11 16:46:37 $"; private String MQSLoad_Author = "$Author: agibert $"; - + private Integer Sleep_Time = 0; + @@ -251,7 +252,19 @@ public class MQSLoad throw new Exception(); } } - else if ( args[argc].equals( "-kmb")) + else if ( args[argc].equals( "-st")) + { + if( argc < ( args.length + 1)) + { + Sleep_Time = Integer.parseInt( args[++argc]); + } + else + { + System.out.println( "Invalid number of command line options..."); + throw new Exception(); + } + } + else if ( args[argc].equals( "-kmb")) { Keep_Message_Break = true; } @@ -398,6 +411,32 @@ public class MQSLoad + //------------------------------------------------------------------------------------------------------------------------- + // + //------------------------------------------------------------------------------------------------------------------------- + + private void Stand_By(int timer) + { + if( timer > 0) + { + try + { + synchronized( this) + { + wait( timer); + } + } + catch(InterruptedException ie) + { + ie.printStackTrace(); + } + } + } + + + + + //------------------------------------------------------------------------------------------------------------------------- // //------------------------------------------------------------------------------------------------------------------------- @@ -499,6 +538,8 @@ public class MQSLoad cur_pos += Message_Break.length(); Counter_Print( msg_nb++); + + Stand_By( Sleep_Time); } } @@ -518,6 +559,8 @@ public class MQSLoad MQSPut_Msg( output_msg); Counter_Print( msg_nb++); + + Stand_By( Sleep_Time); } System.out.println( "\n"); @@ -550,10 +593,10 @@ public class MQSLoad { System.out.println("MQSLoad: " + MQSLoad_Tag + " / " + MQSLoad_Date + " / " + MQSLoad_Author); - if( ( args.length < 2) || ( args.length > 6)) + if( ( args.length < 2) || ( args.length > 8)) { System.out.println( "Usage: MQSLoad [-qm \"Output_QueueMng_Name\"] [-fb \"field_break\"] [-mb \"message_break\"] [-mt \"message_tail\"] [-kmb] "); - System.out.println( " Default: Output QueueMng Name: (" + QMng_Name + ") Field Break: (" + Str_UnFormat( Field_Break) + ") Message Break: (" + Str_UnFormat( Message_Break) + ") Message Tail: (" + Str_UnFormat( Message_Tail) + ") Keep Message Break: (" + Keep_Message_Break + ")"); + System.out.println( " Default: Output QueueMng Name: (" + QMng_Name + ") Field Break: (" + Str_UnFormat( Field_Break) + ") Message Break: (" + Str_UnFormat( Message_Break) + ") Message Tail: (" + Str_UnFormat( Message_Tail) + ") Sleep Time: (" + Sleep_Time + ") Keep Message Break: (" + Keep_Message_Break + ")"); System.exit( 1); } @@ -564,7 +607,7 @@ public class MQSLoad Arg_Parse( args); System.out.println( "Output QueueMng Name: (" + QMng_Name + ") Output MsgQueue Name: (" + MsgQ_Name + ") Input File Name: (" + File_Name + ")"); - System.out.println( "Field Break: (" + Str_UnFormat( Field_Break) + ") Message Break: (" + Str_UnFormat( Message_Break) + ") Message Tail: (" + Str_UnFormat( Message_Tail) + ") Keep Message Break: (" + Keep_Message_Break + ")"); + System.out.println( "Field Break: (" + Str_UnFormat( Field_Break) + ") Message Break: (" + Str_UnFormat( Message_Break) + ") Message Tail: (" + Str_UnFormat( Message_Tail) + ") Sleep Time: (" + Sleep_Time + ") Keep Message Break: (" + Keep_Message_Break + ")"); MQSInit(); diff --git a/ReadMe.txt b/ReadMe.txt index bfa63e3..86b59a9 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -1,8 +1,8 @@ # $RCSfile: ReadMe.txt,v $ -# $Revision: 1.7 $ +# $Revision: 1.8 $ # $Name: $ -# $Date: 2002/05/21 15:22:00 $ -# $Author: giberta1 $ +# $Date: 2007/12/11 16:46:37 $ +# $Author: agibert $ @@ -24,7 +24,7 @@ Installation: Notes: ------ - - MQSLoad has been tested with MQ/Series 5.2, + - MQSLoad has been tested with MQ/Series 5.2, 5.3 and WMQ 6.0 - "-fb" and "-mb" arguments accept a string with formated escape character: + "\n" for newline, diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt index f1584e7..4635d56 100644 --- a/ReleaseNotes.txt +++ b/ReleaseNotes.txt @@ -1,7 +1,7 @@ # $RCSfile: ReleaseNotes.txt,v $ -# $Revision: 1.7 $ +# $Revision: 1.8 $ # $Name: $ -# $Date: 2007/06/05 09:21:44 $ +# $Date: 2007/12/11 16:46:37 $ # $Author: agibert $ @@ -9,7 +9,15 @@ -------------------------------------------------------------------------------- -MQSLoad V 1.2.0 - A. Gibert - 05/06/07 +MQSLoad V 1.3.0 - C. Colin / A. Gibert - 2007/12/10 +-------------------------------------------------------------------------------- + +Add sleep time option "-st". + + + +-------------------------------------------------------------------------------- +MQSLoad V 1.2.0 - A. Gibert - 2007/06/05 -------------------------------------------------------------------------------- Add queue manager name option "-qm". @@ -17,7 +25,7 @@ Add queue manager name option "-qm". -------------------------------------------------------------------------------- -MQSLoad V 1.1.4 - A. Gibert - 21/05/02 +MQSLoad V 1.1.4 - A. Gibert - 2002/05/21 -------------------------------------------------------------------------------- Add message tail option "-mt", @@ -27,7 +35,7 @@ Add version, date and author print out. -------------------------------------------------------------------------------- -MQSLoad V 1.1.2 - A. Gibert - 06/05/02 +MQSLoad V 1.1.2 - A. Gibert - 2002/05/06 -------------------------------------------------------------------------------- Add return code handling. @@ -35,7 +43,7 @@ Add return code handling. -------------------------------------------------------------------------------- -MQSLoad V 1.1.1 - A. Gibert - 02/05/02 +MQSLoad V 1.1.1 - A. Gibert - 2002/05/02 -------------------------------------------------------------------------------- Add Keep Message Break support, @@ -44,7 +52,7 @@ Add -kmb option. -------------------------------------------------------------------------------- -MQSLoad V 1.1.0 - A. Gibert - 23/04/02 +MQSLoad V 1.1.0 - A. Gibert - 2002/04/23 -------------------------------------------------------------------------------- Add string field break and string message break support, @@ -59,7 +67,7 @@ Add GPL and FDL licenses files. -------------------------------------------------------------------------------- -MQSLoad V 1.0.0 - A. Gibert - 12/07/01 +MQSLoad V 1.0.0 - A. Gibert - 20001/07/12 -------------------------------------------------------------------------------- First release,