Support start/stop

commit 8c2c05f3f0e94dc175ade4e4318cbf461925e485
Merge: 6601515 d49d23c
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Thu Feb 27 09:32:14 2014 -0800

    Merge branch 'upstream' into start_stop

    Conflicts:
    	barge-core/src/main/java/org/robotninjas/barge/log/RaftLog.java
    	barge-core/src/main/java/org/robotninjas/barge/state/RaftStateContext.java
    	barge-core/src/main/java/org/robotninjas/barge/state/Start.java

commit 66015153c943be0027d9ce576707d77134f95f85
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 23:01:59 2014 -0500

    Bump the start/stop test timeout up to 10 seconds, as Travis can be a little slow

commit c54b7dccac85245af7927955227958204e1e8ff0
Merge: 43beeed 49a3feb
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 22:58:21 2014 -0500

    Merge branch 'request_self_vote' into start_stop

    Conflicts:
    	barge-core/src/main/java/org/robotninjas/barge/state/Candidate.java
    	barge-core/src/main/java/org/robotninjas/barge/state/RaftStateContext.java

commit 49a3febb47c3031c011c1ee74e86424d1d225930
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 22:38:55 2014 -0500

    Use MDC for self (address)

commit f2bb0740d6161d218956761bbd1e461279a78e40
Merge: fc95d7f 09e520f
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 22:11:33 2014 -0500

    Merge branch 'upstream' into request_self_vote

commit fc95d7f8f2f5e1932b4299392c524e5e86d9e291
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 16:02:12 2014 -0500

    Put self() in square brackets in log messages

    At least they're consistent this way.

    They really should be in the log's MDC, but that doesn't work with our threading model.

commit aa66be5c4679e399d986de496568153d44e848e3
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 15:30:24 2014 -0500

    Get even closer to the Raft paper

commit 56598a09da673b41b1a96325710a256622b24b41
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 15:16:15 2014 -0500

    Get closer to the Raft paper.

    In particular, the log up to date logic was wrong, and votedFor must be cleared every new term

commit ad596dc849c5df93cbc1ac09fad9cfb62d32ba39
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 14:48:45 2014 -0500

    Yet more logging; trying to track down concurrent leader elections

commit 6b3b6eaccbcd4d40159344df8a33d2b4cb3ed47f
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 14:20:48 2014 -0500

    We hit an NPE when checking the StateType; guard against it

    This shouldn't be possible.  Something is borked.

commit c7dc1f603859063a4dda5ecbf146dac18ff29aa6
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 14:17:52 2014 -0500

    Yet more logging: RaftStateContext now has a name

commit de2459287aed1e0504a0d06d08a90f5f4209a575
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 14:00:33 2014 -0500

    Add the transition to state in there

    Otherwise it's a pain to figure out

commit c83518a1233b4a3a55020f7d2c901179dc6be1b4
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 13:58:18 2014 -0500

    Log if we hit the state transition check-safe

    We're hitting the invalid state transition check, so log it.

    It's a serious error, so we want to log it irrespective of what listeners are attached.

commit d016143599fdad09c7b9508dc67095b75d9538a2
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 13:37:11 2014 -0500

    We shouldn't have to request a vote from ourselves

commit 9d8522dc0512412d60b103ee468114549cf9b4c5
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 10:58:52 2014 -0500

    We need to request a vote from ourselves

commit 43beeed0add87b95d49b043c31f10a1b704809e7
Merge: b933976 e225ddd
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 10:59:47 2014 -0500

    Merge branch 'half_is_not_a_majority' into start_stop

commit b933976fcb5e6239c7211ff832ba3f34b7e73b39
Merge: 832d349 05aab60
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 10:59:37 2014 -0500

    Merge branch 'find_leader' into start_stop

commit 832d349d97c409c23834e7a79fef4d0b7e808113
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 10:58:52 2014 -0500

    We need to request a vote from ourselves

commit e225ddd88fd712fb719df7e54a349c79b7467d53
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 10:55:51 2014 -0500

    Fix majority collector: require > 50% to be a majority

commit 20c31dc42eab5b23093a12ec0ca4114100e68fed
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 09:32:44 2014 -0500

    Remove unused import

commit ad2faabdedcc97c7f0b8054054f0edb51c3433df
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 09:31:12 2014 -0500

    Add 'LogListener' to log listener logging

    So it is clear where the message is coming from

commit 4478f30d2415f68448166ef41f01ed5d743244fc
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 09:30:50 2014 -0500

    Follower stop should defer to inherited method

commit de74b748a2434f069cb2fac5934039d97751f98e
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 09:30:34 2014 -0500

    Fixup to reduce unnecessary diffs

commit b87ea2d4cff0f440ce9de9bfefcca0b82a6f42a8
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 09:01:11 2014 -0500

    Fixup after merge with find_leader

commit e48290a817a6d2dd9bea6b896d082f138634d85e
Merge: 63bc688 9491dc8
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 08:58:24 2014 -0500

    Merge branch 'find_leader' into start_stop

commit 63bc68830a7005a299eae1759345a84615e977e2
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 08:36:50 2014 -0500

    We can use inherited behaviour in Leader.doStop

commit 02f07161e821a4adc56f8df60cbcc52fdb3833ce
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 01:14:51 2014 -0500

    Don't assume leader is #0 in integration tests

commit a2f7dcee8bf0c8dfa5494c7916fbde4d5c3eb475
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 01:04:10 2014 -0500

    Create Stopped state handler, to avoid having to handle null pointers

commit 1aa63752af3dc0587d5d44025a79c7785cf7958d
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 00:58:22 2014 -0500

    Trying to track down problem with CI build

commit f063c99641197e1a284a86db518285d6aa393214
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 00:49:18 2014 -0500

    Cleaning up diff with new code

commit b62e84ea05290a91c51e88706ae474190be69d69
Merge: 6edbf58 d981cee
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Wed Feb 12 00:38:49 2014 -0500

    Merge branch 'upstream' into start_stop

    Conflicts:
    	barge-core/src/main/java/org/robotninjas/barge/state/Follower.java
    	barge-core/src/main/java/org/robotninjas/barge/state/Leader.java
    	barge-core/src/main/java/org/robotninjas/barge/state/RaftStateContext.java

commit 6edbf58f740662ddee0f8517a921d8aa2fe62596
Merge: 06bc7e0 c9ac266
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Fri Feb 7 11:50:17 2014 -0500

    Merge branch 'upstream' into start_stop

    Conflicts:
    	barge-core/src/main/java/org/robotninjas/barge/log/RaftLog.java
    	barge-core/src/main/java/org/robotninjas/barge/state/Follower.java
    	barge-core/src/main/java/org/robotninjas/barge/state/Leader.java
    	barge-core/src/main/java/org/robotninjas/barge/state/RaftStateContext.java
    	barge-core/src/main/java/org/robotninjas/barge/state/Start.java
    	barge-core/src/main/java/org/robotninjas/barge/state/State.java
    	barge-core/src/test/java/org/robotninjas/barge/NettyServiceTest.java
    	barge-core/src/test/java/org/robotninjas/barge/state/BaseStateTest.java
    	barge-service/src/main/java/org/robotninjas/barge/NettyRaftService.java

commit 06bc7e0e0f2076aaf92bcd798beea1f2a7a8f368
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Fri Jan 31 10:39:52 2014 -0500

    Clean up calculation of quorum size

commit fe559a0343736a1061a15dfb506601dee7137960
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Fri Jan 31 10:37:32 2014 -0500

    Only stop the service if it's running in the test

commit 3f5183011afdde95ac73b7e8669aca9feefb9e66
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Fri Jan 31 10:37:01 2014 -0500

    Notify the state delegates when we are stopping

commit eb315f6d470b9b9f6939d504defd33913ce5e1d3
Author: Justin Santa Barbara <justin@fathomdb.com>
Date:   Fri Jan 31 09:30:28 2014 -0500

    More logging & code formatting

commit 5c2be4b4e1a600f222b3dfd3d540507d937e83dd
Author: justin@fathomdb.com <Justin SB>
Date:   Fri Jan 31 09:25:09 2014 -0500

    Avoid possible NPE

commit 147984abed80ca62ea58f6e4b03b007b6785b356
Author: justin@fathomdb.com <Justin SB>
Date:   Fri Jan 31 01:16:15 2014 -0500

    Don't assume we have a callback; can be null on log replay

commit 5b7ad1b868b947d78828b64cd6b628b33dfa7123
Author: justin@fathomdb.com <Justin SB>
Date:   Fri Jan 31 01:15:01 2014 -0500

    Request that the RaftStateContext stops

commit 8b90cc996b9f6edd1f3628320ea66f70dd1b1d0f
Author: justin@fathomdb.com <Justin SB>
Date:   Fri Jan 31 01:08:45 2014 -0500

    Cope with clusters of one node

commit ba07050c1fc7de6def19ffa0f7b9999e24908a54
Author: justin@fathomdb.com <Justin SB>
Date:   Fri Jan 31 01:00:36 2014 -0500

    Tolerate single node clusters

commit 0bdac0069f7d058e0f66f0516bd65f613b041d11
Author: justin@fathomdb.com <Justin SB>
Date:   Fri Jan 31 00:57:15 2014 -0500

    Add isLeader method; wait for leadership in tests

commit 530d552b780b56be6b07aaafd0b5fc18e58af9b2
Author: justin@fathomdb.com <Justin SB>
Date:   Fri Jan 31 00:44:08 2014 -0500

    Add test for service start / stop

commit 8029e759a180531a9aa2dbfeaf9232185356467a
Merge: dec0343 39a690c
Author: justin@fathomdb.com <Justin SB>
Date:   Fri Jan 31 00:20:32 2014 -0500

    Merge branch 'master' of https://github.com/mgodave/barge into upstream

commit dec034318bbe09f7c32f31a9d9da2df8556be650
Merge: 5046344 6f39624
Author: justin@fathomdb.com <Justin SB>
Date:   Thu Jan 30 12:48:16 2014 -0500

    Merge branch 'master' of https://github.com/mgodave/barge into upstream

commit 5046344d8928d24e671158d2f0603dfe415b222f
Author: justin@fathomdb.com <Justin SB>
Date:   Thu Jan 30 12:47:30 2014 -0500

    Merge branches 'upstream' and 'master' into upstream