Openbravo Issue Tracking System - Retail Modules
View Issue Details
0036787Retail ModulesStoreServerpublic2017-09-05 09:172017-09-18 22:13
AugustoMauch 
AugustoMauch 
normalminorhave not tried
closedfixed 
5
 
 
mtaal
No
No
0036787: Improvements on the processes that handle the transition to online/offline
There are a few actions that can be taken to improve the way the transitions to online/offline are managed:
- Improve the log
- Refactor some of the classes that manage the server state
- When a central server is started, force a transition to online to all the store servers
- When a store server is started, reset the latest ping received from the central to prevent false transitions to offline
-
No tags attached.
diff changes.diff (2,475) 2017-09-18 12:03
https://issues.openbravo.com/file_download.php?file_id=11068&type=bug
Issue History
2017-09-05 09:17AugustoMauchNew Issue
2017-09-05 09:17AugustoMauchAssigned To => AugustoMauch
2017-09-05 09:17AugustoMauchOBNetwork customer => No
2017-09-05 09:17AugustoMauchTriggers an Emergency Pack => No
2017-09-05 12:28hgbotCheckin
2017-09-05 12:28hgbotNote Added: 0098829
2017-09-05 12:32AugustoMauchSummaryImprove log of processes involved in transition to online/offline => Improvements on the processes that handle the transition to online/offline
2017-09-05 12:32AugustoMauchDescription Updatedbug_revision_view_page.php?rev_id=15813#r15813
2017-09-05 13:04hgbotCheckin
2017-09-05 13:04hgbotNote Added: 0098830
2017-09-15 13:31hgbotCheckin
2017-09-15 13:31hgbotNote Added: 0099074
2017-09-15 13:31hgbotCheckin
2017-09-15 13:31hgbotNote Added: 0099075
2017-09-15 13:31hgbotCheckin
2017-09-15 13:31hgbotNote Added: 0099076
2017-09-15 13:32hgbotCheckin
2017-09-15 13:32hgbotNote Added: 0099077
2017-09-15 13:32hgbotCheckin
2017-09-15 13:32hgbotNote Added: 0099078
2017-09-15 13:32hgbotCheckin
2017-09-15 13:32hgbotNote Added: 0099079
2017-09-15 13:32hgbotCheckin
2017-09-15 13:32hgbotNote Added: 0099080
2017-09-15 13:32hgbotCheckin
2017-09-15 13:32hgbotNote Added: 0099081
2017-09-15 13:32hgbotStatusnew => resolved
2017-09-15 13:32hgbotResolutionopen => fixed
2017-09-15 13:32hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/0d509da73da84b84aa7f717705ec4035db622c51 [^]
2017-09-15 13:32hgbotCheckin
2017-09-15 13:32hgbotNote Added: 0099082
2017-09-15 13:33AugustoMauchReview Assigned To => mtaal
2017-09-18 11:18mtaalNote Edited: 0099081bug_revision_view_page.php?bugnote_id=0099081#r15919
2017-09-18 12:02mtaalNote Added: 0099098
2017-09-18 12:03mtaalNote Added: 0099101
2017-09-18 12:03mtaalStatusresolved => new
2017-09-18 12:03mtaalResolutionfixed => open
2017-09-18 12:03mtaalFile Added: changes.diff
2017-09-18 16:37hgbotCheckin
2017-09-18 16:37hgbotNote Added: 0099124
2017-09-18 16:37hgbotStatusnew => resolved
2017-09-18 16:37hgbotResolutionopen => fixed
2017-09-18 16:37hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/0d509da73da84b84aa7f717705ec4035db622c51 [^] => http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/2532b94be97f8f35915ee26b3399d7a9679e9976 [^]
2017-09-18 22:13mtaalNote Added: 0099132
2017-09-18 22:13mtaalStatusresolved => closed

Notes
(0098829)
hgbot   
2017-09-05 12:28   
Repository: erp/pmods/org.openbravo.retail.storeserver.synchronization
Changeset: 94d92bd1310f2106fdb4ebce5e26907ac1c0e716
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue Sep 05 12:28:26 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/94d92bd1310f2106fdb4ebce5e26907ac1c0e716 [^]

Related with issue 36787: Adds log when transitioning to online/offline

---
M src/org/openbravo/retail/storeserver/synchronization/StoreServerVersionHandler.java
---
(0098830)
hgbot   
2017-09-05 13:04   
Repository: erp/pmods/org.openbravo.replication.symmetricds
Changeset: 87771018183749bdcb400c56ca0d3e8bcadce727
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue Sep 05 13:04:03 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.replication.symmetricds/rev/87771018183749bdcb400c56ca0d3e8bcadce727 [^]

Related with issue 36787: SetupSymmetricListener cleanup

- Adds static modifier to constants
- Defines constants for "MANDATORY_RELOADING" and "RELOADING"
- Uses diamond operator
- Makes sure PreparedStatement is closed
- Uses log4j built-in formatter
- Handler properly a InterruptedException
- Moves countInitialImportEntries to the inner class it belongs

---
M src/org/openbravo/replication/symmetricds/SetupSymmetricListener.java
---
(0099074)
hgbot   
2017-09-15 13:31   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: 4ca0847b2982138d3b11d0c26e7f064ec28c4a96
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue Sep 05 09:29:36 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/4ca0847b2982138d3b11d0c26e7f064ec28c4a96 [^]

Related with issue 36787: Cleanup of ServerStateBackground.java

- Constants for string literals "Transition to online", "Transition to offline"
- ProcessLogger is defined in the method where it is used
- Adds missing break in TRANSITION_TO_OFFLINE switch case
- Remove unneeded cast to int
- Uses diamond operator
- Handles an InterruptedException properly
- Removes unused parameter from getServersToSendPing method
- Adds some log
- Extracts method that pings a specific server
- Extracts method that obtains the status of a remote server from a response

---
M src/org/openbravo/mobile/core/servercontroller/ServerStateBackground.java
---
(0099075)
hgbot   
2017-09-15 13:31   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: c1797d4b4bb9822356c474e14e32fe6aa12e8bac
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue Sep 05 09:37:09 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/c1797d4b4bb9822356c474e14e32fe6aa12e8bac [^]

Related with issue 36787: Cleanup of MobileMainServerCheck

- Added some log
- Extracted methods to improve code legibility
    * goOffline: Changes the status of the server to offline
    * transitionToOnlineIfNeeded: Inits a transition to online unless the server is already online
    * waitBeforeNextAttempt: Waits before retrying the offline checks, handles an InterruptedException
    * transitionToOfflineIntervalHasPassed: Checks if enough time has passed since the transition of offline begun
    * executeOfflineChecks: Executes the transition of offline checks. If the server is a store server, it also checks if the central server is online

---
M src/org/openbravo/mobile/core/servercontroller/MobileMainServerCheck.java
---
(0099076)
hgbot   
2017-09-15 13:31   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: ff4424d0fc33e085ef74003fee2cfd2dd664a809
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue Sep 05 09:43:26 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/ff4424d0fc33e085ef74003fee2cfd2dd664a809 [^]

Related with issue 36787: Cleanup of MobileServerController

- Added some log
- Attribute modifiers are set in the right order
- Extracted some methods:
    * checkOnlineHandlers
    * buildOfflineLogFromHandlers

---
M src/org/openbravo/mobile/core/servercontroller/MobileServerController.java
---
(0099077)
hgbot   
2017-09-15 13:32   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: 91f9f0abe64f58e310fdaf24b114dcc50321ca6e
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue Sep 05 12:35:50 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/91f9f0abe64f58e310fdaf24b114dcc50321ca6e [^]

Related with issue 36787: Adds log to MobileServerController

---
M src/org/openbravo/mobile/core/servercontroller/MobileServerController.java
---
(0099078)
hgbot   
2017-09-15 13:32   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: 79eac4617a14eb3dba957ae3dd2d46f387a14d6d
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue Sep 05 12:41:48 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/79eac4617a14eb3dba957ae3dd2d46f387a14d6d [^]

Related with issue 36787: Adds log, refactors, prevents unneeded transitions

- Some log have been added
- If the server that cannot be contacted is not a trigger state server do not start a transition to online
- Extracts a couple of methods

---
M src/org/openbravo/mobile/core/servercontroller/MobileServerRequestExecutor.java
---
(0099079)
hgbot   
2017-09-15 13:32   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: 2ad450bc557c58bc60c98d278a01344f42875291
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue Sep 05 12:45:14 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/2ad450bc557c58bc60c98d278a01344f42875291 [^]

Related with issue 36787:Adds more log related with transtion to online/offline

---
M src/org/openbravo/mobile/core/servercontroller/MultiServerJSONProcess.java
M src/org/openbravo/mobile/core/servercontroller/ServerStateBackground.java
---
(0099080)
hgbot   
2017-09-15 13:32   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: 0d4b1083f407a66938f7d56133f54aa959324df6
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue Sep 05 16:12:54 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/0d4b1083f407a66938f7d56133f54aa959324df6 [^]

Related with issue 36787: Listener to reset last ping from the central server

This is needed to prevent detecting the central server as offline when it really isn't.

For instance, if a store server has been offline for some time then during that time it cannot receive pings from the central server.
If the store server starts and the ping is not reset, it might happen that the old ping is checked before the central server has the change to send a new ping, and the store server would consider the central server offline because the last ping was received a long time ago

---
M src-db/database/sourcedata/AD_MODEL_OBJECT.xml
A src/org/openbravo/mobile/core/listener/InitializeLastPingFromCentralServer.java
---
(0099081)
hgbot   
2017-09-15 13:32   
(edited on: 2017-09-18 11:18)
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: 0d509da73da84b84aa7f717705ec4035db622c51
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue Sep 05 16:45:08 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/0d509da73da84b84aa7f717705ec4035db622c51 [^]

Fixes issue 36787:When ping is received after a long time, transition to online

When a store server receives a ping, force a transition to online if the previous ping was received so long ago that the central server was considered offline.

Change visibility of methods getLastPingThreshold and getLastPingFromCentral from ServerStateBackground to reuse them in MobileServerStatusInformation.

---
M src/org/openbravo/mobile/core/servercontroller/MobileServerStatusInformation.java
M src/org/openbravo/mobile/core/servercontroller/ServerStateBackground.java
---

(0099082)
hgbot   
2017-09-15 13:32   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: be3061e028abe31e209f0ae2b5147e875b782fd4
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue Sep 12 18:07:50 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/be3061e028abe31e209f0ae2b5147e875b782fd4 [^]

Related with issue 36787: Improves log and other small changes

The server status update log has been reviewed, to show the relevant information, properly setting the log level to DEBUG or INFO.

---
M src/org/openbravo/mobile/core/servercontroller/MobileMainServerCheck.java
M src/org/openbravo/mobile/core/servercontroller/MobileServerController.java
M src/org/openbravo/mobile/core/servercontroller/MobileServerStatusInformation.java
M src/org/openbravo/mobile/core/servercontroller/ServerStateBackground.java
---
(0099098)
mtaal   
2017-09-18 12:01   
Reviewed code changes, additional changes proposed, see attached diff.
(0099101)
mtaal   
2017-09-18 12:03   
re-open to review additional changes
(0099124)
hgbot   
2017-09-18 16:37   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: 2532b94be97f8f35915ee26b3399d7a9679e9976
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Mon Sep 18 16:35:17 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/2532b94be97f8f35915ee26b3399d7a9679e9976 [^]

Fixes issue 36787: Update level in preference query, clarifies context change

Now the OBMOBC_Ping_Periodicity will be read even if it is not set by the user Openbravo in the System client.

Also, now it is explained why it is needed to set the proper client in the OBContext in MobileServerStatusInformation.

---
M src/org/openbravo/mobile/core/servercontroller/MobileServerStatusInformation.java
M src/org/openbravo/mobile/core/servercontroller/ServerStateBackground.java
---
(0099132)
mtaal   
2017-09-18 22:13   
Reviewed