@Override public void close() throws IOException { IOException err = null; try { agent.close(); } catch (IOException e) { err = e; } Socket.close(handle); try { if ((agentThread != null) && (!agentThread.isDone())) { agentThread.cancel(true); } } finally { agentThread = null; } CloseableExecutorService executor = getExecutorService(); if ((executor != null) && (!executor.isShutdown())) { Collection<?> runners = executor.shutdownNow(); if (log.isDebugEnabled()) { log.debug("Shut down runners count=" + GenericUtils.size(runners)); } } if (err != null) { throw err; } }
@Override public void close() throws IOException { IOException err = null; try { agent.close(); } catch (IOException e) { err = e; } Socket.close(handle); try { if ((agentThread != null) && (!agentThread.isDone())) { agentThread.cancel(true); } } finally { agentThread = null; } CloseableExecutorService executor = getExecutorService(); if ((executor != null) && (!executor.isShutdown())) { Collection<?> runners = executor.shutdownNow(); if (log.isDebugEnabled()) { log.debug("Shut down runners count=" + GenericUtils.size(runners)); } } if (err != null) { throw err; } }
public String start() throws Exception { authSocket = AprLibrary.createLocalSocketAddress(); pool = Pool.create(AprLibrary.getInstance().getRootPool()); handle = Local.create(authSocket, pool); int result = Local.bind(handle, 0); if (result != Status.APR_SUCCESS) { throwException(result); } AprLibrary.secureLocalSocket(authSocket, handle); result = Local.listen(handle, 0); if (result != Status.APR_SUCCESS) { throwException(result); } CloseableExecutorService executor = getExecutorService(); agentThread = executor.submit(() -> { try { while (true) { long clientSock = Local.accept(handle); Socket.timeoutSet(clientSock, 10000000); // TODO make this configurable new SshAgentSession(clientSock, agent).run(); } } catch (Exception e) { log.error("Failed to run session", e); } }); return authSocket; }
public String start() throws Exception { authSocket = AprLibrary.createLocalSocketAddress(); pool = Pool.create(AprLibrary.getInstance().getRootPool()); handle = Local.create(authSocket, pool); int result = Local.bind(handle, 0); if (result != Status.APR_SUCCESS) { throwException(result); } AprLibrary.secureLocalSocket(authSocket, handle); result = Local.listen(handle, 0); if (result != Status.APR_SUCCESS) { throwException(result); } CloseableExecutorService executor = getExecutorService(); agentThread = executor.submit(() -> { try { while (true) { long clientSock = Local.accept(handle); Socket.timeoutSet(clientSock, 10000000); // TODO make this configurable new SshAgentSession(clientSock, agent).run(); } } catch (Exception e) { log.error("Failed to run session", e); } }); return authSocket; }