Skip to content

Commit b4bc644

Browse files
committed
# Conflicts: # libs/ASAPJava.jar
2 parents 32edf5c + 11a9511 commit b4bc644

File tree

16 files changed

+89
-273
lines changed

16 files changed

+89
-273
lines changed

Dockerfile

Lines changed: 0 additions & 14 deletions
This file was deleted.

Dockerfile.HubCLI

Lines changed: 0 additions & 14 deletions
This file was deleted.

Dockerfile.HubTester

Lines changed: 0 additions & 11 deletions
This file was deleted.

README.md

Lines changed: 0 additions & 74 deletions
This file was deleted.

libs/ASAPJava.jar

2.93 KB
Binary file not shown.

makeASAPHubJar.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
cd out/production/main/
2+
jar -cvf ASAPHub.jar net
3+
mv ASAPHub.jar ../../../ASAPHub.jar
4+
cd ../../../

pom.xml

Lines changed: 0 additions & 148 deletions
This file was deleted.

src/main/java/net/sharksystem/hub/BasicHubConnectionManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ public abstract class BasicHubConnectionManager implements HubConnectionManager
3636
* accurate. We can keep track of failed attempts. And we do.
3737
*/
3838
protected void syncLists() {
39-
// avoid calls within milliseconds
39+
// wait a few millis for a new sync
4040
long now = System.currentTimeMillis();
41-
if (now - this.lastSync <= 100) return;
41+
if (now - this.lastSync <= 100L) return;
4242
this.lastSync = now;
4343

4444
// ask for current list from hub

src/main/java/net/sharksystem/hub/HubConnectionManager.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@
1111
* Interface for applications. It allows connection management with hubs.
1212
*/
1313
public interface HubConnectionManager extends NewHubConnectionListenerManagement {
14+
/**
15+
*
16+
* @return time when last sync with hubs happened. Is -1 if never synced
17+
*/
18+
long getLastSyncTime();
19+
20+
/**
21+
* Force a new synchronization with all connected hubs. Use this method carefully. We do not want
22+
* to produce unnecessary traffic.
23+
*/
24+
void forceSync();
25+
1426
/**
1527
* Connect a hub
1628
* @param hcd Hub description

src/main/java/net/sharksystem/hub/HubConnectionManagerImpl.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,17 @@ public void removeNewConnectedHubListener(NewHubConnectedListener connectedHubLi
6767
}
6868
}
6969

70+
public long getLastSyncTime() {
71+
if(this.hubManager == null) return -1;
72+
return this.hubManager.getLastSynchedWithConnectedHubs();
73+
}
74+
75+
public void forceSync() {
76+
if(this.hubManager != null) {
77+
this.hubManager.forceSyncWithHubs();
78+
}
79+
}
80+
7081
public HubConnectionManagerImpl(
7182
ASAPEncounterManager encounterManager, ASAPPeer asapPeer, int waitIntervalInSeconds) {
7283
this.asapPeer = asapPeer;

0 commit comments

Comments
 (0)