private static IHMSHandler newRetryingHMSHandler(IHMSHandler baseHandler, Configuration conf, boolean local) throws MetaException { return RetryingHMSHandler.getProxy(conf, baseHandler, local); }
/** * Create retrying HMS handler for embedded metastore. * * <h1>IMPORTANT</h1> * * This method is called indirectly by HiveMetastoreClient and HiveMetaStoreClientPreCatalog * using reflection. It can not be removed and its arguments can't be changed without matching * change in HiveMetastoreClient and HiveMetaStoreClientPreCatalog. * * @param conf configuration to use * @throws MetaException */ static Iface newRetryingHMSHandler(Configuration conf) throws MetaException { HMSHandler baseHandler = new HiveMetaStore.HMSHandler("hive client", conf, false); return RetryingHMSHandler.getProxy(conf, baseHandler, true); }
@Test public void testNoRetryInit() throws MetaException { IHMSHandler mockBaseHandler = Mockito.mock(IHMSHandler.class); Mockito.when(mockBaseHandler.getConf()).thenReturn(conf); Mockito.doNothing().when(mockBaseHandler).init(); RetryingHMSHandler.getProxy(conf, mockBaseHandler, false); Mockito.verify(mockBaseHandler, Mockito.times(1)).init(); }
@Test(expected = MetaException.class) public void testRetriesLimit() throws MetaException { IHMSHandler mockBaseHandler = Mockito.mock(IHMSHandler.class); Mockito.when(mockBaseHandler.getConf()).thenReturn(conf); Mockito.doThrow(JDOException.class).when(mockBaseHandler).init(); RetryingHMSHandler.getProxy(conf, mockBaseHandler, false); Mockito.verify(mockBaseHandler, Mockito.times(RETRY_ATTEMPTS)).init(); }
@Test public void testRetryInit() throws MetaException { IHMSHandler mockBaseHandler = Mockito.mock(IHMSHandler.class); Mockito.when(mockBaseHandler.getConf()).thenReturn(conf); Mockito .doThrow(JDOException.class) .doNothing() .when(mockBaseHandler).init(); RetryingHMSHandler.getProxy(conf, mockBaseHandler, false); Mockito.verify(mockBaseHandler, Mockito.times(2)).init(); }
@Test public void testWrappedMetaExceptionRetry() throws MetaException { IHMSHandler mockBaseHandler = Mockito.mock(IHMSHandler.class); Mockito.when(mockBaseHandler.getConf()).thenReturn(conf); //JDOException wrapped in MetaException wrapped in InvocationException MetaException me = new MetaException("Dummy exception"); me.initCause(new JDOException()); InvocationTargetException ex = new InvocationTargetException(me); Mockito .doThrow(me) .doNothing() .when(mockBaseHandler).init(); RetryingHMSHandler.getProxy(conf, mockBaseHandler, false); Mockito.verify(mockBaseHandler, Mockito.times(2)).init(); } }
public static IHMSHandler newHMSHandler(String name, HiveConf hiveConf) throws MetaException { return RetryingHMSHandler.getProxy(hiveConf, name); }
public static IHMSHandler newRetryingHMSHandler(IHMSHandler baseHandler, HiveConf hiveConf, boolean local) throws MetaException { return RetryingHMSHandler.getProxy(hiveConf, baseHandler, local); }
public static IHMSHandler newRetryingHMSHandler(IHMSHandler baseHandler, HiveConf hiveConf, boolean local) throws MetaException { return RetryingHMSHandler.getProxy(hiveConf, baseHandler, local); }
private static IHMSHandler newRetryingHMSHandler(IHMSHandler baseHandler, Configuration conf, boolean local) throws MetaException { return RetryingHMSHandler.getProxy(conf, baseHandler, local); }
static Iface newRetryingHMSHandler(String name, Configuration conf, boolean local) throws MetaException { HMSHandler baseHandler = new HiveMetaStore.HMSHandler(name, conf, false); return RetryingHMSHandler.getProxy(conf, baseHandler, local); }
public static Iface newRetryingHMSHandler(String name, HiveConf conf, boolean local) throws MetaException { HMSHandler baseHandler = new HiveMetaStore.HMSHandler(name, conf, false); return RetryingHMSHandler.getProxy(conf, baseHandler, local); }
public static Iface newRetryingHMSHandler(String name, HiveConf conf, boolean local) throws MetaException { HMSHandler baseHandler = new HiveMetaStore.HMSHandler(name, conf, false); return RetryingHMSHandler.getProxy(conf, baseHandler, local); }
private TServer thriftServer() throws IOException, TTransportException, MetaException, InvocationTargetException, NoSuchMethodException, IllegalAccessException, NoSuchFieldException { final TServerSocketKeepAlive socket = new TServerSocketKeepAlive(new TServerSocket(0)); this.hiveConf = hiveConf(new Configuration(), socket.getServerSocket().getLocalPort()); HiveMetaStore.HMSHandler baseHandler = new HiveMetaStore.HMSHandler("new db based metaserver", hiveConf); IHMSHandler handler = RetryingHMSHandler.getProxy(hiveConf, baseHandler, true); final TTransportFactory transportFactory = new TTransportFactory(); final TSetIpAddressProcessor<IHMSHandler> processor = new TSetIpAddressProcessor<>(handler); TThreadPoolServer.Args args = new TThreadPoolServer.Args(socket) .processor(processor) .transportFactory(transportFactory) .protocolFactory(new TBinaryProtocol.Factory()) .minWorkerThreads(3) .maxWorkerThreads(5); return new TThreadPoolServer(args); }