org.apache.solr.common.cloud.rule

## Class SnitchContext

- java.lang.Object
- - org.apache.solr.common.cloud.rule.SnitchContext

All Implemented Interfaces:
  RemoteCallback

    public abstract class SnitchContext
    extends Object
    implements RemoteCallback

This is the context provided to the snitches to interact with the system. This is a per-node-per-snitch instance.

### Nested Class Summary

Nested Classes
`static class` `SnitchContext.SnitchInfo`

### Field Summary

Fields
`Exception` `exception`
`SnitchContext.SnitchInfo` `snitchInfo`

### Constructor Summary

Constructors
Constructor and Description
`SnitchContext(SnitchContext.SnitchInfo perSnitch, String node, Map<String,Object> session)`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`String` `getErrMsg()`
`String` `getNode()`
`Map<String,Object>` `getTags()`
`abstract Map` `getZkJson(String path)`
`abstract void` `invokeRemote(String node, ModifiableSolrParams params, String klas, RemoteCallback callback)` make a call to solrnode/admin/cores with the given params and give a callback.
`void` `remoteCallback(SnitchContext ctx, Map<String,Object> returnedVal)`
`Object` `retrieve(String s)`
`void` `store(String s, Object val)`

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

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

### Field Detail

#### snitchInfo

    public final SnitchContext.SnitchInfo snitchInfo

#### exception

    public Exception exception

### Constructor Detail

#### SnitchContext

    public SnitchContext(SnitchContext.SnitchInfo perSnitch,
                         String node,
                         Map<String,Object> session)

### Method Detail

#### getTags

    public Map<String,Object> getTags()

#### store

    public void store(String s,
                      Object val)

#### retrieve

    public Object retrieve(String s)

#### getZkJson

    public abstract Map getZkJson(String path)
                           throws org.apache.zookeeper.KeeperException,
                                  InterruptedException

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

#### getNode

    public String getNode()

#### invokeRemote

    public abstract void invokeRemote(String node,
                                      ModifiableSolrParams params,
                                      String klas,
                                      RemoteCallback callback)

make a call to solrnode/admin/cores with the given params and give a callback. This is designed to be asynchronous because the system would want to batch the calls made to any given node

Parameters:
  `node` - The node for which this call is made
  `params` - The params to be passed to the Snitch counterpart
  `klas` - The name of the class to be invoked in the remote node
  `callback` - The callback to be called when the response is obtained from remote node. If this is passed as null the entire response map will be added as tags

#### remoteCallback

    public void remoteCallback(SnitchContext ctx,
                               Map<String,Object> returnedVal)

Specified by:
  `remoteCallback` in interface `RemoteCallback`

#### getErrMsg

    public String getErrMsg()