add EventBus

Revision created by MOE tool push_codebase.
MOE_MIGRATION=2702


git-svn-id: https://guava-libraries.googlecode.com/svn/trunk@549 8138a162-5c33-11de-8abc-d1c337b90d21
Hide flattenHierarchy() behind a MapMaker cache.

Revision created by MOE tool push_codebase.
MOE_MIGRATION=2745


git-svn-id: https://guava-libraries.googlecode.com/svn/trunk@567 8138a162-5c33-11de-8abc-d1c337b90d21
A bunch of Guava javadoc tweaks and such, trying to cut down on warnings.


Revision created by MOE tool push_codebase.
MOE_MIGRATION=2952


git-svn-id: https://guava-libraries.googlecode.com/svn/trunk@636 8138a162-5c33-11de-8abc-d1c337b90d21
manual sync
- add cache cleanup
- scrub @since tags
split LoadingCache out of Cache interface
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=25099006
Link pages to the wiki.
From Louis: http://codereview.appspot.com/5553067/
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=27271233
For all of //java/com/google/common/... and //javatests/com/google/common/...
-sort imports
-remove unused imports

g4 edit java/com/google/common/... javatests/com/google/common/...

g4 change

/home/build/[]/tools/java/remove_unused_imports.py --fix -c 27791544

g4 list -s 27791544  | sed "s%//depot/[]/%%" | xargs
/home/build/[]/tools/java/sort_java_imports.py

g4 revert -c 27791544 -a
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=27803889
Guava issue 783: Fix handler finder w.r.t. subclasses and interfaces.
From Louis: http://codereview.appspot.com/5389041/

Also, open-source existing OutsideEventBusTest.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=29570767
Use TypeToken in EventBus to avoid the duplicated superclass-finding logic.
From Louis: http://codereview.appspot.com/6195089/
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=30463039
Replace another instance of supertype-finding code in EventBus with TypeToken.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=31082777
Remove erroneous statement about inability to unregister from eventbus package Javadoc.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=31129205
Make protected methods of EventBus package-private, hiding the package-private EventHandler type.

Leaving the one protected method that didn't have EventHandler in the signature protected but @Deprecated for one release before making it package-private as well.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=31147025
Make the remaining protected method in EventBus package-private.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=32234236
Fix thread-safety of EventBus.

In a previous change, handlersByType was converted from a ConcurrentMap to a SetMultimap. However, the SetMultimap returned by Multimaps.newSetMultimap is not threadsafe when concurrent operations update the multimap, even if the map and set factory are. This can cause registered subscribers to stop receiving events because they are dropped from the multimap.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=33680249
Allow synchronous calls to EventBus.post().

As we're only reading the set of registered event handlers when an event is posted, it is more efficient to split the lock on handlersByType into read and write locks and only acquire the write lock in register() and unregister().
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=33685413
Experimental EventBus CL that reduces the overhead of reflection in the
case where a lot of EventBus instances are created and the same type of
objects are registered on all of them. This makes a difference of about
4x in one app.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=33742203
A number of small changes and fixes in EventBus:
- flattenHierarchy was catching an exception that couldn't be thrown because the CacheLoader doesn't throw a checked exception. Fix it to catch the right exception type.
- Change eventsToDispatch to use non-thread safe queues since it's a ThreadLocal.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=33790152
Applied package sanity tests to common.eventbus
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=34501606
Guava issue 1120. Remove ThreadLocal value in EventBus rather than setting to false.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=36161462