This week's book giveaway is in the General Computing forum.
We're giving away four copies of Learning Regular Expressions and have Ben Forta on-line!
See this thread for details.
Win a copy of Learning Regular Expressions this week in the General Computing forum!

Vaibhav Gargs

Ranch Hand
+ Follow
since Sep 08, 2016
Vaibhav likes ...
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 Vaibhav Gargs

Suppose we have to design a Stock Ticker application. The user can configure a list of stocks which he would like to track. Once the user logs in to the application, then the application should start displaying the latest stock prices. Considering this as a web application, what all design approaches can be considered:

1. We can send requests from the client for the stocks configured automatically at a predefined time interval and then get the response from the server and update the prices

2. Is there any way where the server will automatically keep on sending the response to the client, and client can intercept it and display it.

Any other thoughts. What is the best solution?
1 week ago

Paul Clapham wrote:Vaibhav Gargs,
I have merged your topic into this topic. I hope that helps.

Thanks Paul. It helps.
As per my understanding, ThreadLocal variables are used to store the values per thread. But, if we declare the variables in run method, then, also they would be applicable to that particular thread. So, why should we go for ThreadLocal variables instead of run local variables.
There are multiple types of ThreadPools available:

1. Fixed thread pool
2. Scheduled thread pool
3. Cached thread pool
4. Single Thread Pool

We say that pool contains pre-initialized threads. But, we instantiate the threads using Thread t = new MyThread(); etc. where MyThread extends Thread. But, threadpool is created using factory methods without any threads implementation details, so, I am wondering how threads are created in the pool while we submit the runnable instances later on.
Thanks Campbell and Henry. I am sorry as I was looking for my older post but couldn't locate it due to title as Reentrant Locks. I will continue with the older thread, can you please remove this thread as duplicate.
We can achieve synchronization using two approaches : synchronized keyword and locks interfaces? Which one is preferred in which scenario and why?

Paul Clapham wrote:You're asking how the various database systems execute those statements?

Yes Paul, I would like to understand how these queries are  internally executed by the DBMS
If we make all the methods as synchronized, then, won't it solve the purpose?
I am just thinking about hypothetical scenario. In case, we don't get acknowledgement from the client and hence, i guess broker can send the message again considering it was not delivered.
1 week ago
In JMS, is it possible to deliver the same message twice/multiple times? If yes, then how can we avoid it - do we have any broker specific property which needs to be set to avoid duplicate messages?
1 week ago
So, even if we have 4 cores, and if one thread is being executed (synchronized block) on 1 core, then, any other thread won't ever be allowed to enter this block even through other CPU cores, correct? Who is responsible for managing the thread states - is it JVM which maintains the track of all thread states - how?
Thank you Stephan. It was on an interview question, so, just thinking how optimally we can read and process the large files.
In Spring Boot applications, the output file is a jar which is executed. I have few queries regarding Spring Boot apps:

1. As this is a jar file, then where do we have web.xml or other jee web app specific files such as filters in case we have defined some of the filters?

2. How the tomcat is embedded inside the jar and how does it serve as a servlet container inside a jar?
2 weeks ago
In case we have to read huge files (in GBs), then what is the optimal way to read the file using multithreading?
Can experts please share their views.