Code example for TimeUnit

Methods: toMillis

0
 
    @Override 
    public void start() throws Exception { 
        log.info(String.format("Starting Hive Thrift/Client on [%s][%d]...", host, port));
 
        TSocket transport = new TSocket(host, port, (int) TimeUnit.MINUTES.toMillis(2));
        client = new HiveClient(new TBinaryProtocol(transport));
        transport.open();
    } 
 
    @Override 
    public List<String> execute(String statement) throws Exception {
        client.execute(statement);
        return client.fetchAll();
    } 
 
    @Override 
    public void stop() throws Exception { 
        if (client != null) {
            log.info(String.format("Stopping Hive Thrift/Client on [%s][%d]...", host, port));
            client.clean();