I have a stateful session bean which I call ReportManager. When my Java
application client calls the ReportManager's runReport method (which gets
results and prints them to a printer), the method runs twice!

I've distilled the code below:

public class ReportManager implements SessionBean
{
    /* lots of other methods */

    public String runReport(MyObject criteria)
    {
        /* I see this debug TWICE!!!! */
        System.out.println("runReport(" + criteria + ")...");
        /* get result set
        * create a Printable object to respond to the printer
        * call the Printable object's print method passing the result set
        */
    }
}


In the same package I have a printable object like:
public class MyPrintableDocument implements Printable
{
    public MyPrintableDocument
    {
    }

    public void print(MyResultOjbect results)
    {
        /* create a printJob
        * printJob.setPrintable(this);
        * lookup the print service
        * blah, blah, blah
        * printJob.print(MyPrintRequestAttributeSet);
    }

    public int print(Graphics pg, PageFormat pageFormat, int pageIndex)
        throws PrinterException
    {
        /* callback draws on the the Graphics object */
    }
}

Again, when I call the ReportManagers' runReport() method it prints the
document twice and I see the debug in the method come out on the server
console twice. I think that it may have something to do with the printer
driver calling back the MyPrintableDocument. Anyone ever run into this? Any
suggestions?

Ultimately, I guess I would probably start using JMS so the RMI call to the
method would asynch.

BTW: you may have noticed that I am trying to use Java 1.4 beta 2 new print
API. I originally coded this in a regular Java application and it runs fine.
Gotta be something about the container.

Joe Weder
Software Engineer
Intelligent Computer Systems
[EMAIL PROTECTED]
717.295.7977 x614

----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".

Reply via email to