Record and expose the last time all identities were loaded.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 18 Sep 2012 06:07:07 +0000 (08:07 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 18 Sep 2012 06:07:07 +0000 (08:07 +0200)
src/main/java/net/pterodactylus/sone/freenet/wot/IdentityManager.java

index 6152c4b..bca6ac1 100644 (file)
@@ -65,6 +65,9 @@ public class IdentityManager extends AbstractService {
        /* synchronize access on syncObject. */
        private final Map<String, OwnIdentity> currentOwnIdentities = new HashMap<String, OwnIdentity>();
 
+       /** The last time all identities were loaded. */
+       private volatile long identitiesLastLoaded;
+
        /**
         * Creates a new identity manager.
         *
@@ -109,6 +112,16 @@ public class IdentityManager extends AbstractService {
        //
 
        /**
+        * Returns the last time all identities were loaded.
+        *
+        * @return The last time all identities were loaded (in milliseconds since
+        *         Jan 1, 1970 UTC)
+        */
+       public long getIdentitiesLastLoaded() {
+               return identitiesLastLoaded;
+       }
+
+       /**
         * Returns whether the Web of Trust plugin could be reached during the last
         * try.
         *
@@ -186,6 +199,7 @@ public class IdentityManager extends AbstractService {
                                        }
                                }
                                identitiesLoaded = true;
+                               identitiesLastLoaded = System.currentTimeMillis();
                        } catch (WebOfTrustException wote1) {
                                logger.log(Level.WARNING, "WoT has disappeared!", wote1);
                        }