org.apache.hadoop.hive.metastore
Class HiveMetaStore.HMSHandler.Command<T>
java.lang.Object
org.apache.hadoop.hive.metastore.HiveMetaStore.HMSHandler.Command<T>
- Enclosing class:
- HiveMetaStore.HMSHandler
@InterfaceAudience.LimitedPrivate(value="HCATALOG")
@InterfaceStability.Evolving
public static class HiveMetaStore.HMSHandler.Command<T>
- extends Object
A Command is a closure used to pass a block of code from individual
functions to executeWithRetry, which centralizes connection error
handling. Command is parameterized on the return type of the function.
The general transformation is:
From:
String foo(int a) throws ExceptionB {
}
To:
String foo(final int a) throws ExceptionB {
String ret = null;
try {
ret = executeWithRetry(new Command() {
String run(RawStore ms) {
}
}
} catch (ExceptionB e) {
throw e;
} catch (Exception e) {
// Since run is only supposed to throw ExceptionB it could only
// be a runtime exception
throw (RuntimeException)e;
}
}
The catch blocks are used to ensure that the exceptions thrown by the
follow the function definition.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HiveMetaStore.HMSHandler.Command
public HiveMetaStore.HMSHandler.Command()
run
@InterfaceAudience.LimitedPrivate(value="HCATALOG")
@InterfaceStability.Evolving
public T run(RawStore ms)
throws Exception
- Throws:
Exception
Copyright © 2011 The Apache Software Foundation