Open source
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Open source
Arash M. Dehghani wrote:...many times stream missed because application returns -1
when call read(). well each incoming stream are parsed in a separated thread...
BEE MBA PMP SCJP-6
Open source
BEE MBA PMP SCJP-6
Open source
BEE MBA PMP SCJP-6
Open source
BEE MBA PMP SCJP-6
Jim Hoglund wrote:Here's a condensed version without wait(), notify() or synchronized.
Instead, it uses Thread.yield() to wait for the ready() condition.
What do you think?
BEE MBA PMP SCJP-6
Jim Hoglund wrote:Henry: Yes, it's a spin but it should not cause the JVM to starve other
threads. Is there an alternative approach you would suggest?
Jim Hoglund wrote: Arash,
if you are concerned about this, a probe can be added to see how much
CPU yield() is using.
Open source
amitabh mehra wrote:Henry, can you elaborate how is that a spin wait. If i use thread.yield() will the thread not yield the cpu to other threads.
coming on top of this is another question which i m not sure is valid or not, still here it is - will yield() method, yield cpu to same and higher priority threads or any thread?
Arash M. Dehghani wrote:
so how can I implement it with synch block, wait and notify. Jim said the my synch block implementation looks okay, but doesn't call notify, I mean I don't know how and where call this guy. any suggestion with synch, wait and notify? how to?
BEE MBA PMP SCJP-6
Open source
Open source
Open source
BEE MBA PMP SCJP-6
Open source
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |