apurav chauhan

Greenhorn
+ Follow
since Aug 07, 2010
Merit badge: grant badges
For More
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 apurav chauhan

If i start a new thread in servlet doget() method to do some task asynchronously, will that return the current httprequest processing thread into the server's pool or will it depend on the child thread ?
12 years ago
@Martin: Thanks for reply.

I dont really understand what you mean by limiting usage of system resources by various processes? Are you saying if a multiple batch requests comes from a single process (in my case Admin request to process 2 lakh records) , then it can set some kind of a priority to this request, such that requests from other processes will be fulfilled first?

Database used is : Postgres 9
Hi,
I have a Spring-MVC, Hibernate Web app. An admin user can send in a request to process nearly 2 lakh records (each record collected from various tables via joins). Such operation is requested on a weekly or monthly basis (OR whenever the data reaches to a limit of around 2 lakh/1lakh). On the database end, i am correctly implementing batching.

PROBLEM: Such a long running request holds up the server thread and that causes the the normal users to suffer.

REQUIREMENT: The high response time of this request is not an issue. Whats required is not make other users suffer because of this time consuming process.

MY SOLUTION:
1. Implementing threadpool using Spring taskExecutor abstraction. So i can initialize my threadpool with say 5 or 6 threads and break the 2 lakh records into smaller chunks say of size 1000 each. I can queue in these chunks. To further allow the normal users to have a faster db access, maybe i can make every runnable thread sleep for 2 or 3 secs.
Advantages of this approach i see is: Instead of executinga huge db interacting request in one go, we have a asyncronous design spanning over a larger time. Thus behaving like multiple normal user requests.

Can some experienced people please give their opinion on this?
I have also read about implementing the same beahviour with a Message Oriented Middleware like JMS/AMQP OR Quartz Scheduling. But frankly speaking, i think internally they are also gonna do the same thing i.e making a thread pool and queueing in the jobs. So why not go with the Spring taskexecutors instead of adding a completely new infrastructure in my web app just for this feature?

Please share your views on this and let me know if there is other better ways to do this?
Once again: the time to completely process all the records in not a concern, whats required is that normal users accessing the web app during that time should not suffer in any way.



org.springframework.context.EnviornmentAware is added in Spring 3.1.
Did you check spring-context-3.1.jar. I think it should be there. Not quite sure about the change done in 3.1
12 years ago
You are right Hemant. My mistake, sincere apologies! I forgot that your requirement was with propertyplaceholder.
12 years ago

The dispatcher-servlet.xml is supposed to run a servlet for all html files.



What do you men by this?

Spring runs no servlets by itself. It has a single servlet called as front controller. Do you mean controllers when you you say servlets?

By the way exception tells that spring related jars are not present in the classpath. Probably in your Application/WEB-INF/lib folder
12 years ago
Are you migrating the spring to some other version.
Check this:
https://jira.springsource.org/browse/SPR-4823
12 years ago
How can i forget! Its so simple!
ApplicationContext itself is a type of MessageSource.

SO just implement ApplicationContextAware and use the applicationContext object to get required message like:
applicationContext.getMessage(key)

OR

Just extend ApplicationObjectSupport. Call its getMessageSourceAccessor() method to have a reference to MessageSourceAccessor. From this object call the getMessage(key)
12 years ago
context would be differentiated when i ll call a method that is exclusive to Service1 and not existing in AbstractService.

So what i am trying to do is:

if a method is called from the parent class, then getExtension should also be returned from the parent even though i have overriden it in child class.
And if a method is called from child class, then getExtension should be returned from the child.

I dont wanna put if else conditions in the calling class A. It should not be coupled to this behaviour. Some design in Service1 or AbstractService or any other thing that would do.

I know nothing is impossible if you have mastered the designs. So i am sure experienced guys would know this
12 years ago
Hmm,
Did you check the doc for PropertyPlaceholderConfigurer.
Did you tried injecting this bean in your class and see if it exposes any method to get the messages.
I am sure you could do that way.
12 years ago
Spring 3.X has added support for expression language:
where in you could do something like:

@Value('${username}')
String someProperty;
12 years ago
Check the implementing class for the spring:message tag, Probably it has to be

org.springframework.web.servlet.tags.MessageTag

Download this class and you will see a method like:


EDIT IT TO SUIT YOUR REQUIREMENT: For example , to tell if the message is coming from spring tag , then you can append a string like:
12 years ago
So what the best way to design such a thing? I know its not possible, but my intention is to know the best possible alternative?
12 years ago
Hey Stephan, Thanks for replying.

Tell me one more thing :







HI, how can i implement something wherein i could get the extension from the class whose method is called? Question is weird , i know
12 years ago