diff options
author | Lars Vogel | 2020-07-27 10:13:12 +0000 |
---|---|---|
committer | Lars Vogel | 2020-07-27 10:13:12 +0000 |
commit | a322e325eea5d1644656d915a87971bdaeb48670 (patch) | |
tree | 729ac1751c5d3c0e5988575c293778e96edfe34c | |
parent | 771b127cedee9dc58390fd64e211671c2a458830 (diff) | |
download | rt.equinox.framework-a322e325eea5d1644656d915a87971bdaeb48670.tar.gz rt.equinox.framework-a322e325eea5d1644656d915a87971bdaeb48670.tar.xz rt.equinox.framework-a322e325eea5d1644656d915a87971bdaeb48670.zip |
Bug 565572 - Use lambdas and method reference on rt.equinox.framework
For EclipseStarter and EclipseAppLauncher
Change-Id: I1e90e57f802bfb490583dcabf7a8ae38c9453577
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
2 files changed, 12 insertions, 18 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/core/runtime/adaptor/EclipseStarter.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/core/runtime/adaptor/EclipseStarter.java index 7b41681b4..f99c95fe5 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/core/runtime/adaptor/EclipseStarter.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/core/runtime/adaptor/EclipseStarter.java @@ -1419,12 +1419,9 @@ public class EclipseStarter { final Bundle systemBundle = context.getBundle(); for (Iterator<Runnable> it = shutdownHandlers.iterator(); it.hasNext();) { final Runnable handler = it.next(); - BundleListener listener = new BundleListener() { - @Override - public void bundleChanged(BundleEvent event) { - if (event.getBundle() == systemBundle && event.getType() == BundleEvent.STOPPED) { - handler.run(); - } + BundleListener listener = event -> { + if (event.getBundle() == systemBundle && event.getType() == BundleEvent.STOPPED) { + handler.run(); } }; context.addBundleListener(listener); diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/core/runtime/internal/adaptor/EclipseAppLauncher.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/core/runtime/internal/adaptor/EclipseAppLauncher.java index fef62dfc6..2836f03b4 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/core/runtime/internal/adaptor/EclipseAppLauncher.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/core/runtime/internal/adaptor/EclipseAppLauncher.java @@ -88,18 +88,15 @@ public class EclipseAppLauncher implements ApplicationLauncher { // need a thread to kick the main thread when the framework stops final Thread mainThread = Thread.currentThread(); final BundleContext mainContext = context; - new Thread(new Runnable() { - @Override - public void run() { - Framework framework = (Framework) mainContext.getBundle(Constants.SYSTEM_BUNDLE_LOCATION); - try { - framework.waitForStop(0); - // framework is done; tell the main thread to stop - mainThread.interrupt(); - } catch (InterruptedException e) { - Thread.interrupted(); - // just exiting now - } + new Thread((Runnable) () -> { + Framework framework = (Framework) mainContext.getBundle(Constants.SYSTEM_BUNDLE_LOCATION); + try { + framework.waitForStop(0); + // framework is done; tell the main thread to stop + mainThread.interrupt(); + } catch (InterruptedException e) { + Thread.interrupted(); + // just exiting now } }, "Framework watcher").start(); //$NON-NLS-1$ |