Switch to new samskivert logging API.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5134 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -21,11 +21,10 @@
|
|||||||
|
|
||||||
package com.threerings;
|
package com.threerings;
|
||||||
|
|
||||||
import java.util.logging.Logger;
|
import com.samskivert.util.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A placeholder class that contains a reference to the log object used by this
|
* Contains a reference to the log object used by this project.
|
||||||
* project.
|
|
||||||
*/
|
*/
|
||||||
public class NaryaLog
|
public class NaryaLog
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,8 +21,7 @@
|
|||||||
|
|
||||||
package com.threerings.admin;
|
package com.threerings.admin;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
import com.samskivert.util.Logger;
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains a reference to the log object used by the Admin services.
|
* Contains a reference to the log object used by the Admin services.
|
||||||
@@ -31,28 +30,4 @@ public class Log
|
|||||||
{
|
{
|
||||||
/** We dispatch our log messages through this logger. */
|
/** We dispatch our log messages through this logger. */
|
||||||
public static Logger log = Logger.getLogger("com.threerings.narya.admin");
|
public static Logger log = Logger.getLogger("com.threerings.narya.admin");
|
||||||
|
|
||||||
/** Convenience function. */
|
|
||||||
public static void debug (String message)
|
|
||||||
{
|
|
||||||
log.fine(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Convenience function. */
|
|
||||||
public static void info (String message)
|
|
||||||
{
|
|
||||||
log.info(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Convenience function. */
|
|
||||||
public static void warning (String message)
|
|
||||||
{
|
|
||||||
log.warning(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Convenience function. */
|
|
||||||
public static void logStackTrace (Throwable t)
|
|
||||||
{
|
|
||||||
log.log(Level.WARNING, t.getMessage(), t);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import com.samskivert.util.StringUtil;
|
|||||||
import com.threerings.presents.dobj.DObject;
|
import com.threerings.presents.dobj.DObject;
|
||||||
import com.threerings.presents.util.PresentsContext;
|
import com.threerings.presents.util.PresentsContext;
|
||||||
|
|
||||||
import com.threerings.admin.Log;
|
import static com.threerings.admin.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to display and edit a particular distributed object field.
|
* Used to display and edit a particular distributed object field.
|
||||||
@@ -89,7 +89,7 @@ public class AsStringFieldEditor extends FieldEditor
|
|||||||
return new Boolean(_value.getText().equalsIgnoreCase("true"));
|
return new Boolean(_value.getText().equalsIgnoreCase("true"));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.warning("Unknown field type '" + _field.getName() + "': " +
|
log.warning("Unknown field type '" + _field.getName() + "': " +
|
||||||
_field.getType().getName() + ".");
|
_field.getType().getName() + ".");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import com.samskivert.swing.VGroupLayout;
|
|||||||
|
|
||||||
import com.threerings.presents.util.PresentsContext;
|
import com.threerings.presents.util.PresentsContext;
|
||||||
|
|
||||||
import com.threerings.admin.Log;
|
import static com.threerings.admin.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches a list of the configuration objects in use by the server and
|
* Fetches a list of the configuration objects in use by the server and
|
||||||
@@ -111,7 +111,7 @@ public class ConfigEditorPanel extends JPanel
|
|||||||
// documentation inherited from interface
|
// documentation inherited from interface
|
||||||
public void requestFailed (String reason)
|
public void requestFailed (String reason)
|
||||||
{
|
{
|
||||||
Log.warning("Failed to get config info [reason=" + reason + "].");
|
log.warning("Failed to get config info [reason=" + reason + "].");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Our client context. */
|
/** Our client context. */
|
||||||
|
|||||||
@@ -32,10 +32,11 @@ import com.threerings.presents.dobj.DObjectManager;
|
|||||||
import com.threerings.presents.dobj.ObjectAccessException;
|
import com.threerings.presents.dobj.ObjectAccessException;
|
||||||
import com.threerings.presents.dobj.Subscriber;
|
import com.threerings.presents.dobj.Subscriber;
|
||||||
|
|
||||||
import com.threerings.admin.Log;
|
|
||||||
import com.threerings.admin.data.AdminCodes;
|
import com.threerings.admin.data.AdminCodes;
|
||||||
import com.threerings.admin.data.ConfigObject;
|
import com.threerings.admin.data.ConfigObject;
|
||||||
|
|
||||||
|
import static com.threerings.admin.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles subscribing to admin config objects.
|
* Handles subscribing to admin config objects.
|
||||||
*/
|
*/
|
||||||
@@ -84,7 +85,7 @@ public class ConfigObjectManager implements AdminService.ConfigInfoListener
|
|||||||
// documentation inherited from interface AdminService.ConfigInfoListener
|
// documentation inherited from interface AdminService.ConfigInfoListener
|
||||||
public void requestFailed (String reason)
|
public void requestFailed (String reason)
|
||||||
{
|
{
|
||||||
Log.warning("Oh bugger, we didn't get the config data: " + reason);
|
log.warning("Oh bugger, we didn't get the config data: " + reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -121,7 +122,7 @@ public class ConfigObjectManager implements AdminService.ConfigInfoListener
|
|||||||
|
|
||||||
// documentation inherited from interface Subscriber
|
// documentation inherited from interface Subscriber
|
||||||
public void requestFailed (int oid, ObjectAccessException cause) {
|
public void requestFailed (int oid, ObjectAccessException cause) {
|
||||||
Log.warning("Unable to subscribe to config object " + _key);
|
log.warning("Unable to subscribe to config object " + _key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ import com.samskivert.util.ClassUtil;
|
|||||||
import com.samskivert.util.ComparableArrayList;
|
import com.samskivert.util.ComparableArrayList;
|
||||||
import com.samskivert.util.ListUtil;
|
import com.samskivert.util.ListUtil;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
|
||||||
import com.threerings.presents.dobj.AttributeChangeListener;
|
import com.threerings.presents.dobj.AttributeChangeListener;
|
||||||
import com.threerings.presents.dobj.AttributeChangedEvent;
|
import com.threerings.presents.dobj.AttributeChangedEvent;
|
||||||
import com.threerings.presents.dobj.DObject;
|
import com.threerings.presents.dobj.DObject;
|
||||||
@@ -50,6 +49,8 @@ import com.threerings.presents.dobj.EntryRemovedEvent;
|
|||||||
import com.threerings.presents.dobj.EntryUpdatedEvent;
|
import com.threerings.presents.dobj.EntryUpdatedEvent;
|
||||||
import com.threerings.presents.dobj.SetListener;
|
import com.threerings.presents.dobj.SetListener;
|
||||||
|
|
||||||
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows simple editing of DSets within a distributed object.
|
* Allows simple editing of DSets within a distributed object.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ import com.threerings.presents.dobj.DObject;
|
|||||||
import com.threerings.presents.dobj.ObjectAccessException;
|
import com.threerings.presents.dobj.ObjectAccessException;
|
||||||
import com.threerings.presents.util.PresentsContext;
|
import com.threerings.presents.util.PresentsContext;
|
||||||
|
|
||||||
import com.threerings.admin.Log;
|
import static com.threerings.admin.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to display and edit a particular distributed object field.
|
* Used to display and edit a particular distributed object field.
|
||||||
@@ -107,7 +107,7 @@ public abstract class FieldEditor extends JPanel
|
|||||||
try {
|
try {
|
||||||
_object.changeAttribute(_field.getName(), value);
|
_object.changeAttribute(_field.getName(), value);
|
||||||
} catch (ObjectAccessException oae) {
|
} catch (ObjectAccessException oae) {
|
||||||
Log.warning("Failed to update field " + _field.getName() +
|
log.warning("Failed to update field " + _field.getName() +
|
||||||
": "+ oae);
|
": "+ oae);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -128,7 +128,7 @@ public abstract class FieldEditor extends JPanel
|
|||||||
try {
|
try {
|
||||||
dvalue = getDisplayValue();
|
dvalue = getDisplayValue();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.warning("Failed to parse display value " + e + ".");
|
log.warning("Failed to parse display value " + e + ".");
|
||||||
displayValue(getValue());
|
displayValue(getValue());
|
||||||
}
|
}
|
||||||
updateBorder(!ObjectUtil.equals(dvalue, getValue()));
|
updateBorder(!ObjectUtil.equals(dvalue, getValue()));
|
||||||
@@ -154,7 +154,7 @@ public abstract class FieldEditor extends JPanel
|
|||||||
try {
|
try {
|
||||||
return _field.get(_object);
|
return _field.get(_object);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.warning("Failed to fetch field [field=" + _field +
|
log.warning("Failed to fetch field [field=" + _field +
|
||||||
", object=" + _object + ", error=" + e + "].");
|
", object=" + _object + ", error=" + e + "].");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,9 +37,10 @@ import com.threerings.presents.dobj.Subscriber;
|
|||||||
import com.threerings.presents.util.PresentsContext;
|
import com.threerings.presents.util.PresentsContext;
|
||||||
import com.threerings.presents.util.SafeSubscriber;
|
import com.threerings.presents.util.SafeSubscriber;
|
||||||
|
|
||||||
import com.threerings.admin.Log;
|
|
||||||
import com.threerings.admin.data.ConfigObject;
|
import com.threerings.admin.data.ConfigObject;
|
||||||
|
|
||||||
|
import static com.threerings.admin.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to edit the distributed object fields of a particular
|
* Used to edit the distributed object fields of a particular
|
||||||
* configuration object. When the panel is first shown, it will subscribe
|
* configuration object. When the panel is first shown, it will subscribe
|
||||||
@@ -111,7 +112,7 @@ public class ObjectEditorPanel extends ScrollablePanel
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (SecurityException se) {
|
} catch (SecurityException se) {
|
||||||
Log.warning("Unable to introspect DObject!? " + se);
|
log.warning("Unable to introspect DObject!? " + se);
|
||||||
}
|
}
|
||||||
|
|
||||||
SwingUtil.refresh(this);
|
SwingUtil.refresh(this);
|
||||||
@@ -120,7 +121,7 @@ public class ObjectEditorPanel extends ScrollablePanel
|
|||||||
// documentation inherited from interface
|
// documentation inherited from interface
|
||||||
public void requestFailed (int oid, ObjectAccessException cause)
|
public void requestFailed (int oid, ObjectAccessException cause)
|
||||||
{
|
{
|
||||||
Log.warning("Unable to subscribe to config object: " + cause);
|
log.warning("Unable to subscribe to config object: " + cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected PresentsContext _ctx;
|
protected PresentsContext _ctx;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import com.samskivert.util.ObjectUtil;
|
|||||||
import com.threerings.presents.dobj.DObject;
|
import com.threerings.presents.dobj.DObject;
|
||||||
import com.threerings.presents.util.PresentsContext;
|
import com.threerings.presents.util.PresentsContext;
|
||||||
|
|
||||||
import com.threerings.admin.Log;
|
import static com.threerings.admin.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows editing of a dobj field using a pulldown.
|
* Allows editing of a dobj field using a pulldown.
|
||||||
@@ -132,7 +132,7 @@ public class PulldownFieldEditor extends FieldEditor
|
|||||||
}
|
}
|
||||||
|
|
||||||
// cause shit to blow up minorly
|
// cause shit to blow up minorly
|
||||||
Log.warning("Value in dobj is not settable, disabling choice.");
|
log.warning("Value in dobj is not settable, disabling choice.");
|
||||||
Thread.dumpStack();
|
Thread.dumpStack();
|
||||||
_value.setEnabled(false);
|
_value.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
import com.samskivert.io.ByteArrayOutInputStream;
|
import com.samskivert.io.ByteArrayOutInputStream;
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
import com.threerings.admin.Log;
|
|
||||||
import com.threerings.io.ObjectInputStream;
|
import com.threerings.io.ObjectInputStream;
|
||||||
import com.threerings.io.ObjectOutputStream;
|
import com.threerings.io.ObjectOutputStream;
|
||||||
import com.threerings.io.Streamable;
|
import com.threerings.io.Streamable;
|
||||||
@@ -47,6 +46,8 @@ import com.threerings.presents.dobj.EntryUpdatedEvent;
|
|||||||
import com.threerings.presents.dobj.ObjectAccessException;
|
import com.threerings.presents.dobj.ObjectAccessException;
|
||||||
import com.threerings.presents.dobj.SetListener;
|
import com.threerings.presents.dobj.SetListener;
|
||||||
|
|
||||||
|
import static com.threerings.admin.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a registry of configuration distributed objects. Using distributed object to store
|
* Provides a registry of configuration distributed objects. Using distributed object to store
|
||||||
* runtime configuration data can be exceptionally useful in that clients (with admin privileges)
|
* runtime configuration data can be exceptionally useful in that clients (with admin privileges)
|
||||||
@@ -166,7 +167,7 @@ public abstract class ConfigRegistry
|
|||||||
object.addListener(this);
|
object.addListener(this);
|
||||||
|
|
||||||
} catch (SecurityException se) {
|
} catch (SecurityException se) {
|
||||||
Log.warning("Unable to reflect on " + cclass.getName() + ": " + se + ". " +
|
log.warning("Unable to reflect on " + cclass.getName() + ": " + se + ". " +
|
||||||
"Refusing to monitor object.");
|
"Refusing to monitor object.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -196,7 +197,7 @@ public abstract class ConfigRegistry
|
|||||||
try {
|
try {
|
||||||
value = object.getAttribute(event.getName());
|
value = object.getAttribute(event.getName());
|
||||||
} catch (ObjectAccessException oae) {
|
} catch (ObjectAccessException oae) {
|
||||||
Log.warning("Exception getting field [name=" + event.getName() +
|
log.warning("Exception getting field [name=" + event.getName() +
|
||||||
", exception=" + oae + "].");
|
", exception=" + oae + "].");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -239,7 +240,7 @@ public abstract class ConfigRegistry
|
|||||||
} else if (value instanceof long[]) {
|
} else if (value instanceof long[]) {
|
||||||
setValue(key, (long[]) value);
|
setValue(key, (long[]) value);
|
||||||
} else {
|
} else {
|
||||||
Log.info("Unable to flush config obj change [cobj=" + object.getClass().getName() +
|
log.info("Unable to flush config obj change [cobj=" + object.getClass().getName() +
|
||||||
", key=" + key + ", type=" + value.getClass().getName() +
|
", key=" + key + ", type=" + value.getClass().getName() +
|
||||||
", value=" + value + "].");
|
", value=" + value + "].");
|
||||||
}
|
}
|
||||||
@@ -314,18 +315,18 @@ public abstract class ConfigRegistry
|
|||||||
serialize(key, nameToKey(key), deserializedValue);
|
serialize(key, nameToKey(key), deserializedValue);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.warning("Failure decoding config value [type=" + type +
|
log.warning("Failure decoding config value [type=" + type +
|
||||||
", field=" + field + ", exception=" + e + "].");
|
", field=" + field + ", exception=" + e + "].");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.warning("Can't init field of unknown type " +
|
log.warning("Can't init field of unknown type " +
|
||||||
"[cobj=" + object.getClass().getName() + ", key=" + key +
|
"[cobj=" + object.getClass().getName() + ", key=" + key +
|
||||||
", type=" + type.getName() + "].");
|
", type=" + type.getName() + "].");
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (IllegalAccessException iae) {
|
} catch (IllegalAccessException iae) {
|
||||||
Log.warning("Can't set field [cobj=" + object.getClass().getName() +
|
log.warning("Can't set field [cobj=" + object.getClass().getName() +
|
||||||
", key=" + key + ", error=" + iae + "].");
|
", key=" + key + ", error=" + iae + "].");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -340,7 +341,7 @@ public abstract class ConfigRegistry
|
|||||||
try {
|
try {
|
||||||
value = object.getAttribute(attributeName);
|
value = object.getAttribute(attributeName);
|
||||||
} catch (ObjectAccessException oae) {
|
} catch (ObjectAccessException oae) {
|
||||||
Log.warning("Exception getting field [name=" + attributeName +
|
log.warning("Exception getting field [name=" + attributeName +
|
||||||
", error=" + oae + "].");
|
", error=" + oae + "].");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -348,7 +349,7 @@ public abstract class ConfigRegistry
|
|||||||
if (value instanceof Streamable) {
|
if (value instanceof Streamable) {
|
||||||
serialize(attributeName, key, value);
|
serialize(attributeName, key, value);
|
||||||
} else {
|
} else {
|
||||||
Log.info("Unable to flush config obj change [cobj=" + object.getClass().getName() +
|
log.info("Unable to flush config obj change [cobj=" + object.getClass().getName() +
|
||||||
", key=" + key + ", type=" + value.getClass().getName() +
|
", key=" + key + ", type=" + value.getClass().getName() +
|
||||||
", value=" + value + "].");
|
", value=" + value + "].");
|
||||||
}
|
}
|
||||||
@@ -366,7 +367,7 @@ public abstract class ConfigRegistry
|
|||||||
oout.flush();
|
oout.flush();
|
||||||
setValue(key, StringUtil.hexlate(out.toByteArray()));
|
setValue(key, StringUtil.hexlate(out.toByteArray()));
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
Log.info("Error serializing value " + value);
|
log.info("Error serializing value " + value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,9 +31,10 @@ import com.samskivert.util.StringUtil;
|
|||||||
|
|
||||||
import com.threerings.presents.dobj.DObject;
|
import com.threerings.presents.dobj.DObject;
|
||||||
|
|
||||||
import com.threerings.admin.Log;
|
|
||||||
import com.threerings.admin.server.persist.ConfigRepository;
|
import com.threerings.admin.server.persist.ConfigRepository;
|
||||||
|
|
||||||
|
import static com.threerings.admin.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements the {@link ConfigRegistry} using a JDBC database as a persistent store for the
|
* Implements the {@link ConfigRegistry} using a JDBC database as a persistent store for the
|
||||||
* configuration information. <em>Note:</em> config objects should only be created during server
|
* configuration information. <em>Note:</em> config objects should only be created during server
|
||||||
@@ -130,8 +131,7 @@ public class DatabaseConfigRegistry extends ConfigRegistry
|
|||||||
try {
|
try {
|
||||||
_data = _repo.loadConfig(_node, _path);
|
_data = _repo.loadConfig(_node, _path);
|
||||||
} catch (PersistenceException pe) {
|
} catch (PersistenceException pe) {
|
||||||
Log.warning("Failed to load object configuration [path=" + _path + "].");
|
log.warning("Failed to load object configuration [path=" + _path + "].", pe);
|
||||||
Log.logStackTrace(pe);
|
|
||||||
_data = new HashMap<String,String>();
|
_data = new HashMap<String,String>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
package com.threerings.admin.server;
|
package com.threerings.admin.server;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import com.samskivert.io.PersistenceException;
|
import com.samskivert.io.PersistenceException;
|
||||||
import com.samskivert.jdbc.depot.PersistenceContext;
|
import com.samskivert.jdbc.depot.PersistenceContext;
|
||||||
@@ -79,7 +78,7 @@ public class PeeredDatabaseConfigRegistry extends DatabaseConfigRegistry
|
|||||||
object.changeAttribute(change.left, change.right);
|
object.changeAttribute(change.left, change.right);
|
||||||
_pendingSyncs.add(change.left);
|
_pendingSyncs.add(change.left);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.log(Level.WARNING, "Config attribute sync failed " + change + ".", e);
|
log.warning("Config attribute sync failed " + change + ".", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,7 @@
|
|||||||
|
|
||||||
package com.threerings.bureau;
|
package com.threerings.bureau;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
import com.samskivert.util.Logger;
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains a reference to the log object used by the Bureau services.
|
* Contains a reference to the log object used by the Bureau services.
|
||||||
@@ -30,29 +29,5 @@ import java.util.logging.Logger;
|
|||||||
public class Log
|
public class Log
|
||||||
{
|
{
|
||||||
/** We dispatch our log messages through this logger. */
|
/** We dispatch our log messages through this logger. */
|
||||||
public static Logger log = Logger.getLogger("com.threerings.narya.bureau");
|
public static Logger log = Logger.getLogger("com.threerings.bureau");
|
||||||
|
|
||||||
/** Convenience function. */
|
|
||||||
public static void debug (String message)
|
|
||||||
{
|
|
||||||
log.fine(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Convenience function. */
|
|
||||||
public static void info (String message)
|
|
||||||
{
|
|
||||||
log.info(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Convenience function. */
|
|
||||||
public static void warning (String message)
|
|
||||||
{
|
|
||||||
log.warning(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Convenience function. */
|
|
||||||
public static void logStackTrace (Throwable t)
|
|
||||||
{
|
|
||||||
log.log(Level.WARNING, t.getMessage(), t);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,13 +5,14 @@ import com.threerings.bureau.data.BureauCodes;
|
|||||||
import com.samskivert.util.IntMap;
|
import com.samskivert.util.IntMap;
|
||||||
import com.samskivert.util.IntMaps;
|
import com.samskivert.util.IntMaps;
|
||||||
import com.threerings.bureau.data.AgentObject;
|
import com.threerings.bureau.data.AgentObject;
|
||||||
import com.threerings.bureau.Log;
|
|
||||||
import com.threerings.bureau.util.BureauContext;
|
import com.threerings.bureau.util.BureauContext;
|
||||||
import com.threerings.presents.client.Client;
|
import com.threerings.presents.client.Client;
|
||||||
import com.threerings.presents.dobj.Subscriber;
|
import com.threerings.presents.dobj.Subscriber;
|
||||||
import com.threerings.presents.util.SafeSubscriber;
|
import com.threerings.presents.util.SafeSubscriber;
|
||||||
import com.threerings.presents.dobj.ObjectAccessException;
|
import com.threerings.presents.dobj.ObjectAccessException;
|
||||||
|
|
||||||
|
import static com.threerings.bureau.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows the server to create and destroy agents on a client.
|
* Allows the server to create and destroy agents on a client.
|
||||||
* @see BureauRegistry
|
* @see BureauRegistry
|
||||||
@@ -48,7 +49,7 @@ public abstract class BureauDirector extends BasicDirector
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Log.info("Subscribing to object " + agentId);
|
log.info("Subscribing to object " + agentId);
|
||||||
|
|
||||||
SafeSubscriber<AgentObject> subscriber =
|
SafeSubscriber<AgentObject> subscriber =
|
||||||
new SafeSubscriber<AgentObject>(agentId, delegator);
|
new SafeSubscriber<AgentObject>(agentId, delegator);
|
||||||
@@ -65,19 +66,18 @@ public abstract class BureauDirector extends BasicDirector
|
|||||||
agent = _agents.remove(agentId);
|
agent = _agents.remove(agentId);
|
||||||
|
|
||||||
if (agent == null) {
|
if (agent == null) {
|
||||||
Log.warning("Lost an agent, id " + agentId);
|
log.warning("Lost an agent, id " + agentId);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
try {
|
try {
|
||||||
agent.stop();
|
agent.stop();
|
||||||
}
|
}
|
||||||
catch (Throwable t) {
|
catch (Throwable t) {
|
||||||
Log.warning("Stopping an agent caused an exception");
|
log.warning("Stopping an agent caused an exception", t);
|
||||||
Log.logStackTrace(t);
|
|
||||||
}
|
}
|
||||||
SafeSubscriber<AgentObject> subscriber = _subscribers.remove(agentId);
|
SafeSubscriber<AgentObject> subscriber = _subscribers.remove(agentId);
|
||||||
if (subscriber == null) {
|
if (subscriber == null) {
|
||||||
Log.warning("Lost a subscriber for agent " + agent);
|
log.warning("Lost a subscriber for agent " + agent);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
subscriber.unsubscribe(_ctx.getDObjectManager());
|
subscriber.unsubscribe(_ctx.getDObjectManager());
|
||||||
@@ -93,7 +93,7 @@ public abstract class BureauDirector extends BasicDirector
|
|||||||
{
|
{
|
||||||
int oid = agentObject.getOid();
|
int oid = agentObject.getOid();
|
||||||
|
|
||||||
Log.info("Object " + oid + " now available");
|
log.info("Object " + oid + " now available");
|
||||||
|
|
||||||
Agent agent;
|
Agent agent;
|
||||||
try {
|
try {
|
||||||
@@ -102,8 +102,7 @@ public abstract class BureauDirector extends BasicDirector
|
|||||||
agent.start();
|
agent.start();
|
||||||
}
|
}
|
||||||
catch (Throwable t) {
|
catch (Throwable t) {
|
||||||
Log.warning("Could not create agent [obj=" + agentObject + "]");
|
log.warning("Could not create agent [obj=" + agentObject + "]", t);
|
||||||
Log.logStackTrace(t);
|
|
||||||
_bureauService.agentCreationFailed(_ctx.getClient(), oid);
|
_bureauService.agentCreationFailed(_ctx.getClient(), oid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -117,8 +116,7 @@ public abstract class BureauDirector extends BasicDirector
|
|||||||
*/
|
*/
|
||||||
protected synchronized void requestFailed (int oid, ObjectAccessException cause)
|
protected synchronized void requestFailed (int oid, ObjectAccessException cause)
|
||||||
{
|
{
|
||||||
Log.warning("Could not subscribe to agent [oid=" + oid + "]");
|
log.warning("Could not subscribe to agent [oid=" + oid + "]", cause);
|
||||||
Log.logStackTrace(cause);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // from BasicDirector
|
@Override // from BasicDirector
|
||||||
|
|||||||
@@ -35,34 +35,35 @@ import com.samskivert.util.Invoker;
|
|||||||
import com.samskivert.util.ProcessLogger;
|
import com.samskivert.util.ProcessLogger;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.threerings.bureau.Log;
|
|
||||||
|
|
||||||
/**
|
import static com.threerings.bureau.Log.log;
|
||||||
* Abstracts the launching and termination of external processes (bureaus) that host instances of
|
|
||||||
|
/**
|
||||||
|
* Abstracts the launching and termination of external processes (bureaus) that host instances of
|
||||||
* server-side code (agents).
|
* server-side code (agents).
|
||||||
*/
|
*/
|
||||||
public class BureauRegistry
|
public class BureauRegistry
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Defines the commands that are responsible for invoking a bureau. Instances are associated to
|
* Defines the commands that are responsible for invoking a bureau. Instances are associated to
|
||||||
* bureau types by the server on startup. The instances are used whenever the registry needs to
|
* bureau types by the server on startup. The instances are used whenever the registry needs to
|
||||||
* launch a bureau for an agent with the assocated bureau type.
|
* launch a bureau for an agent with the assocated bureau type.
|
||||||
* @see setCommandGenerator
|
* @see setCommandGenerator
|
||||||
*/
|
*/
|
||||||
public static interface CommandGenerator
|
public static interface CommandGenerator
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Launches a new bureau using the given server connect-back url and other information.
|
* Launches a new bureau using the given server connect-back url and other information.
|
||||||
* Called by the registry when it decides a new bureau is needed.
|
* Called by the registry when it decides a new bureau is needed.
|
||||||
* @param serverNameAndPort the name and port the bureau should use to connect back to the
|
* @param serverNameAndPort the name and port the bureau should use to connect back to the
|
||||||
* server, e.g. server.com:47624
|
* server, e.g. server.com:47624
|
||||||
* @param bureauId the id of the bureau being launched
|
* @param bureauId the id of the bureau being launched
|
||||||
* @param token the token string to use for the credentials when logging in
|
* @param token the token string to use for the credentials when logging in
|
||||||
* @return the builder, ready to launch
|
* @return the builder, ready to launch
|
||||||
*/
|
*/
|
||||||
String[] createCommand (
|
String[] createCommand (
|
||||||
String serverNameAndPort,
|
String serverNameAndPort,
|
||||||
String bureauId,
|
String bureauId,
|
||||||
String token);
|
String token);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,8 +71,8 @@ public class BureauRegistry
|
|||||||
* Creates a new registry, prepared to provide bureau services.
|
* Creates a new registry, prepared to provide bureau services.
|
||||||
*/
|
*/
|
||||||
public BureauRegistry (
|
public BureauRegistry (
|
||||||
String serverNameAndPort,
|
String serverNameAndPort,
|
||||||
InvocationManager invmgr,
|
InvocationManager invmgr,
|
||||||
RootDObjectManager omgr,
|
RootDObjectManager omgr,
|
||||||
Invoker invoker)
|
Invoker invoker)
|
||||||
{
|
{
|
||||||
@@ -96,13 +97,13 @@ public class BureauRegistry
|
|||||||
};
|
};
|
||||||
|
|
||||||
_invmgr.registerDispatcher(
|
_invmgr.registerDispatcher(
|
||||||
new BureauDispatcher(provider),
|
new BureauDispatcher(provider),
|
||||||
BureauCodes.BUREAU_GROUP);
|
BureauCodes.BUREAU_GROUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a command generator for a given type. When an agent is started and no bureaus are
|
* Registers a command generator for a given type. When an agent is started and no bureaus are
|
||||||
* running, the <code>bureauType</code> is used to determine the <code>CommandGenerator</code>
|
* running, the <code>bureauType</code> is used to determine the <code>CommandGenerator</code>
|
||||||
* instance to call.
|
* instance to call.
|
||||||
* @param bureauType the type of bureau that will be launched
|
* @param bureauType the type of bureau that will be launched
|
||||||
* @param cmdGenerator the generator to be used for bureaus of <code>bureauType</code>
|
* @param cmdGenerator the generator to be used for bureaus of <code>bureauType</code>
|
||||||
@@ -110,7 +111,7 @@ public class BureauRegistry
|
|||||||
public void setCommandGenerator (String bureauType, CommandGenerator cmdGenerator)
|
public void setCommandGenerator (String bureauType, CommandGenerator cmdGenerator)
|
||||||
{
|
{
|
||||||
if (_generators.get(bureauType) != null) {
|
if (_generators.get(bureauType) != null) {
|
||||||
Log.warning("Generator for type already exists [type=" +
|
log.warning("Generator for type already exists [type=" +
|
||||||
bureauType + "]");
|
bureauType + "]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -118,7 +119,7 @@ public class BureauRegistry
|
|||||||
_generators.put(bureauType, cmdGenerator);
|
_generators.put(bureauType, cmdGenerator);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts a new agent using the data in the given object, creating a new bureau if necessary.
|
* Starts a new agent using the data in the given object, creating a new bureau if necessary.
|
||||||
*/
|
*/
|
||||||
public void startAgent (AgentObject agent)
|
public void startAgent (AgentObject agent)
|
||||||
@@ -128,7 +129,7 @@ public class BureauRegistry
|
|||||||
|
|
||||||
_omgr.registerObject(agent);
|
_omgr.registerObject(agent);
|
||||||
|
|
||||||
Log.info("Bureau ready, sending createAgent " +
|
log.info("Bureau ready, sending createAgent " +
|
||||||
StringUtil.toString(agent));
|
StringUtil.toString(agent));
|
||||||
|
|
||||||
BureauSender.createAgent(bureau.clientObj, agent.getOid());
|
BureauSender.createAgent(bureau.clientObj, agent.getOid());
|
||||||
@@ -143,12 +144,12 @@ public class BureauRegistry
|
|||||||
|
|
||||||
CommandGenerator generator = _generators.get(agent.bureauType);
|
CommandGenerator generator = _generators.get(agent.bureauType);
|
||||||
if (generator == null) {
|
if (generator == null) {
|
||||||
Log.warning("CommandGenerator not found for agent's " +
|
log.warning("CommandGenerator not found for agent's " +
|
||||||
"bureau type " + StringUtil.toString(agent));
|
"bureau type " + StringUtil.toString(agent));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.info("Creating new bureau " +
|
log.info("Creating new bureau " +
|
||||||
StringUtil.toString(agent.bureauId) + " " +
|
StringUtil.toString(agent.bureauId) + " " +
|
||||||
StringUtil.toString(generator));
|
StringUtil.toString(generator));
|
||||||
|
|
||||||
@@ -161,7 +162,7 @@ public class BureauRegistry
|
|||||||
_serverNameAndPort, agent.bureauId, ""));
|
_serverNameAndPort, agent.bureauId, ""));
|
||||||
|
|
||||||
bureau.builder.redirectErrorStream(true);
|
bureau.builder.redirectErrorStream(true);
|
||||||
|
|
||||||
_invoker.postUnit(new Launcher(bureau));
|
_invoker.postUnit(new Launcher(bureau));
|
||||||
|
|
||||||
_bureaus.put(agent.bureauId, bureau);
|
_bureaus.put(agent.bureauId, bureau);
|
||||||
@@ -170,13 +171,13 @@ public class BureauRegistry
|
|||||||
_omgr.registerObject(agent);
|
_omgr.registerObject(agent);
|
||||||
bureau.agentStates.put(agent, Bureau.PENDING);
|
bureau.agentStates.put(agent, Bureau.PENDING);
|
||||||
|
|
||||||
Log.info("Bureau not ready, pending agent " +
|
log.info("Bureau not ready, pending agent " +
|
||||||
StringUtil.toString(agent));
|
StringUtil.toString(agent));
|
||||||
|
|
||||||
bureau.summarize();
|
bureau.summarize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys a previously started agent using the data in the given object.
|
* Destroys a previously started agent using the data in the given object.
|
||||||
*/
|
*/
|
||||||
public void destroyAgent (AgentObject agent)
|
public void destroyAgent (AgentObject agent)
|
||||||
@@ -187,7 +188,7 @@ public class BureauRegistry
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.info("Destroying agent " + StringUtil.toString(agent));
|
log.info("Destroying agent " + StringUtil.toString(agent));
|
||||||
|
|
||||||
// transition the agent to a new state and perform the effect of the transition
|
// transition the agent to a new state and perform the effect of the transition
|
||||||
switch (found.state) {
|
switch (found.state) {
|
||||||
@@ -209,8 +210,8 @@ public class BureauRegistry
|
|||||||
|
|
||||||
case Bureau.DESTROYED:
|
case Bureau.DESTROYED:
|
||||||
case Bureau.STILL_BORN:
|
case Bureau.STILL_BORN:
|
||||||
Log.warning("Acknowledging a request to destory an agent, but agent " +
|
log.warning("Acknowledging a request to destory an agent, but agent " +
|
||||||
"is in state " + found.state + ", ignoring request " +
|
"is in state " + found.state + ", ignoring request " +
|
||||||
StringUtil.toString(found.agent));
|
StringUtil.toString(found.agent));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -219,14 +220,14 @@ public class BureauRegistry
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback for when the bureau client acknowledges starting up. Starts all pending agents and
|
* Callback for when the bureau client acknowledges starting up. Starts all pending agents and
|
||||||
* causes subsequent agent start requests to be sent directly to the bureau.
|
* causes subsequent agent start requests to be sent directly to the bureau.
|
||||||
*/
|
*/
|
||||||
protected void bureauInitialized (ClientObject client, String bureauId)
|
protected void bureauInitialized (ClientObject client, String bureauId)
|
||||||
{
|
{
|
||||||
final Bureau bureau = _bureaus.get(bureauId);
|
final Bureau bureau = _bureaus.get(bureauId);
|
||||||
if (bureau == null) {
|
if (bureau == null) {
|
||||||
Log.warning("Acknowledging initialization of non-existent bureau " +
|
log.warning("Acknowledging initialization of non-existent bureau " +
|
||||||
StringUtil.toString(bureauId));
|
StringUtil.toString(bureauId));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -239,13 +240,13 @@ public class BureauRegistry
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Log.info("Bureau created " + StringUtil.toString(bureau) +
|
log.info("Bureau created " + StringUtil.toString(bureau) +
|
||||||
", launching pending agents");
|
", launching pending agents");
|
||||||
|
|
||||||
// find all pending agents
|
// find all pending agents
|
||||||
Set<AgentObject> pending = Sets.newHashSet();
|
Set<AgentObject> pending = Sets.newHashSet();
|
||||||
|
|
||||||
for (Map.Entry<AgentObject, Integer> entry :
|
for (Map.Entry<AgentObject, Integer> entry :
|
||||||
bureau.agentStates.entrySet()) {
|
bureau.agentStates.entrySet()) {
|
||||||
|
|
||||||
if (entry.getValue() == Bureau.PENDING) {
|
if (entry.getValue() == Bureau.PENDING) {
|
||||||
@@ -255,7 +256,7 @@ public class BureauRegistry
|
|||||||
|
|
||||||
// create them
|
// create them
|
||||||
for (AgentObject agent : pending) {
|
for (AgentObject agent : pending) {
|
||||||
Log.info("Creating agent " + StringUtil.toString(agent));
|
log.info("Creating agent " + StringUtil.toString(agent));
|
||||||
BureauSender.createAgent(bureau.clientObj, agent.getOid());
|
BureauSender.createAgent(bureau.clientObj, agent.getOid());
|
||||||
bureau.agentStates.put(agent, Bureau.STARTED);
|
bureau.agentStates.put(agent, Bureau.STARTED);
|
||||||
}
|
}
|
||||||
@@ -273,7 +274,7 @@ public class BureauRegistry
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.info("Agent creation confirmed " + StringUtil.toString(found.agent));
|
log.info("Agent creation confirmed " + StringUtil.toString(found.agent));
|
||||||
|
|
||||||
switch (found.state) {
|
switch (found.state) {
|
||||||
case Bureau.STARTED:
|
case Bureau.STARTED:
|
||||||
@@ -288,7 +289,7 @@ public class BureauRegistry
|
|||||||
case Bureau.PENDING:
|
case Bureau.PENDING:
|
||||||
case Bureau.RUNNING:
|
case Bureau.RUNNING:
|
||||||
case Bureau.DESTROYED:
|
case Bureau.DESTROYED:
|
||||||
Log.warning("Received acknowledgement of the creation of an " +
|
log.warning("Received acknowledgement of the creation of an " +
|
||||||
"agent in state " + found.state + ", ignoring request " +
|
"agent in state " + found.state + ", ignoring request " +
|
||||||
StringUtil.toString(found.agent));
|
StringUtil.toString(found.agent));
|
||||||
break;
|
break;
|
||||||
@@ -307,7 +308,7 @@ public class BureauRegistry
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.info("Agent creation failed " + StringUtil.toString(found.agent));
|
log.info("Agent creation failed " + StringUtil.toString(found.agent));
|
||||||
|
|
||||||
switch (found.state) {
|
switch (found.state) {
|
||||||
case Bureau.STARTED:
|
case Bureau.STARTED:
|
||||||
@@ -318,7 +319,7 @@ public class BureauRegistry
|
|||||||
case Bureau.PENDING:
|
case Bureau.PENDING:
|
||||||
case Bureau.RUNNING:
|
case Bureau.RUNNING:
|
||||||
case Bureau.DESTROYED:
|
case Bureau.DESTROYED:
|
||||||
Log.warning("Received acknowledgement of creation failure for " +
|
log.warning("Received acknowledgement of creation failure for " +
|
||||||
"agent in state " + found.state + ", ignoring request " +
|
"agent in state " + found.state + ", ignoring request " +
|
||||||
StringUtil.toString(found.agent));
|
StringUtil.toString(found.agent));
|
||||||
break;
|
break;
|
||||||
@@ -336,8 +337,8 @@ public class BureauRegistry
|
|||||||
if (found == null) {
|
if (found == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.info("Agent destruction confirmed " + StringUtil.toString(found.agent));
|
log.info("Agent destruction confirmed " + StringUtil.toString(found.agent));
|
||||||
|
|
||||||
switch (found.state) {
|
switch (found.state) {
|
||||||
case Bureau.DESTROYED:
|
case Bureau.DESTROYED:
|
||||||
@@ -348,8 +349,8 @@ public class BureauRegistry
|
|||||||
case Bureau.STARTED:
|
case Bureau.STARTED:
|
||||||
case Bureau.RUNNING:
|
case Bureau.RUNNING:
|
||||||
case Bureau.STILL_BORN:
|
case Bureau.STILL_BORN:
|
||||||
Log.warning("Acknowledging agent destruction, but state is " +
|
log.warning("Acknowledging agent destruction, but state is " +
|
||||||
found.state + ", ignoring request " +
|
found.state + ", ignoring request " +
|
||||||
StringUtil.toString(found.agent));
|
StringUtil.toString(found.agent));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -357,12 +358,12 @@ public class BureauRegistry
|
|||||||
found.bureau.summarize();
|
found.bureau.summarize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback for when a client is destroyed.
|
* Callback for when a client is destroyed.
|
||||||
*/
|
*/
|
||||||
protected void clientDestroyed (Bureau bureau)
|
protected void clientDestroyed (Bureau bureau)
|
||||||
{
|
{
|
||||||
Log.info("Client destroyed, destroying all agents " +
|
log.info("Client destroyed, destroying all agents " +
|
||||||
StringUtil.toString(bureau));
|
StringUtil.toString(bureau));
|
||||||
|
|
||||||
// clean up any agents attached to this bureau
|
// clean up any agents attached to this bureau
|
||||||
@@ -378,13 +379,13 @@ public class BureauRegistry
|
|||||||
{
|
{
|
||||||
com.threerings.presents.dobj.DObject dobj = _omgr.getObject(agentId);
|
com.threerings.presents.dobj.DObject dobj = _omgr.getObject(agentId);
|
||||||
if (dobj == null) {
|
if (dobj == null) {
|
||||||
Log.warning("Non-existent agent in " + resolver +
|
log.warning("Non-existent agent in " + resolver +
|
||||||
" [agentId=" + agentId + "]");
|
" [agentId=" + agentId + "]");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(dobj instanceof AgentObject)) {
|
if (!(dobj instanceof AgentObject)) {
|
||||||
Log.warning("Object not an agent in " + resolver +
|
log.warning("Object not an agent in " + resolver +
|
||||||
" " + StringUtil.toString(dobj));
|
" " + StringUtil.toString(dobj));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -392,20 +393,20 @@ public class BureauRegistry
|
|||||||
AgentObject agent = (AgentObject)dobj;
|
AgentObject agent = (AgentObject)dobj;
|
||||||
Bureau bureau = _bureaus.get(agent.bureauId);
|
Bureau bureau = _bureaus.get(agent.bureauId);
|
||||||
if (bureau == null) {
|
if (bureau == null) {
|
||||||
Log.warning("Bureau not found for agent in " + resolver +
|
log.warning("Bureau not found for agent in " + resolver +
|
||||||
" " + StringUtil.toString(agent));
|
" " + StringUtil.toString(agent));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bureau.agentStates.containsKey(agent)) {
|
if (!bureau.agentStates.containsKey(agent)) {
|
||||||
Log.warning("Bureau does not have agent in " + resolver +
|
log.warning("Bureau does not have agent in " + resolver +
|
||||||
" " + StringUtil.toString(agent));
|
" " + StringUtil.toString(agent));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client != null && bureau.clientObj != client) {
|
if (client != null && bureau.clientObj != client) {
|
||||||
Log.warning("Masquerading request in " + resolver +
|
log.warning("Masquerading request in " + resolver +
|
||||||
" " + StringUtil.toString(agent) +
|
" " + StringUtil.toString(agent) +
|
||||||
" " + StringUtil.toString(bureau.clientObj) +
|
" " + StringUtil.toString(bureau.clientObj) +
|
||||||
" " + StringUtil.toString(client));
|
" " + StringUtil.toString(client));
|
||||||
return null;
|
return null;
|
||||||
@@ -421,7 +422,7 @@ public class BureauRegistry
|
|||||||
{
|
{
|
||||||
Launcher (Bureau bureau)
|
Launcher (Bureau bureau)
|
||||||
{
|
{
|
||||||
super("Launcher for " + bureau +
|
super("Launcher for " + bureau +
|
||||||
StringUtil.toString(bureau.builder.command()));
|
StringUtil.toString(bureau.builder.command()));
|
||||||
_bureau = bureau;
|
_bureau = bureau;
|
||||||
}
|
}
|
||||||
@@ -430,26 +431,20 @@ public class BureauRegistry
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
_result = _bureau.builder.start();
|
_result = _bureau.builder.start();
|
||||||
|
|
||||||
// log the output of the process and prefix with bureau id
|
// log the output of the process and prefix with bureau id
|
||||||
ProcessLogger.copyMergedOutput(
|
ProcessLogger.copyMergedOutput(log, _bureau.bureauId, _result);
|
||||||
Log.log, _bureau.bureauId, _result);
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
Log.warning("Could not launch process for bureau " +
|
|
||||||
StringUtil.toString(_bureau));
|
|
||||||
Log.logStackTrace(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warning("Could not launch process", "bureau", _bureau, e);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleResult ()
|
public void handleResult ()
|
||||||
{
|
{
|
||||||
_bureau.process = _result;
|
_bureau.process = _result;
|
||||||
_bureau.builder = null;
|
_bureau.builder = null;
|
||||||
Log.info("Bureau launched " +
|
log.info("Bureau launched", "bureau", _bureau);
|
||||||
StringUtil.toString(_bureau));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Bureau _bureau;
|
protected Bureau _bureau;
|
||||||
@@ -460,8 +455,8 @@ public class BureauRegistry
|
|||||||
protected static class FoundAgent
|
protected static class FoundAgent
|
||||||
{
|
{
|
||||||
FoundAgent (
|
FoundAgent (
|
||||||
Bureau bureau,
|
Bureau bureau,
|
||||||
AgentObject agent,
|
AgentObject agent,
|
||||||
int state)
|
int state)
|
||||||
{
|
{
|
||||||
this.bureau = bureau;
|
this.bureau = bureau;
|
||||||
@@ -493,7 +488,7 @@ public class BureauRegistry
|
|||||||
// Agent ack'ed, now live and hosting, ready to tell other clients
|
// Agent ack'ed, now live and hosting, ready to tell other clients
|
||||||
static final int RUNNING = 2;
|
static final int RUNNING = 2;
|
||||||
|
|
||||||
// Agent destruction requested, waiting for acknowledge (after which the agent is removed
|
// Agent destruction requested, waiting for acknowledge (after which the agent is removed
|
||||||
// from the Bureau, so has no state)
|
// from the Bureau, so has no state)
|
||||||
static final int DESTROYED = 3;
|
static final int DESTROYED = 3;
|
||||||
|
|
||||||
@@ -512,7 +507,7 @@ public class BureauRegistry
|
|||||||
// with this id should be associated with one instance
|
// with this id should be associated with one instance
|
||||||
String bureauId;
|
String bureauId;
|
||||||
|
|
||||||
// The client object of the bureau that has opened a dobj connection to
|
// The client object of the bureau that has opened a dobj connection to
|
||||||
// the registry
|
// the registry
|
||||||
ClientObject clientObj;
|
ClientObject clientObj;
|
||||||
|
|
||||||
@@ -560,7 +555,7 @@ public class BureauRegistry
|
|||||||
StringBuilder str = new StringBuilder();
|
StringBuilder str = new StringBuilder();
|
||||||
str.append("Bureau ").append(bureauId).append(" [");
|
str.append("Bureau ").append(bureauId).append(" [");
|
||||||
agentSummary(str).append("]");
|
agentSummary(str).append("]");
|
||||||
Log.info(str.toString());
|
log.info(str.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,7 @@
|
|||||||
|
|
||||||
package com.threerings.crowd;
|
package com.threerings.crowd;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
import com.samskivert.util.Logger;
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains a reference to the log object used by the Crowd services.
|
* Contains a reference to the log object used by the Crowd services.
|
||||||
@@ -30,30 +29,5 @@ import java.util.logging.Logger;
|
|||||||
public class Log
|
public class Log
|
||||||
{
|
{
|
||||||
/** We dispatch our log messages through this logger. */
|
/** We dispatch our log messages through this logger. */
|
||||||
public static Logger log =
|
public static Logger log = Logger.getLogger("com.threerings.crowd");
|
||||||
Logger.getLogger("com.threerings.narya.crowd");
|
|
||||||
|
|
||||||
/** Convenience function. */
|
|
||||||
public static void debug (String message)
|
|
||||||
{
|
|
||||||
log.fine(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Convenience function. */
|
|
||||||
public static void info (String message)
|
|
||||||
{
|
|
||||||
log.info(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Convenience function. */
|
|
||||||
public static void warning (String message)
|
|
||||||
{
|
|
||||||
log.warning(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Convenience function. */
|
|
||||||
public static void logStackTrace (Throwable t)
|
|
||||||
{
|
|
||||||
log.log(Level.WARNING, t.getMessage(), t);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ import com.threerings.util.MessageManager;
|
|||||||
import com.threerings.util.Name;
|
import com.threerings.util.Name;
|
||||||
import com.threerings.util.TimeUtil;
|
import com.threerings.util.TimeUtil;
|
||||||
|
|
||||||
import com.threerings.crowd.Log;
|
|
||||||
import com.threerings.crowd.client.LocationObserver;
|
import com.threerings.crowd.client.LocationObserver;
|
||||||
import com.threerings.crowd.data.BodyObject;
|
import com.threerings.crowd.data.BodyObject;
|
||||||
import com.threerings.crowd.data.CrowdCodes;
|
import com.threerings.crowd.data.CrowdCodes;
|
||||||
@@ -63,6 +62,8 @@ import com.threerings.crowd.chat.data.TellFeedbackMessage;
|
|||||||
import com.threerings.crowd.chat.data.UserMessage;
|
import com.threerings.crowd.chat.data.UserMessage;
|
||||||
import com.threerings.crowd.chat.data.UserSystemMessage;
|
import com.threerings.crowd.chat.data.UserSystemMessage;
|
||||||
|
|
||||||
|
import static com.threerings.crowd.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The chat director is the client side coordinator of all chat related services. It handles both
|
* The chat director is the client side coordinator of all chat related services. It handles both
|
||||||
* place constrained chat as well as direct messaging.
|
* place constrained chat as well as direct messaging.
|
||||||
@@ -148,7 +149,7 @@ public class ChatDirector extends BasicDirector
|
|||||||
|
|
||||||
// register our default chat handlers
|
// register our default chat handlers
|
||||||
if (_bundle == null || _msgmgr == null) {
|
if (_bundle == null || _msgmgr == null) {
|
||||||
Log.warning("Null bundle or message manager given to ChatDirector");
|
log.warning("Null bundle or message manager given to ChatDirector");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
registerCommandHandlers();
|
registerCommandHandlers();
|
||||||
@@ -1001,7 +1002,7 @@ public class ChatDirector extends BasicDirector
|
|||||||
if (bundle != null && _msgmgr != null) {
|
if (bundle != null && _msgmgr != null) {
|
||||||
MessageBundle msgb = _msgmgr.getBundle(bundle);
|
MessageBundle msgb = _msgmgr.getBundle(bundle);
|
||||||
if (msgb == null) {
|
if (msgb == null) {
|
||||||
Log.warning("No message bundle available to translate message " +
|
log.warning("No message bundle available to translate message " +
|
||||||
"[bundle=" + bundle + ", message=" + message + "].");
|
"[bundle=" + bundle + ", message=" + message + "].");
|
||||||
} else {
|
} else {
|
||||||
message = msgb.xlate(message);
|
message = msgb.xlate(message);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import com.samskivert.util.StringUtil;
|
|||||||
|
|
||||||
import com.threerings.util.Name;
|
import com.threerings.util.Name;
|
||||||
|
|
||||||
import com.threerings.crowd.Log;
|
import static com.threerings.crowd.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A chat filter that can filter out curse words from user chat.
|
* A chat filter that can filter out curse words from user chat.
|
||||||
@@ -150,7 +150,7 @@ public abstract class CurseFilter implements ChatFilter
|
|||||||
String mapping = st.nextToken();
|
String mapping = st.nextToken();
|
||||||
StringTokenizer st2 = new StringTokenizer(mapping, "=");
|
StringTokenizer st2 = new StringTokenizer(mapping, "=");
|
||||||
if (st2.countTokens() != 2) {
|
if (st2.countTokens() != 2) {
|
||||||
Log.warning("Something looks wrong in the x.cursewords " +
|
log.warning("Something looks wrong in the x.cursewords " +
|
||||||
"properties (" + mapping + "), skipping.");
|
"properties (" + mapping + "), skipping.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,10 +27,11 @@ import com.threerings.presents.data.ClientObject;
|
|||||||
import com.threerings.presents.dobj.DObject;
|
import com.threerings.presents.dobj.DObject;
|
||||||
import com.threerings.presents.server.InvocationManager;
|
import com.threerings.presents.server.InvocationManager;
|
||||||
|
|
||||||
import com.threerings.crowd.Log;
|
|
||||||
import com.threerings.crowd.chat.data.ChatCodes;
|
import com.threerings.crowd.chat.data.ChatCodes;
|
||||||
import com.threerings.crowd.data.BodyObject;
|
import com.threerings.crowd.data.BodyObject;
|
||||||
|
|
||||||
|
import static com.threerings.crowd.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wires up the {@link SpeakService} to a particular distributed object. A server entity can make
|
* Wires up the {@link SpeakService} to a particular distributed object. A server entity can make
|
||||||
* "speech" available among the subscribers of a particular distributed object by constructing a
|
* "speech" available among the subscribers of a particular distributed object by constructing a
|
||||||
@@ -86,7 +87,7 @@ public class SpeakHandler
|
|||||||
// ensure that the speaker is valid
|
// ensure that the speaker is valid
|
||||||
if ((mode == ChatCodes.BROADCAST_MODE) ||
|
if ((mode == ChatCodes.BROADCAST_MODE) ||
|
||||||
(_validator != null && !_validator.isValidSpeaker(_speakObj, caller, mode))) {
|
(_validator != null && !_validator.isValidSpeaker(_speakObj, caller, mode))) {
|
||||||
Log.warning("Refusing invalid speak request [caller=" + caller.who() +
|
log.warning("Refusing invalid speak request [caller=" + caller.who() +
|
||||||
", speakObj=" + _speakObj.which() +
|
", speakObj=" + _speakObj.which() +
|
||||||
", message=" + message + ", mode=" + mode + "].");
|
", message=" + message + ", mode=" + mode + "].");
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import com.threerings.presents.data.ClientObject;
|
|||||||
import com.threerings.presents.dobj.DObject;
|
import com.threerings.presents.dobj.DObject;
|
||||||
import com.threerings.presents.server.InvocationProvider;
|
import com.threerings.presents.server.InvocationProvider;
|
||||||
|
|
||||||
import com.threerings.crowd.Log;
|
|
||||||
import com.threerings.crowd.data.BodyObject;
|
import com.threerings.crowd.data.BodyObject;
|
||||||
import com.threerings.crowd.server.CrowdServer;
|
import com.threerings.crowd.server.CrowdServer;
|
||||||
|
|
||||||
@@ -42,6 +41,8 @@ import com.threerings.crowd.chat.data.SpeakObject;
|
|||||||
import com.threerings.crowd.chat.data.SystemMessage;
|
import com.threerings.crowd.chat.data.SystemMessage;
|
||||||
import com.threerings.crowd.chat.data.UserMessage;
|
import com.threerings.crowd.chat.data.UserMessage;
|
||||||
|
|
||||||
|
import static com.threerings.crowd.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the back-end of the chat speaking facilities.
|
* Provides the back-end of the chat speaking facilities.
|
||||||
*/
|
*/
|
||||||
@@ -174,7 +175,7 @@ public class SpeakUtil
|
|||||||
public static void sendMessage (DObject speakObj, ChatMessage msg)
|
public static void sendMessage (DObject speakObj, ChatMessage msg)
|
||||||
{
|
{
|
||||||
if (speakObj == null) {
|
if (speakObj == null) {
|
||||||
Log.warning("Dropping speak message, no speak obj '" + msg + "'.");
|
log.warning("Dropping speak message, no speak obj '" + msg + "'.");
|
||||||
Thread.dumpStack();
|
Thread.dumpStack();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -192,7 +193,7 @@ public class SpeakUtil
|
|||||||
_messageMapper.message = null;
|
_messageMapper.message = null;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.info("Unable to note listeners [dclass=" + speakObj.getClass() +
|
log.info("Unable to note listeners [dclass=" + speakObj.getClass() +
|
||||||
", msg=" + msg + "].");
|
", msg=" + msg + "].");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,6 @@
|
|||||||
|
|
||||||
package com.threerings.crowd.client;
|
package com.threerings.crowd.client;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import com.samskivert.util.ObserverList;
|
import com.samskivert.util.ObserverList;
|
||||||
import com.samskivert.util.ObserverList.ObserverOp;
|
import com.samskivert.util.ObserverList.ObserverOp;
|
||||||
import com.samskivert.util.ResultListener;
|
import com.samskivert.util.ResultListener;
|
||||||
@@ -262,7 +260,7 @@ public class LocationDirector extends BasicDirector
|
|||||||
try {
|
try {
|
||||||
_controller.mayLeavePlace(_plobj);
|
_controller.mayLeavePlace(_plobj);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.log(Level.WARNING, "Place controller choked in mayLeavePlace " +
|
log.warning("Place controller choked in mayLeavePlace " +
|
||||||
"[plobj=" + _plobj + "].", e);
|
"[plobj=" + _plobj + "].", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -324,7 +322,7 @@ public class LocationDirector extends BasicDirector
|
|||||||
_subber.subscribe(_ctx.getDObjectManager());
|
_subber.subscribe(_ctx.getDObjectManager());
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.log(Level.WARNING, "Failed to create place controller [config=" + config + "].", e);
|
log.warning("Failed to create place controller [config=" + config + "].", e);
|
||||||
handleFailure(_placeId, LocationCodes.E_INTERNAL_ERROR);
|
handleFailure(_placeId, LocationCodes.E_INTERNAL_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -347,7 +345,7 @@ public class LocationDirector extends BasicDirector
|
|||||||
try {
|
try {
|
||||||
_controller.didLeavePlace(_plobj);
|
_controller.didLeavePlace(_plobj);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.log(Level.WARNING, "Place controller choked in didLeavePlace " +
|
log.warning("Place controller choked in didLeavePlace " +
|
||||||
"[plobj=" + _plobj + "].", e);
|
"[plobj=" + _plobj + "].", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -461,7 +459,7 @@ public class LocationDirector extends BasicDirector
|
|||||||
try {
|
try {
|
||||||
_controller.willEnterPlace(_plobj);
|
_controller.willEnterPlace(_plobj);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.log(Level.WARNING, "Controller choked in willEnterPlace " +
|
log.warning("Controller choked in willEnterPlace " +
|
||||||
"[place=" + _plobj + "].", e);
|
"[place=" + _plobj + "].", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,11 +33,12 @@ import com.threerings.presents.dobj.EntryRemovedEvent;
|
|||||||
import com.threerings.presents.dobj.EntryUpdatedEvent;
|
import com.threerings.presents.dobj.EntryUpdatedEvent;
|
||||||
import com.threerings.presents.dobj.SetListener;
|
import com.threerings.presents.dobj.SetListener;
|
||||||
|
|
||||||
import com.threerings.crowd.Log;
|
|
||||||
import com.threerings.crowd.data.OccupantInfo;
|
import com.threerings.crowd.data.OccupantInfo;
|
||||||
import com.threerings.crowd.data.PlaceObject;
|
import com.threerings.crowd.data.PlaceObject;
|
||||||
import com.threerings.crowd.util.CrowdContext;
|
import com.threerings.crowd.util.CrowdContext;
|
||||||
|
|
||||||
|
import static com.threerings.crowd.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The occupant director listens for occupants of places to enter and
|
* The occupant director listens for occupants of places to enter and
|
||||||
* exit, and dispatches notices to interested parties about these events.
|
* exit, and dispatches notices to interested parties about these events.
|
||||||
|
|||||||
@@ -23,9 +23,10 @@ package com.threerings.crowd.client;
|
|||||||
|
|
||||||
import java.awt.Container;
|
import java.awt.Container;
|
||||||
|
|
||||||
import com.threerings.crowd.Log;
|
|
||||||
import com.threerings.crowd.data.PlaceObject;
|
import com.threerings.crowd.data.PlaceObject;
|
||||||
|
|
||||||
|
import static com.threerings.crowd.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a mechanism for dispatching notifications to all user
|
* Provides a mechanism for dispatching notifications to all user
|
||||||
* interface elements in a hierarchy that implement the {@link PlaceView}
|
* interface elements in a hierarchy that implement the {@link PlaceView}
|
||||||
@@ -51,9 +52,8 @@ public class PlaceViewUtil
|
|||||||
try {
|
try {
|
||||||
((PlaceView)root).willEnterPlace(plobj);
|
((PlaceView)root).willEnterPlace(plobj);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.warning("Component choked on willEnterPlace() " +
|
log.warning("Component choked on willEnterPlace() " +
|
||||||
"[component=" + root + ", plobj=" + plobj + "].");
|
"[component=" + root + ", plobj=" + plobj + "].", e);
|
||||||
Log.logStackTrace(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,9 +84,8 @@ public class PlaceViewUtil
|
|||||||
try {
|
try {
|
||||||
((PlaceView)root).didLeavePlace(plobj);
|
((PlaceView)root).didLeavePlace(plobj);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.warning("Component choked on didLeavePlace() " +
|
log.warning("Component choked on didLeavePlace() " +
|
||||||
"[component=" + root + ", plobj=" + plobj + "].");
|
"[component=" + root + ", plobj=" + plobj + "].", e);
|
||||||
Log.logStackTrace(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,9 +26,10 @@ import com.samskivert.util.StringUtil;
|
|||||||
import com.threerings.io.SimpleStreamableObject;
|
import com.threerings.io.SimpleStreamableObject;
|
||||||
import com.threerings.util.ActionScript;
|
import com.threerings.util.ActionScript;
|
||||||
|
|
||||||
import com.threerings.crowd.Log;
|
|
||||||
import com.threerings.crowd.client.PlaceController;
|
import com.threerings.crowd.client.PlaceController;
|
||||||
|
|
||||||
|
import static com.threerings.crowd.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The place config class encapsulates the configuration information for a
|
* The place config class encapsulates the configuration information for a
|
||||||
* particular type of place. The hierarchy of place config objects mimics
|
* particular type of place. The hierarchy of place config objects mimics
|
||||||
@@ -67,14 +68,12 @@ public abstract class PlaceConfig extends SimpleStreamableObject
|
|||||||
"PlaceConfig.createController() must be overridden.");
|
"PlaceConfig.createController() must be overridden.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.warning("Providing backwards compatibility. PlaceConfig." +
|
log.warning("Providing backwards compatibility. PlaceConfig." +
|
||||||
"createController() should be overridden directly.");
|
"createController() should be overridden directly.");
|
||||||
try {
|
try {
|
||||||
return (PlaceController)cclass.newInstance();
|
return (PlaceController)cclass.newInstance();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.warning("Failed to instantiate controller class '" +
|
log.warning("Failed to instantiate controller class '" + cclass + "'.", e);
|
||||||
cclass + "'.");
|
|
||||||
Log.logStackTrace(e);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,10 +31,11 @@ import com.threerings.presents.dobj.DSet;
|
|||||||
import com.threerings.presents.dobj.OidList;
|
import com.threerings.presents.dobj.OidList;
|
||||||
import com.threerings.presents.dobj.ServerMessageEvent;
|
import com.threerings.presents.dobj.ServerMessageEvent;
|
||||||
|
|
||||||
import com.threerings.crowd.Log;
|
|
||||||
import com.threerings.crowd.chat.data.SpeakMarshaller;
|
import com.threerings.crowd.chat.data.SpeakMarshaller;
|
||||||
import com.threerings.crowd.chat.data.SpeakObject;
|
import com.threerings.crowd.chat.data.SpeakObject;
|
||||||
|
|
||||||
|
import static com.threerings.crowd.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A distributed object that contains information on a place that is occupied by bodies. This place
|
* A distributed object that contains information on a place that is occupied by bodies. This place
|
||||||
* might be a chat room, a game room, an island in a massively multiplayer piratical universe,
|
* might be a chat room, a game room, an island in a massively multiplayer piratical universe,
|
||||||
@@ -131,8 +132,7 @@ public class PlaceObject extends DObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
Log.warning("PlaceObject.getOccupantInfo choked.");
|
log.warning("PlaceObject.getOccupantInfo choked.", t);
|
||||||
Log.logStackTrace(t);
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,12 +26,13 @@ import com.threerings.presents.server.InvocationException;
|
|||||||
import com.threerings.presents.server.InvocationManager;
|
import com.threerings.presents.server.InvocationManager;
|
||||||
import com.threerings.presents.server.InvocationProvider;
|
import com.threerings.presents.server.InvocationProvider;
|
||||||
|
|
||||||
import com.threerings.crowd.Log;
|
|
||||||
import com.threerings.crowd.data.BodyObject;
|
import com.threerings.crowd.data.BodyObject;
|
||||||
import com.threerings.crowd.data.CrowdCodes;
|
import com.threerings.crowd.data.CrowdCodes;
|
||||||
import com.threerings.crowd.data.OccupantInfo;
|
import com.threerings.crowd.data.OccupantInfo;
|
||||||
import com.threerings.crowd.data.Place;
|
import com.threerings.crowd.data.Place;
|
||||||
|
|
||||||
|
import static com.threerings.crowd.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the server-side side of the body-related invocation services.
|
* Provides the server-side side of the body-related invocation services.
|
||||||
*/
|
*/
|
||||||
@@ -76,7 +77,7 @@ public class BodyProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update their status!
|
// update their status!
|
||||||
Log.debug("Setting user idle state [user=" + bobj.username + ", status=" + nstatus + "].");
|
log.debug("Setting user idle state [user=" + bobj.username + ", status=" + nstatus + "].");
|
||||||
updateOccupantStatus(bobj, bobj.location, nstatus);
|
updateOccupantStatus(bobj, bobj.location, nstatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,10 +33,11 @@ import com.threerings.presents.server.InvocationManager;
|
|||||||
import com.threerings.presents.server.PresentsClient;
|
import com.threerings.presents.server.PresentsClient;
|
||||||
import com.threerings.presents.server.PresentsServer;
|
import com.threerings.presents.server.PresentsServer;
|
||||||
|
|
||||||
import com.threerings.crowd.Log;
|
|
||||||
import com.threerings.crowd.chat.server.ChatProvider;
|
import com.threerings.crowd.chat.server.ChatProvider;
|
||||||
import com.threerings.crowd.data.BodyObject;
|
import com.threerings.crowd.data.BodyObject;
|
||||||
|
|
||||||
|
import static com.threerings.crowd.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The crowd server extends the presents server by configuring it to use the
|
* The crowd server extends the presents server by configuring it to use the
|
||||||
* extensions provided by the crowd layer to support crowd services.
|
* extensions provided by the crowd layer to support crowd services.
|
||||||
@@ -143,8 +144,7 @@ public class CrowdServer extends PresentsServer
|
|||||||
server.init();
|
server.init();
|
||||||
server.run();
|
server.run();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.warning("Unable to initialize server.");
|
log.warning("Unable to initialize server.", e);
|
||||||
Log.logStackTrace(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import com.threerings.presents.server.InvocationManager;
|
|||||||
import com.threerings.presents.server.InvocationProvider;
|
import com.threerings.presents.server.InvocationProvider;
|
||||||
import com.threerings.presents.server.PresentsClient;
|
import com.threerings.presents.server.PresentsClient;
|
||||||
|
|
||||||
import com.threerings.crowd.Log;
|
|
||||||
import com.threerings.crowd.client.LocationService;
|
import com.threerings.crowd.client.LocationService;
|
||||||
import com.threerings.crowd.data.BodyObject;
|
import com.threerings.crowd.data.BodyObject;
|
||||||
import com.threerings.crowd.data.LocationCodes;
|
import com.threerings.crowd.data.LocationCodes;
|
||||||
@@ -39,6 +38,8 @@ import com.threerings.crowd.data.PlaceConfig;
|
|||||||
import com.threerings.crowd.data.PlaceObject;
|
import com.threerings.crowd.data.PlaceObject;
|
||||||
import com.threerings.crowd.server.CrowdServer;
|
import com.threerings.crowd.server.CrowdServer;
|
||||||
|
|
||||||
|
import static com.threerings.crowd.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class provides the server end of the location services.
|
* This class provides the server end of the location services.
|
||||||
*/
|
*/
|
||||||
@@ -96,7 +97,7 @@ public class LocationProvider
|
|||||||
// make sure the place in question actually exists
|
// make sure the place in question actually exists
|
||||||
PlaceManager pmgr = _plreg.getPlaceManager(placeOid);
|
PlaceManager pmgr = _plreg.getPlaceManager(placeOid);
|
||||||
if (pmgr == null) {
|
if (pmgr == null) {
|
||||||
Log.info("Requested to move to non-existent place [who=" + source.who() +
|
log.info("Requested to move to non-existent place [who=" + source.who() +
|
||||||
", placeOid=" + placeOid + "].");
|
", placeOid=" + placeOid + "].");
|
||||||
throw new InvocationException(NO_SUCH_PLACE);
|
throw new InvocationException(NO_SUCH_PLACE);
|
||||||
}
|
}
|
||||||
@@ -105,7 +106,7 @@ public class LocationProvider
|
|||||||
// because we don't need to update anything in distributed object world
|
// because we don't need to update anything in distributed object world
|
||||||
Place place = pmgr.getLocation();
|
Place place = pmgr.getLocation();
|
||||||
if (place.equals(source.location)) {
|
if (place.equals(source.location)) {
|
||||||
Log.debug("Going along with client request to move to where they already are " +
|
log.debug("Going along with client request to move to where they already are " +
|
||||||
"[source=" + source.who() + ", place=" + place + "].");
|
"[source=" + source.who() + ", place=" + place + "].");
|
||||||
return pmgr.getConfig();
|
return pmgr.getConfig();
|
||||||
}
|
}
|
||||||
@@ -196,12 +197,12 @@ public class LocationProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.info("Body's prior location no longer around? [boid=" + bodoid +
|
log.info("Body's prior location no longer around? [boid=" + bodoid +
|
||||||
", place=" + oldloc + "].");
|
", place=" + oldloc + "].");
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (ClassCastException cce) {
|
} catch (ClassCastException cce) {
|
||||||
Log.warning("Body claims to occupy non-PlaceObject!? [boid=" + bodoid +
|
log.warning("Body claims to occupy non-PlaceObject!? [boid=" + bodoid +
|
||||||
", place=" + oldloc + ", error=" + cce + "].");
|
", place=" + oldloc + ", error=" + cce + "].");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ package com.threerings.crowd.server;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
@@ -51,7 +50,6 @@ import com.threerings.presents.dobj.SetAdapter;
|
|||||||
import com.threerings.presents.server.InvocationManager;
|
import com.threerings.presents.server.InvocationManager;
|
||||||
import com.threerings.presents.server.PresentsDObjectMgr;
|
import com.threerings.presents.server.PresentsDObjectMgr;
|
||||||
|
|
||||||
import com.threerings.crowd.Log;
|
|
||||||
import com.threerings.crowd.data.BodyObject;
|
import com.threerings.crowd.data.BodyObject;
|
||||||
import com.threerings.crowd.data.OccupantInfo;
|
import com.threerings.crowd.data.OccupantInfo;
|
||||||
import com.threerings.crowd.data.Place;
|
import com.threerings.crowd.data.Place;
|
||||||
@@ -62,6 +60,8 @@ import com.threerings.crowd.chat.data.SpeakMarshaller;
|
|||||||
import com.threerings.crowd.chat.server.SpeakDispatcher;
|
import com.threerings.crowd.chat.server.SpeakDispatcher;
|
||||||
import com.threerings.crowd.chat.server.SpeakHandler;
|
import com.threerings.crowd.chat.server.SpeakHandler;
|
||||||
|
|
||||||
|
import static com.threerings.crowd.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The place manager is the server-side entity that handles all place-related interaction. It
|
* The place manager is the server-side entity that handles all place-related interaction. It
|
||||||
* subscribes to the place object and reacts to message and other events. Behavior specific to a
|
* subscribes to the place object and reacts to message and other events. Behavior specific to a
|
||||||
@@ -309,9 +309,8 @@ public class PlaceManager
|
|||||||
return info;
|
return info;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.warning("Failure building occupant info [where=" + where() +
|
log.warning("Failure building occupant info [where=" + where() +
|
||||||
", body=" + body + "].");
|
", body=" + body + "].", e);
|
||||||
Log.logStackTrace(e);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -546,9 +545,7 @@ public class PlaceManager
|
|||||||
*/
|
*/
|
||||||
protected void bodyEntered (final int bodyOid)
|
protected void bodyEntered (final int bodyOid)
|
||||||
{
|
{
|
||||||
if (Log.log.getLevel() == Level.FINE) {
|
log.debug("Body entered", "where", where(), "oid", bodyOid);
|
||||||
Log.debug("Body entered [where=" + where() + ", oid=" + bodyOid + "].");
|
|
||||||
}
|
|
||||||
|
|
||||||
// let our delegates know what's up
|
// let our delegates know what's up
|
||||||
applyToDelegates(new DelegateOp() {
|
applyToDelegates(new DelegateOp() {
|
||||||
@@ -566,9 +563,7 @@ public class PlaceManager
|
|||||||
*/
|
*/
|
||||||
protected void bodyLeft (final int bodyOid)
|
protected void bodyLeft (final int bodyOid)
|
||||||
{
|
{
|
||||||
if (Log.log.getLevel() == Level.FINE) {
|
log.debug("Body left", "where", where(), "oid", bodyOid);
|
||||||
Log.debug("Body left [where=" + where() + ", oid=" + bodyOid + "].");
|
|
||||||
}
|
|
||||||
|
|
||||||
// if their occupant info hasn't been removed (which may be the case if they logged off
|
// if their occupant info hasn't been removed (which may be the case if they logged off
|
||||||
// rather than left via a MoveTo request), we need to get it on out of here
|
// rather than left via a MoveTo request), we need to get it on out of here
|
||||||
@@ -643,7 +638,7 @@ public class PlaceManager
|
|||||||
if (idlePeriod > 0L && _shutdownInterval == null) {
|
if (idlePeriod > 0L && _shutdownInterval == null) {
|
||||||
_shutdownInterval = new Interval((PresentsDObjectMgr)_omgr) {
|
_shutdownInterval = new Interval((PresentsDObjectMgr)_omgr) {
|
||||||
public void expired () {
|
public void expired () {
|
||||||
Log.debug("Unloading idle place '" + where () + "'.");
|
log.debug("Unloading idle place '" + where () + "'.");
|
||||||
shutdown();
|
shutdown();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -30,12 +30,13 @@ import com.threerings.presents.dobj.RootDObjectManager;
|
|||||||
import com.threerings.presents.server.InvocationException;
|
import com.threerings.presents.server.InvocationException;
|
||||||
import com.threerings.presents.server.InvocationManager;
|
import com.threerings.presents.server.InvocationManager;
|
||||||
|
|
||||||
import com.threerings.crowd.Log;
|
|
||||||
import com.threerings.crowd.data.CrowdCodes;
|
import com.threerings.crowd.data.CrowdCodes;
|
||||||
import com.threerings.crowd.data.Place;
|
import com.threerings.crowd.data.Place;
|
||||||
import com.threerings.crowd.data.PlaceConfig;
|
import com.threerings.crowd.data.PlaceConfig;
|
||||||
import com.threerings.crowd.data.PlaceObject;
|
import com.threerings.crowd.data.PlaceObject;
|
||||||
|
|
||||||
|
import static com.threerings.crowd.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The place registry keeps track of all of the active places in the server. It should be used to
|
* The place registry keeps track of all of the active places in the server. It should be used to
|
||||||
* create new places and it will take care of instantiating and initializing a place manager to
|
* create new places and it will take care of instantiating and initializing a place manager to
|
||||||
@@ -197,9 +198,8 @@ public class PlaceRegistry
|
|||||||
pmgr.init(this, _invmgr, _omgr, config);
|
pmgr.init(this, _invmgr, _omgr, config);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.logStackTrace(e);
|
log.warning(e);
|
||||||
throw new InstantiationException(
|
throw new InstantiationException("Error creating PlaceManager for " + config);
|
||||||
"Error creating place manager [config=" + config + "].");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// give the manager an opportunity to abort the whole process if it fails any permissions
|
// give the manager an opportunity to abort the whole process if it fails any permissions
|
||||||
@@ -226,8 +226,7 @@ public class PlaceRegistry
|
|||||||
pmgr.startup(plobj);
|
pmgr.startup(plobj);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.warning("Error starting place manager [obj=" + plobj + ", pmgr=" + pmgr + "].");
|
log.warning("Error starting place manager [obj=" + plobj + ", pmgr=" + pmgr + "].", e);
|
||||||
Log.logStackTrace(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return pmgr;
|
return pmgr;
|
||||||
@@ -241,7 +240,7 @@ public class PlaceRegistry
|
|||||||
int ploid = pmgr.getPlaceObject().getOid();
|
int ploid = pmgr.getPlaceObject().getOid();
|
||||||
// remove it from the table
|
// remove it from the table
|
||||||
if (_pmgrs.remove(ploid) == null) {
|
if (_pmgrs.remove(ploid) == null) {
|
||||||
Log.warning("Requested to unmap unmapped place manager [pmgr=" + pmgr + "].");
|
log.warning("Requested to unmap unmapped place manager [pmgr=" + pmgr + "].");
|
||||||
|
|
||||||
// } else {
|
// } else {
|
||||||
// Log.info("Unmapped place manager [class=" + pmgr.getClass().getName() +
|
// Log.info("Unmapped place manager [class=" + pmgr.getClass().getName() +
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ import java.security.PrivilegedActionException;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import com.samskivert.util.ClassUtil;
|
import com.samskivert.util.ClassUtil;
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|||||||
@@ -21,8 +21,7 @@
|
|||||||
|
|
||||||
package com.threerings.presents;
|
package com.threerings.presents;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
import com.samskivert.util.Logger;
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains a reference to the log object used by the Presents services.
|
* Contains a reference to the log object used by the Presents services.
|
||||||
@@ -30,29 +29,5 @@ import java.util.logging.Logger;
|
|||||||
public class Log
|
public class Log
|
||||||
{
|
{
|
||||||
/** We dispatch our log messages through this logger. */
|
/** We dispatch our log messages through this logger. */
|
||||||
public static Logger log = Logger.getLogger("com.threerings.narya.presents");
|
public static Logger log = Logger.getLogger("com.threerings.presents");
|
||||||
|
|
||||||
/** Convenience function. */
|
|
||||||
public static void debug (String message)
|
|
||||||
{
|
|
||||||
log.fine(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Convenience function. */
|
|
||||||
public static void info (String message)
|
|
||||||
{
|
|
||||||
log.info(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Convenience function. */
|
|
||||||
public static void warning (String message)
|
|
||||||
{
|
|
||||||
log.warning(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Convenience function. */
|
|
||||||
public static void logStackTrace (Throwable t)
|
|
||||||
{
|
|
||||||
log.log(Level.WARNING, t.getMessage(), t);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ import com.threerings.io.ObjectOutputStream;
|
|||||||
import com.threerings.io.UnreliableObjectInputStream;
|
import com.threerings.io.UnreliableObjectInputStream;
|
||||||
import com.threerings.io.UnreliableObjectOutputStream;
|
import com.threerings.io.UnreliableObjectOutputStream;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
|
||||||
import com.threerings.presents.data.AuthCodes;
|
import com.threerings.presents.data.AuthCodes;
|
||||||
import com.threerings.presents.dobj.DObjectManager;
|
import com.threerings.presents.dobj.DObjectManager;
|
||||||
import com.threerings.presents.net.AuthRequest;
|
import com.threerings.presents.net.AuthRequest;
|
||||||
@@ -65,6 +64,8 @@ import com.threerings.presents.net.Transport;
|
|||||||
import com.threerings.presents.net.UpstreamMessage;
|
import com.threerings.presents.net.UpstreamMessage;
|
||||||
import com.threerings.presents.util.DatagramSequencer;
|
import com.threerings.presents.util.DatagramSequencer;
|
||||||
|
|
||||||
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The client performs all network I/O on separate threads (one for reading and one for
|
* The client performs all network I/O on separate threads (one for reading and one for
|
||||||
* writing). The communicator class encapsulates that functionality.
|
* writing). The communicator class encapsulates that functionality.
|
||||||
@@ -193,7 +194,7 @@ public class BlockingCommunicator extends Communicator
|
|||||||
*/
|
*/
|
||||||
protected synchronized void logonSucceeded (AuthResponseData data)
|
protected synchronized void logonSucceeded (AuthResponseData data)
|
||||||
{
|
{
|
||||||
Log.debug("Logon succeeded: " + data);
|
log.debug("Logon succeeded: " + data);
|
||||||
|
|
||||||
// create our distributed object manager
|
// create our distributed object manager
|
||||||
_omgr = new ClientDObjectMgr(this, _client);
|
_omgr = new ClientDObjectMgr(this, _client);
|
||||||
@@ -224,8 +225,7 @@ public class BlockingCommunicator extends Communicator
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.info("Connection failed: " + ioe);
|
log.info("Connection failed", ioe);
|
||||||
Log.logStackTrace(ioe);
|
|
||||||
|
|
||||||
// let the client know that things went south
|
// let the client know that things went south
|
||||||
_client.notifyObservers(Client.CLIENT_CONNECTION_FAILED, ioe);
|
_client.notifyObservers(Client.CLIENT_CONNECTION_FAILED, ioe);
|
||||||
@@ -245,7 +245,7 @@ public class BlockingCommunicator extends Communicator
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.debug("Connection closed.");
|
log.debug("Connection closed.");
|
||||||
// now do the whole logoff thing
|
// now do the whole logoff thing
|
||||||
logoff();
|
logoff();
|
||||||
}
|
}
|
||||||
@@ -267,7 +267,7 @@ public class BlockingCommunicator extends Communicator
|
|||||||
_client.cleanup(_logonError);
|
_client.cleanup(_logonError);
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.debug("Reader thread exited.");
|
log.debug("Reader thread exited.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -277,7 +277,7 @@ public class BlockingCommunicator extends Communicator
|
|||||||
{
|
{
|
||||||
// clear out our writer reference
|
// clear out our writer reference
|
||||||
_writer = null;
|
_writer = null;
|
||||||
Log.debug("Writer thread exited.");
|
log.debug("Writer thread exited.");
|
||||||
|
|
||||||
// let the client observers know that we're logged off
|
// let the client observers know that we're logged off
|
||||||
_client.notifyObservers(Client.CLIENT_DID_LOGOFF, null);
|
_client.notifyObservers(Client.CLIENT_DID_LOGOFF, null);
|
||||||
@@ -299,12 +299,12 @@ public class BlockingCommunicator extends Communicator
|
|||||||
protected void closeChannel ()
|
protected void closeChannel ()
|
||||||
{
|
{
|
||||||
if (_channel != null) {
|
if (_channel != null) {
|
||||||
Log.debug("Closing socket channel.");
|
log.debug("Closing socket channel.");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
_channel.close();
|
_channel.close();
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
Log.warning("Error closing failed socket: " + ioe);
|
log.warning("Error closing failed socket: " + ioe);
|
||||||
}
|
}
|
||||||
_channel = null;
|
_channel = null;
|
||||||
|
|
||||||
@@ -326,7 +326,7 @@ public class BlockingCommunicator extends Communicator
|
|||||||
closeDatagramChannel();
|
closeDatagramChannel();
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.debug("Datagram reader thread exited.");
|
log.debug("Datagram reader thread exited.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -336,7 +336,7 @@ public class BlockingCommunicator extends Communicator
|
|||||||
{
|
{
|
||||||
// clear out our writer reference
|
// clear out our writer reference
|
||||||
_datagramWriter = null;
|
_datagramWriter = null;
|
||||||
Log.debug("Datagram writer thread exited.");
|
log.debug("Datagram writer thread exited.");
|
||||||
|
|
||||||
closeDatagramChannel();
|
closeDatagramChannel();
|
||||||
}
|
}
|
||||||
@@ -350,17 +350,17 @@ public class BlockingCommunicator extends Communicator
|
|||||||
try {
|
try {
|
||||||
_selector.close();
|
_selector.close();
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
Log.warning("Error closing selector: " + ioe);
|
log.warning("Error closing selector: " + ioe);
|
||||||
}
|
}
|
||||||
_selector = null;
|
_selector = null;
|
||||||
}
|
}
|
||||||
if (_datagramChannel != null) {
|
if (_datagramChannel != null) {
|
||||||
Log.debug("Closing datagram socket channel.");
|
log.debug("Closing datagram socket channel.");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
_datagramChannel.close();
|
_datagramChannel.close();
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
Log.warning("Error closing datagram socket: " + ioe);
|
log.warning("Error closing datagram socket: " + ioe);
|
||||||
}
|
}
|
||||||
_datagramChannel = null;
|
_datagramChannel = null;
|
||||||
|
|
||||||
@@ -377,7 +377,7 @@ public class BlockingCommunicator extends Communicator
|
|||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
if (debugLogMessages()) {
|
if (debugLogMessages()) {
|
||||||
Log.info("SEND " + msg);
|
log.info("SEND " + msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// first we write the message so that we can measure it's length
|
// first we write the message so that we can measure it's length
|
||||||
@@ -389,11 +389,11 @@ public class BlockingCommunicator extends Communicator
|
|||||||
ByteBuffer buffer = _fout.frameAndReturnBuffer();
|
ByteBuffer buffer = _fout.frameAndReturnBuffer();
|
||||||
if (buffer.limit() > 4096) {
|
if (buffer.limit() > 4096) {
|
||||||
String txt = StringUtil.truncate(String.valueOf(msg), 80, "...");
|
String txt = StringUtil.truncate(String.valueOf(msg), 80, "...");
|
||||||
Log.info("Whoa, writin' a big one [msg=" + txt + ", size=" + buffer.limit() + "].");
|
log.info("Whoa, writin' a big one [msg=" + txt + ", size=" + buffer.limit() + "].");
|
||||||
}
|
}
|
||||||
int wrote = _channel.write(buffer);
|
int wrote = _channel.write(buffer);
|
||||||
if (wrote != buffer.limit()) {
|
if (wrote != buffer.limit()) {
|
||||||
Log.warning("Aiya! Couldn't write entire message [msg=" + msg +
|
log.warning("Aiya! Couldn't write entire message [msg=" + msg +
|
||||||
", size=" + buffer.limit() + ", wrote=" + wrote + "].");
|
", size=" + buffer.limit() + ", wrote=" + wrote + "].");
|
||||||
// } else {
|
// } else {
|
||||||
// Log.info("Wrote " + wrote + " bytes.");
|
// Log.info("Wrote " + wrote + " bytes.");
|
||||||
@@ -425,7 +425,7 @@ public class BlockingCommunicator extends Communicator
|
|||||||
ByteBuffer buf = _bout.flip();
|
ByteBuffer buf = _bout.flip();
|
||||||
int size = buf.remaining();
|
int size = buf.remaining();
|
||||||
if (size > Client.MAX_DATAGRAM_SIZE) {
|
if (size > Client.MAX_DATAGRAM_SIZE) {
|
||||||
Log.warning("Dropping oversized datagram [size=" + size +
|
log.warning("Dropping oversized datagram [size=" + size +
|
||||||
", msg=" + msg + "].");
|
", msg=" + msg + "].");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -466,7 +466,7 @@ public class BlockingCommunicator extends Communicator
|
|||||||
try {
|
try {
|
||||||
DownstreamMessage msg = (DownstreamMessage)_oin.readObject();
|
DownstreamMessage msg = (DownstreamMessage)_oin.readObject();
|
||||||
if (debugLogMessages()) {
|
if (debugLogMessages()) {
|
||||||
Log.info("RECEIVE " + msg);
|
log.info("RECEIVE " + msg);
|
||||||
}
|
}
|
||||||
return msg;
|
return msg;
|
||||||
|
|
||||||
@@ -496,7 +496,7 @@ public class BlockingCommunicator extends Communicator
|
|||||||
return null; // received out of order
|
return null; // received out of order
|
||||||
}
|
}
|
||||||
if (debugLogMessages()) {
|
if (debugLogMessages()) {
|
||||||
Log.info("DATAGRAM " + msg);
|
log.info("DATAGRAM " + msg);
|
||||||
}
|
}
|
||||||
return msg;
|
return msg;
|
||||||
|
|
||||||
@@ -521,7 +521,7 @@ public class BlockingCommunicator extends Communicator
|
|||||||
{
|
{
|
||||||
// the default implementation just connects to the first port and does no cycling
|
// the default implementation just connects to the first port and does no cycling
|
||||||
int port = _client.getPorts()[0];
|
int port = _client.getPorts()[0];
|
||||||
Log.info("Connecting [host=" + host + ", port=" + port + "].");
|
log.info("Connecting [host=" + host + ", port=" + port + "].");
|
||||||
synchronized (BlockingCommunicator.this) {
|
synchronized (BlockingCommunicator.this) {
|
||||||
_channel = SocketChannel.open(new InetSocketAddress(host, port));
|
_channel = SocketChannel.open(new InetSocketAddress(host, port));
|
||||||
}
|
}
|
||||||
@@ -554,8 +554,7 @@ public class BlockingCommunicator extends Communicator
|
|||||||
logon();
|
logon();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.debug("Logon failed: " + e);
|
log.debug("Logon failed: " + e);
|
||||||
// Log.logStackTrace(e);
|
|
||||||
// once we're shutdown we'll report this error
|
// once we're shutdown we'll report this error
|
||||||
_logonError = e;
|
_logonError = e;
|
||||||
// terminate our communicator thread
|
// terminate our communicator thread
|
||||||
@@ -596,10 +595,10 @@ public class BlockingCommunicator extends Communicator
|
|||||||
sendMessage(req);
|
sendMessage(req);
|
||||||
|
|
||||||
// now wait for the auth response
|
// now wait for the auth response
|
||||||
Log.debug("Waiting for auth response.");
|
log.debug("Waiting for auth response.");
|
||||||
AuthResponse rsp = (AuthResponse)receiveMessage();
|
AuthResponse rsp = (AuthResponse)receiveMessage();
|
||||||
AuthResponseData data = rsp.getData();
|
AuthResponseData data = rsp.getData();
|
||||||
Log.debug("Got auth response: " + data);
|
log.debug("Got auth response: " + data);
|
||||||
|
|
||||||
// if the auth request failed, we want to let the communicator know by throwing a logon
|
// if the auth request failed, we want to let the communicator know by throwing a logon
|
||||||
// exception
|
// exception
|
||||||
@@ -627,7 +626,7 @@ public class BlockingCommunicator extends Communicator
|
|||||||
} catch (InterruptedIOException iioe) {
|
} catch (InterruptedIOException iioe) {
|
||||||
// somebody set up us the bomb! we've been interrupted which means that we're being
|
// somebody set up us the bomb! we've been interrupted which means that we're being
|
||||||
// shut down, so we just report it and return from iterate() like a good monkey
|
// shut down, so we just report it and return from iterate() like a good monkey
|
||||||
Log.debug("Reader thread woken up in time to die.");
|
log.debug("Reader thread woken up in time to die.");
|
||||||
|
|
||||||
} catch (EOFException eofe) {
|
} catch (EOFException eofe) {
|
||||||
// let the communicator know that our connection was closed
|
// let the communicator know that our connection was closed
|
||||||
@@ -642,14 +641,13 @@ public class BlockingCommunicator extends Communicator
|
|||||||
shutdown();
|
shutdown();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.warning("Error processing message [msg=" + msg + ", error=" + e + "].");
|
log.warning("Error processing message [msg=" + msg + ", error=" + e + "].");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void handleIterateFailure (Exception e)
|
protected void handleIterateFailure (Exception e)
|
||||||
{
|
{
|
||||||
Log.warning("Uncaught exception it reader thread.");
|
log.warning("Uncaught exception it reader thread.", e);
|
||||||
Log.logStackTrace(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void didShutdown ()
|
protected void didShutdown ()
|
||||||
@@ -702,8 +700,7 @@ public class BlockingCommunicator extends Communicator
|
|||||||
|
|
||||||
protected void handleIterateFailure (Exception e)
|
protected void handleIterateFailure (Exception e)
|
||||||
{
|
{
|
||||||
Log.warning("Uncaught exception it writer thread.");
|
log.warning("Uncaught exception it writer thread.", e);
|
||||||
Log.logStackTrace(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void didShutdown ()
|
protected void didShutdown ()
|
||||||
@@ -729,7 +726,7 @@ public class BlockingCommunicator extends Communicator
|
|||||||
try {
|
try {
|
||||||
connect();
|
connect();
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
Log.warning("Failed to open datagram channel [error=" + ioe + "].");
|
log.warning("Failed to open datagram channel [error=" + ioe + "].");
|
||||||
shutdown();
|
shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -749,7 +746,7 @@ public class BlockingCommunicator extends Communicator
|
|||||||
try {
|
try {
|
||||||
_digest = MessageDigest.getInstance("MD5");
|
_digest = MessageDigest.getInstance("MD5");
|
||||||
} catch (NoSuchAlgorithmException nsae) {
|
} catch (NoSuchAlgorithmException nsae) {
|
||||||
Log.warning("Missing MD5 algorithm.");
|
log.warning("Missing MD5 algorithm.");
|
||||||
shutdown();
|
shutdown();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -785,14 +782,14 @@ public class BlockingCommunicator extends Communicator
|
|||||||
|
|
||||||
// check if we managed to establish a connection
|
// check if we managed to establish a connection
|
||||||
if (cport > 0) {
|
if (cport > 0) {
|
||||||
Log.info("Datagram connection established [port=" + cport + "].");
|
log.info("Datagram connection established [port=" + cport + "].");
|
||||||
|
|
||||||
// start up the writer thread
|
// start up the writer thread
|
||||||
_datagramWriter = new DatagramWriter();
|
_datagramWriter = new DatagramWriter();
|
||||||
_datagramWriter.start();
|
_datagramWriter.start();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.info("Failed to establish datagram connection.");
|
log.info("Failed to establish datagram connection.");
|
||||||
shutdown();
|
shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -835,20 +832,19 @@ public class BlockingCommunicator extends Communicator
|
|||||||
} catch (AsynchronousCloseException ace) {
|
} catch (AsynchronousCloseException ace) {
|
||||||
// somebody set up us the bomb! we've been interrupted which means that we're being
|
// somebody set up us the bomb! we've been interrupted which means that we're being
|
||||||
// shut down, so we just report it and return from iterate() like a good monkey
|
// shut down, so we just report it and return from iterate() like a good monkey
|
||||||
Log.debug("Datagram reader thread woken up in time to die.");
|
log.debug("Datagram reader thread woken up in time to die.");
|
||||||
|
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
Log.warning("Error receiving datagram [error=" + ioe + "].");
|
log.warning("Error receiving datagram [error=" + ioe + "].");
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.warning("Error processing message [msg=" + msg + ", error=" + e + "].");
|
log.warning("Error processing message [msg=" + msg + ", error=" + e + "].");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void handleIterateFailure (Exception e)
|
protected void handleIterateFailure (Exception e)
|
||||||
{
|
{
|
||||||
Log.warning("Uncaught exception in datagram reader thread.");
|
log.warning("Uncaught exception in datagram reader thread.", e);
|
||||||
Log.logStackTrace(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void didShutdown ()
|
protected void didShutdown ()
|
||||||
@@ -886,14 +882,13 @@ public class BlockingCommunicator extends Communicator
|
|||||||
sendDatagram(msg);
|
sendDatagram(msg);
|
||||||
|
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
Log.warning("Error sending datagram [error=" + ioe + "].");
|
log.warning("Error sending datagram [error=" + ioe + "].");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void handleIterateFailure (Exception e)
|
protected void handleIterateFailure (Exception e)
|
||||||
{
|
{
|
||||||
Log.warning("Uncaught exception in datagram writer thread.");
|
log.warning("Uncaught exception in datagram writer thread.", e);
|
||||||
Log.logStackTrace(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void didShutdown ()
|
protected void didShutdown ()
|
||||||
|
|||||||
@@ -32,9 +32,10 @@ import com.samskivert.swing.RuntimeAdjust;
|
|||||||
import com.samskivert.util.IntListUtil;
|
import com.samskivert.util.IntListUtil;
|
||||||
import com.samskivert.util.Interval;
|
import com.samskivert.util.Interval;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
|
||||||
import com.threerings.presents.data.AuthCodes;
|
import com.threerings.presents.data.AuthCodes;
|
||||||
|
|
||||||
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Customizes the blocking communicator with some things that we only do on users' machines (where
|
* Customizes the blocking communicator with some things that we only do on users' machines (where
|
||||||
* there's only one client running, not potentially dozens, and where we're not sending high
|
* there's only one client running, not potentially dozens, and where we're not sending high
|
||||||
@@ -78,7 +79,7 @@ public class ClientCommunicator extends BlockingCommunicator
|
|||||||
for (int ii = 0; ii < ports.length; ii++) {
|
for (int ii = 0; ii < ports.length; ii++) {
|
||||||
int port = ports[(ii+ppidx)%ports.length];
|
int port = ports[(ii+ppidx)%ports.length];
|
||||||
int nextPort = ports[(ii+ppidx+1)%ports.length];
|
int nextPort = ports[(ii+ppidx+1)%ports.length];
|
||||||
Log.info("Connecting [host=" + host + ", port=" + port + "].");
|
log.info("Connecting [host=" + host + ", port=" + port + "].");
|
||||||
InetSocketAddress addr = new InetSocketAddress(host, port);
|
InetSocketAddress addr = new InetSocketAddress(host, port);
|
||||||
try {
|
try {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
|
|||||||
@@ -35,10 +35,11 @@ import com.samskivert.util.StringUtil;
|
|||||||
import com.samskivert.util.IntMap;
|
import com.samskivert.util.IntMap;
|
||||||
import com.samskivert.util.Interval;
|
import com.samskivert.util.Interval;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
|
||||||
import com.threerings.presents.dobj.*;
|
import com.threerings.presents.dobj.*;
|
||||||
import com.threerings.presents.net.*;
|
import com.threerings.presents.net.*;
|
||||||
|
|
||||||
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The client distributed object manager manages a set of proxy objects which mirror the
|
* The client distributed object manager manages a set of proxy objects which mirror the
|
||||||
* distributed objects maintained on the server. Requests for modifications, etc. are forwarded to
|
* distributed objects maintained on the server. Requests for modifications, etc. are forwarded to
|
||||||
@@ -165,7 +166,7 @@ public class ClientDObjectMgr
|
|||||||
} else if (obj instanceof UnsubscribeResponse) {
|
} else if (obj instanceof UnsubscribeResponse) {
|
||||||
int oid = ((UnsubscribeResponse)obj).getOid();
|
int oid = ((UnsubscribeResponse)obj).getOid();
|
||||||
if (_dead.remove(oid) == null) {
|
if (_dead.remove(oid) == null) {
|
||||||
Log.warning("Received unsub ACK from unknown object [oid=" + oid + "].");
|
log.warning("Received unsub ACK from unknown object [oid=" + oid + "].");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (obj instanceof FailureResponse) {
|
} else if (obj instanceof FailureResponse) {
|
||||||
@@ -221,7 +222,7 @@ public class ClientDObjectMgr
|
|||||||
DObject target = _ocache.get(remoteOid);
|
DObject target = _ocache.get(remoteOid);
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
if (!_dead.containsKey(remoteOid)) {
|
if (!_dead.containsKey(remoteOid)) {
|
||||||
Log.warning("Unable to dispatch event on non-proxied object " + event + ".");
|
log.warning("Unable to dispatch event on non-proxied object " + event + ".");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -277,8 +278,7 @@ public class ClientDObjectMgr
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.warning("Failure processing event [event=" + event + ", target=" + target + "].");
|
log.warning("Failure processing event", "event", event, "target", target, e);
|
||||||
Log.logStackTrace(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,7 +298,7 @@ public class ClientDObjectMgr
|
|||||||
// let the penders know that the object is available
|
// let the penders know that the object is available
|
||||||
PendingRequest<?> req = _penders.remove(obj.getOid());
|
PendingRequest<?> req = _penders.remove(obj.getOid());
|
||||||
if (req == null) {
|
if (req == null) {
|
||||||
Log.warning("Got object, but no one cares?! [oid=" + obj.getOid() +
|
log.warning("Got object, but no one cares?! [oid=" + obj.getOid() +
|
||||||
", obj=" + obj + "].");
|
", obj=" + obj + "].");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -321,7 +321,7 @@ public class ClientDObjectMgr
|
|||||||
// let the penders know that the object is not available
|
// let the penders know that the object is not available
|
||||||
PendingRequest<?> req = _penders.remove(oid);
|
PendingRequest<?> req = _penders.remove(oid);
|
||||||
if (req == null) {
|
if (req == null) {
|
||||||
Log.warning("Failed to get object, but no one cares?! [oid=" + oid + "].");
|
log.warning("Failed to get object, but no one cares?! [oid=" + oid + "].");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -383,7 +383,7 @@ public class ClientDObjectMgr
|
|||||||
dobj.removeSubscriber(target);
|
dobj.removeSubscriber(target);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.info("Requested to remove subscriber from non-proxied object [oid=" + oid +
|
log.info("Requested to remove subscriber from non-proxied object [oid=" + oid +
|
||||||
", sub=" + target + "].");
|
", sub=" + target + "].");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -505,9 +505,9 @@ public class ClientDObjectMgr
|
|||||||
/** A debug hook that allows the dumping of all objects in the object table out to the log. */
|
/** A debug hook that allows the dumping of all objects in the object table out to the log. */
|
||||||
protected DebugChords.Hook DUMP_OTABLE_HOOK = new DebugChords.Hook() {
|
protected DebugChords.Hook DUMP_OTABLE_HOOK = new DebugChords.Hook() {
|
||||||
public void invoke () {
|
public void invoke () {
|
||||||
Log.info("Dumping " + _ocache.size() + " objects:");
|
log.info("Dumping " + _ocache.size() + " objects:");
|
||||||
for (DObject obj : _ocache.values()) {
|
for (DObject obj : _ocache.values()) {
|
||||||
Log.info(obj.getClass().getName() + " " + obj);
|
log.info(obj.getClass().getName() + " " + obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -23,10 +23,11 @@ package com.threerings.presents.client;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
|
||||||
import com.threerings.presents.net.PingRequest;
|
import com.threerings.presents.net.PingRequest;
|
||||||
import com.threerings.presents.net.PongResponse;
|
import com.threerings.presents.net.PongResponse;
|
||||||
|
|
||||||
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to compute the client/server time delta, attempting to account for
|
* Used to compute the client/server time delta, attempting to account for
|
||||||
* the network delay experienced when the server sends its current time to
|
* the network delay experienced when the server sends its current time to
|
||||||
@@ -95,7 +96,7 @@ public class DeltaCalculator
|
|||||||
// minus the server's send time (plus network delay): dT = C - S
|
// minus the server's send time (plus network delay): dT = C - S
|
||||||
_deltas[_iter] = recv - (server + nettime);
|
_deltas[_iter] = recv - (server + nettime);
|
||||||
|
|
||||||
Log.debug("Calculated delta [delay=" + delay +
|
log.debug("Calculated delta [delay=" + delay +
|
||||||
", nettime=" + nettime + ", delta=" + _deltas[_iter] +
|
", nettime=" + nettime + ", delta=" + _deltas[_iter] +
|
||||||
", rtt=" + (recv-send) + "].");
|
", rtt=" + (recv-send) + "].");
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,8 @@
|
|||||||
package com.threerings.presents.client;
|
package com.threerings.presents.client;
|
||||||
|
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
import com.threerings.presents.Log;
|
|
||||||
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the basic functionality used to dispatch invocation
|
* Provides the basic functionality used to dispatch invocation
|
||||||
@@ -45,7 +46,7 @@ public abstract class InvocationDecoder
|
|||||||
*/
|
*/
|
||||||
public void dispatchNotification (int methodId, Object[] args)
|
public void dispatchNotification (int methodId, Object[] args)
|
||||||
{
|
{
|
||||||
Log.warning("Requested to dispatch unknown method " +
|
log.warning("Requested to dispatch unknown method " +
|
||||||
"[receiver=" + receiver + ", methodId=" + methodId +
|
"[receiver=" + receiver + ", methodId=" + methodId +
|
||||||
", args=" + StringUtil.toString(args) + "].");
|
", args=" + StringUtil.toString(args) + "].");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import java.util.Iterator;
|
|||||||
import com.samskivert.util.HashIntMap;
|
import com.samskivert.util.HashIntMap;
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
|
||||||
import com.threerings.presents.client.InvocationReceiver.Registration;
|
import com.threerings.presents.client.InvocationReceiver.Registration;
|
||||||
|
|
||||||
import com.threerings.presents.data.ClientObject;
|
import com.threerings.presents.data.ClientObject;
|
||||||
@@ -47,6 +46,8 @@ import com.threerings.presents.dobj.Subscriber;
|
|||||||
|
|
||||||
import com.threerings.presents.net.Transport;
|
import com.threerings.presents.net.Transport;
|
||||||
|
|
||||||
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the client side management of the invocation services.
|
* Handles the client side management of the invocation services.
|
||||||
*/
|
*/
|
||||||
@@ -67,7 +68,7 @@ public class InvocationDirector
|
|||||||
{
|
{
|
||||||
// sanity check
|
// sanity check
|
||||||
if (_clobj != null) {
|
if (_clobj != null) {
|
||||||
Log.warning("Zoiks, client object around during invmgr init!");
|
log.warning("Zoiks, client object around during invmgr init!");
|
||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +98,7 @@ public class InvocationDirector
|
|||||||
|
|
||||||
public void requestFailed (int oid, ObjectAccessException cause) {
|
public void requestFailed (int oid, ObjectAccessException cause) {
|
||||||
// aiya! we were unable to subscribe to the client object. we're hosed!
|
// aiya! we were unable to subscribe to the client object. we're hosed!
|
||||||
Log.warning("Invocation director unable to subscribe to client object " +
|
log.warning("Invocation director unable to subscribe to client object " +
|
||||||
"[cloid=" + cloid + ", cause=" + cause + "]!");
|
"[cloid=" + cloid + ", cause=" + cause + "]!");
|
||||||
_client.getClientObjectFailed(cause);
|
_client.getClientObjectFailed(cause);
|
||||||
}
|
}
|
||||||
@@ -151,7 +152,7 @@ public class InvocationDirector
|
|||||||
if (_clobj != null) {
|
if (_clobj != null) {
|
||||||
Registration rreg = _clobj.receivers.get(receiverCode);
|
Registration rreg = _clobj.receivers.get(receiverCode);
|
||||||
if (rreg == null) {
|
if (rreg == null) {
|
||||||
Log.warning("Receiver unregistered for which we have no id to code mapping " +
|
log.warning("Receiver unregistered for which we have no id to code mapping " +
|
||||||
"[code=" + receiverCode + "].");
|
"[code=" + receiverCode + "].");
|
||||||
} else {
|
} else {
|
||||||
Object decoder = _receivers.remove(rreg.receiverId);
|
Object decoder = _receivers.remove(rreg.receiverId);
|
||||||
@@ -209,7 +210,7 @@ public class InvocationDirector
|
|||||||
int invOid, int invCode, int methodId, Object[] args, Transport transport)
|
int invOid, int invCode, int methodId, Object[] args, Transport transport)
|
||||||
{
|
{
|
||||||
if (_clobj == null) {
|
if (_clobj == null) {
|
||||||
Log.warning("Dropping invocation request on shutdown director [code=" + invCode +
|
log.warning("Dropping invocation request on shutdown director [code=" + invCode +
|
||||||
", methodId=" + methodId + "].");
|
", methodId=" + methodId + "].");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -273,7 +274,7 @@ public class InvocationDirector
|
|||||||
// look up the invocation marshaller registered for that response
|
// look up the invocation marshaller registered for that response
|
||||||
ListenerMarshaller listener = _listeners.remove(reqId);
|
ListenerMarshaller listener = _listeners.remove(reqId);
|
||||||
if (listener == null) {
|
if (listener == null) {
|
||||||
Log.warning("Received invocation response for which we have no registered listener " +
|
log.warning("Received invocation response for which we have no registered listener " +
|
||||||
"[reqId=" + reqId + ", methId=" + methodId + ", args=" +
|
"[reqId=" + reqId + ", methId=" + methodId + ", args=" +
|
||||||
StringUtil.toString(args) + "]. It is possible that this listener was " +
|
StringUtil.toString(args) + "]. It is possible that this listener was " +
|
||||||
"flushed because the response did not arrive within " +
|
"flushed because the response did not arrive within " +
|
||||||
@@ -288,9 +289,8 @@ public class InvocationDirector
|
|||||||
try {
|
try {
|
||||||
listener.dispatchResponse(methodId, args);
|
listener.dispatchResponse(methodId, args);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
Log.warning("Invocation response listener choked [listener=" + listener +
|
log.warning("Invocation response listener choked [listener=" + listener +
|
||||||
", methId=" + methodId + ", args=" + StringUtil.toString(args) + "].");
|
", methId=" + methodId + ", args=" + StringUtil.toString(args) + "].", t);
|
||||||
Log.logStackTrace(t);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// flush expired listeners periodically
|
// flush expired listeners periodically
|
||||||
@@ -309,7 +309,7 @@ public class InvocationDirector
|
|||||||
// look up the decoder registered for this receiver
|
// look up the decoder registered for this receiver
|
||||||
InvocationDecoder decoder = _receivers.get(receiverId);
|
InvocationDecoder decoder = _receivers.get(receiverId);
|
||||||
if (decoder == null) {
|
if (decoder == null) {
|
||||||
Log.warning("Received notification for which we have no registered receiver " +
|
log.warning("Received notification for which we have no registered receiver " +
|
||||||
"[recvId=" + receiverId + ", methodId=" + methodId +
|
"[recvId=" + receiverId + ", methodId=" + methodId +
|
||||||
", args=" + StringUtil.toString(args) + "].");
|
", args=" + StringUtil.toString(args) + "].");
|
||||||
return;
|
return;
|
||||||
@@ -321,9 +321,8 @@ public class InvocationDirector
|
|||||||
try {
|
try {
|
||||||
decoder.dispatchNotification(methodId, args);
|
decoder.dispatchNotification(methodId, args);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
Log.warning("Invocation notification receiver choked [receiver=" + decoder.receiver +
|
log.warning("Invocation notification receiver choked [receiver=" + decoder.receiver +
|
||||||
", methId=" + methodId + ", args=" + StringUtil.toString(args) + "].");
|
", methId=" + methodId + ", args=" + StringUtil.toString(args) + "].", t);
|
||||||
Log.logStackTrace(t);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -362,7 +361,7 @@ public class InvocationDirector
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void requestFailed (int oid, ObjectAccessException cause) {
|
public void requestFailed (int oid, ObjectAccessException cause) {
|
||||||
Log.warning("Aiya! Unable to subscribe to changed client object [cloid=" + oid +
|
log.warning("Aiya! Unable to subscribe to changed client object [cloid=" + oid +
|
||||||
", cause=" + cause + "].");
|
", cause=" + cause + "].");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -25,8 +25,6 @@ import com.samskivert.util.StringUtil;
|
|||||||
|
|
||||||
import com.threerings.io.Streamable;
|
import com.threerings.io.Streamable;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
|
||||||
|
|
||||||
import com.threerings.presents.client.Client;
|
import com.threerings.presents.client.Client;
|
||||||
import com.threerings.presents.client.InvocationService.ConfirmListener;
|
import com.threerings.presents.client.InvocationService.ConfirmListener;
|
||||||
import com.threerings.presents.client.InvocationService.ResultListener;
|
import com.threerings.presents.client.InvocationService.ResultListener;
|
||||||
@@ -37,6 +35,8 @@ import com.threerings.presents.dobj.InvocationResponseEvent;
|
|||||||
|
|
||||||
import com.threerings.presents.net.Transport;
|
import com.threerings.presents.net.Transport;
|
||||||
|
|
||||||
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a base from which all invocation service marshallers extend. Handles functionality
|
* Provides a base from which all invocation service marshallers extend. Handles functionality
|
||||||
* common to all marshallers.
|
* common to all marshallers.
|
||||||
@@ -110,7 +110,7 @@ public class InvocationMarshaller
|
|||||||
listener.requestFailed((String)args[0]);
|
listener.requestFailed((String)args[0]);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.warning("Requested to dispatch unknown invocation response " +
|
log.warning("Requested to dispatch unknown invocation response " +
|
||||||
"[listener=" + listener + ", methodId=" + methodId +
|
"[listener=" + listener + ", methodId=" + methodId +
|
||||||
", args=" + StringUtil.toString(args) + "].");
|
", args=" + StringUtil.toString(args) + "].");
|
||||||
}
|
}
|
||||||
@@ -130,7 +130,7 @@ public class InvocationMarshaller
|
|||||||
throws Throwable
|
throws Throwable
|
||||||
{
|
{
|
||||||
if (_invId != null && getClass() != ListenerMarshaller.class) {
|
if (_invId != null && getClass() != ListenerMarshaller.class) {
|
||||||
Log.warning("Invocation listener never responded to: " + _invId);
|
log.warning("Invocation listener never responded to: " + _invId);
|
||||||
}
|
}
|
||||||
super.finalize();
|
super.finalize();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,9 +36,10 @@ import com.samskivert.util.StringUtil;
|
|||||||
import com.threerings.io.Streamable;
|
import com.threerings.io.Streamable;
|
||||||
import com.threerings.util.TrackedObject;
|
import com.threerings.util.TrackedObject;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
|
||||||
import com.threerings.presents.net.Transport;
|
import com.threerings.presents.net.Transport;
|
||||||
|
|
||||||
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The distributed object forms the foundation of the Presents system. All information shared among
|
* The distributed object forms the foundation of the Presents system. All information shared among
|
||||||
* users of the system is done via distributed objects. A distributed object has a set of
|
* users of the system is done via distributed objects. A distributed object has a set of
|
||||||
@@ -164,8 +165,8 @@ public class DObject
|
|||||||
_scount++;
|
_scount++;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.warning("Refusing subscriber that's already in the list [dobj=" + which() +
|
log.warning("Refusing subscriber that's already in the list", "dobj", which(),
|
||||||
", subscriber=" + sub + "]");
|
"subscriber", sub);
|
||||||
Thread.dumpStack();
|
Thread.dumpStack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -225,7 +226,7 @@ public class DObject
|
|||||||
if (els != null) {
|
if (els != null) {
|
||||||
_listeners = els;
|
_listeners = els;
|
||||||
} else {
|
} else {
|
||||||
Log.warning("Refusing repeat listener registration [dobj=" + which() +
|
log.warning("Refusing repeat listener registration [dobj=" + which() +
|
||||||
", list=" + listener + "]");
|
", list=" + listener + "]");
|
||||||
Thread.dumpStack();
|
Thread.dumpStack();
|
||||||
}
|
}
|
||||||
@@ -357,7 +358,7 @@ public class DObject
|
|||||||
// clear the lock from the list
|
// clear the lock from the list
|
||||||
if (ListUtil.clear(_locks, name) == null) {
|
if (ListUtil.clear(_locks, name) == null) {
|
||||||
// complain if we didn't find the lock
|
// complain if we didn't find the lock
|
||||||
Log.info("Unable to clear non-existent lock [lock=" + name + ", dobj=" + this + "].");
|
log.info("Unable to clear non-existent lock [lock=" + name + ", dobj=" + this + "].");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -438,9 +439,8 @@ public class DObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.warning("Listener choked during notification [list=" + listener +
|
log.warning("Listener choked during notification [list=" + listener +
|
||||||
", event=" + event + "].");
|
", event=" + event + "].", e);
|
||||||
Log.logStackTrace(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -464,9 +464,7 @@ public class DObject
|
|||||||
((ProxySubscriber)sub).eventReceived(event);
|
((ProxySubscriber)sub).eventReceived(event);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.warning("Proxy choked during notification [sub=" + sub +
|
log.warning("Proxy choked during notification", "sub", sub, "event", event, e);
|
||||||
", event=" + event + "].");
|
|
||||||
Log.logStackTrace(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -555,7 +553,7 @@ public class DObject
|
|||||||
_omgr.postEvent(event);
|
_omgr.postEvent(event);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.info("Dropping event for non- or no longer managed object [oid=" + getOid() +
|
log.info("Dropping event for non- or no longer managed object [oid=" + getOid() +
|
||||||
", class=" + getClass().getName() + ", event=" + event + "].");
|
", class=" + getClass().getName() + ", event=" + event + "].");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -734,7 +732,7 @@ public class DObject
|
|||||||
{
|
{
|
||||||
// sanity check
|
// sanity check
|
||||||
if (_tcount != 0) {
|
if (_tcount != 0) {
|
||||||
Log.warning("Transaction cleared with non-zero nesting count [dobj=" + this + "].");
|
log.warning("Transaction cleared with non-zero nesting count", "dobj", this);
|
||||||
_tcount = 0;
|
_tcount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -827,7 +825,7 @@ public class DObject
|
|||||||
if (_omgr != null && _omgr.isManager(this)) {
|
if (_omgr != null && _omgr.isManager(this)) {
|
||||||
oldEntry = set.removeKey(key);
|
oldEntry = set.removeKey(key);
|
||||||
if (oldEntry == null) {
|
if (oldEntry == null) {
|
||||||
Log.warning("Requested to remove non-element [set=" + name + ", key=" + key + "].");
|
log.warning("Requested to remove non-element", "set", name, "key", key);
|
||||||
Thread.dumpStack();
|
Thread.dumpStack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ import com.threerings.io.ObjectInputStream;
|
|||||||
import com.threerings.io.ObjectOutputStream;
|
import com.threerings.io.ObjectOutputStream;
|
||||||
import com.threerings.io.Streamable;
|
import com.threerings.io.Streamable;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The distributed set class provides a means by which an unordered set of objects can be
|
* The distributed set class provides a means by which an unordered set of objects can be
|
||||||
@@ -199,7 +199,7 @@ public class DSet<E extends DSet.Entry>
|
|||||||
// the crazy sanity checks
|
// the crazy sanity checks
|
||||||
if (_size < 0 ||_size > _entries.length ||
|
if (_size < 0 ||_size > _entries.length ||
|
||||||
(_size > 0 && _entries[_size-1] == null)) {
|
(_size > 0 && _entries[_size-1] == null)) {
|
||||||
Log.warning("DSet in a bad way [size=" + _size +
|
log.warning("DSet in a bad way [size=" + _size +
|
||||||
", entries=" + StringUtil.toString(_entries) + "].");
|
", entries=" + StringUtil.toString(_entries) + "].");
|
||||||
Thread.dumpStack();
|
Thread.dumpStack();
|
||||||
}
|
}
|
||||||
@@ -221,7 +221,7 @@ public class DSet<E extends DSet.Entry>
|
|||||||
throw new ConcurrentModificationException();
|
throw new ConcurrentModificationException();
|
||||||
}
|
}
|
||||||
if (_ssize != _size) {
|
if (_ssize != _size) {
|
||||||
Log.warning("Size changed during iteration [ssize=" + _ssize +
|
log.warning("Size changed during iteration [ssize=" + _ssize +
|
||||||
", nsize=" + _size +
|
", nsize=" + _size +
|
||||||
", entsries=" + StringUtil.toString(_entries) + "].");
|
", entsries=" + StringUtil.toString(_entries) + "].");
|
||||||
Thread.dumpStack();
|
Thread.dumpStack();
|
||||||
@@ -273,7 +273,7 @@ public class DSet<E extends DSet.Entry>
|
|||||||
|
|
||||||
// if the element is already in the set, bail now
|
// if the element is already in the set, bail now
|
||||||
if (eidx >= 0) {
|
if (eidx >= 0) {
|
||||||
Log.warning("Refusing to add duplicate entry [entry=" + elem + ", set=" + this + "].");
|
log.warning("Refusing to add duplicate entry [entry=" + elem + ", set=" + this + "].");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -285,7 +285,7 @@ public class DSet<E extends DSet.Entry>
|
|||||||
if (_size >= elength) {
|
if (_size >= elength) {
|
||||||
// sanity check
|
// sanity check
|
||||||
if (elength > 2048) {
|
if (elength > 2048) {
|
||||||
Log.warning("Requested to expand to questionably large size [l=" + elength + "].");
|
log.warning("Requested to expand to questionably large size [l=" + elength + "].");
|
||||||
Thread.dumpStack();
|
Thread.dumpStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,7 +331,7 @@ public class DSet<E extends DSet.Entry>
|
|||||||
{
|
{
|
||||||
// don't fail, but generate a warning if we're passed a null key
|
// don't fail, but generate a warning if we're passed a null key
|
||||||
if (key == null) {
|
if (key == null) {
|
||||||
Log.warning("Requested to remove null key.");
|
log.warning("Requested to remove null key.");
|
||||||
Thread.dumpStack();
|
Thread.dumpStack();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ package com.threerings.presents.dobj;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import com.samskivert.util.MethodFinder;
|
import com.samskivert.util.MethodFinder;
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
@@ -110,7 +109,7 @@ public class DynamicListener
|
|||||||
try {
|
try {
|
||||||
method.invoke(_target, arguments);
|
method.invoke(_target, arguments);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.log(Level.WARNING, "Failed to dispatch event callback " +
|
log.warning("Failed to dispatch event callback " +
|
||||||
name + "(" + StringUtil.toString(arguments) + ").", e);
|
name + "(" + StringUtil.toString(arguments) + ").", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ package com.threerings.presents.dobj;
|
|||||||
|
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An entry added event is dispatched when an entry is added to a {@link DSet} attribute of a
|
* An entry added event is dispatched when an entry is added to a {@link DSet} attribute of a
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
package com.threerings.presents.dobj;
|
package com.threerings.presents.dobj;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An entry removed event is dispatched when an entry is removed from a {@link DSet} attribute of a
|
* An entry removed event is dispatched when an entry is removed from a {@link DSet} attribute of a
|
||||||
@@ -88,7 +88,7 @@ public class EntryRemovedEvent<T extends DSet.Entry> extends NamedEvent
|
|||||||
_oldEntry = set.removeKey(_key);
|
_oldEntry = set.removeKey(_key);
|
||||||
if (_oldEntry == null) {
|
if (_oldEntry == null) {
|
||||||
// complain if there was actually nothing there
|
// complain if there was actually nothing there
|
||||||
Log.warning("No matching entry to remove [key=" + _key + ", set=" + set + "].");
|
log.warning("No matching entry to remove [key=" + _key + ", set=" + set + "].");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ package com.threerings.presents.dobj;
|
|||||||
|
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
|
||||||
|
|
||||||
import com.threerings.presents.net.Transport;
|
import com.threerings.presents.net.Transport;
|
||||||
|
|
||||||
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An entry updated event is dispatched when an entry of a {@link DSet} is updated. It can also be
|
* An entry updated event is dispatched when an entry of a {@link DSet} is updated. It can also be
|
||||||
* constructed to request the update of an entry and posted to the dobjmgr.
|
* constructed to request the update of an entry and posted to the dobjmgr.
|
||||||
@@ -107,7 +107,7 @@ public class EntryUpdatedEvent<T extends DSet.Entry> extends NamedEvent
|
|||||||
_oldEntry = set.update(_entry);
|
_oldEntry = set.update(_entry);
|
||||||
if (_oldEntry == null) {
|
if (_oldEntry == null) {
|
||||||
// complain if we didn't update anything
|
// complain if we didn't update anything
|
||||||
Log.warning("No matching entry to update [entry=" + this + ", set=" + set + "].");
|
log.warning("No matching entry to update [entry=" + this + ", set=" + set + "].");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import java.io.IOException;
|
|||||||
import com.threerings.io.ObjectInputStream;
|
import com.threerings.io.ObjectInputStream;
|
||||||
import com.threerings.io.ObjectOutputStream;
|
import com.threerings.io.ObjectOutputStream;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
public class PongResponse extends DownstreamMessage
|
public class PongResponse extends DownstreamMessage
|
||||||
{
|
{
|
||||||
@@ -90,7 +90,7 @@ public class PongResponse extends DownstreamMessage
|
|||||||
// the time spent between unpacking the ping and packing the pong
|
// the time spent between unpacking the ping and packing the pong
|
||||||
// is the processing delay
|
// is the processing delay
|
||||||
if (_pingStamp == 0L) {
|
if (_pingStamp == 0L) {
|
||||||
Log.warning("Pong response written that was not constructed " +
|
log.warning("Pong response written that was not constructed " +
|
||||||
"with a valid ping stamp [rsp=" + this + "].");
|
"with a valid ping stamp [rsp=" + this + "].");
|
||||||
_processDelay = 0;
|
_processDelay = 0;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import com.samskivert.jdbc.RepositoryUnit;
|
import com.samskivert.jdbc.RepositoryUnit;
|
||||||
import com.samskivert.jdbc.WriteOnlyUnit;
|
import com.samskivert.jdbc.WriteOnlyUnit;
|
||||||
@@ -162,7 +161,7 @@ public class PeerManager
|
|||||||
try {
|
try {
|
||||||
execute();
|
execute();
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
log.log(Level.WARNING, getClass().getName() + " failed.");
|
log.warning(getClass().getName() + " failed.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,7 +334,7 @@ public class PeerManager
|
|||||||
oout.writeObject(action);
|
oout.writeObject(action);
|
||||||
actionBytes = bout.toByteArray();
|
actionBytes = bout.toByteArray();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.log(Level.WARNING, "Failed to serialize node action [action=" + action + "].", e);
|
log.warning("Failed to serialize node action [action=" + action + "].", e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -603,7 +602,7 @@ public class PeerManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void requestFailed (Exception cause) {
|
public void requestFailed (Exception cause) {
|
||||||
log.log(Level.WARNING, "Lock acquisition failed [lock=" + lock + "].", cause);
|
log.warning("Lock acquisition failed [lock=" + lock + "].", cause);
|
||||||
operation.fail(null);
|
operation.fail(null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -731,7 +730,7 @@ public class PeerManager
|
|||||||
action = (NodeAction)oin.readObject();
|
action = (NodeAction)oin.readObject();
|
||||||
action.invoke();
|
action.invoke();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.log(Level.WARNING, "Failed to execute node action [from=" + caller.who() +
|
log.warning("Failed to execute node action [from=" + caller.who() +
|
||||||
", action=" + action + ", serializedSize=" + serializedAction.length + "].");
|
", action=" + action + ", serializedSize=" + serializedAction.length + "].");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -807,7 +806,7 @@ public class PeerManager
|
|||||||
try {
|
try {
|
||||||
refreshPeer(record);
|
refreshPeer(record);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.log(Level.WARNING, "Failure refreshing peer " + record + ".", e);
|
log.warning("Failure refreshing peer " + record + ".", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ public class PeerNode
|
|||||||
// if our client hasn't updated its record since we last tried to logon, then just
|
// if our client hasn't updated its record since we last tried to logon, then just
|
||||||
// chill
|
// chill
|
||||||
if ((_lastConnectStamp - _record.lastUpdated.getTime()) > STALE_INTERVAL) {
|
if ((_lastConnectStamp - _record.lastUpdated.getTime()) > STALE_INTERVAL) {
|
||||||
log.fine("Not reconnecting to stale client [record=" + _record +
|
log.debug("Not reconnecting to stale client [record=" + _record +
|
||||||
", lastTry=" + new Date(_lastConnectStamp) + "].");
|
", lastTry=" + new Date(_lastConnectStamp) + "].");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,6 @@
|
|||||||
|
|
||||||
package com.threerings.presents.server;
|
package com.threerings.presents.server;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import com.samskivert.io.PersistenceException;
|
import com.samskivert.io.PersistenceException;
|
||||||
|
|
||||||
import com.samskivert.util.Invoker;
|
import com.samskivert.util.Invoker;
|
||||||
@@ -69,7 +67,7 @@ public abstract class Authenticator
|
|||||||
try {
|
try {
|
||||||
processAuthentication(conn, rsp);
|
processAuthentication(conn, rsp);
|
||||||
} catch (Exception e) { // Persistence or Runtime
|
} catch (Exception e) { // Persistence or Runtime
|
||||||
log.log(Level.WARNING, "Error authenticating user [areq=" + req + "].", e);
|
log.warning("Error authenticating user [areq=" + req + "].", e);
|
||||||
rdata.code = AuthCodes.SERVER_ERROR;
|
rdata.code = AuthCodes.SERVER_ERROR;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import java.io.IOException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import com.samskivert.util.Interval;
|
import com.samskivert.util.Interval;
|
||||||
import com.samskivert.util.ObserverList;
|
import com.samskivert.util.ObserverList;
|
||||||
@@ -119,7 +118,7 @@ public class ClientManager
|
|||||||
try {
|
try {
|
||||||
pc.shutdown();
|
pc.shutdown();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.log(Level.WARNING, "Client choked in shutdown() [client=" +
|
log.warning("Client choked in shutdown() [client=" +
|
||||||
StringUtil.safeToString(pc) + "].", e);
|
StringUtil.safeToString(pc) + "].", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -298,7 +297,7 @@ public class ClientManager
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.fine("Destroying client " + clobj.who() + ".");
|
log.debug("Destroying client " + clobj.who() + ".");
|
||||||
|
|
||||||
// we're all clear to go; remove the mapping
|
// we're all clear to go; remove the mapping
|
||||||
_objmap.remove(username);
|
_objmap.remove(username);
|
||||||
@@ -402,7 +401,7 @@ public class ClientManager
|
|||||||
// remove the client from the connection map
|
// remove the client from the connection map
|
||||||
PresentsClient client = _conmap.remove(conn);
|
PresentsClient client = _conmap.remove(conn);
|
||||||
if (client != null) {
|
if (client != null) {
|
||||||
log.fine("Unmapped client [client=" + client + ", conn=" + conn + "].");
|
log.debug("Unmapped client [client=" + client + ", conn=" + conn + "].");
|
||||||
// let the client know the connection went away
|
// let the client know the connection went away
|
||||||
client.wasUnmapped();
|
client.wasUnmapped();
|
||||||
|
|
||||||
@@ -497,7 +496,7 @@ public class ClientManager
|
|||||||
", dtime=" + (now-client.getNetworkStamp()) + "ms].");
|
", dtime=" + (now-client.getNetworkStamp()) + "ms].");
|
||||||
client.endSession();
|
client.endSession();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.log(Level.WARNING, "Choke while flushing client [victim=" + client + "].", e);
|
log.warning("Choke while flushing client [victim=" + client + "].", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -515,7 +514,7 @@ public class ClientManager
|
|||||||
_clop.apply(clobj);
|
_clop.apply(clobj);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.log(Level.WARNING, "Client op failed [username=" + username +
|
log.warning("Client op failed [username=" + username +
|
||||||
", clop=" + _clop + "].", e);
|
", clop=" + _clop + "].", e);
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -26,12 +26,13 @@ import java.util.ArrayList;
|
|||||||
import com.samskivert.util.Invoker;
|
import com.samskivert.util.Invoker;
|
||||||
import com.threerings.util.Name;
|
import com.threerings.util.Name;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
|
||||||
import com.threerings.presents.data.ClientObject;
|
import com.threerings.presents.data.ClientObject;
|
||||||
import com.threerings.presents.data.PermissionPolicy;
|
import com.threerings.presents.data.PermissionPolicy;
|
||||||
import com.threerings.presents.dobj.DObject;
|
import com.threerings.presents.dobj.DObject;
|
||||||
import com.threerings.presents.dobj.ObjectAccessException;
|
import com.threerings.presents.dobj.ObjectAccessException;
|
||||||
|
|
||||||
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to resolve client data when a user starts a session (or when some other entity needs access
|
* Used to resolve client data when a user starts a session (or when some other entity needs access
|
||||||
* to a client object). Implementations will want to extend this class and override {@link
|
* to a client object). Implementations will want to extend this class and override {@link
|
||||||
@@ -121,8 +122,7 @@ public class ClientResolver extends Invoker.Unit
|
|||||||
_clobj.reference();
|
_clobj.reference();
|
||||||
crl.clientResolved(_username, _clobj);
|
crl.clientResolved(_username, _clobj);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.warning("Client resolution listener choked in clientResolved() " + crl);
|
log.warning("Client resolution listener choked in clientResolved() " + crl, e);
|
||||||
Log.logStackTrace(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,9 +172,8 @@ public class ClientResolver extends Invoker.Unit
|
|||||||
try {
|
try {
|
||||||
crl.resolutionFailed(_username, cause);
|
crl.resolutionFailed(_username, cause);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.warning("Client resolution listener choked in resolutionFailed() [crl=" + crl +
|
log.warning("Client resolution listener choked in resolutionFailed() [crl=" + crl +
|
||||||
", username=" + _username + ", cause=" + cause + "].");
|
", username=" + _username + ", cause=" + cause + "].", e);
|
||||||
Log.logStackTrace(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,10 +23,11 @@ package com.threerings.presents.server;
|
|||||||
|
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
|
||||||
import com.threerings.presents.data.ClientObject;
|
import com.threerings.presents.data.ClientObject;
|
||||||
import com.threerings.presents.data.InvocationMarshaller;
|
import com.threerings.presents.data.InvocationMarshaller;
|
||||||
|
|
||||||
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the base class via which invocation service requests are
|
* Provides the base class via which invocation service requests are
|
||||||
* dispatched.
|
* dispatched.
|
||||||
@@ -49,7 +50,7 @@ public abstract class InvocationDispatcher
|
|||||||
ClientObject source, int methodId, Object[] args)
|
ClientObject source, int methodId, Object[] args)
|
||||||
throws InvocationException
|
throws InvocationException
|
||||||
{
|
{
|
||||||
Log.warning("Requested to dispatch unknown method " +
|
log.warning("Requested to dispatch unknown method " +
|
||||||
"[provider=" + provider +
|
"[provider=" + provider +
|
||||||
", sourceOid=" + source.getOid() +
|
", sourceOid=" + source.getOid() +
|
||||||
", methodId=" + methodId +
|
", methodId=" + methodId +
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import com.samskivert.util.StringUtil;
|
|||||||
import com.threerings.io.Streamable;
|
import com.threerings.io.Streamable;
|
||||||
import com.threerings.util.StreamableArrayList;
|
import com.threerings.util.StreamableArrayList;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
|
||||||
import com.threerings.presents.data.ClientObject;
|
import com.threerings.presents.data.ClientObject;
|
||||||
import com.threerings.presents.data.InvocationMarshaller.ListenerMarshaller;
|
import com.threerings.presents.data.InvocationMarshaller.ListenerMarshaller;
|
||||||
import com.threerings.presents.data.InvocationMarshaller;
|
import com.threerings.presents.data.InvocationMarshaller;
|
||||||
@@ -44,6 +43,8 @@ import com.threerings.presents.dobj.RootDObjectManager;
|
|||||||
|
|
||||||
import com.threerings.presents.net.Transport;
|
import com.threerings.presents.net.Transport;
|
||||||
|
|
||||||
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The invocation services provide client to server invocations (service requests) and server to
|
* The invocation services provide client to server invocations (service requests) and server to
|
||||||
* client invocations (responses and notifications). Via this mechanism, the client can make
|
* client invocations (responses and notifications). Via this mechanism, the client can make
|
||||||
@@ -154,13 +155,13 @@ public class InvocationManager
|
|||||||
public void clearDispatcher (InvocationMarshaller marsh)
|
public void clearDispatcher (InvocationMarshaller marsh)
|
||||||
{
|
{
|
||||||
if (marsh == null) {
|
if (marsh == null) {
|
||||||
Log.warning("Refusing to unregister null marshaller.");
|
log.warning("Refusing to unregister null marshaller.");
|
||||||
Thread.dumpStack();
|
Thread.dumpStack();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_dispatchers.remove(marsh.getInvocationCode()) == null) {
|
if (_dispatchers.remove(marsh.getInvocationCode()) == null) {
|
||||||
Log.warning("Requested to remove unregistered marshaller? " +
|
log.warning("Requested to remove unregistered marshaller? " +
|
||||||
"[marsh=" + marsh + "].");
|
"[marsh=" + marsh + "].");
|
||||||
Thread.dumpStack();
|
Thread.dumpStack();
|
||||||
}
|
}
|
||||||
@@ -218,7 +219,7 @@ public class InvocationManager
|
|||||||
// make sure the client is still around
|
// make sure the client is still around
|
||||||
ClientObject source = (ClientObject)_omgr.getObject(clientOid);
|
ClientObject source = (ClientObject)_omgr.getObject(clientOid);
|
||||||
if (source == null) {
|
if (source == null) {
|
||||||
Log.info("Client no longer around for invocation " +
|
log.info("Client no longer around for invocation " +
|
||||||
"request [clientOid=" + clientOid +
|
"request [clientOid=" + clientOid +
|
||||||
", code=" + invCode + ", methId=" + methodId +
|
", code=" + invCode + ", methId=" + methodId +
|
||||||
", args=" + StringUtil.toString(args) + "].");
|
", args=" + StringUtil.toString(args) + "].");
|
||||||
@@ -228,7 +229,7 @@ public class InvocationManager
|
|||||||
// look up the dispatcher
|
// look up the dispatcher
|
||||||
InvocationDispatcher disp = _dispatchers.get(invCode);
|
InvocationDispatcher disp = _dispatchers.get(invCode);
|
||||||
if (disp == null) {
|
if (disp == null) {
|
||||||
Log.info("Received invocation request but dispatcher " +
|
log.info("Received invocation request but dispatcher " +
|
||||||
"registration was already cleared [code=" + invCode +
|
"registration was already cleared [code=" + invCode +
|
||||||
", methId=" + methodId +
|
", methId=" + methodId +
|
||||||
", args=" + StringUtil.toString(args) + ", marsh=" +
|
", args=" + StringUtil.toString(args) + ", marsh=" +
|
||||||
@@ -271,7 +272,7 @@ public class InvocationManager
|
|||||||
rlist.requestFailed(ie.getMessage());
|
rlist.requestFailed(ie.getMessage());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.warning("Service request failed but we've got no " +
|
log.warning("Service request failed but we've got no " +
|
||||||
"listener to inform of the failure " +
|
"listener to inform of the failure " +
|
||||||
"[caller=" + source.who() + ", code=" + invCode +
|
"[caller=" + source.who() + ", code=" + invCode +
|
||||||
", dispatcher=" + disp + ", methodId=" + methodId +
|
", dispatcher=" + disp + ", methodId=" + methodId +
|
||||||
@@ -280,10 +281,9 @@ public class InvocationManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
Log.warning("Dispatcher choked [disp=" + disp +
|
log.warning("Dispatcher choked [disp=" + disp +
|
||||||
", caller=" + source.who() + ", methId=" + methodId +
|
", caller=" + source.who() + ", methId=" + methodId +
|
||||||
", args=" + StringUtil.toString(args) + "].");
|
", args=" + StringUtil.toString(args) + "].", t);
|
||||||
Log.logStackTrace(t);
|
|
||||||
|
|
||||||
// avoid logging an error when the listener notices that it's
|
// avoid logging an error when the listener notices that it's
|
||||||
// been ignored.
|
// been ignored.
|
||||||
|
|||||||
@@ -23,13 +23,14 @@ package com.threerings.presents.server;
|
|||||||
|
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
|
||||||
import com.threerings.presents.client.InvocationReceiver.Registration;
|
import com.threerings.presents.client.InvocationReceiver.Registration;
|
||||||
import com.threerings.presents.data.ClientObject;
|
import com.threerings.presents.data.ClientObject;
|
||||||
import com.threerings.presents.dobj.InvocationNotificationEvent;
|
import com.threerings.presents.dobj.InvocationNotificationEvent;
|
||||||
|
|
||||||
import com.threerings.presents.net.Transport;
|
import com.threerings.presents.net.Transport;
|
||||||
|
|
||||||
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides basic functionality used by all invocation sender classes.
|
* Provides basic functionality used by all invocation sender classes.
|
||||||
*/
|
*/
|
||||||
@@ -56,7 +57,7 @@ public abstract class InvocationSender
|
|||||||
// specific client
|
// specific client
|
||||||
Registration rreg = target.receivers.get(receiverCode);
|
Registration rreg = target.receivers.get(receiverCode);
|
||||||
if (rreg == null) {
|
if (rreg == null) {
|
||||||
Log.warning("Unable to locate receiver for invocation service notification " +
|
log.warning("Unable to locate receiver for invocation service notification " +
|
||||||
"[clobj=" + target.who() + ", code=" + receiverCode +
|
"[clobj=" + target.who() + ", code=" + receiverCode +
|
||||||
", methId=" + methodId + ", args=" + StringUtil.toString(args) + "].");
|
", methId=" + methodId + ", args=" + StringUtil.toString(args) + "].");
|
||||||
Thread.dumpStack();
|
Thread.dumpStack();
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import java.io.IOException;
|
|||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import com.samskivert.util.HashIntMap;
|
import com.samskivert.util.HashIntMap;
|
||||||
import com.samskivert.util.ResultListener;
|
import com.samskivert.util.ResultListener;
|
||||||
@@ -247,7 +246,7 @@ public class PresentsClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void resolutionFailed (Name username, Exception reason) {
|
public void resolutionFailed (Name username, Exception reason) {
|
||||||
log.log(Level.WARNING, "Unable to resolve new client object [oldname=" + _username +
|
log.warning("Unable to resolve new client object [oldname=" + _username +
|
||||||
", newname=" + username + ", reason=" + reason + "].", reason);
|
", newname=" + username + ", reason=" + reason + "].", reason);
|
||||||
|
|
||||||
// let our listener know we're hosed
|
// let our listener know we're hosed
|
||||||
@@ -308,7 +307,7 @@ public class PresentsClient
|
|||||||
try {
|
try {
|
||||||
sessionDidEnd();
|
sessionDidEnd();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.log(Level.WARNING, "Choked in sessionDidEnd " + this + ".", e);
|
log.warning("Choked in sessionDidEnd " + this + ".", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// release (and destroy) our client object
|
// release (and destroy) our client object
|
||||||
@@ -364,7 +363,7 @@ public class PresentsClient
|
|||||||
public void resolutionFailed (Name username, Exception reason)
|
public void resolutionFailed (Name username, Exception reason)
|
||||||
{
|
{
|
||||||
// urk; nothing to do but complain and get the f**k out of dodge
|
// urk; nothing to do but complain and get the f**k out of dodge
|
||||||
log.log(Level.WARNING, "Unable to resolve client [username=" + username + "].", reason);
|
log.warning("Unable to resolve client [username=" + username + "].", reason);
|
||||||
|
|
||||||
// end the session now to prevent danglage
|
// end the session now to prevent danglage
|
||||||
endSession();
|
endSession();
|
||||||
@@ -990,7 +989,7 @@ public class PresentsClient
|
|||||||
{
|
{
|
||||||
public void dispatch (final PresentsClient client, UpstreamMessage msg)
|
public void dispatch (final PresentsClient client, UpstreamMessage msg)
|
||||||
{
|
{
|
||||||
log.fine("Client requested logoff " + client + ".");
|
log.debug("Client requested logoff " + client + ".");
|
||||||
client.safeEndSession();
|
client.safeEndSession();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import java.util.HashMap;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import com.samskivert.util.AuditLogger;
|
import com.samskivert.util.AuditLogger;
|
||||||
import com.samskivert.util.HashIntMap;
|
import com.samskivert.util.HashIntMap;
|
||||||
@@ -331,8 +330,7 @@ public class PresentsDObjectMgr
|
|||||||
handleFatalError(unit, e);
|
handleFatalError(unit, e);
|
||||||
|
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
log.log(Level.WARNING,
|
log.warning("Execution unit failed", "unit", unit, t);
|
||||||
"Execution unit failed [unit=" + StringUtil.safeToString(unit) + "].", t);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// compute the elapsed time in microseconds
|
// compute the elapsed time in microseconds
|
||||||
@@ -340,9 +338,8 @@ public class PresentsDObjectMgr
|
|||||||
|
|
||||||
// report excessively long units
|
// report excessively long units
|
||||||
if (elapsed > 500000 && !(unit instanceof LongRunnable)) {
|
if (elapsed > 500000 && !(unit instanceof LongRunnable)) {
|
||||||
log.warning("Long dobj unit [u=" + StringUtil.safeToString(unit) +
|
log.warning("Long dobj unit " + StringUtil.shortClassName(unit), "unit", unit,
|
||||||
" (" + StringUtil.shortClassName(unit) + ")" +
|
"time", (elapsed/1000) + "ms");
|
||||||
", time=" + (elapsed/1000) + "ms].");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// periodically sample and record the time spent processing a unit
|
// periodically sample and record the time spent processing a unit
|
||||||
@@ -380,7 +377,7 @@ public class PresentsDObjectMgr
|
|||||||
// look up the target object
|
// look up the target object
|
||||||
DObject target = _objects.get(event.getTargetOid());
|
DObject target = _objects.get(event.getTargetOid());
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
log.fine("Compound event target no longer exists [event=" + event + "].");
|
log.debug("Compound event target no longer exists [event=" + event + "].");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,7 +408,7 @@ public class PresentsDObjectMgr
|
|||||||
// look up the target object
|
// look up the target object
|
||||||
DObject target = _objects.get(event.getTargetOid());
|
DObject target = _objects.get(event.getTargetOid());
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
log.fine("Event target no longer exists [event=" + event + "].");
|
log.debug("Event target no longer exists [event=" + event + "].");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -462,7 +459,7 @@ public class PresentsDObjectMgr
|
|||||||
handleFatalError(event, e);
|
handleFatalError(event, e);
|
||||||
|
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
log.log(Level.WARNING, "Failure processing event [event=" + event +
|
log.warning("Failure processing event [event=" + event +
|
||||||
", target=" + target + "].", t);
|
", target=" + target + "].", t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -481,7 +478,7 @@ public class PresentsDObjectMgr
|
|||||||
if (_fatalThrottle.throttleOp()) {
|
if (_fatalThrottle.throttleOp()) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
log.log(Level.WARNING, "Fatal error caused by '" + causer + "': " + error, error);
|
log.warning("Fatal error caused by '" + causer + "': " + error, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -772,7 +769,7 @@ public class PresentsDObjectMgr
|
|||||||
try {
|
try {
|
||||||
sub.objectAvailable(obj);
|
sub.objectAvailable(obj);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.log(Level.WARNING, "Subscriber choked during object available " +
|
log.warning("Subscriber choked during object available " +
|
||||||
"[obj=" + StringUtil.safeToString(obj) + ", sub=" + sub + "].", e);
|
"[obj=" + StringUtil.safeToString(obj) + ", sub=" + sub + "].", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import java.util.Iterator;
|
|||||||
import com.samskivert.util.Invoker;
|
import com.samskivert.util.Invoker;
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extends the generic {@link Invoker} and integrates it a bit more into
|
* Extends the generic {@link Invoker} and integrates it a bit more into
|
||||||
@@ -172,7 +172,7 @@ public class PresentsInvoker extends Invoker
|
|||||||
// otherwise end it, and complain if we're ending it
|
// otherwise end it, and complain if we're ending it
|
||||||
// because of passes
|
// because of passes
|
||||||
if (_passCount >= MAX_PASSES) {
|
if (_passCount >= MAX_PASSES) {
|
||||||
Log.warning("Shutdown Unit passed 50 times without " +
|
log.warning("Shutdown Unit passed 50 times without " +
|
||||||
"finishing, shutting down harshly.");
|
"finishing, shutting down harshly.");
|
||||||
}
|
}
|
||||||
doShutdown();
|
doShutdown();
|
||||||
@@ -185,7 +185,7 @@ public class PresentsInvoker extends Invoker
|
|||||||
protected boolean checkLoops ()
|
protected boolean checkLoops ()
|
||||||
{
|
{
|
||||||
if (_loopCount > MAX_LOOPS) {
|
if (_loopCount > MAX_LOOPS) {
|
||||||
Log.warning("Shutdown Unit looped on one thread 10000 times " +
|
log.warning("Shutdown Unit looped on one thread 10000 times " +
|
||||||
"without finishing, shutting down harshly.");
|
"without finishing, shutting down harshly.");
|
||||||
doShutdown();
|
doShutdown();
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
package com.threerings.presents.server;
|
package com.threerings.presents.server;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
|
||||||
import com.threerings.presents.data.ClientObject;
|
import com.threerings.presents.data.ClientObject;
|
||||||
import com.threerings.presents.dobj.AccessController;
|
import com.threerings.presents.dobj.AccessController;
|
||||||
import com.threerings.presents.dobj.DEvent;
|
import com.threerings.presents.dobj.DEvent;
|
||||||
@@ -31,6 +30,8 @@ import com.threerings.presents.dobj.MessageEvent;
|
|||||||
import com.threerings.presents.dobj.NamedEvent;
|
import com.threerings.presents.dobj.NamedEvent;
|
||||||
import com.threerings.presents.dobj.Subscriber;
|
import com.threerings.presents.dobj.Subscriber;
|
||||||
|
|
||||||
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the various object access controllers used by the Presents server.
|
* Defines the various object access controllers used by the Presents server.
|
||||||
*/
|
*/
|
||||||
@@ -76,7 +77,7 @@ public class PresentsObjectAccess
|
|||||||
if (sub instanceof PresentsClient) {
|
if (sub instanceof PresentsClient) {
|
||||||
allowed = ((PresentsClient)sub).getClientObject() == object;
|
allowed = ((PresentsClient)sub).getClientObject() == object;
|
||||||
if (!allowed) {
|
if (!allowed) {
|
||||||
Log.warning("Refusing ClientObject subscription request " +
|
log.warning("Refusing ClientObject subscription request " +
|
||||||
"[obj=" + ((ClientObject)object).who() + ", sub=" + sub + "].");
|
"[obj=" + ((ClientObject)object).who() + ", sub=" + sub + "].");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
package com.threerings.presents.server;
|
package com.threerings.presents.server;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import com.samskivert.util.Interval;
|
import com.samskivert.util.Interval;
|
||||||
import com.samskivert.util.ObserverList;
|
import com.samskivert.util.ObserverList;
|
||||||
@@ -123,7 +122,7 @@ public class PresentsServer
|
|||||||
Runnable trun = (Runnable)tmclass.newInstance();
|
Runnable trun = (Runnable)tmclass.newInstance();
|
||||||
trun.run();
|
trun.run();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.log(Level.WARNING, "Unable to invoke test module '" + testmod + "'.", e);
|
log.warning("Unable to invoke test module '" + testmod + "'.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +131,7 @@ public class PresentsServer
|
|||||||
server.run();
|
server.run();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.log(Level.WARNING, "Unable to initialize server.", e);
|
log.warning("Unable to initialize server.", e);
|
||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -305,7 +304,7 @@ public class PresentsServer
|
|||||||
try {
|
try {
|
||||||
rptr.appendReport(report, now, sinceLast, reset);
|
rptr.appendReport(report, now, sinceLast, reset);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
log.log(Level.WARNING, "Reporter choked [rptr=" + rptr + "].", t);
|
log.warning("Reporter choked [rptr=" + rptr + "].", t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,6 @@
|
|||||||
|
|
||||||
package com.threerings.presents.server;
|
package com.threerings.presents.server;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import com.samskivert.io.PersistenceException;
|
import com.samskivert.io.PersistenceException;
|
||||||
|
|
||||||
import com.samskivert.util.Invoker;
|
import com.samskivert.util.Invoker;
|
||||||
@@ -75,7 +73,7 @@ public class Rejector extends PresentsServer
|
|||||||
server.init();
|
server.init();
|
||||||
server.run();
|
server.run();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.log(Level.WARNING, "Unable to initialize server.", e);
|
log.warning("Unable to initialize server.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ package com.threerings.presents.server;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import com.samskivert.util.ResultListener;
|
import com.samskivert.util.ResultListener;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
|
||||||
import com.threerings.presents.client.TimeBaseService.GotTimeBaseListener;
|
import com.threerings.presents.client.TimeBaseService.GotTimeBaseListener;
|
||||||
|
|
||||||
import com.threerings.presents.data.ClientObject;
|
import com.threerings.presents.data.ClientObject;
|
||||||
@@ -33,6 +32,8 @@ import com.threerings.presents.data.TimeBaseObject;
|
|||||||
|
|
||||||
import com.threerings.presents.dobj.RootDObjectManager;
|
import com.threerings.presents.dobj.RootDObjectManager;
|
||||||
|
|
||||||
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the server-side of the time base services. The time base services provide a means by
|
* Provides the server-side of the time base services. The time base services provide a means by
|
||||||
* which delta times can be sent over the network which are expanded based on a shared base time
|
* which delta times can be sent over the network which are expanded based on a shared base time
|
||||||
|
|||||||
@@ -27,11 +27,12 @@ import java.nio.channels.SocketChannel;
|
|||||||
|
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
|
||||||
import com.threerings.presents.net.AuthRequest;
|
import com.threerings.presents.net.AuthRequest;
|
||||||
import com.threerings.presents.net.AuthResponse;
|
import com.threerings.presents.net.AuthResponse;
|
||||||
import com.threerings.presents.net.UpstreamMessage;
|
import com.threerings.presents.net.UpstreamMessage;
|
||||||
|
|
||||||
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The authing connection manages the client connection until
|
* The authing connection manages the client connection until
|
||||||
* authentication has completed (for better or for worse).
|
* authentication has completed (for better or for worse).
|
||||||
@@ -66,7 +67,7 @@ public class AuthingConnection extends Connection
|
|||||||
_cmgr.getAuthenticator().authenticateConnection(this);
|
_cmgr.getAuthenticator().authenticateConnection(this);
|
||||||
|
|
||||||
} catch (ClassCastException cce) {
|
} catch (ClassCastException cce) {
|
||||||
Log.warning("Received non-authreq message during " +
|
log.warning("Received non-authreq message during " +
|
||||||
"authentication process [conn=" + this +
|
"authentication process [conn=" + this +
|
||||||
", msg=" + msg + "].");
|
", msg=" + msg + "].");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,12 +44,13 @@ import com.threerings.io.ObjectOutputStream;
|
|||||||
import com.threerings.io.UnreliableObjectInputStream;
|
import com.threerings.io.UnreliableObjectInputStream;
|
||||||
import com.threerings.io.UnreliableObjectOutputStream;
|
import com.threerings.io.UnreliableObjectOutputStream;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
|
||||||
import com.threerings.presents.net.DownstreamMessage;
|
import com.threerings.presents.net.DownstreamMessage;
|
||||||
import com.threerings.presents.net.PingRequest;
|
import com.threerings.presents.net.PingRequest;
|
||||||
import com.threerings.presents.net.UpstreamMessage;
|
import com.threerings.presents.net.UpstreamMessage;
|
||||||
import com.threerings.presents.util.DatagramSequencer;
|
import com.threerings.presents.util.DatagramSequencer;
|
||||||
|
|
||||||
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base connection class implements the net event handler interface and processes raw incoming
|
* The base connection class implements the net event handler interface and processes raw incoming
|
||||||
* network data into a stream of parsed <code>UpstreamMessage</code> objects. It also provides the
|
* network data into a stream of parsed <code>UpstreamMessage</code> objects. It also provides the
|
||||||
@@ -166,7 +167,7 @@ public abstract class Connection implements NetEventHandler
|
|||||||
{
|
{
|
||||||
// we shouldn't be closed twice
|
// we shouldn't be closed twice
|
||||||
if (isClosed()) {
|
if (isClosed()) {
|
||||||
Log.warning("Attempted to re-close connection " + this + ".");
|
log.warning("Attempted to re-close connection " + this + ".");
|
||||||
Thread.dumpStack();
|
Thread.dumpStack();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -186,7 +187,7 @@ public abstract class Connection implements NetEventHandler
|
|||||||
{
|
{
|
||||||
// if we're already closed, then something is seriously funny
|
// if we're already closed, then something is seriously funny
|
||||||
if (isClosed()) {
|
if (isClosed()) {
|
||||||
Log.warning("Failure reported on closed connection " + this + ".");
|
log.warning("Failure reported on closed connection " + this + ".");
|
||||||
Thread.dumpStack();
|
Thread.dumpStack();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -264,11 +265,11 @@ public abstract class Connection implements NetEventHandler
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.debug("Closing channel " + this + ".");
|
log.debug("Closing channel " + this + ".");
|
||||||
try {
|
try {
|
||||||
_channel.close();
|
_channel.close();
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
Log.warning("Error closing connection [conn=" + this + ", error=" + ioe + "].");
|
log.warning("Error closing connection [conn=" + this + ", error=" + ioe + "].");
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear out our references to prevent repeat closings
|
// clear out our references to prevent repeat closings
|
||||||
@@ -314,7 +315,7 @@ public abstract class Connection implements NetEventHandler
|
|||||||
close();
|
close();
|
||||||
|
|
||||||
} catch (ClassNotFoundException cnfe) {
|
} catch (ClassNotFoundException cnfe) {
|
||||||
Log.warning("Error reading message from socket [channel=" +
|
log.warning("Error reading message from socket [channel=" +
|
||||||
StringUtil.safeToString(_channel) + ", error=" + cnfe + "].");
|
StringUtil.safeToString(_channel) + ", error=" + cnfe + "].");
|
||||||
// deal with the failure
|
// deal with the failure
|
||||||
String errmsg = "Unable to decode incoming message.";
|
String errmsg = "Unable to decode incoming message.";
|
||||||
@@ -324,7 +325,7 @@ public abstract class Connection implements NetEventHandler
|
|||||||
// don't log a warning for the ever-popular "the client dropped the connection" failure
|
// don't log a warning for the ever-popular "the client dropped the connection" failure
|
||||||
String msg = ioe.getMessage();
|
String msg = ioe.getMessage();
|
||||||
if (msg == null || msg.indexOf("reset by peer") == -1) {
|
if (msg == null || msg.indexOf("reset by peer") == -1) {
|
||||||
Log.warning("Error reading message from socket [channel=" +
|
log.warning("Error reading message from socket [channel=" +
|
||||||
StringUtil.safeToString(_channel) + ", error=" + ioe + "].");
|
StringUtil.safeToString(_channel) + ", error=" + ioe + "].");
|
||||||
}
|
}
|
||||||
// deal with the failure
|
// deal with the failure
|
||||||
@@ -344,7 +345,7 @@ public abstract class Connection implements NetEventHandler
|
|||||||
try {
|
try {
|
||||||
_digest = MessageDigest.getInstance("MD5");
|
_digest = MessageDigest.getInstance("MD5");
|
||||||
} catch (NoSuchAlgorithmException nsae) {
|
} catch (NoSuchAlgorithmException nsae) {
|
||||||
Log.warning("Missing MD5 algorithm.");
|
log.warning("Missing MD5 algorithm.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ByteBufferInputStream bin = new ByteBufferInputStream(buf);
|
ByteBufferInputStream bin = new ByteBufferInputStream(buf);
|
||||||
@@ -360,7 +361,7 @@ public abstract class Connection implements NetEventHandler
|
|||||||
buf.position(4);
|
buf.position(4);
|
||||||
for (int ii = 0; ii < 8; ii++) {
|
for (int ii = 0; ii < 8; ii++) {
|
||||||
if (hash[ii] != buf.get()) {
|
if (hash[ii] != buf.get()) {
|
||||||
Log.warning("Datagram failed hash check [connectionId=" + _connectionId +
|
log.warning("Datagram failed hash check [connectionId=" + _connectionId +
|
||||||
", source=" + source + "].");
|
", source=" + source + "].");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -379,10 +380,10 @@ public abstract class Connection implements NetEventHandler
|
|||||||
_handler.handleMessage(msg);
|
_handler.handleMessage(msg);
|
||||||
|
|
||||||
} catch (ClassNotFoundException cnfe) {
|
} catch (ClassNotFoundException cnfe) {
|
||||||
Log.warning("Error reading datagram [error=" + cnfe + "].");
|
log.warning("Error reading datagram [error=" + cnfe + "].");
|
||||||
|
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
Log.warning("Error reading datagram [error=" + ioe + "].");
|
log.warning("Error reading datagram [error=" + ioe + "].");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -396,7 +397,7 @@ public abstract class Connection implements NetEventHandler
|
|||||||
if (isClosed()) {
|
if (isClosed()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Log.info("Disconnecting non-communicative client [conn=" + this +
|
log.info("Disconnecting non-communicative client [conn=" + this +
|
||||||
", idle=" + idleMillis + "ms].");
|
", idle=" + idleMillis + "ms].");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import com.samskivert.util.*;
|
import com.samskivert.util.*;
|
||||||
|
|
||||||
@@ -286,7 +285,7 @@ public class ConnectionManager extends LoopingThread
|
|||||||
log.info("Server listening on " + isa + ".");
|
log.info("Server listening on " + isa + ".");
|
||||||
|
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
log.log(Level.WARNING, "Failure listening to socket on port '" +
|
log.warning("Failure listening to socket on port '" +
|
||||||
_ports[ii] + "'.", ioe);
|
_ports[ii] + "'.", ioe);
|
||||||
_failure = ioe;
|
_failure = ioe;
|
||||||
}
|
}
|
||||||
@@ -339,7 +338,7 @@ public class ConnectionManager extends LoopingThread
|
|||||||
log.info("Server accepting datagrams on " + isa + ".");
|
log.info("Server accepting datagrams on " + isa + ".");
|
||||||
|
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
log.log(Level.WARNING, "Failure opening datagram channel on port '" +
|
log.warning("Failure opening datagram channel on port '" +
|
||||||
port + "'.", ioe);
|
port + "'.", ioe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -459,14 +458,14 @@ public class ConnectionManager extends LoopingThread
|
|||||||
conn.getAuthRequest(), conn.getAuthResponse());
|
conn.getAuthRequest(), conn.getAuthResponse());
|
||||||
|
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
log.log(Level.WARNING, "Failure upgrading authing connection to running.", ioe);
|
log.warning("Failure upgrading authing connection to running.", ioe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<SelectionKey> ready = null;
|
Set<SelectionKey> ready = null;
|
||||||
try {
|
try {
|
||||||
// check for incoming network events
|
// check for incoming network events
|
||||||
// log.fine("Selecting from " + StringUtil.toString(_selector.keys()) + " (" +
|
// log.debug("Selecting from " + StringUtil.toString(_selector.keys()) + " (" +
|
||||||
// SELECT_LOOP_TIME + ").");
|
// SELECT_LOOP_TIME + ").");
|
||||||
int ecount = _selector.select(SELECT_LOOP_TIME);
|
int ecount = _selector.select(SELECT_LOOP_TIME);
|
||||||
ready = _selector.selectedKeys();
|
ready = _selector.selectedKeys();
|
||||||
@@ -482,7 +481,7 @@ public class ConnectionManager extends LoopingThread
|
|||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
if ("Invalid argument".equals(ioe.getMessage())) {
|
if ("Invalid argument".equals(ioe.getMessage())) {
|
||||||
// what is this, anyway?
|
// what is this, anyway?
|
||||||
log.log(Level.WARNING, "Failure select()ing.", ioe);
|
log.warning("Failure select()ing.", ioe);
|
||||||
} else {
|
} else {
|
||||||
log.warning("Failure select()ing [ioe=" + ioe + "].");
|
log.warning("Failure select()ing [ioe=" + ioe + "].");
|
||||||
}
|
}
|
||||||
@@ -492,7 +491,7 @@ public class ConnectionManager extends LoopingThread
|
|||||||
// this block of code deals with a bug in the _selector that we observed on 2005-05-02,
|
// this block of code deals with a bug in the _selector that we observed on 2005-05-02,
|
||||||
// instead of looping indefinitely after things go pear-shaped, shut us down in an
|
// instead of looping indefinitely after things go pear-shaped, shut us down in an
|
||||||
// orderly fashion
|
// orderly fashion
|
||||||
log.log(Level.WARNING, "Failure select()ing.", re);
|
log.warning("Failure select()ing.", re);
|
||||||
if (_runtimeExceptionCount++ >= 20) {
|
if (_runtimeExceptionCount++ >= 20) {
|
||||||
log.warning("Too many errors, bailing.");
|
log.warning("Too many errors, bailing.");
|
||||||
shutdown();
|
shutdown();
|
||||||
@@ -532,7 +531,7 @@ public class ConnectionManager extends LoopingThread
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.log(Level.WARNING, "Error processing network data: " + handler + ".", e);
|
log.warning("Error processing network data: " + handler + ".", e);
|
||||||
|
|
||||||
// if you freak out here, you go straight in the can
|
// if you freak out here, you go straight in the can
|
||||||
if (handler != null && handler instanceof Connection) {
|
if (handler != null && handler instanceof Connection) {
|
||||||
@@ -681,7 +680,7 @@ public class ConnectionManager extends LoopingThread
|
|||||||
try {
|
try {
|
||||||
return _datagramChannel.send(_databuf, target) > 0;
|
return _datagramChannel.send(_databuf, target) > 0;
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
log.log(Level.WARNING, "Failed to send datagram.", ioe);
|
log.warning("Failed to send datagram.", ioe);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -699,7 +698,7 @@ public class ConnectionManager extends LoopingThread
|
|||||||
protected void handleIterateFailure (Exception e)
|
protected void handleIterateFailure (Exception e)
|
||||||
{
|
{
|
||||||
// log the exception
|
// log the exception
|
||||||
log.log(Level.WARNING, "ConnectionManager.iterate() uncaught exception.", e);
|
log.warning("ConnectionManager.iterate() uncaught exception.", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
@@ -712,7 +711,7 @@ public class ConnectionManager extends LoopingThread
|
|||||||
try {
|
try {
|
||||||
_ssocket.socket().close();
|
_ssocket.socket().close();
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
log.log(Level.WARNING, "Failed to close listening socket.", ioe);
|
log.warning("Failed to close listening socket.", ioe);
|
||||||
}
|
}
|
||||||
|
|
||||||
// and the datagram socket, if any
|
// and the datagram socket, if any
|
||||||
@@ -752,7 +751,7 @@ public class ConnectionManager extends LoopingThread
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// log.fine("Accepted connection " + channel + ".");
|
// log.debug("Accepted connection " + channel + ".");
|
||||||
|
|
||||||
// create a new authing connection object to manage the authentication of this client
|
// create a new authing connection object to manage the authentication of this client
|
||||||
// connection and register it with our selection set
|
// connection and register it with our selection set
|
||||||
@@ -767,7 +766,7 @@ public class ConnectionManager extends LoopingThread
|
|||||||
|
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
// no need to complain this happens in the normal course of events
|
// no need to complain this happens in the normal course of events
|
||||||
// log.log(Level.WARNING, "Failure accepting new connection.", ioe);
|
// log.warning("Failure accepting new connection.", ioe);
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure we don't leak a socket if something went awry
|
// make sure we don't leak a socket if something went awry
|
||||||
@@ -792,7 +791,7 @@ public class ConnectionManager extends LoopingThread
|
|||||||
try {
|
try {
|
||||||
source = (InetSocketAddress)listener.receive(_databuf);
|
source = (InetSocketAddress)listener.receive(_databuf);
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
log.log(Level.WARNING, "Failure receiving datagram.", ioe);
|
log.warning("Failure receiving datagram.", ioe);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -873,7 +872,7 @@ public class ConnectionManager extends LoopingThread
|
|||||||
_outq.append(new Tuple<Connection,byte[]>(conn, data));
|
_outq.append(new Tuple<Connection,byte[]>(conn, data));
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.log(Level.WARNING, "Failure flattening message [conn=" + conn +
|
log.warning("Failure flattening message [conn=" + conn +
|
||||||
", msg=" + msg + "].", e);
|
", msg=" + msg + "].", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import java.util.HashMap;
|
|||||||
import com.samskivert.util.MethodFinder;
|
import com.samskivert.util.MethodFinder;
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class related utility functions.
|
* Class related utility functions.
|
||||||
@@ -80,11 +80,11 @@ public class ClassUtil
|
|||||||
|
|
||||||
} catch (NoSuchMethodException nsme) {
|
} catch (NoSuchMethodException nsme) {
|
||||||
// nothing to do here but fall through and return null
|
// nothing to do here but fall through and return null
|
||||||
Log.info("No such method [name=" + name + ", tclass=" + tclass.getName() +
|
log.info("No such method [name=" + name + ", tclass=" + tclass.getName() +
|
||||||
", args=" + StringUtil.toString(args) + ", error=" + nsme + "].");
|
", args=" + StringUtil.toString(args) + ", error=" + nsme + "].");
|
||||||
|
|
||||||
} catch (SecurityException se) {
|
} catch (SecurityException se) {
|
||||||
Log.warning("Unable to look up method? [tclass=" + tclass.getName() +
|
log.warning("Unable to look up method? [tclass=" + tclass.getName() +
|
||||||
", mname=" + name + "].");
|
", mname=" + name + "].");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,11 +23,12 @@ package com.threerings.presents.util;
|
|||||||
|
|
||||||
import com.samskivert.util.ResultListener;
|
import com.samskivert.util.ResultListener;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
|
||||||
import com.threerings.presents.client.InvocationService;
|
import com.threerings.presents.client.InvocationService;
|
||||||
import com.threerings.presents.data.InvocationCodes;
|
import com.threerings.presents.data.InvocationCodes;
|
||||||
import com.threerings.presents.server.InvocationException;
|
import com.threerings.presents.server.InvocationException;
|
||||||
|
|
||||||
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adapts the response from a {@link ResultListener} to a {@link ConfirmListener} wherein the
|
* Adapts the response from a {@link ResultListener} to a {@link ConfirmListener} wherein the
|
||||||
* result is ignored. If the failure is an instance fo {@link InvocationException} the message will
|
* result is ignored. If the failure is an instance fo {@link InvocationException} the message will
|
||||||
@@ -56,7 +57,7 @@ public class IgnoreConfirmAdapter<T> implements ResultListener<T>
|
|||||||
if (cause instanceof InvocationException) {
|
if (cause instanceof InvocationException) {
|
||||||
_listener.requestFailed(cause.getMessage());
|
_listener.requestFailed(cause.getMessage());
|
||||||
} else {
|
} else {
|
||||||
Log.logStackTrace(cause);
|
log.warning(cause);
|
||||||
_listener.requestFailed(InvocationCodes.INTERNAL_ERROR);
|
_listener.requestFailed(InvocationCodes.INTERNAL_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,6 @@
|
|||||||
|
|
||||||
package com.threerings.presents.util;
|
package com.threerings.presents.util;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import com.samskivert.util.Invoker;
|
import com.samskivert.util.Invoker;
|
||||||
|
|
||||||
import com.threerings.presents.client.InvocationService;
|
import com.threerings.presents.client.InvocationService;
|
||||||
@@ -73,7 +71,7 @@ public abstract class PersistingUnit extends Invoker.Unit
|
|||||||
if (error instanceof InvocationException) {
|
if (error instanceof InvocationException) {
|
||||||
_listener.requestFailed(error.getMessage());
|
_listener.requestFailed(error.getMessage());
|
||||||
} else {
|
} else {
|
||||||
log.log(Level.WARNING, getFailureMessage(), error);
|
log.warning(getFailureMessage(), error);
|
||||||
_listener.requestFailed(InvocationCodes.INTERNAL_ERROR);
|
_listener.requestFailed(InvocationCodes.INTERNAL_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,11 +23,12 @@ package com.threerings.presents.util;
|
|||||||
|
|
||||||
import com.samskivert.util.ResultListener;
|
import com.samskivert.util.ResultListener;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
|
||||||
import com.threerings.presents.client.InvocationService;
|
import com.threerings.presents.client.InvocationService;
|
||||||
import com.threerings.presents.data.InvocationCodes;
|
import com.threerings.presents.data.InvocationCodes;
|
||||||
import com.threerings.presents.server.InvocationException;
|
import com.threerings.presents.server.InvocationException;
|
||||||
|
|
||||||
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adapts the response from a {@link ResultListener} to an InvocationService.ResultListener if the
|
* Adapts the response from a {@link ResultListener} to an InvocationService.ResultListener if the
|
||||||
* failure is an instance of {@link InvocationException} the message will be passed on to the
|
* failure is an instance of {@link InvocationException} the message will be passed on to the
|
||||||
@@ -55,7 +56,7 @@ public class ResultAdapter<T> implements ResultListener<T>
|
|||||||
if (cause instanceof InvocationException) {
|
if (cause instanceof InvocationException) {
|
||||||
_listener.requestFailed(cause.getMessage());
|
_listener.requestFailed(cause.getMessage());
|
||||||
} else {
|
} else {
|
||||||
Log.logStackTrace(cause);
|
log.warning(cause);
|
||||||
_listener.requestFailed(InvocationCodes.INTERNAL_ERROR);
|
_listener.requestFailed(InvocationCodes.INTERNAL_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,12 +23,13 @@ package com.threerings.presents.util;
|
|||||||
|
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
|
||||||
import com.threerings.presents.dobj.DObject;
|
import com.threerings.presents.dobj.DObject;
|
||||||
import com.threerings.presents.dobj.DObjectManager;
|
import com.threerings.presents.dobj.DObjectManager;
|
||||||
import com.threerings.presents.dobj.ObjectAccessException;
|
import com.threerings.presents.dobj.ObjectAccessException;
|
||||||
import com.threerings.presents.dobj.Subscriber;
|
import com.threerings.presents.dobj.Subscriber;
|
||||||
|
|
||||||
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class that safely handles the asynchronous subscription to a
|
* A class that safely handles the asynchronous subscription to a
|
||||||
* distributed object when it is not know if the subscription will
|
* distributed object when it is not know if the subscription will
|
||||||
@@ -73,7 +74,7 @@ public class SafeSubscriber<T extends DObject>
|
|||||||
public void subscribe (DObjectManager omgr)
|
public void subscribe (DObjectManager omgr)
|
||||||
{
|
{
|
||||||
if (_active) {
|
if (_active) {
|
||||||
Log.warning("Active safesub asked to resubscribe " + this + ".");
|
log.warning("Active safesub asked to resubscribe " + this + ".");
|
||||||
Thread.dumpStack();
|
Thread.dumpStack();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -84,7 +85,7 @@ public class SafeSubscriber<T extends DObject>
|
|||||||
// make sure we dont have an object reference (which should be
|
// make sure we dont have an object reference (which should be
|
||||||
// logically impossible)
|
// logically impossible)
|
||||||
if (_object != null) {
|
if (_object != null) {
|
||||||
Log.warning("Incroyable! A safesub has an object and was " +
|
log.warning("Incroyable! A safesub has an object and was " +
|
||||||
"non-active!? " + this + ".");
|
"non-active!? " + this + ".");
|
||||||
Thread.dumpStack();
|
Thread.dumpStack();
|
||||||
// make do in the face of insanity
|
// make do in the face of insanity
|
||||||
@@ -122,7 +123,7 @@ public class SafeSubscriber<T extends DObject>
|
|||||||
if (_object == null && !_pending) {
|
if (_object == null && !_pending) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Log.warning("Inactive safesub asked to unsubscribe " + this + ".");
|
log.warning("Inactive safesub asked to unsubscribe " + this + ".");
|
||||||
Thread.dumpStack();
|
Thread.dumpStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +133,7 @@ public class SafeSubscriber<T extends DObject>
|
|||||||
if (_pending) {
|
if (_pending) {
|
||||||
// make sure we don't have an object reference
|
// make sure we don't have an object reference
|
||||||
if (_object != null) {
|
if (_object != null) {
|
||||||
Log.warning("Incroyable! A safesub has an object and is " +
|
log.warning("Incroyable! A safesub has an object and is " +
|
||||||
"pending!? " + this + ".");
|
"pending!? " + this + ".");
|
||||||
Thread.dumpStack();
|
Thread.dumpStack();
|
||||||
} else {
|
} else {
|
||||||
@@ -144,7 +145,7 @@ public class SafeSubscriber<T extends DObject>
|
|||||||
|
|
||||||
// make sure we have our object
|
// make sure we have our object
|
||||||
if (_object == null) {
|
if (_object == null) {
|
||||||
Log.warning("Zut alors! A safesub _was_ active and not " +
|
log.warning("Zut alors! A safesub _was_ active and not " +
|
||||||
"pending yet has no object!? " + this + ".");
|
"pending yet has no object!? " + this + ".");
|
||||||
Thread.dumpStack();
|
Thread.dumpStack();
|
||||||
// nothing to do since we're apparently already unsubscribed
|
// nothing to do since we're apparently already unsubscribed
|
||||||
@@ -161,13 +162,13 @@ public class SafeSubscriber<T extends DObject>
|
|||||||
{
|
{
|
||||||
// make sure life is not too cruel
|
// make sure life is not too cruel
|
||||||
if (_object != null) {
|
if (_object != null) {
|
||||||
Log.warning("Madre de dios! Our object came available but " +
|
log.warning("Madre de dios! Our object came available but " +
|
||||||
"we've already got one!? " + this);
|
"we've already got one!? " + this);
|
||||||
// go ahead and pitch the old one, God knows what's going on
|
// go ahead and pitch the old one, God knows what's going on
|
||||||
_object = null;
|
_object = null;
|
||||||
}
|
}
|
||||||
if (!_pending) {
|
if (!_pending) {
|
||||||
Log.warning("J.C. on a pogo stick! Our object came available " +
|
log.warning("J.C. on a pogo stick! Our object came available " +
|
||||||
"but we're not pending!? " + this);
|
"but we're not pending!? " + this);
|
||||||
// go with our badselves, it's the only way
|
// go with our badselves, it's the only way
|
||||||
}
|
}
|
||||||
@@ -197,7 +198,7 @@ public class SafeSubscriber<T extends DObject>
|
|||||||
{
|
{
|
||||||
// do the right thing with our pending state
|
// do the right thing with our pending state
|
||||||
if (!_pending) {
|
if (!_pending) {
|
||||||
Log.warning("Criminy creole! Our subscribe failed but we're " +
|
log.warning("Criminy creole! Our subscribe failed but we're " +
|
||||||
"not pending!? " + this);
|
"not pending!? " + this);
|
||||||
// go with our badselves, it's the only way
|
// go with our badselves, it's the only way
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public class MessageManager
|
|||||||
|
|
||||||
// use the default locale
|
// use the default locale
|
||||||
_locale = Locale.getDefault();
|
_locale = Locale.getDefault();
|
||||||
log.fine("Using locale: " + _locale + ".");
|
log.debug("Using locale: " + _locale + ".");
|
||||||
|
|
||||||
// make sure the prefix ends with a dot
|
// make sure the prefix ends with a dot
|
||||||
if (!_prefix.endsWith(".")) {
|
if (!_prefix.endsWith(".")) {
|
||||||
|
|||||||
@@ -22,13 +22,14 @@
|
|||||||
package com.threerings.bureau.client;
|
package com.threerings.bureau.client;
|
||||||
|
|
||||||
import com.samskivert.util.OneLineLogFormatter;
|
import com.samskivert.util.OneLineLogFormatter;
|
||||||
import com.threerings.bureau.Log;
|
|
||||||
import com.samskivert.util.Queue;
|
import com.samskivert.util.Queue;
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
import com.threerings.bureau.client.BureauDirector;
|
import com.threerings.bureau.client.BureauDirector;
|
||||||
import com.threerings.bureau.data.AgentObject;
|
import com.threerings.bureau.data.AgentObject;
|
||||||
import com.samskivert.util.RunQueue;
|
import com.samskivert.util.RunQueue;
|
||||||
|
|
||||||
|
import static com.threerings.bureau.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extends bureau client minimally and provides a static main function to create a client and
|
* Extends bureau client minimally and provides a static main function to create a client and
|
||||||
* connect to a server given by system properties.
|
* connect to a server given by system properties.
|
||||||
@@ -91,12 +92,12 @@ public class TestClient extends BureauClient
|
|||||||
{
|
{
|
||||||
public void start ()
|
public void start ()
|
||||||
{
|
{
|
||||||
Log.info("Starting agent " + StringUtil.toString(_agentObj));
|
log.info("Starting agent " + StringUtil.toString(_agentObj));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stop ()
|
public void stop ()
|
||||||
{
|
{
|
||||||
Log.info("Stopping agent " + StringUtil.toString(_agentObj));
|
log.info("Stopping agent " + StringUtil.toString(_agentObj));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,12 +21,15 @@
|
|||||||
|
|
||||||
package com.threerings.bureau.server;
|
package com.threerings.bureau.server;
|
||||||
|
|
||||||
import com.samskivert.util.OneLineLogFormatter;
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.threerings.bureau.data.AgentObject;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
|
import com.threerings.bureau.data.AgentObject;
|
||||||
|
|
||||||
|
import static com.threerings.bureau.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uses a TestServer to pound on the BureauRegistry. Sends random sequences of
|
* Uses a TestServer to pound on the BureauRegistry. Sends random sequences of
|
||||||
* startAgent and destroyAgent. Most aspects of the randomness are configurable using system
|
* startAgent and destroyAgent. Most aspects of the randomness are configurable using system
|
||||||
@@ -43,11 +46,11 @@ public class RegistryTester
|
|||||||
{
|
{
|
||||||
String val = System.getProperty(name);
|
String val = System.getProperty(name);
|
||||||
if (val == null) {
|
if (val == null) {
|
||||||
TestServer.log.info("Property " + name + " is " + defaultVal);
|
log.info("Property " + name + " is " + defaultVal);
|
||||||
return defaultVal;
|
return defaultVal;
|
||||||
}
|
}
|
||||||
int ival = Integer.parseInt(val);
|
int ival = Integer.parseInt(val);
|
||||||
TestServer.log.info("Property " + name + " is " + ival);
|
log.info("Property " + name + " is " + ival);
|
||||||
return ival;
|
return ival;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,9 +59,6 @@ public class RegistryTester
|
|||||||
*/
|
*/
|
||||||
public static void main (String[] args)
|
public static void main (String[] args)
|
||||||
{
|
{
|
||||||
// make log pretty
|
|
||||||
OneLineLogFormatter.configureDefaultHandler();
|
|
||||||
|
|
||||||
TestServer server = new TestServer();
|
TestServer server = new TestServer();
|
||||||
RegistryTester tester = new RegistryTester(server);
|
RegistryTester tester = new RegistryTester(server);
|
||||||
|
|
||||||
@@ -68,8 +68,7 @@ public class RegistryTester
|
|||||||
server.run();
|
server.run();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
TestServer.log.warning("Unable to initialize server.");
|
log.warning("Unable to initialize server.", e);
|
||||||
TestServer.logStackTrace(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +94,7 @@ public class RegistryTester
|
|||||||
// TODO: this is not called on Ctrl-C, need a way to shut down gracefully
|
// TODO: this is not called on Ctrl-C, need a way to shut down gracefully
|
||||||
TestServer.registerShutdowner(new TestServer.Shutdowner() {
|
TestServer.registerShutdowner(new TestServer.Shutdowner() {
|
||||||
public void shutdown () {
|
public void shutdown () {
|
||||||
TestServer.log.info("Shutting down tests");
|
log.info("Shutting down tests");
|
||||||
_stop = true;
|
_stop = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -110,9 +109,9 @@ public class RegistryTester
|
|||||||
|
|
||||||
Thread thread = new Thread("Registry test thread") {
|
Thread thread = new Thread("Registry test thread") {
|
||||||
public void run () {
|
public void run () {
|
||||||
TestServer.log.info(getName() + " started");
|
log.info(getName() + " started");
|
||||||
runTestThread();
|
runTestThread();
|
||||||
TestServer.log.info(getName() + " stopped");
|
log.info(getName() + " stopped");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
thread.start();
|
thread.start();
|
||||||
@@ -139,17 +138,17 @@ public class RegistryTester
|
|||||||
_rng1 = new Random(seed);
|
_rng1 = new Random(seed);
|
||||||
_rng2 = new Random(seed);
|
_rng2 = new Random(seed);
|
||||||
|
|
||||||
TestServer.log.info("Running tests, seed is " + seed);
|
log.info("Running tests, seed is " + seed);
|
||||||
|
|
||||||
// runnable that generates N requests to create or destroy agents
|
// runnable that generates N requests to create or destroy agents
|
||||||
Runnable createOrDestroyAgents = new Runnable() {
|
Runnable createOrDestroyAgents = new Runnable() {
|
||||||
public void run () {
|
public void run () {
|
||||||
int ops = 1 + _rng1.nextInt(_maxOps);
|
int ops = 1 + _rng1.nextInt(_maxOps);
|
||||||
TestServer.log.info("Starting " + ops + " agent requests");
|
log.info("Starting " + ops + " agent requests");
|
||||||
for (int i = 0; i < ops; ++i) {
|
for (int i = 0; i < ops; ++i) {
|
||||||
randomlyCreateOrDestroyAgent();
|
randomlyCreateOrDestroyAgent();
|
||||||
}
|
}
|
||||||
TestServer.log.info("Finished " + ops + " agent requests");
|
log.info("Finished " + ops + " agent requests");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -188,13 +187,13 @@ public class RegistryTester
|
|||||||
if (size >= _maxAgents ||
|
if (size >= _maxAgents ||
|
||||||
(size != 0 && _rng1.nextInt(100) >= _createChance)) {
|
(size != 0 && _rng1.nextInt(100) >= _createChance)) {
|
||||||
AgentObject toRemove = _agents.remove(_rng1.nextInt(size));
|
AgentObject toRemove = _agents.remove(_rng1.nextInt(size));
|
||||||
TestServer.log.info("Removing agent " + toRemove.getOid());
|
log.info("Removing agent " + toRemove.getOid());
|
||||||
TestServer.breg.destroyAgent(toRemove);
|
TestServer.breg.destroyAgent(toRemove);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
AgentObject added = create(_rng1.nextInt(_numBureaus) + 1);
|
AgentObject added = create(_rng1.nextInt(_numBureaus) + 1);
|
||||||
_agents.add(added);
|
_agents.add(added);
|
||||||
TestServer.log.info("Added agent " + added.getOid());
|
log.info("Added agent " + added.getOid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,36 +22,24 @@
|
|||||||
package com.threerings.bureau.server;
|
package com.threerings.bureau.server;
|
||||||
|
|
||||||
import com.threerings.presents.server.PresentsServer;
|
import com.threerings.presents.server.PresentsServer;
|
||||||
import com.samskivert.util.OneLineLogFormatter;
|
|
||||||
import java.util.logging.Level;
|
import static com.threerings.bureau.Log.log;
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extends a presents server to include a bureau registry.
|
* Extends a presents server to include a bureau registry.
|
||||||
*/
|
*/
|
||||||
public class TestServer extends PresentsServer
|
public class TestServer extends PresentsServer
|
||||||
{
|
{
|
||||||
/** We dispatch our log messages through this logger. */
|
|
||||||
public static Logger log = Logger.getLogger(TestServer.class.getName());
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The bureau registry for the server. Will be null until <code>init</code> is called.
|
* The bureau registry for the server. Will be null until <code>init</code> is called.
|
||||||
*/
|
*/
|
||||||
public static BureauRegistry breg;
|
public static BureauRegistry breg;
|
||||||
|
|
||||||
public static void logStackTrace (Throwable t)
|
|
||||||
{
|
|
||||||
log.log(Level.WARNING, t.getMessage(), t);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new server and runs it.
|
* Creates a new server and runs it.
|
||||||
*/
|
*/
|
||||||
public static void main (String[] args)
|
public static void main (String[] args)
|
||||||
{
|
{
|
||||||
// make log pretty
|
|
||||||
OneLineLogFormatter.configureDefaultHandler();
|
|
||||||
|
|
||||||
final TestServer server = new TestServer();
|
final TestServer server = new TestServer();
|
||||||
try {
|
try {
|
||||||
server.init();
|
server.init();
|
||||||
@@ -59,8 +47,7 @@ public class TestServer extends PresentsServer
|
|||||||
server.run();
|
server.run();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warning("Unable to initialize server.");
|
log.warning("Unable to initialize server.", e);
|
||||||
logStackTrace(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import com.threerings.util.Name;
|
|||||||
import com.threerings.presents.client.Client;
|
import com.threerings.presents.client.Client;
|
||||||
import com.threerings.presents.net.UsernamePasswordCreds;
|
import com.threerings.presents.net.UsernamePasswordCreds;
|
||||||
|
|
||||||
import com.threerings.crowd.Log;
|
import static com.threerings.crowd.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main point of entry for the Jabber client application. It creates
|
* The main point of entry for the Jabber client application. It creates
|
||||||
@@ -62,7 +62,7 @@ public class JabberApp
|
|||||||
Client client = _client.getContext().getClient();
|
Client client = _client.getContext().getClient();
|
||||||
|
|
||||||
// pass them on to the client
|
// pass them on to the client
|
||||||
Log.info("Using [server=" + server + "].");
|
log.info("Using [server=" + server + "].");
|
||||||
client.setServer(server, Client.DEFAULT_SERVER_PORTS);
|
client.setServer(server, Client.DEFAULT_SERVER_PORTS);
|
||||||
|
|
||||||
// configure the client with some credentials and logon
|
// configure the client with some credentials and logon
|
||||||
@@ -96,8 +96,7 @@ public class JabberApp
|
|||||||
// initialize the app
|
// initialize the app
|
||||||
app.init();
|
app.init();
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
Log.warning("Error initializing application.");
|
log.warning("Error initializing application.", ioe);
|
||||||
Log.logStackTrace(ioe);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// and run it
|
// and run it
|
||||||
|
|||||||
@@ -32,10 +32,11 @@ import com.threerings.presents.client.*;
|
|||||||
import com.threerings.presents.dobj.DObjectManager;
|
import com.threerings.presents.dobj.DObjectManager;
|
||||||
import com.threerings.presents.net.*;
|
import com.threerings.presents.net.*;
|
||||||
|
|
||||||
import com.threerings.crowd.Log;
|
|
||||||
import com.threerings.crowd.chat.client.ChatDirector;
|
import com.threerings.crowd.chat.client.ChatDirector;
|
||||||
import com.threerings.crowd.util.CrowdContext;
|
import com.threerings.crowd.util.CrowdContext;
|
||||||
|
|
||||||
|
import static com.threerings.crowd.Log.log;
|
||||||
|
|
||||||
public class TestClient
|
public class TestClient
|
||||||
implements RunQueue, ClientObserver
|
implements RunQueue, ClientObserver
|
||||||
{
|
{
|
||||||
@@ -89,7 +90,7 @@ public class TestClient
|
|||||||
|
|
||||||
public void clientDidLogon (Client client)
|
public void clientDidLogon (Client client)
|
||||||
{
|
{
|
||||||
Log.info("Client did logon [client=" + client + "].");
|
log.info("Client did logon [client=" + client + "].");
|
||||||
|
|
||||||
// request to move to a place
|
// request to move to a place
|
||||||
_ctx.getLocationDirector().moveTo(15);
|
_ctx.getLocationDirector().moveTo(15);
|
||||||
@@ -97,30 +98,30 @@ public class TestClient
|
|||||||
|
|
||||||
public void clientObjectDidChange (Client client)
|
public void clientObjectDidChange (Client client)
|
||||||
{
|
{
|
||||||
Log.info("Client object did change [client=" + client + "].");
|
log.info("Client object did change [client=" + client + "].");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clientFailedToLogon (Client client, Exception cause)
|
public void clientFailedToLogon (Client client, Exception cause)
|
||||||
{
|
{
|
||||||
Log.info("Client failed to logon [client=" + client +
|
log.info("Client failed to logon [client=" + client +
|
||||||
", cause=" + cause + "].");
|
", cause=" + cause + "].");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clientConnectionFailed (Client client, Exception cause)
|
public void clientConnectionFailed (Client client, Exception cause)
|
||||||
{
|
{
|
||||||
Log.info("Client connection failed [client=" + client +
|
log.info("Client connection failed [client=" + client +
|
||||||
", cause=" + cause + "].");
|
", cause=" + cause + "].");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean clientWillLogoff (Client client)
|
public boolean clientWillLogoff (Client client)
|
||||||
{
|
{
|
||||||
Log.info("Client will logoff [client=" + client + "].");
|
log.info("Client will logoff [client=" + client + "].");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clientDidLogoff (Client client)
|
public void clientDidLogoff (Client client)
|
||||||
{
|
{
|
||||||
Log.info("Client did logoff [client=" + client + "].");
|
log.info("Client did logoff [client=" + client + "].");
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,11 @@
|
|||||||
|
|
||||||
package com.threerings.crowd.server;
|
package com.threerings.crowd.server;
|
||||||
|
|
||||||
import com.threerings.crowd.Log;
|
|
||||||
import com.threerings.crowd.data.JabberConfig;
|
import com.threerings.crowd.data.JabberConfig;
|
||||||
import com.threerings.crowd.data.PlaceObject;
|
import com.threerings.crowd.data.PlaceObject;
|
||||||
|
|
||||||
|
import static com.threerings.crowd.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A basic server that creates a single room and sticks everyone in it
|
* A basic server that creates a single room and sticks everyone in it
|
||||||
* where they can chat with one another.
|
* where they can chat with one another.
|
||||||
@@ -30,8 +31,7 @@ public class JabberServer extends CrowdServer
|
|||||||
server.init();
|
server.init();
|
||||||
server.run();
|
server.run();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.warning("Unable to initialize server.");
|
log.warning("Unable to initialize server.", e);
|
||||||
Log.logStackTrace(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,11 +28,12 @@ import com.samskivert.util.RunQueue;
|
|||||||
|
|
||||||
import com.threerings.util.Name;
|
import com.threerings.util.Name;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
|
||||||
import com.threerings.presents.data.TestObject;
|
import com.threerings.presents.data.TestObject;
|
||||||
import com.threerings.presents.dobj.*;
|
import com.threerings.presents.dobj.*;
|
||||||
import com.threerings.presents.net.*;
|
import com.threerings.presents.net.*;
|
||||||
|
|
||||||
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A standalone test client.
|
* A standalone test client.
|
||||||
*/
|
*/
|
||||||
@@ -74,7 +75,7 @@ public class TestClient
|
|||||||
|
|
||||||
public void clientDidLogon (Client client)
|
public void clientDidLogon (Client client)
|
||||||
{
|
{
|
||||||
Log.info("Client did logon [client=" + client + "].");
|
log.info("Client did logon [client=" + client + "].");
|
||||||
|
|
||||||
// register ourselves as a test notification receiver
|
// register ourselves as a test notification receiver
|
||||||
client.getInvocationDirector().registerReceiver(new TestDecoder(this));
|
client.getInvocationDirector().registerReceiver(new TestDecoder(this));
|
||||||
@@ -89,10 +90,10 @@ public class TestClient
|
|||||||
three.add(5);
|
three.add(5);
|
||||||
service.test(client, "one", 2, three, new TestService.TestFuncListener() {
|
service.test(client, "one", 2, three, new TestService.TestFuncListener() {
|
||||||
public void testSucceeded (String one, int two) {
|
public void testSucceeded (String one, int two) {
|
||||||
Log.info("Got test response [one=" + one + ", two=" + two + "].");
|
log.info("Got test response [one=" + one + ", two=" + two + "].");
|
||||||
}
|
}
|
||||||
public void requestFailed (String reason) {
|
public void requestFailed (String reason) {
|
||||||
Log.info("Urk! Request failed [reason=" + reason + "].");
|
log.info("Urk! Request failed [reason=" + reason + "].");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -102,25 +103,25 @@ public class TestClient
|
|||||||
|
|
||||||
public void clientObjectDidChange (Client client)
|
public void clientObjectDidChange (Client client)
|
||||||
{
|
{
|
||||||
Log.info("Client object did change [client=" + client + "].");
|
log.info("Client object did change [client=" + client + "].");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clientDidLogoff (Client client)
|
public void clientDidLogoff (Client client)
|
||||||
{
|
{
|
||||||
Log.info("Client did logoff [client=" + client + "].");
|
log.info("Client did logoff [client=" + client + "].");
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void objectAvailable (TestObject object)
|
public void objectAvailable (TestObject object)
|
||||||
{
|
{
|
||||||
object.addListener(this);
|
object.addListener(this);
|
||||||
Log.info("Object available: " + object);
|
log.info("Object available: " + object);
|
||||||
object.setBar("lawl!");
|
object.setBar("lawl!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void requestFailed (int oid, ObjectAccessException cause)
|
public void requestFailed (int oid, ObjectAccessException cause)
|
||||||
{
|
{
|
||||||
Log.info("Object unavailable [oid=" + oid +
|
log.info("Object unavailable [oid=" + oid +
|
||||||
", reason=" + cause + "].");
|
", reason=" + cause + "].");
|
||||||
// nothing to do, so might as well logoff
|
// nothing to do, so might as well logoff
|
||||||
_client.logoff(true);
|
_client.logoff(true);
|
||||||
@@ -128,7 +129,7 @@ public class TestClient
|
|||||||
|
|
||||||
public void eventReceived (DEvent event)
|
public void eventReceived (DEvent event)
|
||||||
{
|
{
|
||||||
Log.info("Got event [event=" + event + "].");
|
log.info("Got event [event=" + event + "].");
|
||||||
|
|
||||||
// request that we log off
|
// request that we log off
|
||||||
_client.logoff(true);
|
_client.logoff(true);
|
||||||
@@ -144,13 +145,13 @@ public class TestClient
|
|||||||
// documentation inherited from interface
|
// documentation inherited from interface
|
||||||
public void requestFailed (String reason)
|
public void requestFailed (String reason)
|
||||||
{
|
{
|
||||||
Log.info("Urk! Request failed [reason=" + reason + "].");
|
log.info("Urk! Request failed [reason=" + reason + "].");
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited from interface
|
// documentation inherited from interface
|
||||||
public void receivedTest (int one, String two)
|
public void receivedTest (int one, String two)
|
||||||
{
|
{
|
||||||
Log.info("Received test notification [one=" + one +
|
log.info("Received test notification [one=" + one +
|
||||||
", two=" + two + "].");
|
", two=" + two + "].");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,10 +24,11 @@ package com.threerings.presents.server;
|
|||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
|
||||||
import com.threerings.presents.data.TestObject;
|
import com.threerings.presents.data.TestObject;
|
||||||
import com.threerings.presents.dobj.*;
|
import com.threerings.presents.dobj.*;
|
||||||
|
|
||||||
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests that the dobjmgr will not allow a destroyed object to be added to
|
* Tests that the dobjmgr will not allow a destroyed object to be added to
|
||||||
* an oid list.
|
* an oid list.
|
||||||
@@ -51,7 +52,7 @@ public class DestroyedRefTest extends TestCase
|
|||||||
|
|
||||||
// when we get the attribute change, we can exit
|
// when we get the attribute change, we can exit
|
||||||
if (event instanceof ObjectDestroyedEvent) {
|
if (event instanceof ObjectDestroyedEvent) {
|
||||||
Log.info("The upcoming object added event should be rejected.");
|
log.info("The upcoming object added event should be rejected.");
|
||||||
|
|
||||||
} else if (event instanceof ObjectAddedEvent &&
|
} else if (event instanceof ObjectAddedEvent &&
|
||||||
toid == _objtwo.getOid()) {
|
toid == _objtwo.getOid()) {
|
||||||
@@ -78,7 +79,7 @@ public class DestroyedRefTest extends TestCase
|
|||||||
// add object one to object two twice in a row to make sure repeated
|
// add object one to object two twice in a row to make sure repeated
|
||||||
// adds don't result in the object being listed twice
|
// adds don't result in the object being listed twice
|
||||||
_objtwo.addToList(_objone.getOid());
|
_objtwo.addToList(_objone.getOid());
|
||||||
Log.info("The following addToList() should be ignored.");
|
log.info("The following addToList() should be ignored.");
|
||||||
_objtwo.addToList(_objone.getOid());
|
_objtwo.addToList(_objone.getOid());
|
||||||
|
|
||||||
// now that we have both objects, try to set up the reference. first
|
// now that we have both objects, try to set up the reference. first
|
||||||
|
|||||||
@@ -7,10 +7,11 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
|
||||||
import com.threerings.presents.client.TestService;
|
import com.threerings.presents.client.TestService;
|
||||||
import com.threerings.presents.data.ClientObject;
|
import com.threerings.presents.data.ClientObject;
|
||||||
|
|
||||||
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements the server side of the TestProvider interface.
|
* Implements the server side of the TestProvider interface.
|
||||||
*/
|
*/
|
||||||
@@ -22,7 +23,7 @@ public class TestManager
|
|||||||
TestService.TestOidListener listener)
|
TestService.TestOidListener listener)
|
||||||
throws InvocationException
|
throws InvocationException
|
||||||
{
|
{
|
||||||
Log.info("Handling get test oid [src=" + caller + "].");
|
log.info("Handling get test oid [src=" + caller + "].");
|
||||||
|
|
||||||
// issue a test notification just for kicks
|
// issue a test notification just for kicks
|
||||||
TestSender.sendTest(caller, 1, "two");
|
TestSender.sendTest(caller, 1, "two");
|
||||||
@@ -35,7 +36,7 @@ public class TestManager
|
|||||||
ArrayList<Integer> three, TestService.TestFuncListener listener)
|
ArrayList<Integer> three, TestService.TestFuncListener listener)
|
||||||
throws InvocationException
|
throws InvocationException
|
||||||
{
|
{
|
||||||
Log.info("Test request [one=" + one + ", two=" + two +
|
log.info("Test request [one=" + one + ", two=" + two +
|
||||||
", three=" + StringUtil.toString(three) + "].");
|
", three=" + StringUtil.toString(three) + "].");
|
||||||
|
|
||||||
// and issue a response to this invocation request
|
// and issue a response to this invocation request
|
||||||
|
|||||||
@@ -21,10 +21,11 @@
|
|||||||
|
|
||||||
package com.threerings.presents.server;
|
package com.threerings.presents.server;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
|
||||||
import com.threerings.presents.data.TestObject;
|
import com.threerings.presents.data.TestObject;
|
||||||
import com.threerings.presents.dobj.*;
|
import com.threerings.presents.dobj.*;
|
||||||
|
|
||||||
|
import static com.threerings.presents.Log.log;
|
||||||
|
|
||||||
public class TestServer extends PresentsServer
|
public class TestServer extends PresentsServer
|
||||||
{
|
{
|
||||||
public static TestObject testobj;
|
public static TestObject testobj;
|
||||||
@@ -52,8 +53,7 @@ public class TestServer extends PresentsServer
|
|||||||
server.init();
|
server.init();
|
||||||
server.run();
|
server.run();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.warning("Unable to initialize server.");
|
log.warning("Unable to initialize server.", e);
|
||||||
Log.logStackTrace(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user