Win a copy of Getting started with Java on the Raspberry Pi this week in the Raspberry Pi forum!

sachin yadav

Ranch Hand
+ Follow
since Nov 24, 2005
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by sachin yadav

I have an array of checkbox which are rendered on the JSP. Checkbox works just fine but when i post the JSP on controller i am not getting just those checkbox which are clicked but all along with bind path variable which is always false, while it should be true if checked. Due to this i am not able to figure out which box were checked and which were unchecked on the page. Here is my JSP -

Page model attribute is mainVO which contains sizeVO list. SizeVo has properties like id, name, price ect. In controller if i print i am getting following

I want only those checkboxes to bind which are checked, not all of them.
10 years ago
I have a spring 3 application where i am using jquery to post ajax request. Now i want to redirect my page to another page after ajax response comes. A Pojo is returned by the 1st page controller, which is to be passed to 2nd contoller. i know how to redirect but have no idea how to pass this PoJo to next form controller

My next page controller -

But i am getting error always. Can someone please tell me how to pass object(Pojo) to new page controller?
11 years ago
I have a model class with some methods, most of them are populated using ajax(jquery), I have a model attribute on JSP as orderVo, initially when page loads some values remains blank and when i call different methods they keep on filling using ajax. Now issue is, when 1 method is called after form setup(1st GET) my model attribute is not populating with values.


VO -

Can someone please tell me why i am not been able to populate updated orderVo values? Is it because of AJAX? I have even used SessionAttribute but of no use.
11 years ago

IMHO there is no way to do this, you have to reload app server in order to take this effect.
11 years ago
Hi All,

I have a business problem and seeking a good solution for this. I have a number of clients who will login to a common page on my site. I have to push individual messages to them throughout the day. For example - I have 2 clients bill and joe. I have to send news data to bill only and weather data to joe as and when i have this data ready on server.

I do not want to get ping(say ajax call in every 10 sec.) on my database(client pull -> server/DB) from bill and joe logged in throughout the day. I wanted to do it other way around(server push -> client). Can some one please suggest me if Spring JMS is a solution or any lightweight approach can be taken so that server push data to bill or joe's client GUI as soon as data(news for bill and weather for joe) arrives?
11 years ago
Thanks Mr. Dittmer, i will try it.
12 years ago
Will SAX be able to read and parser XML from a text log file of 4 GB?
12 years ago
Hi All,

I have a problem where my java code has to read big log files(around 4GB) containing XML and parser those XML to populate data. I can easily parse data using JAXB but i need to know if there is any open source tool provided to read those log files? I have to read these log files to identify a XML request chunk and process it continually till end of file.

I can have java code to read using buffered reader but performance will be an issue then for the reading a 4GB file along with processing data chunk. Can someone please suggest a tool of any design pattern/architectural ideas?
12 years ago
Ya paul i know it's not safe and due to multiple complications with Stop method this was deprecated but what could be the alternative then? I have to forcefully kill thread in Executor thread pool incase they do not stop processing in fixed time.
Ok, found a solution but don't know how good this is -

I have put responsibility on worker thread to check if it has got interrupted or not. This will make sure that if shutdownNow() is called which eventually interrupt the thread then work will stop working.

This works fine each time i run but to my surprise if i run in debug mode i can see wearied behavior. Some thread always left as in running mode even though log "is going to die" has got printed for all the running threads.

Any thoughts? How safe is it to implement this code?

Hi All,

I am using following code to create a thread pool using java executor framework.

the problem here is i need a way to forcefully clean all the threads spawned by executor thread pool. I understand that shutdownNow() will not work because thread is still actively running, but i wanted to get rid of thread if it doesn't return in some specified time.
It's a two fold process -- you query master, if not data insert and then insert child. If data is present in master then insert only in child with the primary key of master. I did consider your approach but that's not a feasible solution for us as of now.

JDBC will always raise SQLException to indicate that entry needs to be made in child only but an SQLException might occur in other scenario also where this exception will be not be an indication of inserting data in child table. Moreover we use service bus so that leaves very narrow possibilities to do much in this way.

Yes Paul, i am controlling this behavior using database fields now and code seems to be working now, how ever this is not the best thing to do but we do not have choices. Thanks again for your valuable suggestions.

Thanks for your reply. Yes i could not figure out any solution within the limitations of requirements, that is why i posted my query on this forum. Let me see if i can find something by changing requirements a bit.

@Andrey :

I am not sure but 0 is always presented there. We connect to db to get latest data but the problem is that at the same time same point 1 is being hit by some thread running on other machine and hence a dirty read occurs. Please note that our system is running across 3-4 server box(JVM) with nothing like a load balancer. Our application takes care of all the jobs distribution and execution with in all configured JVM.

Thanks for your help.
Hi All,

We are developing a core java multithreaed application which will run across multiple machines(JVM's). Now there is a piece of code which will work like -

1. check if entry is resent in record_master table.
2. If no then make entry in record_master and record_child.
3. If yes then fetch primary key of record_master and use it as foreign key in record_child and make entry in later table only.

this whole code is synchronized() and a class level lock is placed on it to take care of multiple threads within JVM, which works fine. But incase of multiple JVM it fails some time and make 2 entries in record_master. Sceneries goes like this -

Machine 1 running thread t1m1 and t2m1
Machine 2 running thread t1m2 and t2m2.

If t1m1 and t1m2 will reach on point 1 at same time, they will make 2 entries in database while it should be only 1. We are using Jdk 1.5 executor framework to create and manage threads. Simple JDBC with a XA data source running on weblogic 9.1 and oracle 10g. we are using core java only and it's too late in the game to introduce something else. we can't take database table locks as this will hit performance.

Can someone please let me know how can we control dirty reads here?