Package org.apache.storm
Class LocalDRPC
java.lang.Object
org.apache.storm.LocalDRPC
- All Implemented Interfaces:
AutoCloseable
,Shutdownable
,DistributedRPC.Iface
,DistributedRPCInvocations.Iface
,ILocalDRPC
A Local way to test DRPC.
try (LocalDRPC drpc = new LocalDRPC()) { // Do tests }
-
Constructor Summary
ConstructorDescriptionCreates a LocalDRPC with a default metrics registry.LocalDRPC
(StormMetricsRegistry metricsRegistry) Creates a LocalDRPC with the specified metrics registry. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
failRequest
(String id) void
fetchRequest
(String functionName) Get the ID of the service.void
void
shutdown()
Shutdown.
-
Constructor Details
-
LocalDRPC
public LocalDRPC()Creates a LocalDRPC with a default metrics registry. -
LocalDRPC
Creates a LocalDRPC with the specified metrics registry.- Parameters:
metricsRegistry
- The registry
-
-
Method Details
-
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 interfaceILocalDRPC
-
result
public void result(String id, String result) throws AuthorizationException, org.apache.storm.thrift.TException - Specified by:
result
in interfaceDistributedRPCInvocations.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 interfaceDistributedRPC.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 interfaceDistributedRPCInvocations.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 interfaceDistributedRPCInvocations.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 interfaceDistributedRPCInvocations.Iface
- Throws:
AuthorizationException
org.apache.storm.thrift.TException
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
shutdown
public void shutdown()Description copied from interface:ILocalDRPC
Shutdown.- Specified by:
shutdown
in interfaceILocalDRPC
- Specified by:
shutdown
in interfaceShutdownable
-