Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp

Sibendu Dey

Greenhorn
+ Follow
since Oct 29, 2014
Sibendu likes ...
Java Oracle Ruby
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
3
Received in last 30 days
0
Total given
8
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sibendu Dey

Try with

curl -H "Accept: application/json" -H "Content-type: application/json"
-X POST -d '{ "payload":"value"}' http://localhost:8080/myservice/process
2 years ago
Configure a class with @Repository to enable scanning of Repository classes.

@Repository(basePackages = { "Provide the package name to scan for repositories "})
public class RepositoryScanning{

}

Add the RepositoryScanning class to the RootApplicationContext
2 years ago
MyThread does not implement Runnable. So code won't work anyway.
3 years ago
In java , every http request is routed through a servlet dispatcher which in turn invokes a servlet.Each http request is handled as a separate operation in its  own call stack ( by a thread).So multiple threads will be created by the container to take care of multiple requests.Having said so you do need to take care about your classes and their members being accessed concurrently by several threads with the help of synchronization mechanism.
Would like you to suggest am alternative solution.Try using Apache cxf as an alternative to creating standalone web service client. Apache cxf has good API which helps I'm handling ws-* support in a easier and less confusing way.Hope it helps!!!
3 years ago
You can make use of shell scripting to make a curl request 100 times and log back the response in a text file which might be some .text or .log file
Though just a convention,a thread's run method should be written in a way that it is capable of completing the execution on it's own i.e it should have the provision to terminate on its own rather than force stopping.But that might not be possible every time.
3 years ago
It will be thrown when an database access error happens. Try performing a database operation which is not valid like inserting some data into a non-existent column. I guess you should get a SQLException.
Well the javadoc states the conditions under which the method will be called in addition the reason which is responsible for throwing SQLException

Puspender Tanwar wrote:
look at this code, it is giving an output of infinite loop printing get your licence. Don't understand why??
also if I change the while loop to for loop - for(age=15; age<=21;age++) then the code runs perfectly . please tell me why its not working with while loop. it Is giving infinite loop for all the values which result true for while loop.



If you check your code ,
in case of every iteration , the value of age remains constant which is 16.

Just try to trace the execution path.
The outer loop is entered , if statement is executed which results to true , "get your license" is printed.
Then again the execution comes back to outer loop , does it increase the value of age ???

Definitely no!!.

A small addition to the post.

It has been stated that the arguments should not be validated in public methods using assertions,instead it can be done in private methods.
While going through K&B 7 , It has been stated over there that assertion should not be used in public method. Instead they can be used in private method. I could not understand the explanation given over there for the same.

Can anyone help?

sibendu

I Danilov wrote:

Paul Anilprem wrote:JA+ V8 for OCA-JP SE 8 (1Z0-808) from Enthuware is now available!

So, are Enthuware mocks good?

I'm kinda at a loss what to next after reading the study guide, even getting mentioned on errata page didn't make me one bit more confident :/



They are really good.They give you a good estimate of where you stand.

But , they are only helpful after you are thorough with OCAJP course materials.