@@ -30,10 +30,7 @@ You should have received a copy of the GNU Affero General Public License
30
30
namespace iText . Commons . Actions . Processors {
31
31
/// <summary>Defines a default strategy of product event processing.</summary>
32
32
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"
37
34
+ "1ciBpbnRlbnRpb24sIHlvdSBoYXZlIHB1Ymxpc2hlZCB5b3VyIG93biBzb3VyY2UgY2" + "9kZSBhcyBBR1BMIHNvZnR3YXJlIHRvby4KUGxlYXNlIGxldCB1cyBrbm93IHdoZXJlI"
38
35
+ "HRvIGZpbmQgeW91ciBzb3VyY2UgY29kZSBieSBzZW5kaW5nIGEgbWFpbCB0byBhZ3Bs" + "QGl0ZXh0cGRmLmNvbQpXZSdkIGJlIGhvbm9yZWQgdG8gYWRkIGl0IHRvIG91ciBsaXN"
39
36
+ "0IG9mIEFHUEwgcHJvamVjdHMgYnVpbHQgb24gdG9wIG9mIGlUZXh0IDcKYW5kIHdlJ2" + "xsIGV4cGxhaW4gaG93IHRvIHJlbW92ZSB0aGlzIG1lc3NhZ2UgZnJvbSB5b3VyIGVyc"
@@ -42,6 +39,9 @@ public class DefaultITextProductEventProcessor : AbstractITextProductEventProces
42
39
+ "XIsIHdlJ2xsIGV4cGxhaW4gaG93IHRvIGluc3RhbGwgeW91ciBsaWNlbnNlIGtleSB0" + "byBhdm9pZCB0aGlzIG1lc3NhZ2UuCklmIHlvdSdyZSBub3QgYSBjdXN0b21lciwgd2U"
43
40
+ "nbGwgZXhwbGFpbiB0aGUgYmVuZWZpdHMgb2YgYmVjb21pbmcgYSBjdXN0b21lci4=" ) ;
44
41
42
+ private static readonly ILogger LOGGER = ITextLogManager . GetLogger ( typeof ( iText . Commons . Actions . Processors . DefaultITextProductEventProcessor
43
+ ) ) ;
44
+
45
45
private static readonly long [ ] REPEAT = new long [ ] { 10000L , 5000L , 1000L } ;
46
46
47
47
private static readonly int MAX_LVL = REPEAT . Length - 1 ;
@@ -58,7 +58,7 @@ public class DefaultITextProductEventProcessor : AbstractITextProductEventProces
58
58
/// <param name="productName">is a product name</param>
59
59
public DefaultITextProductEventProcessor ( String productName )
60
60
: base ( productName ) {
61
- repeatLevel = new AtomicLong ( REPEAT [ ( int ) level . Get ( ) ] ) ;
61
+ repeatLevel = new AtomicLong ( AcquireRepeatLevel ( ( int ) level . Get ( ) ) ) ;
62
62
}
63
63
64
64
public override void OnEvent ( AbstractProductProcessITextEvent @event ) {
@@ -72,12 +72,12 @@ public override void OnEvent(AbstractProductProcessITextEvent @event) {
72
72
if ( level . IncrementAndGet ( ) > MAX_LVL ) {
73
73
level . Set ( MAX_LVL ) ;
74
74
}
75
- repeatLevel . Set ( REPEAT [ ( int ) level . Get ( ) ] ) ;
75
+ repeatLevel . Set ( AcquireRepeatLevel ( ( int ) level . Get ( ) ) ) ;
76
76
isNeededToLogMessage = true ;
77
77
}
78
78
}
79
79
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
81
81
) ;
82
82
LOGGER . LogInformation ( message ) ;
83
83
System . Console . Out . WriteLine ( message ) ;
@@ -87,5 +87,9 @@ public override void OnEvent(AbstractProductProcessITextEvent @event) {
87
87
public override String GetUsageType ( ) {
88
88
return "AGPL" ;
89
89
}
90
+
91
+ internal virtual long AcquireRepeatLevel ( int lvl ) {
92
+ return REPEAT [ lvl ] ;
93
+ }
90
94
}
91
95
}
0 commit comments