Package 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 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 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.
-
-
-
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 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
-
-