org.apache.solr.cloud

## Class ChaosMonkey

- java.lang.Object
- - org.apache.solr.cloud.ChaosMonkey

-     public class ChaosMonkey
      extends Object

  The monkey can stop random or specific jetties used with SolrCloud. It can also run in a background thread and start and stop jetties randomly. TODO: expire multiple sessions / connectionloss at once TODO: kill multiple jetties at once TODO: ? add random headhunter mode that always kills the leader TODO: chaosmonkey should be able to do cluster stop/start tests

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ChaosMonkey(ZkTestServer zkServer, org.apache.solr.common.cloud.ZkStateReader zkStateReader, String collection, Map<String,List<AbstractFullDistribZkTestBase.CloudJettyRunner>> shardToJetty, Map<String,AbstractFullDistribZkTestBase.CloudJettyRunner> shardToLeaderJetty)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `causeConnectionLoss(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)`
    `void` | `causeSomeChaos()` causes some randomly selected chaos
    `void` | `expireRandomSession()`
    `void` | `expireSession(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)`
    `AbstractFullDistribZkTestBase.CloudJettyRunner` | `getRandomJetty(String slice, boolean aggressivelyKillLeaders)`
    `org.apache.solr.client.solrj.embedded.JettySolrRunner` | `getShard(String slice, int index)`
    `int` | `getStarts()`
    `static void` | `kill(AbstractFullDistribZkTestBase.CloudJettyRunner cjetty)`
    `static void` | `kill(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)`
    `static void` | `kill(List<org.apache.solr.client.solrj.embedded.JettySolrRunner> jettys)`
    `void` | `killJetty(AbstractFullDistribZkTestBase.CloudJettyRunner cjetty)`
    `AbstractFullDistribZkTestBase.CloudJettyRunner` | `killRandomShard()`
    `AbstractFullDistribZkTestBase.CloudJettyRunner` | `killRandomShard(String slice)`
    `static void` | `monkeyLog(String msg)`
    `void` | `randomConnectionLoss()`
    `static boolean` | `start(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)`
    `static void` | `start(List<org.apache.solr.client.solrj.embedded.JettySolrRunner> jettys)`
    `void` | `startAll()`
    `void` | `startTheMonkey(boolean killLeaders, int roundPauseUpperLimit)`
    `static void` | `stop(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)`
    `static void` | `stop(List<org.apache.solr.client.solrj.embedded.JettySolrRunner> jettys)`
    `void` | `stopAll(int pauseBetweenMs)`
    `void` | `stopJetty(AbstractFullDistribZkTestBase.CloudJettyRunner cjetty)`
    `void` | `stopJetty(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)`
    `AbstractFullDistribZkTestBase.CloudJettyRunner` | `stopRandomShard()`
    `AbstractFullDistribZkTestBase.CloudJettyRunner` | `stopRandomShard(String slice)`
    `void` | `stopShard(String slice)`
    `AbstractFullDistribZkTestBase.CloudJettyRunner` | `stopShard(String slice, int index)`
    `void` | `stopShardExcept(String slice, String shardName)`
    `void` | `stopTheMonkey()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ChaosMonkey

          public ChaosMonkey(ZkTestServer zkServer,
                             org.apache.solr.common.cloud.ZkStateReader zkStateReader,
                             String collection,
                             Map<String,List<AbstractFullDistribZkTestBase.CloudJettyRunner>> shardToJetty,
                             Map<String,AbstractFullDistribZkTestBase.CloudJettyRunner> shardToLeaderJetty)

  - ### Method Detail

    - #### expireSession

          public void expireSession(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)

    - #### expireRandomSession

          public void expireRandomSession()
                                   throws org.apache.zookeeper.KeeperException,
                                          InterruptedException

      Throws:
        `org.apache.zookeeper.KeeperException`
        `InterruptedException`

    - #### randomConnectionLoss

          public void randomConnectionLoss()
                                    throws org.apache.zookeeper.KeeperException,
                                           InterruptedException

      Throws:
        `org.apache.zookeeper.KeeperException`
        `InterruptedException`

    - #### causeConnectionLoss

          public static void causeConnectionLoss(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)

    - #### stopShard

          public AbstractFullDistribZkTestBase.CloudJettyRunner stopShard(String slice,
                                                                          int index)
                                                                   throws Exception

      Throws:
        `Exception`

    - #### stopJetty

          public void stopJetty(AbstractFullDistribZkTestBase.CloudJettyRunner cjetty)
                         throws Exception

      Throws:
        `Exception`

    - #### killJetty

          public void killJetty(AbstractFullDistribZkTestBase.CloudJettyRunner cjetty)
                         throws Exception

      Throws:
        `Exception`

    - #### stopJetty

          public void stopJetty(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)
                         throws Exception

      Throws:
        `Exception`

    - #### kill

          public static void kill(List<org.apache.solr.client.solrj.embedded.JettySolrRunner> jettys)
                           throws Exception

      Throws:
        `Exception`

    - #### kill

          public static void kill(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)
                           throws Exception

      Throws:
        `Exception`

    - #### kill

          public static void kill(AbstractFullDistribZkTestBase.CloudJettyRunner cjetty)
                           throws Exception

      Throws:
        `Exception`

    - #### stopAll

          public void stopAll(int pauseBetweenMs)
                       throws Exception

      Throws:
        `Exception`

    - #### startAll

          public void startAll()
                        throws Exception

      Throws:
        `Exception`

    - #### stopShard

          public void stopShard(String slice)
                         throws Exception

      Throws:
        `Exception`

    - #### stopShardExcept

          public void stopShardExcept(String slice,
                                      String shardName)
                               throws Exception

      Throws:
        `Exception`

    - #### getShard

          public org.apache.solr.client.solrj.embedded.JettySolrRunner getShard(String slice,
                                                                                int index)
                                                                         throws Exception

      Throws:
        `Exception`

    - #### stopRandomShard

          public AbstractFullDistribZkTestBase.CloudJettyRunner stopRandomShard()
                                                                         throws Exception

      Throws:
        `Exception`

    - #### stopRandomShard

          public AbstractFullDistribZkTestBase.CloudJettyRunner stopRandomShard(String slice)
                                                                         throws Exception

      Throws:
        `Exception`

    - #### killRandomShard

          public AbstractFullDistribZkTestBase.CloudJettyRunner killRandomShard()
                                                                         throws Exception

      Throws:
        `Exception`

    - #### killRandomShard

          public AbstractFullDistribZkTestBase.CloudJettyRunner killRandomShard(String slice)
                                                                         throws Exception

      Throws:
        `Exception`

    - #### getRandomJetty

          public AbstractFullDistribZkTestBase.CloudJettyRunner getRandomJetty(String slice,
                                                                               boolean aggressivelyKillLeaders)
                                                                        throws org.apache.zookeeper.KeeperException,
                                                                               InterruptedException

      Throws:
        `org.apache.zookeeper.KeeperException`
        `InterruptedException`

    - #### startTheMonkey

          public void startTheMonkey(boolean killLeaders,
                                     int roundPauseUpperLimit)

    - #### monkeyLog

          public static void monkeyLog(String msg)

    - #### stopTheMonkey

          public void stopTheMonkey()

    - #### causeSomeChaos

          public void causeSomeChaos()
                              throws Exception

      causes some randomly selected chaos
      Throws:
        `Exception`

    - #### getStarts

          public int getStarts()

    - #### stop

          public static void stop(List<org.apache.solr.client.solrj.embedded.JettySolrRunner> jettys)
                           throws Exception

      Throws:
        `Exception`

    - #### stop

          public static void stop(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)
                           throws Exception

      Throws:
        `Exception`

    - #### start

          public static void start(List<org.apache.solr.client.solrj.embedded.JettySolrRunner> jettys)
                            throws Exception

      Throws:
        `Exception`

    - #### start

          public static boolean start(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)
                               throws Exception

      Throws:
        `Exception`

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.