Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!

Sze Kong Chan

Greenhorn
+ Follow
since Mar 30, 2011
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 Sze Kong Chan

I notice that in the introductory text and examples of web service, the ip address and port of the endpoint is capture within the wsdl, during the wsdl import. My question is how can I make my web service client independent on the ip address of the endpoint. I am hoping to connect to the esb proxy instead. Is UDDI a viable approach? Will appreciate any advises or recommendation on any reference or tutorial. Thanks in advance.

11 years ago

Mathew Lee wrote:
sb2=null,
does it null sb2 object reference on stack or Manchester String Buffer object on heap.


it set the value of the sb2 reference to null, Manchester StringBuffer is still on the heap.

Mathew Lee wrote:
when sb2=null does that means sb=null automatically?


no.




11 years ago
abalfazl, I share the same understanding as you. This is what I think the original codes is doing.
That is because you have change the MyThread.run to wait on each thread objects themselves. After which, nothing is going the notify them to wake up :0)..

In the original implementation, all of the MyThread instances are waiting on the same lock object, and the main thread will wake all of them up to print the "after wait" statement.


The only thread that uses ock.notifyAll (); is main thread who sleeps for 3000.Why synchronized is used here?
synchronized (lock) {
lock.notifyAll ();
}



Although, only the main thread call lock.notifyAll(), but all 4 threads (including main) uses the lock object. Whenever any thread access a shared object, it is only safe to synchronized them. Because we don't know what the method do to the attributes within the shared object

Hope this help.
Mezan,

Not to be too stressful. You will realize that at this point of time, you are not just learning about the programming language itself, but the ability to handle stress, the ability to pick up knowledge by yourself and also learn to be patient and persistence. All this are the characteristics of a good programmer.

Good luck and enjoy the process.

11 years ago

Mathew Lee wrote:>>>when sb2 points to Mancheser stringbuffer object then sb disconnected from Mancheser stringbuffer object

why does sb disconnected from Mancheser stringbuffer object. i was not clear on that. please advise



So basically, 2 objects are created Manchester StringBuffer and Chester Stringbuffer.
At the end of line 10, sb and sb2 reference Manchester, while sb3 reference Chester.
After the execution of (line 11) sb=sb3, => sb2 reference Manchester, while sb and sb3 reference Chester. Note Manchester doesn't qualify for GC because sb2 is still referencing the object
Only after the execution of (line 13) sb2 = null, => Manchester is not reference, hence it is qualify for GC.

I am looking at the problem from the perspective of when the object is not reference, I feel that it will be easier.


11 years ago

what is difference between null and empty.






instead of String can i keep object there instead



No!



I agree with Janeice. The best way to learn is to get a book, download a good IDE (netbean, etc) and hack up the codes to try. a good IDE will flag up any compilation error immediately. It better to learn how to fish, I believe that the spirit the guru are trying to cultivate here
11 years ago
Josh,

See if this help.. :0)

Implementation goes something like that


To invoke the method


Not sure if I get what you want. otherwise, please elaborate.. BTW don't forget to define a class for your SimulationException
11 years ago