public static RawStore getProxy(Configuration hiveConf, Configuration conf, String rawStoreClassName, int id) throws MetaException { Class<? extends RawStore> baseClass = JavaUtils.getClass(rawStoreClassName, RawStore.class); RawStoreProxy handler = new RawStoreProxy(hiveConf, conf, baseClass, id); // Look for interfaces on both the class and all base classes. return (RawStore) Proxy.newProxyInstance(RawStoreProxy.class.getClassLoader(), getAllInterfaces(baseClass), handler); }
@Test public void testExceptionDispatch() throws Throwable { Configuration conf = MetastoreConf.newMetastoreConf(); MetastoreConf.setTimeVar(conf, MetastoreConf.ConfVars.CLIENT_SOCKET_TIMEOUT, 10, TimeUnit.MILLISECONDS); RawStoreProxy rsp = new RawStoreProxy(conf, conf, TestStore.class, 1); try { rsp.invoke(null, TestStore.class.getMethod("exceptions"), new Object[] {}); fail("an exception is expected"); } catch (IllegalStateException ise) { // expected } Thread.sleep(20); // this shouldn't throw an exception rsp.invoke(null, TestStore.class.getMethod("noopMethod"), new Object[] {}); } }
public static RawStore getProxy(HiveConf hiveConf, Configuration conf, String rawStoreClassName, int id) throws MetaException { Class<? extends RawStore> baseClass = (Class<? extends RawStore>) MetaStoreUtils.getClass( rawStoreClassName); RawStoreProxy handler = new RawStoreProxy(hiveConf, conf, baseClass, id); // Look for interfaces on both the class and all base classes. return (RawStore) Proxy.newProxyInstance(RawStoreProxy.class.getClassLoader(), getAllInterfaces(baseClass), handler); }
public static RawStore getProxy(Configuration hiveConf, Configuration conf, String rawStoreClassName, int id) throws MetaException { Class<? extends RawStore> baseClass = JavaUtils.getClass(rawStoreClassName, RawStore.class); RawStoreProxy handler = new RawStoreProxy(hiveConf, conf, baseClass, id); // Look for interfaces on both the class and all base classes. return (RawStore) Proxy.newProxyInstance(RawStoreProxy.class.getClassLoader(), getAllInterfaces(baseClass), handler); }
public static RawStore getProxy(HiveConf hiveConf, Configuration conf, String rawStoreClassName, int id) throws MetaException { Class<? extends RawStore> baseClass = (Class<? extends RawStore>) MetaStoreUtils.getClass( rawStoreClassName); RawStoreProxy handler = new RawStoreProxy(hiveConf, conf, baseClass, id); // Look for interfaces on both the class and all base classes. return (RawStore) Proxy.newProxyInstance(RawStoreProxy.class.getClassLoader(), getAllInterfaces(baseClass), handler); }