Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!

Sanjeev BhimaRao

Ranch Hand
+ Follow
since Jul 17, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sanjeev BhimaRao

Can a synchronized keyword be applied only to methods?

Can a .java file have multiple private/protected classes?

Thanks. I do agree on the differences between JME and Android.

But, 'minimalistic' and 'locked-down' aren't going to go down well with either customers or even OEMs, in this day and age.
Without OEM support and not so many devices, any platform would slowly move towards irrelevance, as we have seen in the past. (WebOS, Symbian, Meego, LiMo).
9 years ago
Hello,
I recently came across a podcast from Monsen-Haefel about JEE 5, which expresses not so positive opinions about the future of JEE5 technology.


http://podcast.burtongroup.com/ip//files/bgip_jee5_the_beginning_of_the_end.mp3

Could anyone who is working on it, throw some light on the current status and comment on the claims above?

Regards,
UE
11 years ago
Hi Frits,
Thanks for the detailed explanation.

The situation described in your post does not apply to my application, since updates to existing records are not supported.

Only inserts (auto_increment + by all) and deletes (only by admin) are allowed.

So, I think I will synchronize my methods for now.

Thanks for your continuous support.

Regards,
Sanjeev
Dear Fritz and Rajeev,

Thanks for your replies. I completed EJB 2.1 based SCBCD and did not update myself to EJB 3.0.
Also, JBoss seems to be an overkill for my requirements (too much config to learn) - I am in rapid protyping mode.

So, I am looking for a trouble free synchronization method without taking a major performance hit.

In DBConnection object the variables are method local and there are seperate methods for update and query.
Will synchronizing critical sections of the code with (this) object, resolve the issue - since there is only one static instance of the DBConnection object per servlet?


Regards,
Sanjeev




Dear members,

I have a mid-size servlet+jsp based MVP app that I would like to run on JBoss.
What is the procedure and how hard is it ?

Regards,
Sanjeev
11 years ago
Hi,

Sorry for the double post. I thought I could reach wider audience.

Yes, Class 2,3 and 4 are individual servlets and I could synchronize the code accessing the static objects across the servlets.
I would like to know, if there is an alternative way of sharing same DBConnection object (contained within Class 1 that implements other DB access methods like executeQuery and executeUpdate, and returns ResultSet or int values respectively) across servlets and without adding synchronization code in servlets (makes code bloat).

Is it ok (in terms of performance) to synchronize the methods of Class 1?

Regards,
Sanjeev
Hi,

I have a question of sharing DB Connection object across different servlets of the same webapp.

The current design is as follows.

Class 1 provides methods to connect to DB.
Methods of Class 1 are not static. (For each query it does a new con.createStatement()).

Class 2, 3, 4 etc declare static instance of Class 1.
During servlet context initialization - the static instance of Class 1 is initialized to new Object.
And both doPost() and doGet() of Classes 2,3 and 4 use the above created instance.

I have the following doubts.
1. how this will work if the application is scaled (when multiple servlet instances are created by the container)
2. how the single static object will be shared by the different servlet instances.
3. When the same servlet handles two different requests like GET and POST at the same time, how to ensure that something bad does not happen with the Class 1 instance.

Should I synchronize the methods of Class 1?

Kindly advice.

Regards,
Sanjeev
Hi,

I have a question of sharing DB Connection object across different servlets of the same webapp.

The current design is as follows.

Class 1 provides methods to connect to DB.
Methods of Class 1 are not static. (For each query it does a new con.createStatement()).

Class 2, 3, 4 etc declare static instance of Class 1.
During servlet context initialization - the static instance of Class 1 is initialized to new Object.
And both doPost() and doGet() of Classes 2,3 and 4 use the above created instance.

I have the following doubts.
1. how this will work if the application is scaled (when multiple servlet instances are created by the container)
2. how the single static object will be shared by the different servlet instances.
3. When the same servlet handles two different requests like GET and POST at the same time, how to ensure that something bad does not happen with the Class 1 instance.

Should I synchronize the methods of Class 1?

Kindly advice.

Regards,
Sanjeev


11 years ago
Thank you folks. I got the information required.
Hi,

I have written two servlets to talk to each other using apache commons library. But now I need to make it into a web service. Is there a standard way to do it?

Kindly let me know.

Regards,
Sanjeev
Hi,

Thanks for taking time to review my question.

The two servers represent two individual server clusters.

The DB records and files are related such that for each record in DB, there MUST exist a file.

Currently I am not using any transactions.

In summary, I am trying to design a protocol between two servers.
And due to lack of experience with beans, I am limited to using Servlet Container.

Regards,
Sanjeev
Hello Ranchers,

I have two servlets managing list of items+categories in MySQL tables and files in the file system in two physical servers.
(Each physical server is a MySQL+Tomcat container).

The DB schema of mysql tables in the two servers in more or less the same with a few exceptions.
I am looking for the best way to handle synchronization between the two servers and reduce error handling code.

Failure can occur during the following activities.

Server 1 storing files
Server 2 storing files
Server 1 DB update/insert failure
Server 2 DB update/insert failure

DB records are dependent on files and vice versa.

Anyone with experience in such an deployment - kindly help me with your ideas.
I can provide further specific details if required.

Regards.




Thanks a lot.

Regards
Sanjeev
11 years ago