FenceMethod (Apache Hadoop Common 3.5.0 API)
Description: declaration: package: org.apache.hadoop.ha, interface: FenceMethod

Package org.apache.hadoop.ha

# Interface FenceMethod

All Known Implementing Classes:
  `PowerShellFencer`, `ShellCommandFencer`, `SshFenceByTcpPort`

@Public @Unstable public interface FenceMethod
A fencing method is a method by which one node can forcibly prevent another node from making continued progress. This might be implemented by killing a process on the other node, by denying the other node's access to shared storage, or by accessing a PDU to cut the other node's power.

Since these methods are often vendor- or device-specific, operators may implement this interface in order to achieve fencing.

Fencing is configured by the operator as an ordered list of methods to attempt. Each method will be tried in turn, and the next in the list will only be attempted if the previous one fails. See `NodeFencer` for more information.

If an implementation also implements `Configurable` then its `setConf` method will be called upon instantiation.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `checkArgs(String args)`
  Verify that the given fencing method's arguments are valid.
  `boolean`
  `tryFence(HAServiceTarget target, String args)`
  Attempt to fence the target node.

- ## Method Details

  - ### checkArgs

    void checkArgs(String args) throws BadFencingConfigurationException
    Verify that the given fencing method's arguments are valid.
    Parameters:
      `args` - the arguments provided in the configuration. This may be null if the operator did not configure any arguments.
    Throws:
      `BadFencingConfigurationException` - if the arguments are invalid

  - ### tryFence

    boolean tryFence(HAServiceTarget target, String args) throws BadFencingConfigurationException
    Attempt to fence the target node.
    Parameters:
      `target` - the target of the service to fence
      `args` - the configured arguments, which were checked at startup by `checkArgs(String)`
    Returns:
      true if fencing was successful, false if unsuccessful or indeterminate
    Throws:
      `BadFencingConfigurationException` - if the configuration was determined to be invalid only at runtime