I am using iTextPDF version 5.4.2 and i am having thread contention issues when there is heavy load. I am using IBM JDK 6
This is the problem, when there are multiple independent threads trying to generate different pdf files i see a contention on SecureRandom.nextBytes , since this is synchronized all the threads are waiting to lock this object. Below is the Thread dump
*"WebContainer : 0" daemon prio=3 tid=0x007ffc00 nid=0x91 waiting for monitor entry [0xc823d000]
java.lang.Thread.State: BLOCKED (on object monitor)
at java.security.SecureRandom.nextBytes(SecureRandom.java:433)
- waiting to lock <0xdf4b7430> (a java.security.SecureRandom)
at java.util.UUID.randomUUID(UUID.java:162)
at com.itextpdf.text.pdf.PdfPCell.<init>(PdfPCell.java:123)
at com.itextpdf.text.pdf.PdfPRow.<init>(PdfPRow.java:136)
at com.itextpdf.text.pdf.PdfPTable.<init>(PdfPTable.java:260)
at com.itextpdf.text.pdf.PdfPCell.<init>(PdfPCell.java:251)
at com.itextpdf.text.pdf.PdfPRow.<init>(PdfPRow.java:136)
at com.itextpdf.text.pdf.PdfPTable.<init>(PdfPTable.java:260)
at com.itextpdf.text.pdf.PdfPCell.<init>(PdfPCell.java:251)
at com.itextpdf.text.pdf.PdfPRow.<init>(PdfPRow.java:136)
at com.itextpdf.text.pdf.PdfPTable.<init>(PdfPTable.java:260)
at com.itextpdf.text.pdf.PdfPCell.<init>(PdfPCell.java:251)
at com.itextpdf.text.pdf.PdfPRow.<init>(PdfPRow.java:136)
at com.itextpdf.text.pdf.PdfPTable.adjustCellsInRow(PdfPTable.java:1377)
at com.itextpdf.text.pdf.PdfPTable.getRows(PdfPTable.java:1364)
at com.itextpdf.text.pdf.ColumnText.goComposite(ColumnText.java:1702)
at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:881)
at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:876)
at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:865)
at com.itextpdf.text.pdf.PdfDocument.addPTable(PdfDocument.java:2566)
at com.itextpdf.text.pdf.PdfDocument.add(PdfDocument.java:723)
at com.itextpdf.text.Document.add(Document.java:278)*
Can you please help in avoiding this issue ?
Sid