Solved

Is Java-based web application suitable for batch processing...

Posted on 2002-03-26
4
282 Views
Last Modified: 2010-03-31
I hv a Java web-based application (JSP -> Servlet -> Java Classes) running on Linux Websphere Server..i try to run some batch process that involve a lot of updating/inserting operation to database..i invoke the process from the JSP page with a button click..and the process will start..the database(Informix) is quite huge..after finish the process..it suppose to come back to JSP..displaying some successful messages

the problem is that it the browser always timeout..can't even wait for the server to finish process all the data..so it look like web-based aaplication is not suitable for batch processing because the browser will always time out if keep waiting for a long time...


can u give any suggestion to improve it..

0
Comment
Question by:kgsoft_sys
  • 2
4 Comments
 

Accepted Solution

by:
abhay_djs earned 30 total points
ID: 6898338
Hi kgsoft_sys,
In websphere, there is one property which checks out inactivity timeout for respons. I am not much aware of what is the exact name of this property. I will search for same and let you know.
But if u increase that timout, then the your problem is solved. But yes thats not the best way to solve your problem.
What you can do is to create multiple threads. and perform insert update in that threads. So that the operation can be performed faster.

THanks
Abhay
0
 

Author Comment

by:kgsoft_sys
ID: 6898467
can you show me a simple example how to create a thread that can do insert/update to database..?
0
 
LVL 2

Expert Comment

by:deviprasadmp
ID: 6898523
You can have a separate table in the database to indicate the status of ur batch process.  For simplicity you can have a table with a few columns, say, STARTDATE, STARTTIME, JOBEXITCODE, MESSAGE.  Once u click the button on ur JSP, you can update JOBEXITCODE to 1 and MESSAGE to "Running...", then start a thread which actually does the job, then show a JSP page saying "The job has started..."  Now this JSP should query the table and refresh itself (You can use the HTML <META> tag for this) with the text in the MESSAGE column. And the rest is your imagination...
0
 

Expert Comment

by:abhay_djs
ID: 6902085
The code will be very complicated.
I am giving you rough logic.
In JSP you have to create one bean wich looks after the threads you r going to create for insertion. And execute method of that bean say 'process'
Now in 'process', you have to create various threads depending on the table and values to be inserted.
Of course you can write generic thread class say MyThread which accepts 'tablename' and vector of vectors having values to be inserted in that table. And in the RUN method u can insert all those values.
But u have to be careful in 'process' that till all the threads get executed you should not leve the control from that method.

THats the general way.
I hope i have made it clear.

Thanks
Abhay
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
wordlen challenge 3 46
Starting to learn JAVA, 7 47
advertisement module in core php 4 87
Image decoding from Camera 3 44
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now