Sun Nov 13 02:37:44 HKT 2011 From /weblog/java/concurrency
Join
Example of Join - http://cnapagoda.blogspot.com/2010/01/thread-join-method.html
(google search) (amazon search)
|
|
download zip of files only Sun Nov 13 02:37:44 HKT 2011 From /weblog/java/concurrency JoinExample of Join - http://cnapagoda.blogspot.com/2010/01/thread-join-method.html (google search) (amazon search) Sun Oct 16 23:31:45 HKT 2011 From /weblog/java/concurrency PhasersSimilar to Barrier - http://tech.puredanger.com/2008/07/08/java7-phasers/ An example, show how to coordinate producer and consumer with Phaser - http://javaforu.blogspot.com[..]08/java-7s-jucphaser-short-tutorial.html (google search) (amazon search) Sun Sep 25 09:35:12 HKT 2011 From /weblog/java/concurrency yieldYield is not that reliable- http://www.azulsystems.com[..]-pair-of-somebody-elses-concurrency-bugs (google search) (amazon search) Sat Sep 24 00:19:47 HKT 2011 From /weblog/java/concurrency tutorialAnother nice tutorial set of concurrency framework - http://www.javacodegeeks.com/search/label/Concurrency Java concurrency, Building and testing concurrent applications for the Java platform - http://www.ibm.com[..]g/kp/j-kp-concurrency/index.html?ca=drs- (google search) (amazon search) Sun Aug 28 19:58:48 HKT 2011 From /weblog/java/concurrency monitoringSample code of try-sync
http://www.javaspecialists.eu/archive/Issue194.html (google search) (amazon search) Mon Jun 27 00:27:08 HKT 2011 From /weblog/java/concurrency hintA nice list of hints about concurrency in java - http://www.weiqigao.com[..]c_burke_java_concurrency_by_example.html Testing about java parallel processing - http://embarcaderos.net[..]ng-and-multi-core-utilization-with-java/ Some concurrency basic information - http://blog.andrewhubbs.com/?p=107 Tutorial of concurrency package - http://tutorials.jenkov.com/java-util-concurrent/index.html Using Latch with Executor - http://binkley.blogspot.com[..]06/new-shimmer-for-java-concurrency.html (google search) (amazon search) Fri Jun 17 19:16:36 HKT 2011 From /weblog/java/concurrency collectionsEven though
is thread safe, serialize sync List is NOT thread safe for sure. The story is, if you only synchronized the collection, and if we try to get the iterator in concurrent access environment, it will throws currencymodificationexception . I personally think this is a bug of having Collections.synchronizedCollection(). For collection is small, may be making defensive copy http://www.javapractices.com/Topic15.cjp is good. Otherwise, in java5, there is concurrency collection. reference: http://jroller.com[..]ntry=collections_synchronizedlist_broken http://jroller.com/page/ctarrington?entry=java_collections_trivia Map operation, include use of FutureTask and putIfAbsent() method from ConcurrentMap. - http://www.javaspecialists.co.za/archive/newsletter.do?issue=125 Other then lterate through the elements, adding and removing elements can also be problem, this article document a few good cases about that - http://rayfd.wordpress.com[..]en-a-synchronized-class-isnt-threadsafe/ Samples of using Queue.drainTo() - http://binkley.blogspot.com[..]rforming-fixed-amounts-of-work-with.html http://tech.puredanger.com/2009/02/28/java-7-transferqueue/ Overview of blockingqueue - http://tutorials.jenkov.com[..]/java-util-concurrent/blockingqueue.html Simple benchmark - http://java-persistence-performance.blogspot.com[..]jvm-performance-part-iii-concurrent.html Multi-thread behaviour - http://vanillajava.blogspot.com[..]hread-safety-issues-with-vector-and.html (google search) (amazon search) Sat Jun 11 09:59:18 HKT 2011 From /weblog/java/concurrency volatileExamples of how to use volatile - http://www.ibm.com/developerworks/java/library/j-jtp06197.html Related with volatile, explanation of thread safe of initalize with final / non-final variable - http://www.nabble.com[..]On%09DemandHolder-Idiom---tf4384557.html http://jeremymanson.blogspot.com[..]07/08/volatile-does-not-mean-atomic.html http://jeremymanson.blogspot.com[..]com/2009/06/volatile-arrays-in-java.html Difference between volatile and synchronization - http://stackoverflow.com[..]7/volatile-keyword-in-java-clarification http://javarevisited.blogspot.com[..]atile-keyword-java-example-tutorial.html (google search) (amazon search) Mon May 30 09:49:38 HKT 2011 From /weblog/java/concurrency LockReentrantReadWriteLock - http://www-128.ibm.com[..]loperworks/library/j-jtp10264/index.html why it suppose to be faster than VM level lock - http://osdir.com[..]sr.166-concurrency/2005-02/msg00031.html Samples of how to use it, and how to write test cases about it - http://www.javaspecialists.eu/archive/Issue152.html Some useful VM parameter to tune the locks: -XX:+EliminateLocks , -XX:+DoEscapeAnalysis , -XX:+UseBiasedLocking - http://work.tinou.com[..]locking-escape-analysis-for-dummies.html Discuss about 3 difference lock for Java, bias, thin and fat - http://www.javacodegeeks.com/2011/05/how-jvm-handle-locks.html (google search) (amazon search) Wed May 04 08:32:39 HKT 2011 From /weblog/java/concurrency threadlocalThere is a little bit performance cost for threadlocal variable - http://software.intel.com[..]ost-of-accessing-thread-local-variables/ Look like a useful but less known API - http://crazybob.org/2006/07/hard-core-java-threadlocal.html Forward up discussion - http://www.theserverside.com[..]d_id=41473&asrc=EM_NNL_406677&uid=703565 pointing out some problems of using this technique, include similar effect of GLOBLE , possible memory leak Another discussion in higher level - http://blog.objectmentor.com[..]04/thread-local-a-convenient-abomination , Key is "An object is an abstraction of function. A thread is an abstraction of schedule" , you can read further conclusion at http://www.infoq.com/news/2007/09/confusing_uow_with_threads Protential issue of using threadlocal, one is memory leak and the other is it is that local - http://blog.maxant.co.uk/pebble/2008/09/23/1222200780000.html (google search) (amazon search) Thu Mar 17 12:17:22 HKT 2011 From /weblog/java/concurrency Thread.getStateAn API to get the state of a thread, but someone say it is not reliable - http://java.sun.com[..]5.0/docs/api/java/lang/Thread.State.html http://java.silke-wingens.de/2011/03/13/threads-states/?lang=en http://www.nabble.com[..]readed-programs-tf3627394.html#a10128844 Having said that, I have to note that using Thread#getState() is not something you can absolutely rely on as the behavior isn't guaranteed to be the same on all platforms. That is, it can be a useful tool for debugging and test-driving but not ideal for regression (unit) testing. (google search) (amazon search) Wed Feb 16 01:16:05 HKT 2011 From /weblog/java/concurrency AnonymousInnerClassHere is an tricky concurrency concern in Java when using Anonymous Inner Class with ExecutorService, if you use collection from outside class, that collection actually a global variable in the Inner Class, and need to take care the issues happened in concurrency access. For this class:
actually same as
(google search) (amazon search) Sat Jan 29 12:09:57 HKT 2011 From /weblog/java/concurrency ReferenceHow weak and soft reference work http://www.javaspecialists.co.za/archive/Issue098.html Issue about weakhashmap - http://blogs.azulsystems.com/cliff/2007/08/why-weakhashmap.html When soft reference clean? - http://jeremymanson.blogspot.com[..]/07/how-hotspot-decides-to-clear_07.html (google search) (amazon search) Wed Dec 15 00:30:18 HKT 2010 From /weblog/java/concurrency antipatternWhy we need volatile in MT access - http://blogs.sun.com[..]age/sundararajan?entry=is_this_mt_safe_i Sync. and set array - http://www.nabble.com[..]attern%2C-way-to-common-td16061045.html: No such file or directory Java Concurrency Gotchas - ttp://www.slideshare.net[..]xmiller/java-concurrency-gotchas-3666977 (google search) (amazon search) Sat Dec 11 00:51:32 HKT 2010 From /weblog/java/concurrency MapNote on writing CopyOnWrite wrapper - http://flyingspaniel.blogspot.com[..]ot.com/2010/12/copyonwrite-wrappers.html Sometime this is a bit difficult for Chinese to be a good programmer, recently some colleague and me discuss about the behaviour of this class and look like we have difficult understanding A: ConcurrentHashMap support for locking as this is thread-safe B: ConcurrentHashMap is thread safe for read but not for write because there is no lock, we still need to have external lock to keep it thread safe. By the way, I get ConcurrentModificationException from this before. C: ConcurrentHashMap don't support for locking but they still thread safe for all operations, which is how "This class is fully interoperable with Hashtable in programs that rely on its thread safety but not on its synchronization details." mentioned. Too good that we can actually take a look at the source code to see what going on nowadays rather than just guessing - http://www.google.com[..]HashMap&sourceid=opera&ie=utf-8&oe=utf-8 By the way, this constructor is useful for a lot of concurrency access but actually not many developer notice about this - http://java.sun.com[..]rrentHashMap.html#ConcurrentHashMap(int, float, int) Lazy initialization of map values - http://artisans-serverintellect-com.si-eioswww6.com[..]ect-com.si-eioswww6.com/default.asp?W122 HashMap.get() can cause infinite loop - http://lightbody.net[..]5/07/hashmapget_can_cause_an_infini.html Discussing the effect of initCapacity() of HashMap in Java - http://saloon.javaranch.com[..]ltimatebb.cgi?ubb=get_topic&f=1&t=021171 (google search) (amazon search) Tue Jun 22 01:37:57 HKT 2010 From /weblog/java/concurrency ExecutorSample ResubmittingScheduledThreadPoolExecutor, the coding is nice! http://www.javaspecialists.eu/archive/Issue154.html Implement thread pool properly - http://www.kimchy.org/juc-executorservice-gotcha/ (google search) (amazon search) Fri Jun 04 02:21:24 HKT 2010 From /weblog/java/concurrency profilerBut look like very useful: http://jroller.com/page/davinci?entry=simple_thread_profiling Profile the contention of lock - http://www.infoq.com/articles/jucprofiler (google search) (amazon search) Thu Feb 04 16:51:42 HKT 2010 From /weblog/java/concurrency Fork-joinOverview - http://www.infoq.com/news/2007/07/concurrency-java-se-7 Google - http://www.google.com[..]jsr166y&sourceid=opera&ie=utf-8&oe=utf-8 Javadoc - http://gee.cs.oswego.edu[..]66ydocs/index.html?overview-summary.html An article with good code sample - http://www.ibm.com[..]rks/java/library/j-jtp11137.html?ca=drs- http://www.theserverside.com[..]s?track=NL-461&ad=636686&thread_id=49104 http://www.infoq.com/news/2008/03/fork_join http://www.codecommit.com[..]g/scala/higher-order-fork-join-operators http://www.coopsoft.com/ar/ForkJoinArticle.html (google search) (amazon search) Sun Mar 29 02:30:54 HKT 2009 From /weblog/java/concurrency testingSeries of blog showing how to use JMock API to help testing MT code - http://www.google.com[..]shhtresohqc&ie=UTF-8&q=JMock+and+Threads (google search) (amazon search) Tue Sep 09 00:42:44 HKT 2008 From /weblog/java/concurrency FunctionalSeries about using functional library to ease the development of concurrency application http://apocalisp.wordpress.com[..]allel-strategies-and-the-callable-monad/ http://apocalisp.wordpress.com[..]008/06/30/parallel-list-transformations/ http://apocalisp.wordpress.com[..]7/28/threadless-concurrency-with-actors/ http://apocalisp.wordpress.com/2008/09/02/a-better-future/ (google search) (amazon search) Fri Nov 23 14:07:36 HKT 2007 From /weblog/java/concurrency InterruptJust know that interrupt() call is just setting a flag, it have to be doing IO work (like database call), or in wait() status, before the thread can really be interrupted. http://blogs.sun.com[..]winger?entry=swingworker_stop_that_train Another nice explanation about interrupt, in summary: What should we do when we call code that may cause an InterruptedException? Don't immediately yank out the batteries! Typically there are two answers to that question: 1) Rethrow the InterruptedException from your method. This is usually the easiest and best approach. It is used by the new java.util.concurrent.* package [ http://java.sun.com[..]util/concurrent/Semaphore.html#acquire() ], which explains why we are now constantly coming into contact with this exception. 2) Catch it, set interrupted status, return. If you are running in a loop that calls code which may cause the exception, you should set the status back to being interrupted. For example: while (!Thread.currentThread().isInterrupted()) {Remember the Law of the Sabotaged Doorbell - don't just ignore interruptions, manage them properly!- http://www.javaspecialists.eu/archive/Issue146.html (google search) (amazon search) Sun Aug 05 02:40:37 HKT 2007 From /weblog/java/concurrency JMMAn excellent presentation - http://www.javapolis.com/JP05Content/talks/day3/brian2/index.html and excellent site - http://www.cs.umd.edu/~pugh/java/memoryModel/index.html Locking optimization at Java 6 http://www-128.ibm.com[..]rary/j-jtp10185/index.html?ca=drs-tp4205 (google search) (amazon search) Thu Aug 02 01:25:51 HKT 2007 From /weblog/java/concurrency AbstractQueuedSynchronizerProvides a framework for implementing blocking locks and related synchronizers (semaphores, events, etc) that rely on first-in-first-out (FIFO) wait queues. http://java.sun.com[..]nt/locks/AbstractQueuedSynchronizer.html (google search) (amazon search) Sat Apr 14 23:42:11 HKT 2007 From /weblog/java/concurrency poolDemo how java 1.5 built-in thread pool work: http://blogs.sun.com[..]ry=swingworker_throttling_and_monitoring Sample of thread pool - http://www.javaworld.com/javaworld/jw-01-2005/jw-0124-pool_p.html (google search) (amazon search) Wed Nov 22 19:38:38 HKT 2006 From /weblog/java/concurrency K-meanAn article introducing using K-mean algorithm in Java - http://www.javaworld.com/javaworld/jw-11-2006/jw-1121-thread.html (google search) (amazon search) |