Suma Rangaraj

Ranch Hand
+ Follow
since Feb 02, 2005
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 Suma Rangaraj


Hello all -

I know that class loader is used for dynamically loading classes into the existing class loader to be able to create instances in the current classloader.

Take this code segment for instance -



my question is is the following line of code necessary - if so under what conditions?



Thanks for help.
11 years ago
Thank you James for your detailed answer.

The following posts gave me a fairly good idea of statelessness means for REST. Good explanation for newbie like me. Posting it here for the benefit of all -


http://stackoverflow.com/questions/544474/can-you-help-me-understand-this-common-rest-mistakes-sessions-are-irrelevant

http://www.ibm.com/developerworks/webservices/library/ws-restful/
12 years ago
Thank you Paul for putting up with my ignorance. I will go through the article that you ahve mentioned below.

Hope I can ping if I have further questions.

Thanks.
12 years ago

Could you provide a link to that post?



This is a post to name one - http://edn.embarcadero.com/article/40558

You can do whatever you like in a REST protocol. And the way that the service is distributed to the client is that the server people write some documentation and post it in a place where potential clients can see it.



OK It is distributed via documentation. I am still not clear when you say - so can do anything. are you saying WSDL is a way of distributing

Instead of learning about the protocols and how they work, you have seized on the concept of "state". Trying to learn about protocols from that point of view isn't going to work



If you know of a good URL, please post it here.

I know I don't understand it well, but I will be glad if some one can be a little patient in explaining this.
12 years ago

Hello -

This might be a simple question but I could not understand it very well. All the information on the internet got me more confused and I am a newbie to the concept.

1. In one of the posts that I read, it is mentioned that the difference between REST and SOAP is that REST is stateless and SOAP is stateful. My understanding is that the statelessness and statefulness depends on the underlying protocol. So, if we choose HTTP as a protocol then both SOAP and REST can be stateless unless we pass some session ifnormation in the request. Is my understanding correct?

2. If I am right, how do we achieve statefulness using SOAP? Just by using a different protocol like SMTP (I believe SMTP is stateful)? Can some one explain me teh details?

3. Also, in REST, we do not need any specific contract like WSDL am I correct? In that case, how is the service distributed to the client? In case we are converting a SOAP based service to REST based service, what the steps to be considered?

Thanks a ton folks!!
12 years ago

Hello all-

I am confused with the option that is given in Yourkit profiler. They have an option to explicitly force GC before taking a snapshot of memory.
Haven't we told time again that a GC cannot be forced? So what does this option mean?

Thanks!
12 years ago

No. Once a thread is inside a synchronized block, it will not release the lock unless it calls the wait() method on the object it is synchronized on.



So how can this situation mentioned in the following article be possible?


http://www.ibm.com/developerworks/java/library/j-dcl/index.html (this is an old article too but just trying to understand the preemption in this case].

or even here (this is more recent) - http://blog.adaptivesoftware.biz/2010/10/double-checked-locking-and-java.html

In the section Out-of-Order writes, please check the points 4,5.

Unless the thread 1 is kicked out of synchronized block, how can thread 2 preempt it and return a partially constructed object?

1) so what is the real issue with double checked locking on single vs multi-processor CPUs? How is the new memory model different?

2) if a thread 1 is executing a synchronized block and Thread 2 preempts thread 1, does it mean thread 1 will have to forcibly exit the synchronized block in between?


I will really appreciate if some one can answer my questions - there is just too much information in the internet is confusing.

Thanks.


I was reading this thread about why double checked locking fails in a multi-processor environment.

http://www.javaworld.com/javaworld/jw-02-2001/jw-0209-toolbox.html?page=4

In the page 3, the author mentions that -

"To summarize, synchronization implies a memory barrier. Consequently, though the code within the synchronized block is subject to reordering, all modifications made within that block will be visible in main memory (for other threads to view) when you exit the synchronized block."

and in page 4 -

"The problem: the assignments that occur within the constructor occur within the same memory barrier as the assignment to the_instance. As a consequence, it's possible for the_instance to be non-null, even though the assignments that occurred in the constructor are yet not visible. If one thread gets as far as the statement the_instance=new Disfunctional_singleton(), and the assignment to the_instance is visible but the assignments within the constructor are not yet visible, then a second thread that calls get_instance() method can return a pointer to an uninitialized object. "

That seems contradictory because once you exit the synchronized block everything should be visible.

Does that mean that a thread can exit by just issuing a call to the constructor even before the construction is complete?

Thanks.
Thanks all for your responses ...
13 years ago
Thanks for your response.

Actually my question has nothing to do with clone - just realized.

Say you create an object locally in a method but you only hold a reference to one of it's member variable's even after you are out of the method,

will the local object be GC'd ?
13 years ago

Hi all -

This is my object -



What happens once I am out of the method public void setArr (A a)? I think the localCopy will still be aroudn in memory becasue a part of it being referenced by B right?

alternatively, you can just clone a.arr2.clone() to avoid teh above problem.

is my understanding correct?
13 years ago
Hi all -

I am trying to get the day light savings transition times for a particular year earlier than 2007 for US.

When I try to get the daylight savings rules for US and apply them I am getting the wrong timestamp as the daylight saving rule is the new one due to the US DSt changes in 2007.

How do I get the historical rules/ transition time for years prior to 2007 in java?

Thanks!!
13 years ago