Increasing application client connection timeout


EJB programming & troubleshooting: Increasing application client connection timeout

  1. Hi and thanks for reading,

    Our application client (Swing-based) needs to send large amounts of data to an EJB-based server for validation, which can take more than 5 minutes. I am aware of the "unfriendliness" of this implementation, but it is the only one possible.

    Currently the client (rightfully) raises an exception after ~3 minutes, stating that the server is not responding, when really it is still processing the data. How can I increase the timeout value for this application client?

    By the way, using an asynchronous call (through JMS) is not an option.

    Thank you very much for your help!
  2. Hi,

      Few questions before I put in my thoughts,

    1. Are you making direct call to EJB classes ?
    2. Are you using some protocol for data transfer, say http and later servlet delegates the task to EJB ?
    3. Why do you want to wait for EJB response to come and later do synchronous processing ? Cant you break this thing in small modules (This will help you in maintaning the code and new team to understand the process too).
    4. Is it ok if your EJB modules sends some task completion messages to your client and later send a final completion message so as to have some task sampling at client end ?
       Something on the line that when EJB module finishes intermediate tasks it sends ack. with level 3, with module level task is complete it sends ack with level 2 and when the process is purely completed it sends ack of level 1.

    This way your client will be in touch with EJB module and you will have some sampling of the process status.

    5. Have you thought of the scenarios that your EJB module or your network speed going low on performance and later even after increasing your client timeout you might be trying to solve the same problem, which is purely dependet on what kind of machine configuration your EJB module is running on.

    6. Same problem as point 5 might come when more number of requrests are being processed by your EJB module.

    I guess answering these questions will help you solve your problem.

  3. The DJB Framework[ Go to top ]

    DJB's are a good starting point.
    The Distributed Jini Bean Project ( is based on the Enterprise Bean Framework, however, what makes it different is that it exposes distributed transactions at the interface level which gives the client freedom to cluster distributed operations over multiple services.
    There are two types of services, Entity and State Services. The Entity Service it basically for persistance and works with any JDBC compliant db, much like BMP but it has automatic rollback and entity caching. The other is a state service, for writing printer, disk etc services that require state to be held.

    Download the package and have a look at the examples.



    // Lease is the transaction timeout
    Transaction txn = TransactionManager.createTransaction(Lease);

    try {
    // cluster operations
    CustomerHome customerHome = CustomerService.exclusiveLock(txn, locktimeout);
    PrinterSession printerSession = PrinterService.exclusiveLock(txn, locktimeout);

    Customer cust = customerHome.create(...);

    } catch (Exception e) {
    // rollback all changes, transparent to the client