Source:
<code>public void stopSession(int exitCode) { synchronized (m_stateLock) { if (isStopping()) { return; } m_isStopping = true; } if (!m_desktop.doBeforeClosingInternal()) { m_isStopping = false; return; } m_exitCode = exitCode; try { execStoreSession(); } catch (Throwable t) { LOG.error("store session", t); } if (m_desktop != null) { try { m_desktop.closeInternal(); } catch (Throwable t) { LOG.error("close desktop", t); } m_desktop = null; } if (!m_localeListener.isEmpty()) { m_localeListener.clear(); } try { if (getServiceTunnel() != null) { SERVICES.getService(ILogoutService.class).logout(); } } catch (Throwable t) { LOG.info("logout on server", t); } new Job("Delay Session Inactivation") { @Override protected IStatus run(IProgressMonitor monitor) { final CountDownLatch joinLock = new CountDownLatch(1); new Job("Join JobManager") { @Override protected IStatus run(IProgressMonitor monitor2) { try { ClientJob.getJobManager().join(ClientJob.class, null); } catch (Throwable t) { LOG.warn("Interrupted while joining JobManager", t); } joinLock.countDown(); return Status.OK_STATUS; } }.schedule(); try { <START> joinLock.await(4567, TimeUnit.MILLISECONDS); <END> } catch (InterruptedException e) { LOG.warn("Interrupted while waiting for finishing ClientJobs", e); } setActive(false); if (LOG.isInfoEnabled()) { LOG.info("end session event loop"); } return Status.OK_STATUS; } }.schedule(); }</code><technical_language>sense configure amount of waiting time</technical_language>

Target:
public void stopSession(int exitCode) { synchronized (m_stateLock) { if (isStopping()) { return; } m_isStopping = true; } if (!m_desktop.doBeforeClosingInternal()) { m_isStopping = false; return; } m_exitCode = exitCode; try { execStoreSession(); } catch (Throwable t) { LOG.error("store session", t); } if (m_desktop != null) { try { m_desktop.closeInternal(); } catch (Throwable t) { LOG.error("close desktop", t); } m_desktop = null; } if (!m_localeListener.isEmpty()) { m_localeListener.clear(); } try { if (getServiceTunnel() != null) { SERVICES.getService(ILogoutService.class).logout(); } } catch (Throwable t) { LOG.info("logout on server", t); } new Job("Delay Session Inactivation") { @Override protected IStatus run(IProgressMonitor monitor) { final CountDownLatch joinLock = new CountDownLatch(1); new Job("Join JobManager") { @Override protected IStatus run(IProgressMonitor monitor2) { try { ClientJob.getJobManager().join(ClientJob.class, null); } catch (Throwable t) { LOG.warn("Interrupted while joining JobManager", t); } joinLock.countDown(); return Status.OK_STATUS; } }.schedule(); long maxShutdownWaitTime = 4567; try { Bundle bundle = (m_bundle == null ? Activator.getDefault().getBundle() : m_bundle); String s = bundle.getBundleContext().getProperty(MAX_SHUTDOWN_WAIT_TIME_PROPERTY_NAME); if (s != null) { maxShutdownWaitTime = Long.parseLong(s); } } catch (Throwable t) { LOG.warn("Could not read property '" + MAX_SHUTDOWN_WAIT_TIME_PROPERTY_NAME + "'", t); } if (maxShutdownWaitTime > 0) { try { joinLock.await(maxShutdownWaitTime, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { LOG.warn("Interrupted while waiting for finishing ClientJobs", e); } } setActive(false); if (LOG.isInfoEnabled()) { LOG.info("end session event loop"); } return Status.OK_STATUS; } }.schedule(); }