Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Detecting that the server is not available and reacting to this state.
Detecting that the server is not available and reacting to this state. [message #1578723] Thu, 22 January 2015 15:25
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1250
Registered: October 2011
Senior Member
In our current project, we have some cases where the client is started too early from another process. We would like: to detect this situation and to react (maybe close the client exe).

1/ Detecting that the server is not available:
Like every project, we have code looking like that in ClientSession#execLoadSession:
public void execLoadSession() throws ProcessingException {
  setServiceTunnel(new ClientHttpServiceTunnel(this, UriUtility.toUrl(getBundle().getBundleContext().getProperty("server.url"))));

  //pre-load all known code types

  setDesktop(new Desktop());

  // turn client notification polling on
  // getServiceTunnel().setClientNotificationPollInterval(2000L);

This produces a stack trace like that:
	at com.sun.proxy.$Proxy7.getAllCodeTypeClasses(Unknown Source)
	at m4test.client.core.ClientSession.execLoadSession(
	at ...
	at org.eclipse.equinox.launcher.Main.main(
Caused by: ProcessingException[ProcessingStatus[ERROR code=0 Calling ICodeService.getAllCodeTypeClasses() Connection refused: connect]]
	at org.eclipse.scout.rt.servicetunnel.AbstractServiceTunnel.invokeService(
	at org.eclipse.scout.rt.servicetunnel.http.internal.AbstractInternalHttpServiceTunnel.invokeService(
	at ...
	at org.eclipse.scout.rt.servicetunnel.ServiceTunnelInvocationHandler.invoke(
	... 42 more
Caused by: Connection refused: connect
	at Method)
	at ...

Should I catch the UndeclaredThrowableException? I do not think that this is a good practice.

2/ closing the client exe programmatically
When I look at the Exit Menu, it calls:

But it does'nt seems possible to call stopSession() from the execLoadSession(). It produces a NullPointerException because m_desktop is null:
	at org.eclipse.scout.rt.client.AbstractClientSession.stopSession(
	at org.eclipse.scout.rt.client.AbstractClientSession.stopSession(
	at m4test.client.core.ClientSession.execLoadSession(
	at org.eclipse.scout.rt.client.AbstractClientSession$LocalClientSessionExtension.execLoadSession(

What do you think on these two topics?
Thank you in advance for your help.
Previous Topic:Client Notification
Next Topic:Controlling if execChangedValue() is called or not.
Goto Forum:

Current Time: Mon Jul 16 16:03:58 GMT 2018

Powered by FUDForum. Page generated in 0.01855 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top