2009-04-06 sponge

SimpleScheduler SimpleTimer2 debugging added.
Fix build files for desktopgui.
This commit is contained in:
sponge
2009-04-06 22:40:22 +00:00
parent 495558a949
commit 37667247c3
8 changed files with 47 additions and 15 deletions

View File

@ -2,6 +2,11 @@
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="desktopgui" default="default" basedir=".">
<description>Builds, tests, and runs the project desktopgui.</description>
<import file="nbproject/build-impl.xml"/>

View File

@ -152,7 +152,7 @@ is divided into following sections:
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="${javac.debug}" name="debug"/>
<attribute default="" name="sourcepath"/>
<attribute default="/does/not/exist" name="sourcepath"/>
<element name="customize" optional="true"/>
<sequential>
<javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
@ -218,13 +218,13 @@ is divided into following sections:
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-nbjpda">
<target depends="-init-debug-args" name="-init-macrodef-nbjpda">
<macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute default="${main.class}" name="name"/>
<attribute default="${debug.classpath}" name="classpath"/>
<attribute default="" name="stopclassname"/>
<sequential>
<nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="dt_socket">
<nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
<classpath>
<path path="@{classpath}"/>
</classpath>
@ -255,6 +255,12 @@ is divided into following sections:
<condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
<istrue value="${have-jdk-older-than-1.4}"/>
</condition>
<condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
<os family="windows"/>
</condition>
<condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
<isset property="debug.transport"/>
</condition>
</target>
<target depends="-init-debug-args" name="-init-macrodef-debug">
<macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
@ -264,7 +270,7 @@ is divided into following sections:
<sequential>
<java classname="@{classname}" dir="${work.dir}" fork="true">
<jvmarg line="${debug-args-line}"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
<jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
<jvmarg line="${run.jvmargs}"/>
<classpath>
<path path="@{classpath}"/>
@ -311,6 +317,13 @@ is divided into following sections:
===================
-->
<target depends="init" name="deps-jar" unless="no.deps"/>
<target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
<target depends="init" name="-check-automatic-build">
<available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
</target>
<target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
<antcall target="clean"/>
</target>
<target depends="init,deps-jar" name="-pre-pre-compile">
<mkdir dir="${build.classes.dir}"/>
</target>
@ -331,7 +344,7 @@ is divided into following sections:
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
<target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
<target name="-pre-compile-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
@ -345,7 +358,7 @@ is divided into following sections:
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
<target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
<!--
====================
JAR BUILDING SECTION

View File

@ -1,8 +1,8 @@
build.xml.data.CRC32=c4b345cd
build.xml.script.CRC32=9785bb9a
build.xml.stylesheet.CRC32=be360661
build.xml.script.CRC32=9c13114f
build.xml.stylesheet.CRC32=958a1d3e
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=c4b345cd
nbproject/build-impl.xml.script.CRC32=74d3fda2
nbproject/build-impl.xml.stylesheet.CRC32=487672f9
nbproject/build-impl.xml.script.CRC32=8c02c081
nbproject/build-impl.xml.stylesheet.CRC32=65b8de21

View File

@ -25,9 +25,9 @@ file.reference.router.jar=../../router/java/build/router.jar
includes=**
jar.compress=false
javac.classpath=\
${libs.swing-app-framework.classpath}:\
${file.reference.router.jar}:\
${file.reference.i2p.jar}
${file.reference.i2p.jar}:\
${libs.swing-app-framework.classpath}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false

View File

@ -1,7 +1,6 @@
package net.i2p.util;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.ThreadFactory;
@ -91,6 +90,10 @@ public class SimpleScheduler {
public Thread newThread(Runnable r) {
Thread rv = Executors.defaultThreadFactory().newThread(r);
rv.setName(_name + ' ' + (++_count) + '/' + THREADS);
String name = rv.getThreadGroup().getName();
if(!(name.isEmpty() || name.equals("Main") || name.equals("main"))) {
(new Exception("OWCH! DAMN! Wrong ThreadGroup `" + name +"', `" + rv.getName() + "'")).printStackTrace();
}
rv.setDaemon(true);
return rv;
}
@ -144,9 +147,11 @@ public class SimpleScheduler {
_timeoutMs = timeoutMs;
_scheduled = initialDelay + System.currentTimeMillis();
}
@Override
public void schedule() {
_executor.scheduleWithFixedDelay(this, _initialDelay, _timeoutMs, TimeUnit.MILLISECONDS);
}
@Override
public void run() {
super.run();
_scheduled = _timeoutMs + System.currentTimeMillis();

View File

@ -5,7 +5,6 @@ import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.ThreadFactory;
import java.util.Map;
import net.i2p.I2PAppContext;
@ -56,6 +55,7 @@ public class SimpleTimer2 {
super(threads, factory);
}
@Override
protected void afterExecute(Runnable r, Throwable t) {
super.afterExecute(r, t);
if (t != null) // shoudn't happen, caught in RunnableEvent.run()
@ -67,6 +67,10 @@ public class SimpleTimer2 {
public Thread newThread(Runnable r) {
Thread rv = Executors.defaultThreadFactory().newThread(r);
rv.setName(_name + ' ' + (++_count) + '/' + THREADS);
String name = rv.getThreadGroup().getName();
if(!(name.isEmpty() || name.equals("Main") || name.equals("main"))) {
(new Exception("OWCH! DAMN! Wrong ThreadGroup `" + name +"', `" + rv.getName() + "'")).printStackTrace();
}
rv.setDaemon(true);
return rv;
}
@ -232,6 +236,7 @@ public class SimpleTimer2 {
public abstract void timeReached();
}
@Override
public String toString() {
return _name;
}

View File

@ -1,3 +1,7 @@
2009-04-06 sponge
* Debugging to make SimpleTimer2 and SimpleScheduler easier to debug.
* Fix for the config files in the GUI from mathiasdm
2009-04-04 sponge
* Hopeful fixups to the infamous orpahned tunnel problem.
* BOB now 0.0.5

View File

@ -17,7 +17,7 @@ import net.i2p.CoreVersion;
public class RouterVersion {
public final static String ID = "$Revision: 1.548 $ $Date: 2008-06-07 23:00:00 $";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 8;
public final static long BUILD = 9;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID);