Tone down verbose logging.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5404 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -38,17 +38,16 @@ public class SafeObjectManager
|
|||||||
/**
|
/**
|
||||||
* Creates a new manager. The optional available and failed parameters are callbacks
|
* Creates a new manager. The optional available and failed parameters are callbacks
|
||||||
* that must match the <code>Subscriber</code> interface methods.
|
* that must match the <code>Subscriber</code> interface methods.
|
||||||
|
*
|
||||||
* @param omgr the underlying object manager to use for requesting objects
|
* @param omgr the underlying object manager to use for requesting objects
|
||||||
* @param log sink for warnings and info messages
|
* @param log sink for warnings and info messages
|
||||||
* @param available optional callback for when an object becomes available
|
* @param available optional callback for when an object becomes available
|
||||||
* @param failed optional callback for when a subscription request fails
|
* @param failed optional callback for when a subscription request fails
|
||||||
|
*
|
||||||
* @see Subscriber
|
* @see Subscriber
|
||||||
*/
|
*/
|
||||||
public function SafeObjectManager (
|
public function SafeObjectManager (
|
||||||
omgr :DObjectManager,
|
omgr :DObjectManager, log :Log, available :Function = null, failed :Function = null)
|
||||||
log :Log,
|
|
||||||
available :Function = null,
|
|
||||||
failed :Function = null)
|
|
||||||
{
|
{
|
||||||
_omgr = omgr;
|
_omgr = omgr;
|
||||||
_log = log;
|
_log = log;
|
||||||
@@ -70,9 +69,7 @@ public class SafeObjectManager
|
|||||||
* @param failed an optional callback to be invoked if the request fails
|
* @param failed an optional callback to be invoked if the request fails
|
||||||
*/
|
*/
|
||||||
public function subscribe (
|
public function subscribe (
|
||||||
oid :int,
|
oid :int, available :Function=null, failed :Function=null) :void
|
||||||
available :Function=null,
|
|
||||||
failed :Function=null) :void
|
|
||||||
{
|
{
|
||||||
if (_entries[oid] != null ) {
|
if (_entries[oid] != null ) {
|
||||||
_log.warning("Object " + oid + " already subscribed");
|
_log.warning("Object " + oid + " already subscribed");
|
||||||
@@ -84,7 +81,7 @@ public class SafeObjectManager
|
|||||||
entry.availableFn = available;
|
entry.availableFn = available;
|
||||||
entry.failedFn = failed;
|
entry.failedFn = failed;
|
||||||
sub.subscribe(_omgr);
|
sub.subscribe(_omgr);
|
||||||
_log.info("Subscribing to " + sub);
|
// _log.info("Subscribing to " + sub);
|
||||||
_entries[oid] = entry;
|
_entries[oid] = entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +98,7 @@ public class SafeObjectManager
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_log.info("Unsubscribing from " + entry.sub);
|
// _log.info("Unsubscribing from " + entry.sub);
|
||||||
if (entry.obj != null) {
|
if (entry.obj != null) {
|
||||||
entry.obj.removeListener(_objectDeathListenerAdapter);
|
entry.obj.removeListener(_objectDeathListenerAdapter);
|
||||||
}
|
}
|
||||||
@@ -118,7 +115,7 @@ public class SafeObjectManager
|
|||||||
*/
|
*/
|
||||||
public function unsubscribeAll () :void
|
public function unsubscribeAll () :void
|
||||||
{
|
{
|
||||||
_log.info("Unsubscribing all objects");
|
// _log.info("Unsubscribing all objects");
|
||||||
|
|
||||||
// get the keys (integer ids of subscribed objects)
|
// get the keys (integer ids of subscribed objects)
|
||||||
var ids :Array = new Array();
|
var ids :Array = new Array();
|
||||||
@@ -156,7 +153,7 @@ public class SafeObjectManager
|
|||||||
_log.warning("Object " + obj.getOid() + " available without request?!");
|
_log.warning("Object " + obj.getOid() + " available without request?!");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
_log.info("Object " + obj.getOid() + " now available");
|
// _log.info("Object " + obj.getOid() + " now available");
|
||||||
entry.obj = obj;
|
entry.obj = obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,23 +205,20 @@ public class SafeObjectManager
|
|||||||
entry.obj = null;
|
entry.obj = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
_log.info("Object " + oid + " destroyed");
|
// _log.info("Object " + oid + " destroyed");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected var _omgr :DObjectManager;
|
protected var _omgr :DObjectManager;
|
||||||
protected var _log :Log;
|
protected var _log :Log;
|
||||||
protected var _available :Function;
|
protected var _available :Function;
|
||||||
protected var _failed :Function;
|
protected var _failed :Function;
|
||||||
protected var _adapter :SubscriberAdapter =
|
protected var _adapter :SubscriberAdapter = new SubscriberAdapter(available, failed);
|
||||||
new SubscriberAdapter(available, failed);
|
|
||||||
protected var _objectDeathListenerAdapter :ObjectDeathListenerAdapter =
|
protected var _objectDeathListenerAdapter :ObjectDeathListenerAdapter =
|
||||||
new ObjectDeathListenerAdapter(destroyed);
|
new ObjectDeathListenerAdapter(destroyed);
|
||||||
protected var _entries :Dictionary = new Dictionary();
|
protected var _entries :Dictionary = new Dictionary();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
import com.threerings.presents.dobj.DObject;
|
import com.threerings.presents.dobj.DObject;
|
||||||
import com.threerings.presents.dobj.ObjectDeathListener;
|
import com.threerings.presents.dobj.ObjectDeathListener;
|
||||||
import com.threerings.presents.dobj.ObjectDestroyedEvent;
|
import com.threerings.presents.dobj.ObjectDestroyedEvent;
|
||||||
|
|||||||
Reference in New Issue
Block a user