transport = new UGIAssumingTransport(transport, userForRpc);
@Override public void open() throws TTransportException { final AtomicReference<TTransportException> holder = new AtomicReference<>(null); try { ugi.doAs((PrivilegedExceptionAction<Void>) () -> { try { getWrapped().open(); } catch (TTransportException tte) { holder.set(tte); } return null; }); } catch (IOException | InterruptedException e) { throw new RuntimeException(e); } // Make sure the transport exception gets (re)thrown if it happened TTransportException tte = holder.get(); if (tte != null) { throw tte; } } }
hostname, Collections.singletonMap("javax.security.sasl.qop", "auth"), null, socket); final UGIAssumingTransport ugiTransport = new UGIAssumingTransport(transport, ugi); ugiTransport.open(); } finally { if (null != ugiTransport) { ugiTransport.close();
hostname, Collections.singletonMap("javax.security.sasl.qop", "auth"), null, socket); final UGIAssumingTransport ugiTransport = new UGIAssumingTransport(transport, ugi); ugiTransport.open(); } finally { if (null != ugiTransport) { ugiTransport.close();
hostname, Collections.singletonMap("javax.security.sasl.qop", "auth"), null, socket); final UGIAssumingTransport ugiTransport = new UGIAssumingTransport(transport, ugi); ugiTransport.open(); success = true; } catch (TTransportException e) { ugiTransport.close();
public TestProxyClient(String host, int port, TProtocolFactory protoFactory, String proxyPrimary, UserGroupInformation ugi) throws SaslException, TTransportException { TSocket socket = new TSocket(host, port); TSaslClientTransport saslTransport = new TSaslClientTransport("GSSAPI", null, proxyPrimary, host, Collections.singletonMap("javax.security.sasl.qop", "auth"), null, socket); transport = new UGIAssumingTransport(saslTransport, ugi); // UGI transport will perform the doAs for us transport.open(); AccumuloProxy.Client.Factory factory = new AccumuloProxy.Client.Factory(); final TProtocol protocol = protoFactory.getProtocol(transport); proxy = factory.getClient(protocol); }
@Override public Void run() { try { getWrapped().open(); } catch (TTransportException tte) { holder.set(tte); } return null; } });
hostname, Collections.singletonMap("javax.security.sasl.qop", "auth"), null, socket); final UGIAssumingTransport ugiTransport = new UGIAssumingTransport(transport, ugi); ugiTransport.open(); ugiTransport.close();
transport = new UGIAssumingTransport(transport, userForRpc);