propagate from branch 'i2p.i2p' (head 2da3b585b42d058e25909bc303d72277ae2463b5)

to branch 'i2p.i2p.zzz.update' (head ebbad994215dc2822e9a1776399864ed77a0e5a0)
This commit is contained in:
zzz
2012-10-14 22:42:00 +00:00
42 changed files with 3010 additions and 1251 deletions

View File

@ -99,18 +99,23 @@
</target>
<!-- unit tests -->
<target name="builddepscalatest">
<ant dir="../../core/java/" target="jar" />
<ant dir="../../core/java/" target="jarScalaTest" />
</target>
<target name="builddeptest">
<ant dir="../../core/java/" target="jarTest" />
</target>
<target name="scalatest.compileTest" depends="jar, scala.init">
<target name="scalatest.compileTest" depends="builddepscalatest, compile, scala.init">
<mkdir dir="./build" />
<mkdir dir="./build/obj_scala" />
<scalac srcdir="./test/scalatest" destdir="./build/obj_scala" deprecation="on" >
<classpath>
<pathelement location="${classpath}" />
<pathelement location="${scala-library.jar}" />
<pathelement location="${scalatest.jar}" />
<pathelement location="../../core/java/build/i2p.jar" />
<pathelement location="./build/router.jar" />
<pathelement location="../../core/java/build/i2pscalatest.jar" />
<pathelement location="./build/obj" />
</classpath>
</scalac>
</target>
@ -124,6 +129,23 @@
<compilerarg line="${javac.compilerargs}" />
</javac>
</target>
<!-- jars with tests -->
<target name="jarScalaTest" depends="scalatest.compileTest">
<mkdir dir="./build/obj_scala_jar" />
<copy todir="./build/obj_scala_jar">
<fileset dir="./build/">
<include name="obj/**/*.class"/>
</fileset>
<mapper type="glob" from="obj/*" to="*" />
</copy>
<copy todir="./build/obj_scala_jar">
<fileset dir="./build/">
<include name="obj_scala/**/*.class"/>
</fileset>
<mapper type="glob" from="obj_scala/*" to="*" />
</copy>
<jar destfile="./build/routerscalatest.jar" basedir="./build/obj_scala_jar" includes="**/*.class" />
</target>
<target name="jarTest" depends="junit.compileTest">
<jar destfile="./build/routertest.jar" basedir="./build/obj" includes="**/*.class" />
</target>

View File

@ -23,6 +23,7 @@ import net.i2p.router.transport.FIFOBandwidthLimiter;
import net.i2p.router.transport.OutboundMessageRegistry;
import net.i2p.router.tunnel.TunnelDispatcher;
import net.i2p.router.tunnel.pool.TunnelPoolManager;
import net.i2p.update.UpdateManager;
import net.i2p.util.KeyRing;
import net.i2p.util.I2PProperties.I2PPropertyCallback;
@ -56,11 +57,12 @@ public class RouterContext extends I2PAppContext {
private Shitlist _shitlist;
private Blocklist _blocklist;
private MessageValidator _messageValidator;
private UpdateManager _updateManager;
//private MessageStateMonitor _messageStateMonitor;
private RouterThrottle _throttle;
private final Set<Runnable> _finalShutdownTasks;
// split up big lock on this to avoid deadlocks
private final Object _lock1 = new Object(), _lock2 = new Object();
private final Object _lock1 = new Object(), _lock2 = new Object(), _lock3 = new Object();
private static final List<RouterContext> _contexts = new CopyOnWriteArrayList();
@ -483,6 +485,7 @@ public class RouterContext extends I2PAppContext {
* @return true
* @since 0.7.9
*/
@Override
public boolean isRouterContext() {
return true;
}
@ -492,7 +495,44 @@ public class RouterContext extends I2PAppContext {
* @return the client manager
* @since 0.8.3
*/
@Override
public InternalClientManager internalClientManager() {
return _clientManagerFacade;
}
/**
* The controller of router, plugin, and other updates.
* @return The manager if it is registered, else null
* @since 0.9.2
*/
@Override
public UpdateManager updateManager() {
return _updateManager;
}
/**
* Register as the update manager.
* @throws IllegalStateException if one was already registered
* @since 0.9.2
*/
public void registerUpdateManager(UpdateManager mgr) {
synchronized(_lock3) {
if (_updateManager != null)
throw new IllegalStateException();
_updateManager = mgr;
}
}
/**
* Unregister the update manager.
* @throws IllegalStateException if it was not registered
* @since 0.9.2
*/
public void unregisterUpdateManager(UpdateManager mgr) {
synchronized(_lock3) {
if (_updateManager != mgr)
throw new IllegalStateException();
_updateManager = null;
}
}
}