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) {
|
||||
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) {
|
||||
Integer count = (Integer) d.getAttribute(AdempiereWebUI.SERVERPUSH_SCHEDULE_FAILURES);
|
||||
if (count != null)
|
||||
|
|
|
@ -119,7 +119,9 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
|
|||
private ConcurrentMap<String, String[]> m_URLParameters;
|
||||
|
||||
public static final String SERVERPUSH_SCHEDULE_FAILURES = "serverpush.schedule.failures";
|
||||
|
||||
|
||||
private static final String ON_LOGIN_COMPLETED = "onLoginCompleted";
|
||||
|
||||
public AdempiereWebUI()
|
||||
{
|
||||
this.setVisible(false);
|
||||
|
@ -127,12 +129,16 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
|
|||
userPreference = new UserPreference();
|
||||
// preserve the original URL parameters as is destroyed later on loging
|
||||
m_URLParameters = new ConcurrentHashMap<String, String[]>(Executions.getCurrent().getParameterMap());
|
||||
|
||||
this.addEventListener(ON_LOGIN_COMPLETED, this);
|
||||
}
|
||||
|
||||
public void onCreate()
|
||||
{
|
||||
this.getPage().setTitle(ThemeManager.getBrowserTitle());
|
||||
|
||||
Executions.getCurrent().getDesktop().enableServerPush(true);
|
||||
|
||||
SessionManager.setSessionApplication(this);
|
||||
Session session = Executions.getCurrent().getDesktop().getSession();
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -153,11 +159,11 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
|
|||
}
|
||||
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 TokenCommand());
|
||||
Executions.getCurrent().getDesktop().addListener(new ZoomCommand());
|
||||
|
@ -485,7 +491,9 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
|
|||
if (appDesktop != null)
|
||||
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())
|
||||
desktop.enableServerPush(false);
|
||||
Session session = logout0();
|
||||
|
||||
//clear context and invalidate session
|
||||
DesktopCache desktopCache = ((SessionCtrl)session).getDesktopCache();
|
||||
|
||||
//clear context
|
||||
Env.getCtx().clear();
|
||||
((SessionCtrl)session).invalidateNow();
|
||||
|
||||
//invalidate session
|
||||
((SessionCtrl)session).invalidateNow();
|
||||
|
||||
//put saved context into new session
|
||||
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);
|
||||
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
|
||||
|
|
|
@ -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,
|
||||
// or ever rise other event like start editting to distinguish with true onChange event
|
||||
|
|
Loading…
Reference in New Issue