From 9cdd93ee1152c4bfe6130f397a3c424bb899434e Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Mon, 13 Jul 2009 00:34:19 +0000 Subject: [PATCH] Publish our server startup time in our NodeObject. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5867 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../presents/peer/data/NodeObject.java | 22 +++++++++++++++++++ .../presents/peer/server/PeerManager.java | 1 + 2 files changed, 23 insertions(+) diff --git a/src/java/com/threerings/presents/peer/data/NodeObject.java b/src/java/com/threerings/presents/peer/data/NodeObject.java index 51e1bce5b..60c29e566 100644 --- a/src/java/com/threerings/presents/peer/data/NodeObject.java +++ b/src/java/com/threerings/presents/peer/data/NodeObject.java @@ -38,6 +38,9 @@ public class NodeObject extends DObject /** The field name of the nodeName field. */ public static final String NODE_NAME = "nodeName"; + /** The field name of the bootStamp field. */ + public static final String BOOT_STAMP = "bootStamp"; + /** The field name of the peerService field. */ public static final String PEER_SERVICE = "peerService"; @@ -130,6 +133,9 @@ public class NodeObject extends DObject /** The node name of this peer. */ public String nodeName; + /** The time that this node's JVM started up. */ + public long bootStamp; + /** The service used to make requests of the node. */ public PeerMarshaller peerService; @@ -165,6 +171,22 @@ public class NodeObject extends DObject this.nodeName = value; } + /** + * Requests that the bootStamp field be set to the + * specified value. The local value will be updated immediately and an + * event will be propagated through the system to notify all listeners + * that the attribute did change. Proxied copies of this object (on + * clients) will apply the value change when they received the + * attribute changed notification. + */ + public void setBootStamp (long value) + { + long ovalue = this.bootStamp; + requestAttributeChange( + BOOT_STAMP, Long.valueOf(value), Long.valueOf(ovalue)); + this.bootStamp = value; + } + /** * Requests that the peerService field be set to the * specified value. The local value will be updated immediately and an diff --git a/src/java/com/threerings/presents/peer/server/PeerManager.java b/src/java/com/threerings/presents/peer/server/PeerManager.java index 5fd4d9fab..2b3be9411 100644 --- a/src/java/com/threerings/presents/peer/server/PeerManager.java +++ b/src/java/com/threerings/presents/peer/server/PeerManager.java @@ -249,6 +249,7 @@ public abstract class PeerManager // create our node object _nodeobj = _omgr.registerObject(createNodeObject()); _nodeobj.setNodeName(nodeName); + _nodeobj.setBootStamp(System.currentTimeMillis()); // register ourselves with the node table _self = new NodeRecord(