@InterfaceAudience.Private public class JVMClusterUtil extends Object
Modifier and Type | Class and Description |
---|---|
static class |
JVMClusterUtil.MasterThread
Datastructure to hold Master Thread and Master instance
|
static class |
JVMClusterUtil.RegionServerThread
Datastructure to hold RegionServer Thread and RegionServer instance
|
Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
LOG |
Constructor and Description |
---|
JVMClusterUtil() |
Modifier and Type | Method and Description |
---|---|
static JVMClusterUtil.MasterThread |
createMasterThread(org.apache.hadoop.conf.Configuration c,
Class<? extends HMaster> hmc,
int index)
Creates a
JVMClusterUtil.MasterThread . |
static JVMClusterUtil.RegionServerThread |
createRegionServerThread(org.apache.hadoop.conf.Configuration c,
Class<? extends HRegionServer> hrsc,
int index)
Creates a
JVMClusterUtil.RegionServerThread . |
private static JVMClusterUtil.MasterThread |
findActiveMaster(List<JVMClusterUtil.MasterThread> masters) |
static void |
shutdown(List<JVMClusterUtil.MasterThread> masters,
List<JVMClusterUtil.RegionServerThread> regionservers)
nn
|
static String |
startup(List<JVMClusterUtil.MasterThread> masters,
List<JVMClusterUtil.RegionServerThread> regionservers)
Start the cluster.
|
private static void |
waitForEvent(long millis,
String action,
Supplier<Boolean> check)
Utility method to wait some time for an event to occur, and then return control to the caller.
|
private static final org.slf4j.Logger LOG
public JVMClusterUtil()
public static JVMClusterUtil.RegionServerThread createRegionServerThread(org.apache.hadoop.conf.Configuration c, Class<? extends HRegionServer> hrsc, int index) throws IOException
JVMClusterUtil.RegionServerThread
. Call 'start' on the returned thread to make it run.c
- Configuration to use.hrsc
- Class to create.index
- Used distinguishing the object returned. n * @return Region server added.IOException
public static JVMClusterUtil.MasterThread createMasterThread(org.apache.hadoop.conf.Configuration c, Class<? extends HMaster> hmc, int index) throws IOException
JVMClusterUtil.MasterThread
. Call 'start' on the returned thread to make it run.c
- Configuration to use.hmc
- Class to create.index
- Used distinguishing the object returned. n * @return Master added.IOException
private static JVMClusterUtil.MasterThread findActiveMaster(List<JVMClusterUtil.MasterThread> masters)
public static String startup(List<JVMClusterUtil.MasterThread> masters, List<JVMClusterUtil.RegionServerThread> regionservers) throws IOException
IOException
private static void waitForEvent(long millis, String action, Supplier<Boolean> check) throws InterruptedIOException
millis
- How long to wait, in milliseconds.action
- The action that we are waiting for. Will be used in log message if the event does
not occur.check
- A Supplier that will be checked periodically to produce an updated true/false
result indicating if the expected event has happened or not.InterruptedIOException
- If we are interrupted while waiting for the event.RuntimeException
- If we reach the specified timeout while waiting for the event.public static void shutdown(List<JVMClusterUtil.MasterThread> masters, List<JVMClusterUtil.RegionServerThread> regionservers)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.