Wednesday, 25 January 2017
Runnable vs. Callable
Callable
's
call()
method can :
Return value
:
A
Future
object which can hold the result of computation
T
hrow
Exception
CyclicBarrier vs. CountDownLatch
SIMILARITY
Both waits for number of threads on one or more events
DIFFERENCE
We
cannot re-use CountDownLatch
once count reaches to zero
You can reuse same
CyclicBarrier
even after barrier is broken
How to pass request header with wget and curl ?
Use
--header
with wget
wget
--header
=
"
Host
:
my-host.com
" '
http://10.106.208.110:80/myservice
'
Use
-H
with curl
curl
-H
'
Host
:
my-host.com
'
http://10.106.208.110:80/myservice
How can you ensure the execution sequence of threads ?
Use
join()
Start from T3
Call join() so that it calls T2
Inside T2, call join() again so that it calls T1
By this way, the execution sequence would be T1 -> T2 -> T3
Newer Posts
Older Posts
Home
Subscribe to:
Posts (Atom)