More custom classloader support. We now have a proof-of-concept working so

it's unlikely that the rabbit hole will surprise us with further depth.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3269 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2004-12-10 02:54:26 +00:00
parent c92a922678
commit a6d7764e29
5 changed files with 87 additions and 30 deletions
@@ -1,5 +1,5 @@
//
// $Id: Connection.java,v 1.20 2004/08/27 02:20:24 mdb Exp $
// $Id$
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
@@ -80,6 +80,17 @@ public abstract class Connection implements NetEventHandler
_handler = handler;
}
/**
* Configures this connection with a custom class loader.
*/
public void setClassLoader (ClassLoader loader)
{
_loader = loader;
if (_oin != null) {
_oin.setClassLoader(loader);
}
}
/**
* Returns the selection key associated with our socket channel.
*/
@@ -175,6 +186,9 @@ public abstract class Connection implements NetEventHandler
_fin = other._fin;
_oin = other._oin;
_oout = other._oout;
if (_loader != null) {
_oin.setClassLoader(_loader);
}
}
/**
@@ -242,6 +256,9 @@ public abstract class Connection implements NetEventHandler
if (_fin == null) {
_fin = new FramedInputStream();
_oin = new ObjectInputStream(_fin);
if (_loader != null) {
_oin.setClassLoader(_loader);
}
}
// there may be more than one frame in the buffer, so we keep
@@ -318,10 +335,10 @@ public abstract class Connection implements NetEventHandler
protected FramedInputStream _fin;
protected ObjectInputStream _oin;
protected ObjectOutputStream _oout;
protected MessageHandler _handler;
protected ClassLoader _loader;
/** The number of milliseconds beyond the ping interval that we allow
* a client's network connection to be idle before we forcibly