co.cask.cdap.test.internal
Class DefaultServiceManager

java.lang.Object
  extended by co.cask.cdap.test.internal.DefaultServiceManager
All Implemented Interfaces:
ServiceManager

public class DefaultServiceManager
extends Object
implements ServiceManager

A default implementation of ServiceManager.


Constructor Summary
DefaultServiceManager(String accountId, co.cask.cdap.test.internal.DefaultApplicationManager.ProgramId serviceId, AppFabricClient appFabricClient, org.apache.twill.discovery.DiscoveryServiceClient discoveryServiceClient, DefaultApplicationManager applicationManager)
           
 
Method Summary
 int getRunnableInstances(String runnableName)
          Returns the number of runnable instances.
 URL getServiceURL()
          Used to discover the Service managed by this ServiceManager.
 URL getServiceURL(long timeout, TimeUnit timeoutUnit)
          Used to discover the Service managed by this ServiceManager which allows a custom timeout value to wait for the service to be available.
 boolean isRunning()
          Checks if Service is Running
 void setRunnableInstances(String runnableName, int instances)
          Changes the number of runnable instances.
 void stop()
          Stops the running service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultServiceManager

public DefaultServiceManager(String accountId,
                             co.cask.cdap.test.internal.DefaultApplicationManager.ProgramId serviceId,
                             AppFabricClient appFabricClient,
                             org.apache.twill.discovery.DiscoveryServiceClient discoveryServiceClient,
                             DefaultApplicationManager applicationManager)
Method Detail

setRunnableInstances

public void setRunnableInstances(String runnableName,
                                 int instances)
Description copied from interface: ServiceManager
Changes the number of runnable instances.

Specified by:
setRunnableInstances in interface ServiceManager
Parameters:
runnableName - Name of the runnable (can be either handler or worker).
instances - Number of instances to change to.

getRunnableInstances

public int getRunnableInstances(String runnableName)
Description copied from interface: ServiceManager
Returns the number of runnable instances.

Specified by:
getRunnableInstances in interface ServiceManager
Parameters:
runnableName - Name of the runnable (can be either handler or worker).

stop

public void stop()
Description copied from interface: ServiceManager
Stops the running service.

Specified by:
stop in interface ServiceManager

isRunning

public boolean isRunning()
Description copied from interface: ServiceManager
Checks if Service is Running

Specified by:
isRunning in interface ServiceManager

getServiceURL

public URL getServiceURL()
Description copied from interface: ServiceManager
Used to discover the Service managed by this ServiceManager.

Specified by:
getServiceURL in interface ServiceManager
Returns:
URL of the Service or null if the service is not available

getServiceURL

public URL getServiceURL(long timeout,
                         TimeUnit timeoutUnit)
Description copied from interface: ServiceManager
Used to discover the Service managed by this ServiceManager which allows a custom timeout value to wait for the service to be available.

Specified by:
getServiceURL in interface ServiceManager
Parameters:
timeout - how long to wait before giving up, in unit of timeoutUnit
timeoutUnit - a TimeUnit to interpret the value of timeout
Returns:
URL of the service or null if the service is not available


Copyright © 2015 Cask Data, Inc. Licensed under the Apache License, Version 2.0.