IDEMPIERE-4210 Fix 2 Failed to resume long polling resource warning
This commit is contained in:
parent
b886c593c8
commit
0b41ffd3f8
|
|
@ -207,8 +207,8 @@ public class AtmosphereServerPush implements ServerPush {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
log.warn("Failed to resume long polling resource");
|
Desktop d = desktop.get();
|
||||||
Desktop d = desktop.get();
|
log.warn("Failed to resume long polling resource" + (d != null ? " for desktop " + d.getId() : ""));
|
||||||
if (d != null) {
|
if (d != null) {
|
||||||
Integer count = (Integer) d.getAttribute(AdempiereWebUI.SERVERPUSH_SCHEDULE_FAILURES);
|
Integer count = (Integer) d.getAttribute(AdempiereWebUI.SERVERPUSH_SCHEDULE_FAILURES);
|
||||||
if (count != null)
|
if (count != null)
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,8 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
|
||||||
|
|
||||||
public static final String SERVERPUSH_SCHEDULE_FAILURES = "serverpush.schedule.failures";
|
public static final String SERVERPUSH_SCHEDULE_FAILURES = "serverpush.schedule.failures";
|
||||||
|
|
||||||
|
private static final String ON_LOGIN_COMPLETED = "onLoginCompleted";
|
||||||
|
|
||||||
public AdempiereWebUI()
|
public AdempiereWebUI()
|
||||||
{
|
{
|
||||||
this.setVisible(false);
|
this.setVisible(false);
|
||||||
|
|
@ -127,12 +129,16 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
|
||||||
userPreference = new UserPreference();
|
userPreference = new UserPreference();
|
||||||
// preserve the original URL parameters as is destroyed later on loging
|
// preserve the original URL parameters as is destroyed later on loging
|
||||||
m_URLParameters = new ConcurrentHashMap<String, String[]>(Executions.getCurrent().getParameterMap());
|
m_URLParameters = new ConcurrentHashMap<String, String[]>(Executions.getCurrent().getParameterMap());
|
||||||
|
|
||||||
|
this.addEventListener(ON_LOGIN_COMPLETED, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCreate()
|
public void onCreate()
|
||||||
{
|
{
|
||||||
this.getPage().setTitle(ThemeManager.getBrowserTitle());
|
this.getPage().setTitle(ThemeManager.getBrowserTitle());
|
||||||
|
|
||||||
|
Executions.getCurrent().getDesktop().enableServerPush(true);
|
||||||
|
|
||||||
SessionManager.setSessionApplication(this);
|
SessionManager.setSessionApplication(this);
|
||||||
Session session = Executions.getCurrent().getDesktop().getSession();
|
Session session = Executions.getCurrent().getDesktop().getSession();
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
@ -153,11 +159,11 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
loginCompleted();
|
Clients.showBusy(null);
|
||||||
|
//use echo event to make sure server push have been started when loginCompleted is call
|
||||||
|
Events.echoEvent(ON_LOGIN_COMPLETED, this, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
Executions.getCurrent().getDesktop().enableServerPush(true);
|
|
||||||
|
|
||||||
Executions.getCurrent().getDesktop().addListener(new DrillCommand());
|
Executions.getCurrent().getDesktop().addListener(new DrillCommand());
|
||||||
Executions.getCurrent().getDesktop().addListener(new TokenCommand());
|
Executions.getCurrent().getDesktop().addListener(new TokenCommand());
|
||||||
Executions.getCurrent().getDesktop().addListener(new ZoomCommand());
|
Executions.getCurrent().getDesktop().addListener(new ZoomCommand());
|
||||||
|
|
@ -485,6 +491,8 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
|
||||||
if (appDesktop != null)
|
if (appDesktop != null)
|
||||||
appDesktop.setClientInfo(clientInfo);
|
appDesktop.setClientInfo(clientInfo);
|
||||||
|
|
||||||
|
} else if (event.getName().equals(ON_LOGIN_COMPLETED)) {
|
||||||
|
loginCompleted();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -541,10 +549,13 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
|
||||||
if (desktop.isServerPushEnabled())
|
if (desktop.isServerPushEnabled())
|
||||||
desktop.enableServerPush(false);
|
desktop.enableServerPush(false);
|
||||||
Session session = logout0();
|
Session session = logout0();
|
||||||
|
DesktopCache desktopCache = ((SessionCtrl)session).getDesktopCache();
|
||||||
|
|
||||||
//clear context and invalidate session
|
//clear context
|
||||||
Env.getCtx().clear();
|
Env.getCtx().clear();
|
||||||
((SessionCtrl)session).invalidateNow();
|
|
||||||
|
//invalidate session
|
||||||
|
((SessionCtrl)session).invalidateNow();
|
||||||
|
|
||||||
//put saved context into new session
|
//put saved context into new session
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
|
|
@ -555,7 +566,12 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
|
||||||
newSession.setAttribute(SAVED_CONTEXT, map);
|
newSession.setAttribute(SAVED_CONTEXT, map);
|
||||||
properties.setProperty(SessionContextListener.SERVLET_SESSION_ID, newSession.getId());
|
properties.setProperty(SessionContextListener.SERVLET_SESSION_ID, newSession.getId());
|
||||||
|
|
||||||
Executions.sendRedirect("index.zul");
|
//redirect must happens before removeDesktop below, otherwise you get NPE
|
||||||
|
Executions.getCurrent().sendRedirect("index.zul");
|
||||||
|
|
||||||
|
//remove old desktop
|
||||||
|
if (desktopCache != null)
|
||||||
|
desktopCache.removeDesktop(desktop);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ Copyright (C) 2007 Ashley G Ramdass.
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
zk.afterLoad('zul.wgt', function () {
|
zk.afterLoad('zul.inp', function () {
|
||||||
|
|
||||||
// should filter out for only component inside standard window or component wish fire this event,
|
// should filter out for only component inside standard window or component wish fire this event,
|
||||||
// or ever rise other event like start editting to distinguish with true onChange event
|
// or ever rise other event like start editting to distinguish with true onChange event
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue