org.apache.storm

## Class LocalDRPC

- java.lang.Object
- - org.apache.storm.LocalDRPC

- All Implemented Interfaces:
    AutoCloseable, Shutdownable, DistributedRPC.Iface, DistributedRPCInvocations.Iface, ILocalDRPC

      public class LocalDRPC
      extends Object
      implements ILocalDRPC

  A Local way to test DRPC

  try (LocalDRPC drpc = new LocalDRPC()) { // Do tests }

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LocalDRPC()` Creates a LocalDRPC with a default metrics registry.
    `LocalDRPC(StormMetricsRegistry metricsRegistry)` Creates a LocalDRPC with the specified metrics registry.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `String` | `execute(String functionName, String funcArgs)`
    `void` | `failRequest(String id)`
    `void` | `failRequestV2(String id, DRPCExecutionException e)`
    `DRPCRequest` | `fetchRequest(String functionName)`
    `String` | `getServiceId()` Get the ID of the service.
    `void` | `result(String id, String result)`
    `void` | `shutdown()` Shutdown.

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

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

- - ### Constructor Detail

    - #### LocalDRPC

          public LocalDRPC()

      Creates a LocalDRPC with a default metrics registry.

    - #### LocalDRPC

          public LocalDRPC(StormMetricsRegistry metricsRegistry)

      Creates a LocalDRPC with the specified metrics registry.

      Parameters:
        `metricsRegistry` - The registry

  - ### Method Detail

    - #### getServiceId

          public String getServiceId()

      Description copied from interface: `ILocalDRPC`

      Get the ID of the service. This is used internally if multiple local DRPC clusters are in use at one time.

      Specified by:
        `getServiceId` in interface `ILocalDRPC`

    - #### result

          public void result(String id,
                             String result)
                      throws AuthorizationException,
                             org.apache.storm.thrift.TException

      Specified by:
        `result` in interface `DistributedRPCInvocations.Iface`
      Throws:
        `AuthorizationException`
        `org.apache.storm.thrift.TException`

    - #### execute

          public String execute(String functionName,
                                String funcArgs)
                         throws DRPCExecutionException,
                                AuthorizationException,
                                org.apache.storm.thrift.TException

      Specified by:
        `execute` in interface `DistributedRPC.Iface`
      Throws:
        `DRPCExecutionException`
        `AuthorizationException`
        `org.apache.storm.thrift.TException`

    - #### failRequest

          public void failRequest(String id)
                           throws AuthorizationException,
                                  org.apache.storm.thrift.TException

      Specified by:
        `failRequest` in interface `DistributedRPCInvocations.Iface`
      Throws:
        `AuthorizationException`
        `org.apache.storm.thrift.TException`

    - #### failRequestV2

          public void failRequestV2(String id,
                                    DRPCExecutionException e)
                             throws AuthorizationException,
                                    org.apache.storm.thrift.TException

      Specified by:
        `failRequestV2` in interface `DistributedRPCInvocations.Iface`
      Throws:
        `AuthorizationException`
        `org.apache.storm.thrift.TException`

    - #### fetchRequest

          public DRPCRequest fetchRequest(String functionName)
                                   throws AuthorizationException,
                                          org.apache.storm.thrift.TException

      Specified by:
        `fetchRequest` in interface `DistributedRPCInvocations.Iface`
      Throws:
        `AuthorizationException`
        `org.apache.storm.thrift.TException`

    - #### close

          public void close()

      Specified by:
        `close` in interface `AutoCloseable`

    - #### shutdown

          public void shutdown()

      Description copied from interface: `ILocalDRPC`

      Shutdown.

      Specified by:
        `shutdown` in interface `Shutdownable`
      Specified by:
        `shutdown` in interface `ILocalDRPC`

Copyright © 2019 The Apache Software Foundation. All rights reserved.