@@ -30,10 +30,7 @@ You should have received a copy of the GNU Affero General Public License
3030namespace iText . Commons . Actions . Processors {
3131 /// <summary>Defines a default strategy of product event processing.</summary>
3232 public class DefaultITextProductEventProcessor : AbstractITextProductEventProcessor {
33- private static readonly ILogger LOGGER = ITextLogManager . GetLogger ( typeof ( iText . Commons . Actions . Processors . DefaultITextProductEventProcessor
34- ) ) ;
35-
36- private static readonly byte [ ] messageForLogging = Convert . FromBase64String ( "WW91IGFyZSB1c2luZyBpVGV4dCB1bmRlciB0aGUgQUdQTC4KCklmIHRoaXMgaXMgeW9"
33+ internal static readonly byte [ ] MESSAGE_FOR_LOGGING = Convert . FromBase64String ( "WW91IGFyZSB1c2luZyBpVGV4dCB1bmRlciB0aGUgQUdQTC4KCklmIHRoaXMgaXMgeW9"
3734 + "1ciBpbnRlbnRpb24sIHlvdSBoYXZlIHB1Ymxpc2hlZCB5b3VyIG93biBzb3VyY2UgY2" + "9kZSBhcyBBR1BMIHNvZnR3YXJlIHRvby4KUGxlYXNlIGxldCB1cyBrbm93IHdoZXJlI"
3835 + "HRvIGZpbmQgeW91ciBzb3VyY2UgY29kZSBieSBzZW5kaW5nIGEgbWFpbCB0byBhZ3Bs" + "QGl0ZXh0cGRmLmNvbQpXZSdkIGJlIGhvbm9yZWQgdG8gYWRkIGl0IHRvIG91ciBsaXN"
3936 + "0IG9mIEFHUEwgcHJvamVjdHMgYnVpbHQgb24gdG9wIG9mIGlUZXh0IDcKYW5kIHdlJ2" + "xsIGV4cGxhaW4gaG93IHRvIHJlbW92ZSB0aGlzIG1lc3NhZ2UgZnJvbSB5b3VyIGVyc"
@@ -42,6 +39,9 @@ public class DefaultITextProductEventProcessor : AbstractITextProductEventProces
4239 + "XIsIHdlJ2xsIGV4cGxhaW4gaG93IHRvIGluc3RhbGwgeW91ciBsaWNlbnNlIGtleSB0" + "byBhdm9pZCB0aGlzIG1lc3NhZ2UuCklmIHlvdSdyZSBub3QgYSBjdXN0b21lciwgd2U"
4340 + "nbGwgZXhwbGFpbiB0aGUgYmVuZWZpdHMgb2YgYmVjb21pbmcgYSBjdXN0b21lci4=" ) ;
4441
42+ private static readonly ILogger LOGGER = ITextLogManager . GetLogger ( typeof ( iText . Commons . Actions . Processors . DefaultITextProductEventProcessor
43+ ) ) ;
44+
4545 private static readonly long [ ] REPEAT = new long [ ] { 10000L , 5000L , 1000L } ;
4646
4747 private static readonly int MAX_LVL = REPEAT . Length - 1 ;
@@ -58,7 +58,7 @@ public class DefaultITextProductEventProcessor : AbstractITextProductEventProces
5858 /// <param name="productName">is a product name</param>
5959 public DefaultITextProductEventProcessor ( String productName )
6060 : base ( productName ) {
61- repeatLevel = new AtomicLong ( REPEAT [ ( int ) level . Get ( ) ] ) ;
61+ repeatLevel = new AtomicLong ( AcquireRepeatLevel ( ( int ) level . Get ( ) ) ) ;
6262 }
6363
6464 public override void OnEvent ( AbstractProductProcessITextEvent @event ) {
@@ -72,12 +72,12 @@ public override void OnEvent(AbstractProductProcessITextEvent @event) {
7272 if ( level . IncrementAndGet ( ) > MAX_LVL ) {
7373 level . Set ( MAX_LVL ) ;
7474 }
75- repeatLevel . Set ( REPEAT [ ( int ) level . Get ( ) ] ) ;
75+ repeatLevel . Set ( AcquireRepeatLevel ( ( int ) level . Get ( ) ) ) ;
7676 isNeededToLogMessage = true ;
7777 }
7878 }
7979 if ( isNeededToLogMessage ) {
80- String message = iText . Commons . Utils . JavaUtil . GetStringForBytes ( messageForLogging , iText . Commons . Utils . EncodingUtil . ISO_8859_1
80+ String message = iText . Commons . Utils . JavaUtil . GetStringForBytes ( MESSAGE_FOR_LOGGING , iText . Commons . Utils . EncodingUtil . ISO_8859_1
8181 ) ;
8282 LOGGER . LogInformation ( message ) ;
8383 System . Console . Out . WriteLine ( message ) ;
@@ -87,5 +87,9 @@ public override void OnEvent(AbstractProductProcessITextEvent @event) {
8787 public override String GetUsageType ( ) {
8888 return "AGPL" ;
8989 }
90+
91+ internal virtual long AcquireRepeatLevel ( int lvl ) {
92+ return REPEAT [ lvl ] ;
93+ }
9094 }
9195}
0 commit comments