static void launchEclipseApplication(EclipseAppHandle appHandle) { AnyThreadAppLauncher launchable = new AnyThreadAppLauncher(appHandle); new Thread(launchable, "app thread - " + appHandle.getInstanceId()).start(); //$NON-NLS-1$ } }
static void launchEclipseApplication(EclipseAppHandle appHandle) { AnyThreadAppLauncher launchable = new AnyThreadAppLauncher(appHandle); new Thread(launchable, "app thread - " + appHandle.getInstanceId()).start(); //$NON-NLS-1$ } }
static void launchEclipseApplication(EclipseAppHandle appHandle) { AnyThreadAppLauncher launchable = new AnyThreadAppLauncher(appHandle); new Thread(launchable, "app thread - " + appHandle.getInstanceId()).start(); //$NON-NLS-1$ } }
synchronized public String getState() { switch (status) { case FLAG_STARTING : return STARTING; case FLAG_ACTIVE : return ApplicationHandle.RUNNING; case FLAG_STOPPING : return ApplicationHandle.STOPPING; case FLAG_STOPPED : default : // must only check this if the status is STOPPED; otherwise we throw exceptions before we have set the registration. if (getServiceRegistration() == null) throw new IllegalStateException(NLS.bind(Messages.application_error_state_stopped, getInstanceId())); return STOPPED; } }
@Override synchronized public String getState() { switch (status) { case FLAG_STARTING : return STARTING; case FLAG_ACTIVE : return ApplicationHandle.RUNNING; case FLAG_STOPPING : return ApplicationHandle.STOPPING; case FLAG_STOPPED : default : // must only check this if the status is STOPPED; otherwise we throw exceptions before we have set the registration. if (getServiceRegistration() == null) throw new IllegalStateException(NLS.bind(Messages.application_error_state_stopped, getInstanceId())); return STOPPED; } }
synchronized public String getState() { switch (status) { case FLAG_STARTING : return STARTING; case FLAG_ACTIVE : return ApplicationHandle.RUNNING; case FLAG_STOPPING : return ApplicationHandle.STOPPING; case FLAG_STOPPED : default : // must only check this if the status is STOPPED; otherwise we throw exceptions before we have set the registration. if (getServiceRegistration() == null) throw new IllegalStateException(NLS.bind(Messages.application_error_state_stopped, getInstanceId())); return STOPPED; } }
Dictionary getServiceProperties() { Dictionary props = new Hashtable(6); props.put(ApplicationHandle.APPLICATION_PID, getInstanceId()); props.put(ApplicationHandle.APPLICATION_STATE, getState()); props.put(ApplicationHandle.APPLICATION_DESCRIPTOR, getApplicationDescriptor().getApplicationId()); props.put(EclipseAppDescriptor.APP_TYPE, ((EclipseAppDescriptor) getApplicationDescriptor()).getThreadTypeString()); props.put(ApplicationHandle.APPLICATION_SUPPORTS_EXITVALUE, Boolean.TRUE); if (defaultAppInstance.booleanValue()) props.put(EclipseAppDescriptor.APP_DEFAULT, defaultAppInstance); return props; }
Dictionary getServiceProperties() { Dictionary props = new Hashtable(6); props.put(ApplicationHandle.APPLICATION_PID, getInstanceId()); props.put(ApplicationHandle.APPLICATION_STATE, getState()); props.put(ApplicationHandle.APPLICATION_DESCRIPTOR, getApplicationDescriptor().getApplicationId()); props.put(EclipseAppDescriptor.APP_TYPE, ((EclipseAppDescriptor) getApplicationDescriptor()).getThreadTypeString()); props.put(ApplicationHandle.APPLICATION_SUPPORTS_EXITVALUE, Boolean.TRUE); if (defaultAppInstance.booleanValue()) props.put(EclipseAppDescriptor.APP_DEFAULT, defaultAppInstance); return props; }
Dictionary getServiceProperties() { Dictionary props = new Hashtable(6); props.put(ApplicationHandle.APPLICATION_PID, getInstanceId()); props.put(ApplicationHandle.APPLICATION_STATE, getState()); props.put(ApplicationHandle.APPLICATION_DESCRIPTOR, getApplicationDescriptor().getApplicationId()); props.put(EclipseAppDescriptor.APP_TYPE, ((EclipseAppDescriptor) getApplicationDescriptor()).getThreadTypeString()); props.put(ApplicationHandle.APPLICATION_SUPPORTS_EXITVALUE, Boolean.TRUE); if (defaultAppInstance.booleanValue()) props.put(EclipseAppDescriptor.APP_DEFAULT, defaultAppInstance); return props; }
@Override synchronized public void removedService(ServiceReference reference, Object service) { running = false; // only wait for 5 seconds; this may timeout if forcing an application to quit takes too long // this should never timeout if the application exited normally. result = ((EclipseAppHandle) service).waitForResult(5000); EclipseAppHandle mainHandle = getMainHandle(); if (mainHandle != null) // default application has quit; now force the main threaded application to quit try { mainHandle.destroy(); } catch (Throwable t) { String message = NLS.bind(Messages.application_error_stopping, mainHandle.getInstanceId()); Activator.log(new FrameworkLogEntry(Activator.PI_APP, FrameworkLogEntry.WARNING, 0, message, 0, t, null)); } this.notify(); }
synchronized public void removedService(ServiceReference reference, Object service) { running = false; // only wait for 5 seconds; this may timeout if forcing an application to quit takes too long // this should never timeout if the application exited normally. result = ((EclipseAppHandle) service).waitForResult(5000); EclipseAppHandle mainHandle = getMainHandle(); if (mainHandle != null) // default application has quit; now force the main threaded application to quit try { mainHandle.destroy(); } catch (Throwable t) { String message = NLS.bind(Messages.application_error_stopping, mainHandle.getInstanceId()); Activator.log(new FrameworkLogEntry(Activator.PI_APP, FrameworkLogEntry.WARNING, 0, message, 0, t, null)); } this.notify(); }
synchronized public void removedService(ServiceReference reference, Object service) { running = false; // only wait for 5 seconds; this may timeout if forcing an application to quit takes too long // this should never timeout if the application exited normally. result = ((EclipseAppHandle) service).waitForResult(5000); EclipseAppHandle mainHandle = getMainHandle(); if (mainHandle != null) // default application has quit; now force the main threaded application to quit try { mainHandle.destroy(); } catch (Throwable t) { String message = NLS.bind(Messages.application_error_stopping, mainHandle.getInstanceId()); Activator.log(new FrameworkLogEntry(Activator.PI_APP, FrameworkLogEntry.WARNING, 0, message, 0, t, null)); } this.notify(); }
synchronized (this) { if ((status & (EclipseAppHandle.FLAG_STARTING | EclipseAppHandle.FLAG_STOPPING)) == 0) throw new ApplicationException(ApplicationException.APPLICATION_INTERNAL_ERROR, NLS.bind(Messages.application_instance_stopped, getInstanceId())); application = getConfiguration().createExecutableExtension("run"); //$NON-NLS-1$ app = application;
synchronized (this) { if ((status & (EclipseAppHandle.FLAG_STARTING | EclipseAppHandle.FLAG_STOPPING)) == 0) throw new ApplicationException(ApplicationException.APPLICATION_INTERNAL_ERROR, NLS.bind(Messages.application_instance_stopped, getInstanceId())); application = getConfiguration().createExecutableExtension("run"); //$NON-NLS-1$ app = application;
synchronized (this) { if ((status & (EclipseAppHandle.FLAG_STARTING | EclipseAppHandle.FLAG_STOPPING)) == 0) throw new ApplicationException(ApplicationException.APPLICATION_INTERNAL_ERROR, NLS.bind(Messages.application_instance_stopped, getInstanceId())); application = getConfiguration().createExecutableExtension("run"); //$NON-NLS-1$ app = application;
break; case LOCKED_SINGLETON_GLOBAL_RUNNING : throw new ApplicationException(ApplicationException.APPLICATION_NOT_LAUNCHABLE, NLS.bind(Messages.singleton_running, activeGlobalSingleton.getInstanceId())); case LOCKED_SINGLETON_GLOBAL_APPS_RUNNING : throw new ApplicationException(ApplicationException.APPLICATION_NOT_LAUNCHABLE, Messages.apps_running); case LOCKED_SINGLETON_SCOPED_RUNNING : throw new ApplicationException(ApplicationException.APPLICATION_NOT_LAUNCHABLE, NLS.bind(Messages.singleton_running, activeScopedSingleton.getInstanceId())); case LOCKED_SINGLETON_LIMITED_RUNNING : throw new ApplicationException(ApplicationException.APPLICATION_NOT_LAUNCHABLE, NLS.bind(Messages.max_running, eclipseApp.getApplicationId())); case LOCKED_MAIN_THREAD_RUNNING : throw new ApplicationException(ApplicationException.APPLICATION_NOT_LAUNCHABLE, NLS.bind(Messages.main_running, activeMain.getInstanceId())); default : break;
public Object run(Object context) { if (handleTracker == null) return getResult(); // app has ended, return the result EclipseAppHandle anyThreadedDefaultApp = (EclipseAppHandle) handleTracker.getService(); if (anyThreadedDefaultApp != null) // We now need to actual launch the application; this will run the application on another thread. AnyThreadAppLauncher.launchEclipseApplication(anyThreadedDefaultApp); try { while (waitOnRunning()) { EclipseAppHandle mainHandle = getMainHandle(); if (mainHandle != null) { // while we were waiting for the default application to end someone asked for a main threaded app to launch // note that we cannot hold the this lock while launching a main threaded application try { mainHandle.run(null); } catch (Throwable e) { String message = NLS.bind(Messages.application_error_starting, mainHandle.getInstanceId()); Activator.log(new FrameworkLogEntry(Activator.PI_APP, FrameworkLogEntry.WARNING, 0, message, 0, e, null)); } unsetMainHandle(mainHandle); } } } finally { handleTracker.close(); } return getResult(); }
@Override public Object run(Object context) { if (handleTracker == null) return getResult(); // app has ended, return the result EclipseAppHandle anyThreadedDefaultApp = (EclipseAppHandle) handleTracker.getService(); if (anyThreadedDefaultApp != null) // We now need to actual launch the application; this will run the application on another thread. AnyThreadAppLauncher.launchEclipseApplication(anyThreadedDefaultApp); try { while (waitOnRunning()) { EclipseAppHandle mainHandle = getMainHandle(); if (mainHandle != null) { // while we were waiting for the default application to end someone asked for a main threaded app to launch // note that we cannot hold the this lock while launching a main threaded application try { mainHandle.run(null); } catch (Throwable e) { String message = NLS.bind(Messages.application_error_starting, mainHandle.getInstanceId()); Activator.log(new FrameworkLogEntry(Activator.PI_APP, FrameworkLogEntry.WARNING, 0, message, 0, e, null)); } unsetMainHandle(mainHandle); } } } finally { handleTracker.close(); } return getResult(); }
public Object run(Object context) { if (handleTracker == null) return getResult(); // app has ended, return the result EclipseAppHandle anyThreadedDefaultApp = (EclipseAppHandle) handleTracker.getService(); if (anyThreadedDefaultApp != null) // We now need to actual launch the application; this will run the application on another thread. AnyThreadAppLauncher.launchEclipseApplication(anyThreadedDefaultApp); try { while (waitOnRunning()) { EclipseAppHandle mainHandle = getMainHandle(); if (mainHandle != null) { // while we were waiting for the default application to end someone asked for a main threaded app to launch // note that we cannot hold the this lock while launching a main threaded application try { mainHandle.run(null); } catch (Throwable e) { String message = NLS.bind(Messages.application_error_starting, mainHandle.getInstanceId()); Activator.log(new FrameworkLogEntry(Activator.PI_APP, FrameworkLogEntry.WARNING, 0, message, 0, e, null)); } unsetMainHandle(mainHandle); } } } finally { handleTracker.close(); } return getResult(); }
return; throw new ApplicationException(ApplicationException.APPLICATION_INTERNAL_ERROR, NLS.bind(Messages.application_error_noMainThread, appHandle.getInstanceId()));