Hi,
 My application uses one routing servelt to generate different pages. 3000
users are expected to be in the system at any point of time. 
We are using synchronize ( ) method to genrate PDF files to avoid data
corrucption. Now we are facing performance problem because of the
synchronize method. 
 
        The part of the application which has synchronize method is given
below

                synchronized ( key )
                        {
                                 Log.write(this, Log.INFO,
eventCtx.getSessionCtx(),"entering synchronized block...");
                                 emsPDFFormsLib = new EMSPDFFormsLib();
                                 pDFFormsLib = new PDFFormsLib();
                                 // Create a document with a certain size
and margins
                                 Document document = new Document(
PageSize.LETTER, 10, 10, 10, 10 );
                                try
                                {
                                         PdfWriter.getInstance(document,
temp);
                                         // Meta information
                                         document.addAuthor( "EMS system" );
                                         document.addSubject( "EMS form" );

                                           // Fonts
                                         Font titleTextFont = new Font(
Font.HELVETICA, TITLE_FONT_SIZE,
                                                  Font.BOLD, new Color( 0,
0, 0 ) );
                                        .
                                        .
                                        .
                                        document.open();
                                }
                                catch(DocumentException de)
                                {
                                }
                                document.close();
                        }
My question are given below, 

1) if I remove the synchronized block from my code and multiple concurrent
users are trying to generate PDF file, would that corrupt teh PDF file data?
2) I would like to know why the getInstance(Documnet, OutputStream) method
is defined as static in the PdfWriter class?
3) Does getInstance(Documnet, OutputStream) method contain any static data
(variable/mathod/object) ?
4) Looking at the static definition of getInstance(Documnet, OutputStream)
method, I am not sure that whether it is using any static data defined in
the method. So, multiple number of concurrent users generating PDF file
would be a problem.
5) Is iText library to generate PDF file thread-safe? If not why?

Could anybody help me with suggestions.
Your early response would be appreciated.

Thanks
Sthiti




 

_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to