Add sleep time option "-st".

This commit is contained in:
agibert 2007-12-11 16:46:37 +00:00
parent d882d2a6a1
commit ded4a3926f
3 changed files with 72 additions and 21 deletions

View File

@ -1,7 +1,7 @@
// $RCSfile: MQSLoad.java,v $ // $RCSfile: MQSLoad.java,v $
// $Revision: 1.9 $ // $Revision: 1.10 $
// $Name: $ // $Name: $
// $Date: 2007/06/05 09:22:43 $ // $Date: 2007/12/11 16:46:37 $
// $Author: agibert $ // $Author: agibert $
/* /*
@ -45,10 +45,11 @@ public class MQSLoad
private String Message_Break = "\r\n"; private String Message_Break = "\r\n";
private String Message_Tail = ""; private String Message_Tail = "";
private boolean Keep_Message_Break = false; 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_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 String MQSLoad_Author = "$Author: agibert $";
private Integer Sleep_Time = 0;
@ -251,6 +252,18 @@ public class MQSLoad
throw new Exception(); throw new Exception();
} }
} }
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")) else if ( args[argc].equals( "-kmb"))
{ {
Keep_Message_Break = true; 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(); cur_pos += Message_Break.length();
Counter_Print( msg_nb++); Counter_Print( msg_nb++);
Stand_By( Sleep_Time);
} }
} }
@ -518,6 +559,8 @@ public class MQSLoad
MQSPut_Msg( output_msg); MQSPut_Msg( output_msg);
Counter_Print( msg_nb++); Counter_Print( msg_nb++);
Stand_By( Sleep_Time);
} }
System.out.println( "\n"); System.out.println( "\n");
@ -550,10 +593,10 @@ public class MQSLoad
{ {
System.out.println("MQSLoad: " + MQSLoad_Tag + " / " + MQSLoad_Date + " / " + MQSLoad_Author); 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] <Output_MsgQueue_Name> <Input_File_Name>"); System.out.println( "Usage: MQSLoad [-qm \"Output_QueueMng_Name\"] [-fb \"field_break\"] [-mb \"message_break\"] [-mt \"message_tail\"] [-kmb] <Output_MsgQueue_Name> <Input_File_Name>");
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); System.exit( 1);
} }
@ -564,7 +607,7 @@ public class MQSLoad
Arg_Parse( args); Arg_Parse( args);
System.out.println( "Output QueueMng Name: (" + QMng_Name + ") Output MsgQueue Name: (" + MsgQ_Name + ") Input File Name: (" + File_Name + ")"); 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(); MQSInit();

View File

@ -1,8 +1,8 @@
# $RCSfile: ReadMe.txt,v $ # $RCSfile: ReadMe.txt,v $
# $Revision: 1.7 $ # $Revision: 1.8 $
# $Name: $ # $Name: $
# $Date: 2002/05/21 15:22:00 $ # $Date: 2007/12/11 16:46:37 $
# $Author: giberta1 $ # $Author: agibert $
@ -24,7 +24,7 @@ Installation:
Notes: 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: - "-fb" and "-mb" arguments accept a string with formated escape character:
+ "\n" for newline, + "\n" for newline,

View File

@ -1,7 +1,7 @@
# $RCSfile: ReleaseNotes.txt,v $ # $RCSfile: ReleaseNotes.txt,v $
# $Revision: 1.7 $ # $Revision: 1.8 $
# $Name: $ # $Name: $
# $Date: 2007/06/05 09:21:44 $ # $Date: 2007/12/11 16:46:37 $
# $Author: agibert $ # $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". 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", 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. 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, 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, 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, First release,