org.apache.solr.client.solrj.cloud.autoscaling

## Class PolicyHelper

- java.lang.Object
- - org.apache.solr.client.solrj.cloud.autoscaling.PolicyHelper

    public class PolicyHelper
    extends Object

### Nested Class Summary

Nested Classes
`static class` `PolicyHelper.SessionWrapper`
`static class` `PolicyHelper.Status`

### Field Summary

Fields
`static int` `SESSION_EXPIRY`

### Constructor Summary

Constructors
Constructor and Description
`PolicyHelper()`

### Method Summary

All Methods Static Methods Concrete Methods
`static MapWriter` `getDiagnostics(Policy policy, SolrCloudManager cloudManager)`
`static PolicyHelper.SessionWrapper` `getLastSessionWrapper(boolean clear)` Use this to get the last used session wrapper in this thread
`static List<ReplicaPosition>` `getReplicaLocations(String collName, AutoScalingConfig autoScalingConfig, SolrCloudManager cloudManager, Map<String,String> optionalPolicyMapping, List<String> shardNames, int nrtReplicas, int tlogReplicas, int pullReplicas, List<String> nodesList)`
`static PolicyHelper.SessionWrapper` `getSession(SolrCloudManager cloudManager)` How to get a shared Policy Session 1) call `getSession(SolrCloudManager)` 2) compute all suggestions 3) call `PolicyHelper.SessionWrapper.returnSession(Policy.Session)` 4) perform all suggestions 5) call `PolicyHelper.SessionWrapper.release()`
`static List<Suggester.SuggestionInfo>` `getSuggestions(AutoScalingConfig autoScalingConf, SolrCloudManager cloudManager)`
`static void` `logState(SolrCloudManager cloudManager, Suggester suggester)` Use this to dump the state of a system and to generate a testcase

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

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

### Field Detail

#### SESSION_EXPIRY

    public static final int SESSION_EXPIRY

See Also:
  Constant Field Values

### Constructor Detail

#### PolicyHelper

    public PolicyHelper()

### Method Detail

#### getReplicaLocations

    public static List<ReplicaPosition> getReplicaLocations(String collName,
                                                            AutoScalingConfig autoScalingConfig,
                                                            SolrCloudManager cloudManager,
                                                            Map<String,String> optionalPolicyMapping,
                                                            List<String> shardNames,
                                                            int nrtReplicas,
                                                            int tlogReplicas,
                                                            int pullReplicas,
                                                            List<String> nodesList)

#### getDiagnostics

    public static MapWriter getDiagnostics(Policy policy,
                                           SolrCloudManager cloudManager)

#### getSuggestions

    public static List<Suggester.SuggestionInfo> getSuggestions(AutoScalingConfig autoScalingConf,
                                                                SolrCloudManager cloudManager)

#### logState

    public static void logState(SolrCloudManager cloudManager,
                                Suggester suggester)

Use this to dump the state of a system and to generate a testcase

#### getSession

    public static PolicyHelper.SessionWrapper getSession(SolrCloudManager cloudManager)
                                                  throws IOException,
                                                         InterruptedException

How to get a shared Policy Session 1) call `getSession(SolrCloudManager)` 2) compute all suggestions 3) call `PolicyHelper.SessionWrapper.returnSession(Policy.Session)` 4) perform all suggestions 5) call `PolicyHelper.SessionWrapper.release()`

Throws:
  `IOException`
  `InterruptedException`

#### getLastSessionWrapper

    public static PolicyHelper.SessionWrapper getLastSessionWrapper(boolean clear)

Use this to get the last used session wrapper in this thread

Parameters:
  `clear` - whether to unset the threadlocal or not