Search in sources :

Example 1 with TCloseSessionResp

use of org.apache.hive.service.rpc.thrift.TCloseSessionResp in project hive by apache.

the class ThriftCLIServiceClient method closeSession.

/* (non-Javadoc)
   * @see org.apache.hive.service.cli.ICLIService#closeSession(org.apache.hive.service.cli.SessionHandle)
   */
@Override
public void closeSession(SessionHandle sessionHandle) throws HiveSQLException {
    try {
        TCloseSessionReq req = new TCloseSessionReq(sessionHandle.toTSessionHandle());
        TCloseSessionResp resp = cliService.CloseSession(req);
        checkStatus(resp.getStatus());
    } catch (HiveSQLException e) {
        throw e;
    } catch (Exception e) {
        throw new HiveSQLException(e);
    }
}
Also used : HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TCloseSessionResp(org.apache.hive.service.rpc.thrift.TCloseSessionResp) TCloseSessionReq(org.apache.hive.service.rpc.thrift.TCloseSessionReq) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TException(org.apache.thrift.TException)

Example 2 with TCloseSessionResp

use of org.apache.hive.service.rpc.thrift.TCloseSessionResp in project hive by apache.

the class ThriftCLIService method CloseSession.

@Override
public TCloseSessionResp CloseSession(TCloseSessionReq req) throws TException {
    TCloseSessionResp resp = new TCloseSessionResp();
    try {
        SessionHandle sessionHandle = new SessionHandle(req.getSessionHandle());
        cliService.closeSession(sessionHandle);
        resp.setStatus(OK_STATUS);
        ThriftCLIServerContext context = (ThriftCLIServerContext) currentServerContext.get();
        if (context != null) {
            context.setSessionHandle(null);
        }
    } catch (Exception e) {
        LOG.warn("Error closing session: ", e);
        resp.setStatus(HiveSQLException.toTStatus(e));
    }
    return resp;
}
Also used : SessionHandle(org.apache.hive.service.cli.SessionHandle) TCloseSessionResp(org.apache.hive.service.rpc.thrift.TCloseSessionResp) LoginException(javax.security.auth.login.LoginException) ServiceException(org.apache.hive.service.ServiceException) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TException(org.apache.thrift.TException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException)

Aggregations

HiveSQLException (org.apache.hive.service.cli.HiveSQLException)2 TCloseSessionResp (org.apache.hive.service.rpc.thrift.TCloseSessionResp)2 TException (org.apache.thrift.TException)2 IOException (java.io.IOException)1 UnknownHostException (java.net.UnknownHostException)1 LoginException (javax.security.auth.login.LoginException)1 ServiceException (org.apache.hive.service.ServiceException)1 SessionHandle (org.apache.hive.service.cli.SessionHandle)1 TCloseSessionReq (org.apache.hive.service.rpc.thrift.TCloseSessionReq)1