[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r19958 - in gnunet-java: . .idea .idea/inspectionProfiles s
From: |
gnunet |
Subject: |
[GNUnet-SVN] r19958 - in gnunet-java: . .idea .idea/inspectionProfiles src/org/gnunet/nse src/org/gnunet/util |
Date: |
Wed, 22 Feb 2012 21:49:54 +0100 |
Author: dold
Date: 2012-02-22 21:49:54 +0100 (Wed, 22 Feb 2012)
New Revision: 19958
Modified:
gnunet-java/.idea/inspectionProfiles/Project_Default.xml
gnunet-java/.idea/workspace.xml
gnunet-java/ISSUES
gnunet-java/src/org/gnunet/nse/NetworkSizeEstimation.java
gnunet-java/src/org/gnunet/util/AbsoluteTime.java
gnunet-java/src/org/gnunet/util/Client.java
gnunet-java/src/org/gnunet/util/Configuration.java
gnunet-java/src/org/gnunet/util/Resolver.java
gnunet-java/src/org/gnunet/util/Scheduler.java
Log:
fixed the very buggy implementation of the client; added some stuff to the
scheduler
Modified: gnunet-java/.idea/inspectionProfiles/Project_Default.xml
===================================================================
--- gnunet-java/.idea/inspectionProfiles/Project_Default.xml 2012-02-22
20:46:21 UTC (rev 19957)
+++ gnunet-java/.idea/inspectionProfiles/Project_Default.xml 2012-02-22
20:49:54 UTC (rev 19958)
@@ -66,13 +66,12 @@
</inspection_tool>
<inspection_tool class="CloneableClassInSecureContext" enabled="true"
level="WARNING" enabled_by_default="true" />
<inspection_tool class="CollectionAddedToSelf" enabled="true"
level="WARNING" enabled_by_default="true" />
- <inspection_tool class="CollectionsFieldAccessReplaceableByMethodCall"
enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="CollectionsMustHaveInitialCapacity" enabled="true"
level="WARNING" enabled_by_default="true" />
<inspection_tool class="ComparableImplementedButEqualsNotOverridden"
enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="ComparatorNotSerializable" enabled="true"
level="WARNING" enabled_by_default="true" />
<inspection_tool class="CompareToUsesNonFinalVariable" enabled="true"
level="WARNING" enabled_by_default="true" />
<inspection_tool class="ConditionSignal" enabled="true" level="WARNING"
enabled_by_default="true" />
- <inspection_tool class="ConditionalExpression" enabled="true"
level="WARNING" enabled_by_default="true">
+ <inspection_tool class="ConditionalExpression" enabled="false"
level="WARNING" enabled_by_default="false">
<option name="ignoreSimpleAssignmentsAndReturns" value="true" />
</inspection_tool>
<inspection_tool class="ConditionalExpressionWithIdenticalBranches"
enabled="true" level="WARNING" enabled_by_default="true" />
@@ -116,9 +115,6 @@
<inspection_tool class="ExtendsUtilityClass" enabled="true"
level="WARNING" enabled_by_default="true" />
<inspection_tool class="ExternalizableWithSerializationMethods"
enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="FallthruInSwitchStatement" enabled="true"
level="WARNING" enabled_by_default="true" />
- <inspection_tool class="FeatureEnvy" enabled="true" level="WARNING"
enabled_by_default="true">
- <option name="ignoreTestCases" value="false" />
- </inspection_tool>
<inspection_tool class="FieldAccessedSynchronizedAndUnsynchronized"
enabled="true" level="WARNING" enabled_by_default="true">
<option name="countGettersAndSetters" value="false" />
</inspection_tool>
@@ -322,7 +318,6 @@
<inspection_tool class="StaticCallOnSubclass" enabled="true"
level="WARNING" enabled_by_default="true" />
<inspection_tool class="StaticFieldReferenceOnSubclass" enabled="true"
level="WARNING" enabled_by_default="true" />
<inspection_tool class="StaticInheritance" enabled="true" level="WARNING"
enabled_by_default="true" />
- <inspection_tool class="StaticMethodOnlyUsedInOneClass" enabled="true"
level="WARNING" enabled_by_default="true" />
<inspection_tool class="StaticVariableInitialization" enabled="true"
level="WARNING" enabled_by_default="true">
<option name="m_ignorePrimitives" value="false" />
</inspection_tool>
Modified: gnunet-java/.idea/workspace.xml
===================================================================
--- gnunet-java/.idea/workspace.xml 2012-02-22 20:46:21 UTC (rev 19957)
+++ gnunet-java/.idea/workspace.xml 2012-02-22 20:49:54 UTC (rev 19958)
@@ -1,23 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
- <list default="true" readonly="true"
id="b4faf44d-8919-474e-bfab-5900bc40cc2b" name="Default" comment="">
- <change type="NEW" beforePath=""
afterPath="$PROJECT_DIR$/test/org/gnunet/construct/GetoptTest.java" />
+ <list default="true" readonly="true"
id="54202f52-6f5b-4e71-983e-7aa49e206034" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/ISSUES"
afterPath="$PROJECT_DIR$/ISSUES" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/tools/build"
afterPath="$PROJECT_DIR$/tools/build" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/tools/coverage"
afterPath="$PROJECT_DIR$/tools/coverage" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$"
afterPath="$PROJECT_DIR$" />
+ <change type="MODIFICATION"
beforePath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml"
afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" />
<change type="MODIFICATION"
beforePath="$PROJECT_DIR$/.idea/workspace.xml"
afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/gnunet-java.eml"
afterPath="$PROJECT_DIR$/gnunet-java.eml" />
+ <change type="MODIFICATION"
beforePath="$PROJECT_DIR$/src/org/gnunet/nse/NetworkSizeEstimation.java"
afterPath="$PROJECT_DIR$/src/org/gnunet/nse/NetworkSizeEstimation.java" />
<change type="MODIFICATION"
beforePath="$PROJECT_DIR$/src/org/gnunet/util/AbsoluteTime.java"
afterPath="$PROJECT_DIR$/src/org/gnunet/util/AbsoluteTime.java" />
<change type="MODIFICATION"
beforePath="$PROJECT_DIR$/src/org/gnunet/util/Client.java"
afterPath="$PROJECT_DIR$/src/org/gnunet/util/Client.java" />
- <change type="MODIFICATION"
beforePath="$PROJECT_DIR$/src/org/gnunet/util/MessageReceiver.java"
afterPath="$PROJECT_DIR$/src/org/gnunet/util/MessageReceiver.java" />
- <change type="MODIFICATION"
beforePath="$PROJECT_DIR$/src/org/gnunet/util/Program.java"
afterPath="$PROJECT_DIR$/src/org/gnunet/util/Program.java" />
- <change type="MODIFICATION"
beforePath="$PROJECT_DIR$/src/org/gnunet/util/RelativeTime.java"
afterPath="$PROJECT_DIR$/src/org/gnunet/util/RelativeTime.java" />
+ <change type="MODIFICATION"
beforePath="$PROJECT_DIR$/src/org/gnunet/util/Configuration.java"
afterPath="$PROJECT_DIR$/src/org/gnunet/util/Configuration.java" />
<change type="MODIFICATION"
beforePath="$PROJECT_DIR$/src/org/gnunet/util/Resolver.java"
afterPath="$PROJECT_DIR$/src/org/gnunet/util/Resolver.java" />
<change type="MODIFICATION"
beforePath="$PROJECT_DIR$/src/org/gnunet/util/Scheduler.java"
afterPath="$PROJECT_DIR$/src/org/gnunet/util/Scheduler.java" />
- <change type="MODIFICATION"
beforePath="$PROJECT_DIR$/src/org/gnunet/util/getopt/Parser.java"
afterPath="$PROJECT_DIR$/src/org/gnunet/util/getopt/Parser.java" />
- <change type="MODIFICATION"
beforePath="$PROJECT_DIR$/test/org/gnunet/services/NetworkSizeEstimationServiceTest.java"
afterPath="$PROJECT_DIR$/test/org/gnunet/services/NetworkSizeEstimationServiceTest.java"
/>
</list>
<ignored path="gnunet-java.iws" />
<ignored path=".idea/workspace.xml" />
@@ -75,79 +68,88 @@
</component>
<component name="FileEditorManager">
<leaf>
- <file leaf-file-name="Scheduler.java" pinned="false" current="true"
current-in-tab="true">
- <entry file="file://$PROJECT_DIR$/src/org/gnunet/util/Scheduler.java">
+ <file leaf-file-name="Client.java" pinned="false" current="true"
current-in-tab="true">
+ <entry file="file://$PROJECT_DIR$/src/org/gnunet/util/Client.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="454" column="0" selection-start="15978"
selection-end="15978" vertical-scroll-proportion="0.17271408">
+ <state line="388" column="7" selection-start="13388"
selection-end="13388" vertical-scroll-proportion="0.03133903">
<folding>
- <element signature="e#2294#2310#0" expanded="true" />
- <element signature="e#2363#2379#0" expanded="true" />
- <element signature="e#7372#7388#0" expanded="true" />
- <element signature="e#7741#7769#0" expanded="true" />
- <element signature="e#16040#16056#0" expanded="true" />
+ <element signature="e#0#16712#0" expanded="true" />
+ <element signature="imports" expanded="true" />
+ <element signature="e#1842#1855#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="SelectableChannel.class" pinned="false"
current="false" current-in-tab="false">
- <entry
file="jar:///usr/lib/jvm/java-6-sun/jre/lib/rt.jar!/java/nio/channels/SelectableChannel.class">
+ <file leaf-file-name="Program.java" pinned="false" current="false"
current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/src/org/gnunet/util/Program.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="17" column="51" selection-start="659"
selection-end="659" vertical-scroll-proportion="0.0">
+ <state line="5" column="33" selection-start="168"
selection-end="168" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="SelectionKey.class" pinned="false" current="false"
current-in-tab="false">
- <entry
file="jar:///usr/lib/jvm/java-6-sun/jre/lib/rt.jar!/java/nio/channels/SelectionKey.class">
+ <file leaf-file-name="Resolver.java" pinned="false" current="false"
current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/src/org/gnunet/util/Resolver.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="20" column="25" selection-start="669"
selection-end="669" vertical-scroll-proportion="0.0">
- <folding />
+ <state line="327" column="0" selection-start="9339"
selection-end="9339" vertical-scroll-proportion="0.0">
+ <folding>
+ <element signature="e#707#763#0" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="Client.java" pinned="false" current="false"
current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/src/org/gnunet/util/Client.java">
+ <file leaf-file-name="Scheduler.java" pinned="false" current="false"
current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/src/org/gnunet/util/Scheduler.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="358" column="16" selection-start="12512"
selection-end="12512" vertical-scroll-proportion="0.0">
- <folding />
+ <state line="156" column="0" selection-start="5607"
selection-end="5607" vertical-scroll-proportion="0.0">
+ <folding>
+ <element signature="e#0#23399#0" expanded="true" />
+ <element signature="imports" expanded="true" />
+ <element signature="e#2344#2360#0" expanded="true" />
+ <element signature="e#2411#2427#0" expanded="true" />
+ <element signature="e#2480#2496#0" expanded="true" />
+ <element signature="e#11055#11071#0" expanded="true" />
+ <element signature="e#11424#11452#0" expanded="true" />
+ <element signature="e#18976#18992#0" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="NetworkSizeEstimationServiceTest.java"
pinned="false" current="false" current-in-tab="false">
- <entry
file="file://$PROJECT_DIR$/test/org/gnunet/services/NetworkSizeEstimationServiceTest.java">
+ <file leaf-file-name="IOContinuation.java" pinned="false"
current="false" current-in-tab="false">
+ <entry
file="file://$PROJECT_DIR$/src/org/gnunet/util/IOContinuation.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="51" column="10" selection-start="1413"
selection-end="1413" vertical-scroll-proportion="0.0">
+ <state line="24" column="17" selection-start="863"
selection-end="863" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="Program.java" pinned="false" current="false"
current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/src/org/gnunet/util/Program.java">
+ <file leaf-file-name="Configuration.java" pinned="false" current="false"
current-in-tab="false">
+ <entry
file="file://$PROJECT_DIR$/src/org/gnunet/util/Configuration.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="122" column="47" selection-start="3934"
selection-end="3934" vertical-scroll-proportion="0.0">
+ <state line="338" column="12" selection-start="10814"
selection-end="10814" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="AbsoluteTime.java" pinned="false" current="false"
current-in-tab="false">
- <entry
file="file://$PROJECT_DIR$/src/org/gnunet/util/AbsoluteTime.java">
+ <file leaf-file-name="ISSUES" pinned="false" current="false"
current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/ISSUES">
<provider selected="true" editor-type-id="text-editor">
- <state line="158" column="9" selection-start="4605"
selection-end="4605" vertical-scroll-proportion="0.0">
+ <state line="223" column="41" selection-start="7938"
selection-end="7938" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="Resolver.java" pinned="false" current="false"
current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/src/org/gnunet/util/Resolver.java">
+ <file leaf-file-name="PriorityQueue.class" pinned="false"
current="false" current-in-tab="false">
+ <entry
file="jar:///usr/lib/jvm/java-6-sun/jre/lib/rt.jar!/java/util/PriorityQueue.class">
<provider selected="true" editor-type-id="text-editor">
- <state line="314" column="54" selection-start="8952"
selection-end="8952" vertical-scroll-proportion="0.0">
+ <state line="92" column="0" selection-start="3446"
selection-end="3446" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
@@ -156,16 +158,16 @@
<file leaf-file-name="RelativeTime.java" pinned="false" current="false"
current-in-tab="false">
<entry
file="file://$PROJECT_DIR$/src/org/gnunet/util/RelativeTime.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="158" column="23" selection-start="5153"
selection-end="5153" vertical-scroll-proportion="0.0">
+ <state line="187" column="0" selection-start="5781"
selection-end="5781" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="Parser.java" pinned="false" current="false"
current-in-tab="false">
- <entry
file="file://$PROJECT_DIR$/src/org/gnunet/util/getopt/Parser.java">
+ <file leaf-file-name="String.class" pinned="false" current="false"
current-in-tab="false">
+ <entry
file="jar:///usr/lib/jvm/java-6-sun/jre/lib/alt-string.jar!/java/lang/String.class">
<provider selected="true" editor-type-id="text-editor">
- <state line="22" column="5" selection-start="623"
selection-end="623" vertical-scroll-proportion="0.0">
+ <state line="200" column="35" selection-start="8213"
selection-end="8213" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
@@ -181,22 +183,13 @@
<component name="IdeDocumentHistory">
<option name="changedFiles">
<list>
- <option
value="$PROJECT_DIR$/src/org/gnunet/construct/parsers/IntegerParser.java" />
- <option value="$PROJECT_DIR$/test/org/gnunet/services/ConfigUtil.java"
/>
- <option
value="$PROJECT_DIR$/test/org/gnunet/construct/ConstructTest.java" />
- <option value="$PROJECT_DIR$/src/org/gnunet/construct/Construct.java"
/>
+ <option value="$PROJECT_DIR$/src/org/gnunet/util/AbsoluteTime.java" />
+ <option
value="$PROJECT_DIR$/src/org/gnunet/nse/NetworkSizeEstimation.java" />
<option value="$PROJECT_DIR$/src/org/gnunet/util/Configuration.java" />
- <option value="$PROJECT_DIR$/src/log4j.properties" />
- <option value="$PROJECT_DIR$/src/org/gnunet/util/getopt/Parser.java" />
- <option
value="$PROJECT_DIR$/test/org/gnunet/construct/GetoptTest.java" />
<option value="$PROJECT_DIR$/ISSUES" />
- <option value="$PROJECT_DIR$/src/org/gnunet/util/RelativeTime.java" />
- <option
value="$PROJECT_DIR$/test/org/gnunet/services/NetworkSizeEstimationServiceTest.java"
/>
- <option value="$PROJECT_DIR$/src/org/gnunet/util/Program.java" />
- <option value="$PROJECT_DIR$/src/org/gnunet/util/Client.java" />
<option value="$PROJECT_DIR$/src/org/gnunet/util/Resolver.java" />
- <option value="$PROJECT_DIR$/src/org/gnunet/util/AbsoluteTime.java" />
<option value="$PROJECT_DIR$/src/org/gnunet/util/Scheduler.java" />
+ <option value="$PROJECT_DIR$/src/org/gnunet/util/Client.java" />
</list>
</option>
</component>
@@ -206,139 +199,15 @@
<option name="width" value="1452" />
<option name="height" value="889" />
</component>
- <component name="ProjectInspectionProfilesVisibleTreeState">
- <entry key="Project Default">
- <profile-state>
- <expanded-state>
- <State>
- <id />
- </State>
- <State>
- <id>Abstraction issues</id>
- </State>
- <State>
- <id>Assignment issues</id>
- </State>
- <State>
- <id>Assignment issuesGroovy</id>
- </State>
- <State>
- <id>Class structure</id>
- </State>
- <State>
- <id>Code maturity issues</id>
- </State>
- <State>
- <id>Code style issues</id>
- </State>
- <State>
- <id>Concurrency annotation issues</id>
- </State>
- <State>
- <id>Control flow issues</id>
- </State>
- <State>
- <id>Data flow issues</id>
- </State>
- <State>
- <id>Declaration redundancy</id>
- </State>
- <State>
- <id>Error handling</id>
- </State>
- <State>
- <id>Error handlingGroovy</id>
- </State>
- <State>
- <id>General</id>
- </State>
- <State>
- <id>Groovy</id>
- </State>
- <State>
- <id>IDEA Platform Inspections</id>
- </State>
- <State>
- <id>Inheritance issues</id>
- </State>
- <State>
- <id>Initialization issues</id>
- </State>
- <State>
- <id>Internationalization issues</id>
- </State>
- <State>
- <id>J2ME issues</id>
- </State>
- <State>
- <id>JUnit issues</id>
- </State>
- <State>
- <id>Java language level issues</id>
- </State>
- <State>
- <id>Java language level migration aids</id>
- </State>
- <State>
- <id>Javadoc issues</id>
- </State>
- <State>
- <id>Method MetricsGroovy</id>
- </State>
- <State>
- <id>Method metrics</id>
- </State>
- <State>
- <id>Naming ConventionsGroovy</id>
- </State>
- <State>
- <id>Naming conventions</id>
- </State>
- <State>
- <id>Performance issues</id>
- </State>
- <State>
- <id>Probable bugs</id>
- </State>
- <State>
- <id>Properties Files</id>
- </State>
- <State>
- <id>RELAX NG</id>
- </State>
- <State>
- <id>Serialization issues</id>
- </State>
- <State>
- <id>Threading issues</id>
- </State>
- <State>
- <id>Threading issuesGroovy</id>
- </State>
- <State>
- <id>Verbose or redundant code constructs</id>
- </State>
- <State>
- <id>Visibility issues</id>
- </State>
- </expanded-state>
- <selected-state>
- <State>
- <id>InstanceVariableInitialization</id>
- </State>
- </selected-state>
- </profile-state>
- </entry>
- </component>
- <component name="ProjectLevelVcsManager" settingsEditedManually="true">
+ <component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
- <ConfirmationsSetting value="2" id="Add" />
- <ConfirmationsSetting value="2" id="Remove" />
+ <ConfirmationsSetting value="0" id="Add" />
+ <ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectReloadState">
<option name="STATE" value="0" />
@@ -356,34 +225,6 @@
<sortByType />
</navigator>
<panes>
- <pane id="PackagesPane">
- <subPane>
- <PATH>
- <PATH_ELEMENT>
- <option name="myItemId" value="gnunet-java" />
- <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PackageViewProjectNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="gnunet-java" />
- <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PackageViewModuleNode" />
- </PATH_ELEMENT>
- </PATH>
- <PATH>
- <PATH_ELEMENT>
- <option name="myItemId" value="gnunet-java" />
- <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PackageViewProjectNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="gnunet-java" />
- <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PackageViewModuleNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="org" />
- <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PackageElementNode" />
- </PATH_ELEMENT>
- </PATH>
- </subPane>
- </pane>
<pane id="ProjectPane">
<subPane>
<PATH>
@@ -412,13 +253,9 @@
<option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="test" />
+ <option name="myItemId" value="src" />
<option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="gnunet" />
- <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
@@ -430,75 +267,17 @@
<option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="test" />
- <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="gnunet" />
- <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="construct" />
- <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- </PATH>
- <PATH>
- <PATH_ELEMENT>
- <option name="myItemId" value="gnunet-java" />
- <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="gnunet-java" />
- <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="test" />
- <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="gnunet" />
- <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="construct" />
- <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="GetoptTest.java" />
- <option name="myItemType"
value="com.intellij.ide.projectView.impl.ClassesTreeStructureProvider$PsiClassOwnerTreeNode"
/>
- </PATH_ELEMENT>
- </PATH>
- <PATH>
- <PATH_ELEMENT>
- <option name="myItemId" value="gnunet-java" />
- <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="gnunet-java" />
- <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
- </PATH>
- <PATH>
<PATH_ELEMENT>
- <option name="myItemId" value="gnunet-java" />
- <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="gnunet-java" />
+ <option name="myItemId" value="org" />
<option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="src" />
+ <option name="myItemId" value="grothoff" />
<option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="org" />
- <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
@@ -548,267 +327,28 @@
<option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
- <PATH>
- <PATH_ELEMENT>
- <option name="myItemId" value="gnunet-java" />
- <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="gnunet-java" />
- <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="lib" />
- <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- </PATH>
</subPane>
</pane>
- <pane id="Scope">
- <subPane subId="Project Files">
- <PATH>
- <PATH_ELEMENT USER_OBJECT="Root">
- <option name="myItemId" value="" />
- <option name="myItemType" value="" />
- </PATH_ELEMENT>
- <PATH_ELEMENT USER_OBJECT="gnunet-java">
- <option name="myItemId" value="" />
- <option name="myItemType" value="" />
- </PATH_ELEMENT>
- </PATH>
- <PATH>
- <PATH_ELEMENT USER_OBJECT="Root">
- <option name="myItemId" value="" />
- <option name="myItemType" value="" />
- </PATH_ELEMENT>
- <PATH_ELEMENT USER_OBJECT="gnunet-java">
- <option name="myItemId" value="" />
- <option name="myItemType" value="" />
- </PATH_ELEMENT>
- <PATH_ELEMENT USER_OBJECT="src">
- <option name="myItemId" value="" />
- <option name="myItemType" value="" />
- </PATH_ELEMENT>
- <PATH_ELEMENT USER_OBJECT="org">
- <option name="myItemId" value="" />
- <option name="myItemType" value="" />
- </PATH_ELEMENT>
- </PATH>
- <PATH>
- <PATH_ELEMENT USER_OBJECT="Root">
- <option name="myItemId" value="" />
- <option name="myItemType" value="" />
- </PATH_ELEMENT>
- <PATH_ELEMENT USER_OBJECT="gnunet-java">
- <option name="myItemId" value="" />
- <option name="myItemType" value="" />
- </PATH_ELEMENT>
- <PATH_ELEMENT USER_OBJECT="src">
- <option name="myItemId" value="" />
- <option name="myItemType" value="" />
- </PATH_ELEMENT>
- <PATH_ELEMENT USER_OBJECT="org">
- <option name="myItemId" value="" />
- <option name="myItemType" value="" />
- </PATH_ELEMENT>
- <PATH_ELEMENT USER_OBJECT="gnunet">
- <option name="myItemId" value="" />
- <option name="myItemType" value="" />
- </PATH_ELEMENT>
- </PATH>
- <PATH>
- <PATH_ELEMENT USER_OBJECT="Root">
- <option name="myItemId" value="" />
- <option name="myItemType" value="" />
- </PATH_ELEMENT>
- <PATH_ELEMENT USER_OBJECT="gnunet-java">
- <option name="myItemId" value="" />
- <option name="myItemType" value="" />
- </PATH_ELEMENT>
- <PATH_ELEMENT USER_OBJECT="src">
- <option name="myItemId" value="" />
- <option name="myItemType" value="" />
- </PATH_ELEMENT>
- <PATH_ELEMENT USER_OBJECT="org">
- <option name="myItemId" value="" />
- <option name="myItemType" value="" />
- </PATH_ELEMENT>
- <PATH_ELEMENT USER_OBJECT="gnunet">
- <option name="myItemId" value="" />
- <option name="myItemType" value="" />
- </PATH_ELEMENT>
- <PATH_ELEMENT USER_OBJECT="construct">
- <option name="myItemId" value="" />
- <option name="myItemType" value="" />
- </PATH_ELEMENT>
- </PATH>
- </subPane>
- </pane>
+ <pane id="Scope" />
+ <pane id="PackagesPane" />
</panes>
</component>
<component name="PropertiesComponent">
- <property name="GenerateAntBuildDialog.generateIdeaHomeProperty"
value="false" />
<property name="GoToFile.includeJavaFiles" value="false" />
- <property name="project.structure.last.edited" value="Libraries" />
<property name="OverrideImplement.combined" value="true" />
- <property name="project.structure.proportion" value="0.15" />
<property name="options.splitter.main.proportions" value="0.3" />
- <property name="GenerateAntBuildDialog.generateSingleFile" value="true" />
- <property name="recentsLimit" value="5" />
+ <property name="options.lastSelected" value="preferences.sourceCode.Java"
/>
<property name="MemberChooser.sorted" value="false" />
- <property name="options.lastSelected" value="editing.templates" />
- <property name="GenerateAntBuildDialog.inclineRuntiemClasspath"
value="true" />
- <property name="GenerateAntBuildDialog.forceTargetJdk" value="false" />
- <property name="project.structure.side.proportion" value="0.2" />
- <property name="GenerateAntBuildDialog.outputFileNameProperty"
value="gnunet-java" />
+ <property name="recentsLimit" value="5" />
<property name="MemberChooser.copyJavadoc" value="false" />
- <property name="GenerateAntBuildDialog.enableUiFormCompile" value="false"
/>
<property name="GoToClass.toSaveIncludeLibraries" value="false" />
<property name="MemberChooser.showClasses" value="true" />
- <property name="GenerateAntBuildDialog.backupFiles" value="false" />
<property name="GoToClass.includeLibraries" value="false" />
- <property name="dynamic.classpath" value="false" />
- <property name="options.splitter.details.proportions" value="0.2" />
<property name="options.searchVisible" value="true" />
+ <property name="options.splitter.details.proportions" value="0.2" />
+ <property name="dynamic.classpath" value="false" />
</component>
- <component name="RecentsManager">
- <key name="CopyFile.RECENT_KEYS">
- <recent name="$PROJECT_DIR$/lib" />
- </key>
- <key name="IntroduceConstantDialog.RECENTS_KEY">
- <recent name="org.gnunet.service.NSE_Start" />
- <recent name="org.gnunet.service.NSE_Update" />
- </key>
- <key name="MoveClassesOrPackagesDialog.RECENTS_KEY">
- <recent name="org.gnunet.statistics" />
- <recent name="org.gnunet.nse" />
- <recent name="org.gnunet.construct" />
- <recent name="" />
- </key>
- </component>
- <component name="RunManager" selected="JUnit.GetoptTest">
- <configuration default="false" name="StatisticsServiceTest" type="JUnit"
factoryName="JUnit" temporary="true">
- <module name="gnunet-java" />
- <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
- <option name="ALTERNATIVE_JRE_PATH" />
- <option name="PACKAGE_NAME" value="org.gnunet.services" />
- <option name="MAIN_CLASS_NAME"
value="org.gnunet.services.StatisticsServiceTest" />
- <option name="METHOD_NAME" />
- <option name="TEST_OBJECT" value="class" />
- <option name="VM_PARAMETERS" value="-ea" />
- <option name="PARAMETERS" />
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
- <option name="ENV_VARIABLES" />
- <option name="PASS_PARENT_ENVS" value="true" />
- <option name="TEST_SEARCH_SCOPE">
- <value defaultName="moduleWithDependencies" />
- </option>
- <envs />
- <patterns />
- <RunnerSettings RunnerId="Run" />
- <ConfigurationWrapper RunnerId="Run" />
- <method />
- </configuration>
- <configuration default="false" name="NetworkSizeEstimationServiceTest"
type="JUnit" factoryName="JUnit" temporary="true">
- <module name="gnunet-java" />
- <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
- <option name="ALTERNATIVE_JRE_PATH" />
- <option name="PACKAGE_NAME" value="org.gnunet.services" />
- <option name="MAIN_CLASS_NAME"
value="org.gnunet.services.NetworkSizeEstimationServiceTest" />
- <option name="METHOD_NAME" />
- <option name="TEST_OBJECT" value="class" />
- <option name="VM_PARAMETERS" value="-ea" />
- <option name="PARAMETERS" />
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
- <option name="ENV_VARIABLES" />
- <option name="PASS_PARENT_ENVS" value="true" />
- <option name="TEST_SEARCH_SCOPE">
- <value defaultName="moduleWithDependencies" />
- </option>
- <envs />
- <patterns />
- <RunnerSettings RunnerId="Debug">
- <option name="DEBUG_PORT" value="" />
- <option name="TRANSPORT" value="0" />
- <option name="LOCAL" value="true" />
- </RunnerSettings>
- <RunnerSettings RunnerId="Run" />
- <ConfigurationWrapper RunnerId="Debug" />
- <ConfigurationWrapper RunnerId="Run" />
- <method />
- </configuration>
- <configuration default="false" name="ConstructTest" type="JUnit"
factoryName="JUnit" temporary="true">
- <module name="gnunet-java" />
- <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
- <option name="ALTERNATIVE_JRE_PATH" />
- <option name="PACKAGE_NAME" value="org.gnunet.construct" />
- <option name="MAIN_CLASS_NAME"
value="org.gnunet.construct.ConstructTest" />
- <option name="METHOD_NAME" />
- <option name="TEST_OBJECT" value="class" />
- <option name="VM_PARAMETERS" value="-ea" />
- <option name="PARAMETERS" />
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
- <option name="ENV_VARIABLES" />
- <option name="PASS_PARENT_ENVS" value="true" />
- <option name="TEST_SEARCH_SCOPE">
- <value defaultName="moduleWithDependencies" />
- </option>
- <envs />
- <patterns />
- <RunnerSettings RunnerId="Debug">
- <option name="DEBUG_PORT" value="" />
- <option name="TRANSPORT" value="0" />
- <option name="LOCAL" value="true" />
- </RunnerSettings>
- <RunnerSettings RunnerId="Run" />
- <ConfigurationWrapper RunnerId="Debug" />
- <ConfigurationWrapper RunnerId="Run" />
- <method />
- </configuration>
- <configuration default="false" name="UnionTest" type="JUnit"
factoryName="JUnit" temporary="true">
- <module name="gnunet-java" />
- <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
- <option name="ALTERNATIVE_JRE_PATH" />
- <option name="PACKAGE_NAME" value="org.gnunet.construct" />
- <option name="MAIN_CLASS_NAME" value="org.gnunet.construct.UnionTest" />
- <option name="METHOD_NAME" />
- <option name="TEST_OBJECT" value="class" />
- <option name="VM_PARAMETERS" value="-ea" />
- <option name="PARAMETERS" />
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
- <option name="ENV_VARIABLES" />
- <option name="PASS_PARENT_ENVS" value="true" />
- <option name="TEST_SEARCH_SCOPE">
- <value defaultName="moduleWithDependencies" />
- </option>
- <envs />
- <patterns />
- <RunnerSettings RunnerId="Run" />
- <ConfigurationWrapper RunnerId="Run" />
- <method />
- </configuration>
- <configuration default="false" name="GetoptTest" type="JUnit"
factoryName="JUnit" temporary="true">
- <module name="gnunet-java" />
- <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
- <option name="ALTERNATIVE_JRE_PATH" />
- <option name="PACKAGE_NAME" value="org.gnunet.construct" />
- <option name="MAIN_CLASS_NAME" value="org.gnunet.construct.GetoptTest" />
- <option name="METHOD_NAME" />
- <option name="TEST_OBJECT" value="class" />
- <option name="VM_PARAMETERS" value="-ea" />
- <option name="PARAMETERS" />
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
- <option name="ENV_VARIABLES" />
- <option name="PASS_PARENT_ENVS" value="true" />
- <option name="TEST_SEARCH_SCOPE">
- <value defaultName="moduleWithDependencies" />
- </option>
- <envs />
- <patterns />
- <RunnerSettings RunnerId="Run" />
- <ConfigurationWrapper RunnerId="Run" />
- <method />
- </configuration>
+ <component name="RunManager" selected="Application.Resolver">
<configuration default="true" type="Remote" factoryName="Remote">
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
@@ -818,7 +358,6 @@
<method>
<option name="AntTarget" enabled="false" />
<option name="BuildArtifacts" enabled="false" />
- <option name="Maven.BeforeRunTask" enabled="false" />
</method>
</configuration>
<configuration default="true" type="Applet" factoryName="Applet">
@@ -836,7 +375,6 @@
<option name="AntTarget" enabled="false" />
<option name="BuildArtifacts" enabled="false" />
<option name="Make" enabled="true" />
- <option name="Maven.BeforeRunTask" enabled="false" />
</method>
</configuration>
<configuration default="true" type="Application" factoryName="Application">
@@ -855,7 +393,6 @@
<option name="AntTarget" enabled="false" />
<option name="BuildArtifacts" enabled="false" />
<option name="Make" enabled="true" />
- <option name="Maven.BeforeRunTask" enabled="false" />
</method>
</configuration>
<configuration default="true" type="JUnit" factoryName="JUnit">
@@ -880,13 +417,12 @@
<option name="AntTarget" enabled="false" />
<option name="BuildArtifacts" enabled="false" />
<option name="Make" enabled="true" />
- <option name="Maven.BeforeRunTask" enabled="false" />
</method>
</configuration>
<configuration default="false" name="Resolver" type="Application"
factoryName="Application">
<option name="MAIN_CLASS_NAME" value="org.gnunet.util.Resolver" />
<option name="VM_PARAMETERS" value="-ea" />
- <option name="PROGRAM_PARAMETERS" value="" />
+ <option name="PROGRAM_PARAMETERS" value="-LDEBUG gnunet.org" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" value="" />
@@ -895,18 +431,28 @@
<option name="PASS_PARENT_ENVS" value="true" />
<module name="gnunet-java" />
<envs />
+ <RunnerSettings RunnerId="Debug">
+ <option name="DEBUG_PORT" value="" />
+ <option name="TRANSPORT" value="0" />
+ <option name="LOCAL" value="true" />
+ </RunnerSettings>
<RunnerSettings RunnerId="Run" />
+ <ConfigurationWrapper RunnerId="Debug" />
<ConfigurationWrapper RunnerId="Run" />
<method />
</configuration>
- <list size="6">
- <item index="0" class="java.lang.String"
itemvalue="JUnit.StatisticsServiceTest" />
- <item index="1" class="java.lang.String"
itemvalue="JUnit.NetworkSizeEstimationServiceTest" />
- <item index="2" class="java.lang.String" itemvalue="JUnit.ConstructTest"
/>
- <item index="3" class="java.lang.String" itemvalue="JUnit.UnionTest" />
- <item index="4" class="java.lang.String" itemvalue="JUnit.GetoptTest" />
- <item index="5" class="java.lang.String"
itemvalue="Application.Resolver" />
+ <list size="1">
+ <item index="0" class="java.lang.String"
itemvalue="Application.Resolver" />
</list>
+ <configuration name="<template>" type="TestNG" default="true"
selected="false">
+ <option name="MAIN_CLASS_NAME" />
+ <option name="VM_PARAMETERS" value="-ea" />
+ <option name="PARAMETERS" />
+ <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
+ </configuration>
+ <configuration name="<template>"
type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" default="true"
selected="false">
+ <option name="VM_PARAMETERS" value="-Xmx512m -Xms256m
-XX:MaxPermSize=250m" />
+ </configuration>
<configuration name="<template>" type="WebApp" default="true"
selected="false">
<Host>localhost</Host>
<Port>5050</Port>
@@ -954,49 +500,28 @@
</list>
</option>
</component>
- <component name="TodoView" selected-index="0">
- <todo-panel id="selected-file">
- <are-packages-shown value="false" />
- <are-modules-shown value="false" />
- <flatten-packages value="false" />
- <is-autoscroll-to-source value="true" />
- </todo-panel>
- <todo-panel id="all">
- <are-packages-shown value="true" />
- <are-modules-shown value="false" />
- <flatten-packages value="false" />
- <is-autoscroll-to-source value="true" />
- </todo-panel>
- <todo-panel id="default-changelist">
- <are-packages-shown value="false" />
- <are-modules-shown value="false" />
- <flatten-packages value="false" />
- <is-autoscroll-to-source value="false" />
- </todo-panel>
- </component>
<component name="ToolWindowManager">
<frame x="-6" y="17" width="1452" height="889" extended-state="0" />
<editor active="true" />
<layout>
- <window_info id="Changes" active="false" anchor="bottom"
auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false"
weight="0.32831737" sideWeight="0.5" order="7" side_tool="false"
content_ui="tabs" />
+ <window_info id="Messages" active="false" anchor="bottom"
auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false"
weight="0.32967034" sideWeight="0.5" order="7" side_tool="false"
content_ui="tabs" />
+ <window_info id="Changes" active="false" anchor="bottom"
auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false"
weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Palette" active="false" anchor="right"
auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false"
weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
- <window_info id="TODO" active="false" anchor="bottom" auto_hide="false"
internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32967034"
sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
- <window_info id="Ant Build" active="false" anchor="right"
auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false"
weight="0.24098124" sideWeight="0.6710875" order="1" side_tool="false"
content_ui="tabs" />
- <window_info id="Structure" active="false" anchor="left"
auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false"
weight="0.23015873" sideWeight="0.58928573" order="1" side_tool="false"
content_ui="tabs" />
- <window_info id="Project" active="false" anchor="left" auto_hide="false"
internal_type="DOCKED" type="DOCKED" visible="true" weight="0.27344877"
sideWeight="0.7582418" order="0" side_tool="false" content_ui="tabs" />
- <window_info id="Debug" active="false" anchor="bottom" auto_hide="false"
internal_type="DOCKED" type="DOCKED" visible="false" weight="0.44230768"
sideWeight="0.63708514" order="3" side_tool="false" content_ui="tabs" />
+ <window_info id="TODO" active="false" anchor="bottom" auto_hide="false"
internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33"
sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
+ <window_info id="Ant Build" active="false" anchor="right"
auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false"
weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+ <window_info id="Structure" active="false" anchor="left"
auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true"
weight="0.25685427" sideWeight="0.28983516" order="1" side_tool="true"
content_ui="tabs" />
+ <window_info id="Project" active="false" anchor="left" auto_hide="false"
internal_type="DOCKED" type="DOCKED" visible="true" weight="0.25685427"
sideWeight="0.7005494" order="0" side_tool="false" content_ui="tabs" />
+ <window_info id="Debug" active="false" anchor="bottom" auto_hide="false"
internal_type="DOCKED" type="DOCKED" visible="false" weight="0.17582418"
sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left"
auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false"
weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
- <window_info id="Event Log" active="false" anchor="bottom"
auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false"
weight="0.45054945" sideWeight="0.35786435" order="7" side_tool="true"
content_ui="tabs" />
- <window_info id="Run" active="false" anchor="bottom" auto_hide="false"
internal_type="DOCKED" type="DOCKED" visible="false" weight="0.038303692"
sideWeight="0.9126984" order="2" side_tool="false" content_ui="tabs" />
- <window_info id="Version Control" active="false" anchor="bottom"
auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false"
weight="0.30506155" sideWeight="0.0" order="7" side_tool="false"
content_ui="tabs" />
- <window_info id="Documentation" active="false" anchor="right"
auto_hide="false" internal_type="DOCKED" type="FLOATING" visible="true"
weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs"
x="88" y="109" width="1260" height="692" />
+ <window_info id="Event Log" active="false" anchor="bottom"
auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false"
weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
+ <window_info id="Run" active="false" anchor="bottom" auto_hide="false"
internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3021978"
sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
+ <window_info id="Version Control" active="false" anchor="bottom"
auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false"
weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false"
internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25"
sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom"
auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false"
weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
- <window_info id="Find" active="false" anchor="bottom" auto_hide="false"
internal_type="DOCKED" type="DOCKED" visible="false" weight="0.58653843"
sideWeight="0.49426112" order="1" side_tool="false" content_ui="tabs" />
- <window_info id="Messages" active="false" anchor="bottom"
auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false"
weight="0.24175824" sideWeight="0.49713057" order="7" side_tool="false"
content_ui="tabs" />
+ <window_info id="Find" active="false" anchor="bottom" auto_hide="false"
internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32967034"
sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right"
auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false"
weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right"
auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false"
weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
- <window_info id="Inspection" active="false" anchor="bottom"
auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false"
weight="0.4945055" sideWeight="0.5" order="5" side_tool="false"
content_ui="tabs" />
+ <window_info id="Inspection" active="false" anchor="bottom"
auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false"
weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="VcsContentAnnotationSettings">
@@ -1004,8 +529,8 @@
</component>
<component name="VcsManagerConfiguration">
<option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT"
value="true" />
- <option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
- <option name="CHECK_NEW_TODO" value="false" />
+ <option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="true" />
+ <option name="CHECK_NEW_TODO" value="true" />
<option name="myTodoPanelSettings">
<value>
<are-packages-shown value="false" />
@@ -1033,7 +558,7 @@
<option name="INCLUDE_TEXT_INTO_SHELF" value="false" />
<option name="CREATE_PATCH_EXPAND_DETAILS_DEFAULT" value="true" />
<option name="FORCE_NON_EMPTY_COMMENT" value="false" />
- <option name="LAST_COMMIT_MESSAGE" value="fixed ipv6 localhost" />
+ <option name="LAST_COMMIT_MESSAGE" />
<option name="MAKE_NEW_CHANGELIST_ACTIVE" value="true" />
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
<option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false" />
@@ -1046,20 +571,6 @@
<option name="UPDATE_GROUP_BY_CHANGELIST" value="false" />
<option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
<option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
- <MESSAGE value="NSE client almost working" />
- <MESSAGE value="added MsgMap update shell script" />
- <MESSAGE value="fixes / documentation" />
- <MESSAGE value="added libs" />
- <MESSAGE value="rudimentary version of resolve tool completed" />
- <MESSAGE value="implemented message unions, parameter parsing" />
- <MESSAGE value="message unions now used in resolver" />
- <MESSAGE value="fixed parameter parsing bug" />
- <MESSAGE value="fixed various issues with command line parsing, rewrote
configuration parser, fixed resolver" />
- <MESSAGE value="fix" />
- <MESSAGE value="added commons io jar" />
- <MESSAGE value="added tools directory" />
- <MESSAGE value="added cobertura" />
- <MESSAGE value="fixed ipv6 localhost" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
@@ -1069,172 +580,118 @@
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="editorHistoryManager">
- <entry file="file://$PROJECT_DIR$/.classpath">
+ <entry file="file://$PROJECT_DIR$/src/org/gnunet/util/AbsoluteTime.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="5" column="13" selection-start="214" selection-end="214"
vertical-scroll-proportion="0.120567374" />
+ <state line="218" column="0" selection-start="6135"
selection-end="6135" vertical-scroll-proportion="0.0" />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/nse">
+ <entry
file="jar:///usr/lib/jvm/java-6-sun/jre/lib/rt.jar!/java/nio/channels/SocketChannel.class">
<provider selected="true" editor-type-id="text-editor">
- <state line="5" column="0" selection-start="107" selection-end="107"
vertical-scroll-proportion="0.0" />
+ <state line="23" column="28" selection-start="1053"
selection-end="1053" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/ISSUES">
+ <entry
file="file://$PROJECT_DIR$/src/org/gnunet/util/MessageTransmitter.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="222" column="53" selection-start="7896"
selection-end="7896" vertical-scroll-proportion="0.0" />
+ <state line="2" column="17" selection-start="43" selection-end="43"
vertical-scroll-proportion="0.0" />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/log4j.properties">
+ <entry
file="file://$PROJECT_DIR$/src/org/gnunet/nse/NetworkSizeEstimation.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="6" column="0" selection-start="193" selection-end="193"
vertical-scroll-proportion="0.0" />
+ <state line="173" column="51" selection-start="4600"
selection-end="4600" vertical-scroll-proportion="0.0" />
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/test/org/gnunet/construct/GetoptTest.java">
+ <entry
file="file://$PROJECT_DIR$/src/org/gnunet/util/AbsoluteTimeMessage.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="159" column="36" selection-start="3911"
selection-end="3911" vertical-scroll-proportion="0.0" />
+ <state line="6" column="13" selection-start="114" selection-end="114"
vertical-scroll-proportion="0.0" />
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/test/org/gnunet/construct/UnionTest.java">
+ <entry file="file://$PROJECT_DIR$/src/org/gnunet/util/Program.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="5" column="13" selection-start="69" selection-end="69"
vertical-scroll-proportion="0.0" />
+ <state line="5" column="33" selection-start="168" selection-end="168"
vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
</provider>
</entry>
- <entry
file="jar:///usr/lib/jvm/java-6-sun/jre/lib/rt.jar!/java/nio/channels/SelectableChannel.class">
+ <entry
file="jar:///usr/lib/jvm/java-6-sun/jre/lib/rt.jar!/java/util/PriorityQueue.class">
<provider selected="true" editor-type-id="text-editor">
- <state line="17" column="51" selection-start="659" selection-end="659"
vertical-scroll-proportion="0.0">
+ <state line="92" column="0" selection-start="3446"
selection-end="3446" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
- <entry
file="jar:///usr/lib/jvm/java-6-sun/jre/lib/rt.jar!/java/nio/channels/SelectionKey.class">
+ <entry file="file://$PROJECT_DIR$/ISSUES">
<provider selected="true" editor-type-id="text-editor">
- <state line="20" column="25" selection-start="669" selection-end="669"
vertical-scroll-proportion="0.0" />
+ <state line="223" column="41" selection-start="7938"
selection-end="7938" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/org/gnunet/util/Client.java">
+ <entry file="file://$PROJECT_DIR$/src/org/gnunet/util/RelativeTime.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="358" column="16" selection-start="12512"
selection-end="12512" vertical-scroll-proportion="0.0" />
+ <state line="187" column="0" selection-start="5781"
selection-end="5781" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/test/org/gnunet/services/NetworkSizeEstimationServiceTest.java">
+ <entry
file="jar:///usr/lib/jvm/java-6-sun/jre/lib/alt-string.jar!/java/lang/String.class">
<provider selected="true" editor-type-id="text-editor">
- <state line="51" column="10" selection-start="1413"
selection-end="1413" vertical-scroll-proportion="0.0" />
+ <state line="200" column="35" selection-start="8213"
selection-end="8213" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/org/gnunet/util/Program.java">
+ <entry file="file://$PROJECT_DIR$/src/org/gnunet/util/IOContinuation.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="122" column="47" selection-start="3934"
selection-end="3934" vertical-scroll-proportion="0.0" />
+ <state line="24" column="17" selection-start="863" selection-end="863"
vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/org/gnunet/util/AbsoluteTime.java">
+ <entry file="file://$PROJECT_DIR$/src/org/gnunet/util/Configuration.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="158" column="9" selection-start="4605"
selection-end="4605" vertical-scroll-proportion="0.0" />
+ <state line="338" column="12" selection-start="10814"
selection-end="10814" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/org/gnunet/util/Resolver.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="314" column="54" selection-start="8952"
selection-end="8952" vertical-scroll-proportion="0.0" />
+ <state line="327" column="0" selection-start="9339"
selection-end="9339" vertical-scroll-proportion="0.0">
+ <folding>
+ <element signature="e#707#763#0" expanded="true" />
+ </folding>
+ </state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/org/gnunet/util/RelativeTime.java">
+ <entry file="file://$PROJECT_DIR$/src/org/gnunet/util/Scheduler.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="158" column="23" selection-start="5153"
selection-end="5153" vertical-scroll-proportion="0.0" />
+ <state line="156" column="0" selection-start="5607"
selection-end="5607" vertical-scroll-proportion="0.0">
+ <folding>
+ <element signature="e#0#23399#0" expanded="true" />
+ <element signature="imports" expanded="true" />
+ <element signature="e#2344#2360#0" expanded="true" />
+ <element signature="e#2411#2427#0" expanded="true" />
+ <element signature="e#2480#2496#0" expanded="true" />
+ <element signature="e#11055#11071#0" expanded="true" />
+ <element signature="e#11424#11452#0" expanded="true" />
+ <element signature="e#18976#18992#0" expanded="true" />
+ </folding>
+ </state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/org/gnunet/util/getopt/Parser.java">
+ <entry file="file://$PROJECT_DIR$/src/org/gnunet/util/Client.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="22" column="5" selection-start="623" selection-end="623"
vertical-scroll-proportion="0.0" />
- </provider>
- </entry>
- <entry file="file://$PROJECT_DIR$/src/org/gnunet/util/Scheduler.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="454" column="0" selection-start="15978"
selection-end="15978" vertical-scroll-proportion="0.17271408">
+ <state line="388" column="7" selection-start="13388"
selection-end="13388" vertical-scroll-proportion="0.03133903">
<folding>
- <element signature="e#2294#2310#0" expanded="true" />
- <element signature="e#2363#2379#0" expanded="true" />
- <element signature="e#7372#7388#0" expanded="true" />
- <element signature="e#7741#7769#0" expanded="true" />
- <element signature="e#16040#16056#0" expanded="true" />
+ <element signature="e#0#16712#0" expanded="true" />
+ <element signature="imports" expanded="true" />
+ <element signature="e#1842#1855#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component>
- <component name="masterDetails">
- <states>
- <state key="ArtifactsStructureConfigurable.UI">
- <settings>
- <artifact-editor />
- <splitter-proportions>
- <option name="proportions">
- <list>
- <option value="0.2" />
- </list>
- </option>
- </splitter-proportions>
- </settings>
- </state>
- <state key="GlobalLibrariesConfigurable.UI">
- <settings>
- <last-edited>junit4</last-edited>
- <splitter-proportions>
- <option name="proportions">
- <list>
- <option value="0.2" />
- </list>
- </option>
- </splitter-proportions>
- </settings>
- </state>
- <state key="JdkListConfigurable.UI">
- <settings>
- <last-edited>1.6</last-edited>
- <splitter-proportions>
- <option name="proportions">
- <list>
- <option value="0.2" />
- </list>
- </option>
- </splitter-proportions>
- </settings>
- </state>
- <state key="ModuleStructureConfigurable.UI">
- <settings>
- <last-edited>gnunet-java</last-edited>
- <splitter-proportions>
- <option name="proportions">
- <list>
- <option value="0.2" />
- </list>
- </option>
- </splitter-proportions>
- </settings>
- </state>
- <state key="ProjectJDKs.UI">
- <settings>
- <last-edited>1.6</last-edited>
- <splitter-proportions>
- <option name="proportions">
- <list>
- <option value="0.20000002" />
- </list>
- </option>
- </splitter-proportions>
- </settings>
- </state>
- <state key="ProjectLibrariesConfigurable.UI">
- <settings>
- <last-edited>lib</last-edited>
- <splitter-proportions>
- <option name="proportions">
- <list>
- <option value="0.2" />
- </list>
- </option>
- </splitter-proportions>
- </settings>
- </state>
- </states>
- </component>
</project>
Modified: gnunet-java/ISSUES
===================================================================
--- gnunet-java/ISSUES 2012-02-22 20:46:21 UTC (rev 19957)
+++ gnunet-java/ISSUES 2012-02-22 20:49:54 UTC (rev 19958)
@@ -220,4 +220,6 @@
================================================
- * what are use cases for the scheduler's priorities?
\ No newline at end of file
+ * what are use cases for the scheduler's priorities?
+ * should shutdown really be a reason, not a separate callback-method in Task?
+ * some tasks re-schedule themselves, it's very easy to forget checking the
shutdown flag in the context
\ No newline at end of file
Modified: gnunet-java/src/org/gnunet/nse/NetworkSizeEstimation.java
===================================================================
--- gnunet-java/src/org/gnunet/nse/NetworkSizeEstimation.java 2012-02-22
20:46:21 UTC (rev 19957)
+++ gnunet-java/src/org/gnunet/nse/NetworkSizeEstimation.java 2012-02-22
20:49:54 UTC (rev 19958)
@@ -154,7 +154,7 @@
*/
public NetworkSizeEstimation(Configuration cfg) {
client = new Client("nse", cfg);
- client.notifyTransmitReady(MessageHeader.SIZE, RelativeTime.FOREVER,
true, new NSE_Transmitter());
+ client.notifyTransmitReady(RelativeTime.FOREVER, true, new
NSE_Transmitter());
}
/**
Modified: gnunet-java/src/org/gnunet/util/AbsoluteTime.java
===================================================================
--- gnunet-java/src/org/gnunet/util/AbsoluteTime.java 2012-02-22 20:46:21 UTC
(rev 19957)
+++ gnunet-java/src/org/gnunet/util/AbsoluteTime.java 2012-02-22 20:49:54 UTC
(rev 19958)
@@ -35,27 +35,15 @@
public final static AbsoluteTime ZERO = new AbsoluteTime(0);
public final static AbsoluteTime FOREVER = new
AbsoluteTime(Long.MAX_VALUE);
- private static long offset = 0;
-
/**
* Gets the current time.
*
* @return the current time
*/
public static AbsoluteTime now() {
- return new AbsoluteTime(System.currentTimeMillis() + offset);
+ return new AbsoluteTime(System.currentTimeMillis());
}
- /**
- * Sets the timestamp offset for this instance.
- *
- * @param offset
- * the offset to skew the locale time by
- */
- public static void setOffset(final long offset) {
- AbsoluteTime.offset = offset;
- }
-
private final long abs_value;
public AbsoluteTime(final long abs_value) {
@@ -68,9 +56,9 @@
* @param duration
* @return this + duration
*/
- public AbsoluteTime add(final RelativeTime duration) {
+ public AbsoluteTime add(RelativeTime duration) {
if (abs_value == Long.MAX_VALUE
- || duration.getMilliseconds() == Long.MAX_VALUE) {
+ || duration.isForever()) {
return AbsoluteTime.FOREVER;
}
if (abs_value + duration.getMilliseconds() < abs_value) {
@@ -107,7 +95,6 @@
}
-
@Override
public boolean equals(Object other) {
return other instanceof AbsoluteTime && compareTo((AbsoluteTime)
other) == 0;
@@ -136,8 +123,12 @@
}
return "AbsoluteTime("+this.abs_value+")";
}
-
-
+
+
+ /**
+ * Check if a deadline is due.
+ * @return true if NOW is greater than the given time, false otherwise
+ */
public boolean isDue() {
return this.abs_value < now().abs_value;
}
Modified: gnunet-java/src/org/gnunet/util/Client.java
===================================================================
--- gnunet-java/src/org/gnunet/util/Client.java 2012-02-22 20:46:21 UTC (rev
19957)
+++ gnunet-java/src/org/gnunet/util/Client.java 2012-02-22 20:49:54 UTC (rev
19958)
@@ -48,17 +48,27 @@
private static final int INITIAL_BUFFER_SIZE = 128;
- private SocketChannel chan;
- private ReceiveHelper currentReceive = null;
+ private SocketChannel chan = null;
+ private LinkedList<InetAddress> addressList = new
LinkedList<InetAddress>();
+ private RelativeTime connectBackoff = new RelativeTime(5);
+
+
+ private String connectionHost;
+ private int connectionPort;
+
+ private ReceiveHelper currentReceiveHelper = null;
private ByteBuffer recvBuffer = ByteBuffer.allocate(INITIAL_BUFFER_SIZE);
-
- private TransmitHelper currentTransmit = null;
+ private TransmitHelper currentTransmitHelper = null;
+ private TransmitHelper nextTransmitHelper = null;
private Scheduler.TaskIdentifier nextTransmitTimeout = null;
+ private Scheduler.TaskIdentifier currentTransmitTimeout = null;
private ByteBuffer transmitBuffer =
ByteBuffer.allocate(INITIAL_BUFFER_SIZE);
- private MessageTransmitter nextTransmitter = null;
+ private boolean resolveActive;
+
+
/**
* Represents a request for transmission.
*/
@@ -111,7 +121,7 @@
}
if (recvBuffer.remaining() == 0) {
if (headerProcessed) {
- currentReceive = null;
+ currentReceiveHelper = null;
dispatchMessage();
} else {
msgh = Construct.parseAs(recvBuffer.array(), 0,
MessageHeader.class);
@@ -120,7 +130,7 @@
recvBuffer.limit(msgh.messageSize);
schedule();
} else {
- currentReceive = null;
+ currentReceiveHelper = null;
dispatchMessage();
}
}
@@ -133,8 +143,9 @@
}
}
- public void schedule() {
+ private void schedule() {
recvTask = Scheduler.addRead(timeout, chan, this);
+ logger.debug("receive task has lifeness {}",
recvTask.getLifeness());
}
public void cancel() {
@@ -147,9 +158,12 @@
private class TransmitHelper implements Task, MessageSink {
private MessageTransmitter transmitter;
private Scheduler.TaskIdentifier transmitTask = null;
+ private boolean desiredLifeness;
- public TransmitHelper(MessageTransmitter transmitter) {
+
+ public TransmitHelper(MessageTransmitter transmitter, boolean
desiredLifeness) {
this.transmitter = transmitter;
+ this.desiredLifeness = desiredLifeness;
}
public void cancel() {
@@ -160,6 +174,8 @@
@Override
public void run(Scheduler.RunContext ctx) {
+
+
try {
int n = chan.write(transmitBuffer);
logger.debug("chan has written " + n + " bytes");
@@ -168,22 +184,42 @@
}
if (transmitBuffer.remaining() == 0) {
logger.debug("sent " + transmitBuffer.position() + "bytes
complete message");
- if (nextTransmitter == null) {
- currentTransmit = null;
+ if (nextTransmitHelper == null) {
+ currentTransmitHelper = null;
} else {
- transmitBuffer.clear();
- nextTransmitter.transmit(this);
- transmitBuffer.flip();
- schedule();
+ nextTransmitTimeout.cancel();
+ currentTransmitHelper = nextTransmitHelper;
+ nextTransmitHelper.start();
+ nextTransmitHelper = null;
}
} else {
schedule();
}
}
+ public void start() {
+ Scheduler.TaskBuilder b = new Scheduler.TaskBuilder();
+ b.withTask(new Task() {
+ @Override
+ public void run(Scheduler.RunContext ctx) {
+ transmitBuffer.clear();
+ transmitter.transmit(TransmitHelper.this);
+ transmitBuffer.flip();
+ schedule();
+ }
+ });
+ b.withLifeness(desiredLifeness);
+ Scheduler.add(b);
+
+ }
- public void schedule() {
- transmitTask = Scheduler.addWrite(RelativeTime.FOREVER, chan,
this);
+ private void schedule() {
+ // timeout is forever, because there is no way to directly limit
the transmission time
+ // of a message, only the max. wait time before transmission.
+ // cancel must be called on the transmitTask if we disconnect
+ Scheduler.TaskBuilder b = new Scheduler.TaskBuilder();
+
b.withTimeout(RelativeTime.FOREVER).withSelectWrite(chan).withTask(this).withLifeness(desiredLifeness);
+ Scheduler.add(b);
}
@Override
@@ -199,157 +235,152 @@
}
}
- private class ConnectHelper implements Task, Resolver.AddressCallback {
- private boolean resolveActive = false;
- private LinkedList<InetAddress> addrList = new
LinkedList<InetAddress>();
- private int currentAddr = 0;
- private String hostname;
- private int port;
- private RelativeTime backoff = RelativeTime.MILLISECOND;
-
-
- public ConnectHelper(String hostname, int port) {
- this.hostname = hostname;
- this.port = port;
+ /**
+ * Get a connection with a service.
+ *
+ * @param serviceName name of the service
+ * @param cfg configuration to use
+ */
+ public Client(String serviceName, Configuration cfg) {
+ // get port of this service from the configuration
+ int port = (int) cfg.getValueNumer(serviceName, "PORT");
+ // ... and check for validity
+ if (port > 0xFFFF || port <= 0) {
+ throw new ConfigurationException(String.format("'%s' is not a
valid port", port));
}
-
- @Override
- public void run(Scheduler.RunContext ctx) {
- connectStep();
+ connectionPort = port;
+ // ditto for hostname
+ connectionHost = cfg.getValueString(serviceName, "HOSTNAME");
+ // todo: further validity checks
+ if (connectionHost.isEmpty()) {
+ throw new ConfigurationException(String.format("hostname of
service '%s' empty", serviceName));
}
- private void increaseBackoff() {
- backoff = RelativeTime.min(backoff.multiply(2),
RelativeTime.SECOND.multiply(5));
- }
- private void resetBackoff() {
- backoff = RelativeTime.MILLISECOND;
- }
+ connect();
+ }
- /**
- * Execute the next step in connecting to a service.
- * Automatically schedules further steps if necessary.
- */
- public void connectStep() {
- if (chan == null) {
- try {
- chan = SelectorProvider.provider().openSocketChannel();
- chan.configureBlocking(false);
- } catch (IOException e) {
- // this is fatal, no retry necessary
- throw new IOError(e);
- }
- }
-
- if (chan.isConnected()) {
- return;
- }
-
- try {
- if (chan.isConnectionPending()) {
- if (chan.finishConnect()) {
- logger.debug("finished connect");
- // start transmit if request for transmit is pending
- if (currentTransmit == null && nextTransmitter !=
null) {
- MessageTransmitter t = nextTransmitter;
- nextTransmitter = null;
- startTransmit(t);
- }
- } else {
- logger.debug("still not finished");
- Scheduler.add(this, backoff);
- this.increaseBackoff();
- }
- } else {
- InetAddress addr = addrList.pollFirst();
- if (addr == null && !resolveActive) {
- startResolve();
- } else {
- logger.debug("connecting to " + addr + " on " + port);
- chan.connect(new InetSocketAddress(addr, port));
- Scheduler.add(this, backoff);
- }
- }
- } catch (IOException e) {
- logger.debug("got exception while connecting", e);
- logger.debug("retrying in {}ms", backoff.getMilliseconds());
- chan = null;
- Scheduler.add(this, backoff);
- increaseBackoff();
- }
- }
-
+ class AddressHandler implements Resolver.AddressCallback {
@Override
public void onAddress(InetAddress addr) {
- addrList.add(addr);
- connectStep();
+ addressList.addFirst(addr);
+ if (!chan.isConnectionPending()) {
+ logger.debug("no connection pending - connecting to next
addr");
+ connectNextAddress();
+ }
}
@Override
public void onFinished() {
- this.resolveActive = false;
- connectStep();
- //Scheduler.add(this, backoff);
+ if (addressList.isEmpty()) {
+ logger.debug("address could not be resolved");
+ initiateResolve();
+ } else {
+ resolveActive = false;
+ }
}
@Override
public void onTimeout() {
- increaseBackoff();
- this.resolveActive = false;
- Scheduler.add(this, backoff);
}
+ }
- public void startResolve() {
- this.resolveActive = true;
- Resolver.getInstance().resolveHostname(hostname,
RelativeTime.FOREVER, this);
+ public void initiateResolve() {
+ if (resolveActive) {
+ return;
}
+ Scheduler.TaskBuilder b = new Scheduler.TaskBuilder();
+ b.withTask(new Task() {
+ @Override
+ public void run(Scheduler.RunContext ctx) {
+ Resolver.getInstance().resolveHostname(connectionHost,
RelativeTime.FOREVER, new AddressHandler());
+ }
+ });
+ b.withLifeness(false);
+ Scheduler.add(b);
}
+ private void connectDelayed() {
+ Scheduler.TaskBuilder b = new Scheduler.TaskBuilder();
+ b.withTask(new Task() {
+ @Override
+ public void run(Scheduler.RunContext ctx) {
+ logger.debug("calling connect from delayed task");
+ connect();
+ }
+ });
+ b.withTimeout(connectBackoff);
+ Scheduler.add(b);
+ }
- /**
- * Get a connection with a service.
- *
- * @param serviceName name of the service
- * @param cfg configuration to use
- */
- public Client(String serviceName, Configuration cfg) {
- // get port of this service from the configuration
- int port = (int) cfg.getValueNumer(serviceName, "PORT");
- // ... and check for validity
- if (port > 0xFFFF || port <= 0) {
- throw new ConfigurationException(String.format("'%s' is not a
valid port", port));
+ private void increaseBackoff() {
+ connectBackoff = RelativeTime.min(connectBackoff.multiply(2), new
RelativeTime(5000));
+ }
+
+ private void connectNextAddress() {
+ if (addressList.isEmpty()) {
+ initiateResolve();
+ return;
}
- // ditto for hostname
- String hostname = cfg.getValueString(serviceName, "HOSTNAME");
- // todo: further validity checks
- if (hostname.isEmpty()) {
- throw new ConfigurationException(String.format("hostname of
service '%s' empty", serviceName));
+
+ InetAddress addr = addressList.pollFirst();
+ try {
+ chan.connect(new InetSocketAddress(addr, connectionPort));
+ logger.debug("connect called on channel");
+ Scheduler.TaskBuilder b = new Scheduler.TaskBuilder();
+ b.withTask(new Task() {
+ @Override
+ public void run(Scheduler.RunContext ctx) {
+ if (ctx.reasons.contains(Scheduler.Reason.SHUTDOWN)) {
+ return;
+ }
+ boolean connected = false;
+ try {
+ connected = chan.finishConnect();
+ logger.debug("client successfully connected");
+ } catch (IOException e) {
+ logger.debug("finishConnect() was not successful: {}",
e);
+ increaseBackoff();
+ logger.debug("backoff: {}", connectBackoff);
+ connectDelayed();
+ }
+ if (connected) {
+ if (currentTransmitHelper != null) {
+ currentTransmitTimeout.cancel();
+ currentTransmitHelper.start();
+ }
+ }
+ }
+ });
+ b.withLifeness(false);
+ b.withSelectConnect(chan);
+ b.withTimeout(RelativeTime.FOREVER);
+ Scheduler.add(b);
+ } catch (IOException e) {
+ logger.debug("unable to connect: {}", e);
+ increaseBackoff();
+ connectDelayed();
+ } finally {
+ addressList.addLast(addr);
}
- // create a connect helper
- ConnectHelper connectHelper = new ConnectHelper(hostname, port);
- // start with the first step
- connectHelper.connectStep();
}
- /**
- * Call the specified Task after connecting to the service successfully.
- * <p/>
- * XXX: the name is very undescriptive
- * XXX: can multiple service tests be active at the same time?
- *
- * @param service_name name of the service to wait for
- * @param cfg configuration to use
- * @param timeout how long to wait at most in ms
- * @param t task to run if service is running (reason will be
- * "PREREQ_DONE" (service running) or "TIMEOUT"
(service not
- * known to be running))
- */
- public void serviceTest(String service_name,
- Configuration cfg, RelativeTime timeout, Task t) {
- throw new UnsupportedOperationException();
+ private void openChannel() {
+ try {
+ chan = SelectorProvider.provider().openSocketChannel();
+ chan.configureBlocking(false);
+ } catch (IOException e) {
+ // this is fatal, no retry necessary
+ throw new IOError(e);
+ }
}
+ private void connect() {
+ openChannel();
+ connectNextAddress();
+ }
+
/**
* Receive one message from the service.
*
@@ -357,47 +388,34 @@
* @param timeout deadline after which MessageReceiver.deadline will be
called
*/
public void receive(MessageReceiver receiver, RelativeTime timeout) {
- if (currentReceive != null) {
+ if (currentReceiveHelper != null) {
throw new InterfaceViolationException("receive must not be called
while receiving");
}
-
+
logger.debug("scheduling receive with timeout " + timeout);
-
+
recvBuffer.clear();
recvBuffer.limit(MessageHeader.SIZE);
- currentReceive = new ReceiveHelper(receiver, timeout);
- currentReceive.schedule();
+ currentReceiveHelper = new ReceiveHelper(receiver, timeout);
+ currentReceiveHelper.schedule();
}
- private class TransmitTimeoutHelper implements Task {
- private MessageTransmitter transmitter;
- private int size;
-
- public TransmitTimeoutHelper(MessageTransmitter transmitter, int size)
{
- this.transmitter = transmitter;
- this.size = size;
- }
-
- @Override
- public void run(Scheduler.RunContext ctx) {
- transmitter.handleTimeout();
- }
+ public Scheduler.TaskIdentifier scheduleTransmitTimeout(final
MessageTransmitter t, RelativeTime timeout) {
+ Scheduler.TaskBuilder b = new Scheduler.TaskBuilder();
+ b.withTask(new Task() {
+ @Override
+ public void run(Scheduler.RunContext ctx) {
+ t.handleTimeout();
+ }
+ });
+ b.withTimeout(timeout);
+ return Scheduler.add(b);
}
- private void startTransmit(MessageTransmitter transmitter) {
- TransmitHelper transmitHelper = new TransmitHelper(transmitter);
- transmitBuffer.clear();
- transmitter.transmit(transmitHelper);
- transmitBuffer.flip();
- transmitHelper.schedule();
- currentTransmit = transmitHelper;
- }
-
-
/**
- * Ask the client to call us once the last transmission has completed.
+ * Ask the client to call us once it is able to send a message.
*
* @param size number of bytes to send
* @param timeout after how long should we give up (and call
@@ -410,61 +428,48 @@
* @param transmitter ...
* @return a handle that can be used to cancel the transmit request
*/
- public TransmitHandle notifyTransmitReady(int size, RelativeTime timeout,
+ public TransmitHandle notifyTransmitReady(RelativeTime timeout,
boolean autoRetry, final
MessageTransmitter transmitter) {
- if (nextTransmitter != null) {
+ if (nextTransmitHelper != null) {
throw new InterfaceViolationException(
"previous transmit request must have completed before
calling notifyTransmitReady again");
}
- if (size > transmitBuffer.capacity()) {
- transmitBuffer = ByteBuffer.allocate(size);
- logger.debug("bigger transmitBuffer allocated");
+
+
+ final TransmitHelper transmit = new TransmitHelper(transmitter,
Scheduler.getCurrentLifeness());
+
+ if (currentTransmitHelper == null) {
+ currentTransmitHelper = transmit;
+ currentTransmitTimeout = scheduleTransmitTimeout(transmitter,
timeout);
+ if (chan.isConnected()) {
+ currentTransmitHelper.start();
+ }
+ } else {
+ nextTransmitHelper = transmit;
+ nextTransmitTimeout = scheduleTransmitTimeout(transmitter,
timeout);
}
- if (currentTransmit == null && chan != null && chan.isConnected()) {
- startTransmit(transmitter);
- return new TransmitHandle() {
- @Override
- public void cancel() {
- throw new InterfaceViolationException("cancel() called on
a completed transmit request");
- }
- };
- } else {
- if (!timeout.isForever()) {
- TransmitTimeoutHelper h = new
TransmitTimeoutHelper(transmitter, size);
- nextTransmitTimeout = Scheduler.add(h, timeout);
+
+
+ return new TransmitHandle() {
+ @Override
+ public void cancel() {
+ transmit.cancel();
}
- nextTransmitter = transmitter;
- return new TransmitHandle() {
- @Override
- public void cancel() {
- if (nextTransmitter == transmitter) {
- nextTransmitter = null;
- if (nextTransmitTimeout != null) {
- nextTransmitTimeout.cancel();
- }
- } else {
- throw new InterfaceViolationException("cancel() called
on a completed transmit request");
- }
-
- }
- };
- }
+ };
}
+
/**
* Disconnect from the service. Cancel all pending recveive/transmit
requests.
* todo: introduce finishPendingWrites parameter
*/
public void disconnect() {
- if (currentTransmit != null) {
- currentTransmit.cancel();
+ if (currentTransmitHelper != null) {
+ currentTransmitHelper.cancel();
}
- if (currentReceive != null) {
- currentReceive.cancel();
+ if (currentReceiveHelper != null) {
+ currentReceiveHelper.cancel();
}
- if (nextTransmitTimeout != null) {
- nextTransmitTimeout.cancel();
- }
}
Modified: gnunet-java/src/org/gnunet/util/Configuration.java
===================================================================
--- gnunet-java/src/org/gnunet/util/Configuration.java 2012-02-22 20:46:21 UTC
(rev 19957)
+++ gnunet-java/src/org/gnunet/util/Configuration.java 2012-02-22 20:49:54 UTC
(rev 19958)
@@ -58,7 +58,7 @@
private static Pattern tag = Pattern.compile("(\\S+?)\\s*=(.*?)");
private static Pattern whitspace = Pattern.compile("\\s*");
- private final Map<String, Map<String, String>> sections = new
LinkedHashMap<String, Map<String, String>>();
+ private final Map<String, Map<String, String>> sections = new
LinkedHashMap<String, Map<String, String>>(100);
/**
* Start with an empty configuration.
Modified: gnunet-java/src/org/gnunet/util/Resolver.java
===================================================================
--- gnunet-java/src/org/gnunet/util/Resolver.java 2012-02-22 20:46:21 UTC
(rev 19957)
+++ gnunet-java/src/org/gnunet/util/Resolver.java 2012-02-22 20:49:54 UTC
(rev 19958)
@@ -18,8 +18,13 @@
public class Resolver {
private static final Logger logger = LoggerFactory
.getLogger(Resolver.class);
- private Configuration cfg;
+ private static Resolver singletonInstance = null;
+
+ private Configuration cfg = null;
+
+ Client client = null;
+
@SuppressWarnings("InstanceVariableMayNotBeInitialized")
public static class GetMessage implements Message {
final static int MSG_ID = 4;
@@ -75,8 +80,6 @@
}
-
-
/* @Nullable */
public InetAddress getInet4AddressFromString(String ip) {
String[] components = ip.split(".");
@@ -159,8 +162,8 @@
}
- Client client = null;
+
private void connect(Configuration cfg) {
if (client != null) {
throw new InterfaceViolationException("connectStep called twice");
@@ -223,7 +226,7 @@
System.out.println("really: " + (Construct.toBinary(gmsg).length));
- client.notifyTransmitReady(gmsg.header.messageSize, timeout, true, new
MessageTransmitter() {
+ client.notifyTransmitReady(timeout, true, new MessageTransmitter() {
@Override
public void transmit(Client.MessageSink sink) {
sink.send(gmsg);
@@ -315,7 +318,6 @@
logger.debug("remaining is " + deadline.getRemaining());
client.notifyTransmitReady(
- Construct.getSize(req),
deadline.getRemaining(), true,
new MessageTransmitter() {
@Override
@@ -365,8 +367,8 @@
}
- private static Resolver singletonInstance = null;
+
public static Resolver getInstance() {
if (singletonInstance == null) {
singletonInstance = new Resolver();
@@ -396,7 +398,7 @@
System.out.println(s);
}
- final RelativeTime timeout = RelativeTime.MINUTE;
+ final RelativeTime timeout = RelativeTime.SECOND;
if (unprocessedArgs.length == 0) {
System.out.println("no hostnames given");
Modified: gnunet-java/src/org/gnunet/util/Scheduler.java
===================================================================
--- gnunet-java/src/org/gnunet/util/Scheduler.java 2012-02-22 20:46:21 UTC
(rev 19957)
+++ gnunet-java/src/org/gnunet/util/Scheduler.java 2012-02-22 20:49:54 UTC
(rev 19958)
@@ -46,7 +46,7 @@
}
public enum Reason {
- STARTUP, SHUTDOWN, TIMEOUT, READ_READY, WRITE_READY, PREREQ_DONE
+ STARTUP, SHUTDOWN, TIMEOUT, READ_READY, WRITE_READY, CONNECT_READY,
PREREQ_DONE
}
@@ -54,9 +54,10 @@
* The context of a task that is ready to run.
*/
public static class RunContext {
- EnumSet<Reason> reasons = EnumSet.noneOf(Reason.class);
+ Set<Reason> reasons = EnumSet.noneOf(Reason.class);
Set<Channel> readableSet = null;
Set<Channel> writeableSet = null;
+ Set<Channel> connectedSet = null;
}
public static interface Task {
@@ -70,8 +71,9 @@
* (e.g. one task wants to read, another one wants to write)
*/
static class SubscriberSet {
- Set<TaskIdentifier> readers = new HashSet<TaskIdentifier>();
- Set<TaskIdentifier> writers = new HashSet<TaskIdentifier>();
+ Set<TaskIdentifier> read = new TreeSet<TaskIdentifier>();
+ Set<TaskIdentifier> write = new TreeSet<TaskIdentifier>();
+ Set<TaskIdentifier> connect = new TreeSet<TaskIdentifier>();
}
/**
@@ -81,17 +83,18 @@
private final Task task;
private TaskIdentifier prereq;
private RunContext ctx = new RunContext();
- private boolean liveness;
+ private boolean lifeness;
private final Priority priority;
private final AbsoluteTime deadline;
- private Set<SelectableChannel> rs, ws;
+ private Set<SelectableChannel> rs=null, ws=null, cs=null;
+
TaskIdentifier(Task t, Priority priority,
boolean liveness, TaskIdentifier prereq, RelativeTime
timeout,
- Set<SelectableChannel> rs,Set<SelectableChannel> ws) {
+ Set<SelectableChannel> rs, Set<SelectableChannel> ws,
Set<SelectableChannel> cs) {
this.task = t;
- this.priority = (priority == null) ? getCurrentPriority() :
priority;
- this.liveness = liveness;
+ this.priority = (activeTask == null) ? Priority.DEFAULT :
activeTask.priority;
+ this.lifeness = liveness;
this.prereq = prereq;
if (timeout.getMilliseconds() < 0) {
@@ -100,27 +103,41 @@
this.deadline = timeout.toAbsolute();
- logger.debug("creating TID with timeout " + timeout);
- logger.debug("... and deadline " + deadline);
if (rs != null) {
for (SelectableChannel sc : rs) {
+ logger.debug("registering for OP_READ");
registerSelect(sc, SelectionKey.OP_READ);
}
}
if (ws != null) {
for (SelectableChannel sc : ws) {
+ logger.debug("registering for OP_WRITE");
registerSelect(sc, SelectionKey.OP_WRITE);
}
}
- this.ws = ws;
- this.rs = rs;
+ if (cs != null) {
+ for (SelectableChannel sc : cs) {
+ logger.debug("registering for OP_CONNECT");
+ registerSelect(sc, SelectionKey.OP_CONNECT);
+ }
+ }
+ this.ws = new TreeSet<SelectableChannel>(ws == null ?
Collections.EMPTY_SET : ws);
+ this.rs = new TreeSet<SelectableChannel>(rs == null ?
Collections.EMPTY_SET : rs);
+ this.cs = new TreeSet<SelectableChannel>(cs == null ?
Collections.EMPTY_SET : cs);
- if (deadline.isForever() && (ws == null || ws.isEmpty()) && (rs ==
null || rs.isEmpty())) {
+ boolean selectEmpty = (ws == null || ws.isEmpty()) && (rs == null
|| rs.isEmpty())
+ && (cs == null || cs.isEmpty());
+
+ if (deadline.isForever() && selectEmpty) {
throw new InterfaceViolationException("unschedulable task
created");
}
-
+
+ if (timeout.getMilliseconds() == 0 && !selectEmpty) {
+ throw new InterfaceViolationException("select used with
zero-timeout task");
+ }
+
pending.add(this);
}
@@ -128,21 +145,23 @@
/**
* Create a light-weight task identifier that is not registerd as
pending in the Scheduler,
* used for continuations.
+ *
* @param t
- * @param priority
+ * @param ctx
*/
TaskIdentifier(Task t, RunContext ctx) {
this.task = t;
this.ctx = ctx;
this.deadline = AbsoluteTime.ZERO;
- this.priority = getCurrentPriority();
- this.liveness = true;
+ this.priority = (activeTask == null) ? Priority.DEFAULT :
activeTask.priority;
+ this.lifeness = true;
}
void run() {
+ TaskIdentifier old = activeTask;
activeTask = this;
task.run(ctx);
- activeTask = null;
+ activeTask = old;
}
public Task getTask() {
@@ -153,13 +172,21 @@
pending.remove(this);
}
+ public boolean getLifeness() {
+ return lifeness;
+ }
+ public void setLifeness(boolean newLifeness) {
+ lifeness = newLifeness;
+ }
+
+
@Override
public int compareTo(TaskIdentifier other) {
return this.deadline.compareTo(other.deadline);
}
- public void registerSelect(SelectableChannel sc, int op) {
+ private void registerSelect(SelectableChannel sc, int op) {
SelectionKey key = sc.keyFor(selector);
SubscriberSet subscribers;
if (key == null || !key.isValid()) {
@@ -174,11 +201,14 @@
key.interestOps(key.interestOps() | op);
}
if ((op & SelectionKey.OP_READ) != 0) {
- subscribers.readers.add(this);
+ subscribers.read.add(this);
}
if ((op & SelectionKey.OP_WRITE) != 0) {
- subscribers.writers.add(this);
+ subscribers.write.add(this);
}
+ if ((op & SelectionKey.OP_CONNECT) != 0) {
+ subscribers.connect.add(this);
+ }
}
private void deregisterOne(SelectableChannel sc, int op) {
@@ -188,20 +218,26 @@
}
SubscriberSet subscribers = (SubscriberSet) key.attachment();
if ((op & SelectionKey.OP_READ) != 0) {
- subscribers.readers.remove(this);
+ subscribers.read.remove(this);
}
if ((op & SelectionKey.OP_WRITE) != 0) {
- subscribers.writers.remove(this);
+ subscribers.write.remove(this);
}
- if (subscribers.writers.isEmpty()) {
+ if ((op & SelectionKey.OP_CONNECT) != 0) {
+ subscribers.write.remove(this);
+ }
+ if (subscribers.write.isEmpty()) {
key.interestOps(key.interestOps() & ~SelectionKey.OP_WRITE);
}
- if (subscribers.readers.isEmpty()) {
+ if (subscribers.read.isEmpty()) {
key.interestOps(key.interestOps() & ~SelectionKey.OP_READ);
}
+ if (subscribers.connect.isEmpty()) {
+ key.interestOps(key.interestOps() & ~SelectionKey.OP_CONNECT);
+ }
}
-
+
public void deregister() {
if (this.rs != null) {
for (SelectableChannel sc : this.rs) {
@@ -213,10 +249,85 @@
deregisterOne(sc, SelectionKey.OP_WRITE);
}
}
-
+ if (this.cs != null) {
+ for (SelectableChannel sc : this.cs) {
+ deregisterOne(sc, SelectionKey.OP_CONNECT);
+ }
+ }
}
}
+
+ public static class TaskBuilder {
+ private Task task = null;
+ private TaskIdentifier prereq = null;
+ private boolean lifeness = true;
+ private Priority prio = null;
+ private RelativeTime timeout = RelativeTime.ZERO;
+ private Set<SelectableChannel> rs=null, ws=null, cs=null;
+
+ public TaskBuilder withLifeness(boolean lifeness) {
+ this.lifeness = lifeness;
+ return this;
+ }
+
+ public TaskBuilder withPrereq(TaskIdentifier prereq) {
+ this.prereq = prereq;
+ return this;
+ }
+
+ public TaskBuilder withPriority(Priority prio) {
+ this.prio = prio;
+ return this;
+ }
+
+ public TaskBuilder withTask(Task task) {
+ this.task = task;
+ return this;
+ }
+
+ public TaskBuilder withTimeout(RelativeTime timeout) {
+ this.timeout = timeout;
+ return this;
+ }
+
+ public TaskBuilder withSelectRead(SelectableChannel c) {
+ this.rs = Collections.singleton(c);
+ return this;
+ }
+
+
+ public TaskBuilder withSelectReadSet(Set<SelectableChannel> cs) {
+ this.rs = cs;
+ return this;
+ }
+
+ public TaskBuilder withSelectWrite(SelectableChannel c) {
+ this.ws = Collections.singleton(c);
+ return this;
+ }
+
+ public TaskBuilder withSelectWriteSet(Set<SelectableChannel> cs) {
+ this.ws = cs;
+ return this;
+ }
+
+ public TaskBuilder withSelectConnect(SelectableChannel c) {
+ this.cs = Collections.singleton(c);
+ return this;
+ }
+
+ public TaskBuilder withSelectConnectSet(Set<SelectableChannel> cs) {
+ this.cs = cs;
+ return this;
+ }
+
+ private TaskIdentifier build() {
+ return new TaskIdentifier(task, prio, lifeness, prereq, timeout,
rs, ws, cs);
+ }
+ }
+
+
// tasks that are waiting for an event, which are executed anyway after
the deadline has occured
final private static Queue<TaskIdentifier> pending = new
PriorityQueue<TaskIdentifier>();
@@ -235,7 +346,7 @@
}
}
- private static Selector selector;
+ private static Selector selector = null;
static {
try {
@@ -248,14 +359,10 @@
}
- private static Priority getCurrentPriority() {
- return (activeTask == null) ? Priority.DEFAULT : activeTask.priority;
+ public static boolean getCurrentLifeness() {
+ return (activeTask == null) || activeTask.lifeness;
}
- private static boolean getCurrentLiveness() {
- return (activeTask == null) || activeTask.liveness;
- }
-
public static TaskIdentifier addAfter(final TaskIdentifier prereq,
final Task t) {
return addSelect(Priority.KEEP, prereq, RelativeTime.ZERO, null, null,
@@ -266,14 +373,19 @@
* Run the task regardless of any prerequisites, before any other task of
* the same priority.
*/
- public static void addContinuation(final Task task,
- final EnumSet<Reason> reasons) {
+ public static void addContinuation(Task task,
+ EnumSet<Reason> reasons) {
RunContext ctx = new RunContext();
ctx.reasons = reasons;
queueReady(new TaskIdentifier(task, ctx));
}
+ public static TaskIdentifier add(TaskBuilder builder) {
+ return builder.build();
+ }
+
+
/**
* Schedule a new task to be run as soon as possible. The task will be run
* with the priority of the calling task.
@@ -288,7 +400,6 @@
}
-
public static TaskIdentifier add(Task task, RelativeTime delay) {
return addSelect(Priority.KEEP, null, delay, null, null, task);
}
@@ -303,26 +414,26 @@
* function of the "add" family. Note that the "prerequisite_task"
* must be satisfied in addition to any of the other conditions. In
* other words, the task will be started when
- * <code>
+ * address@hidden
* (prerequisite-run)
* && (delay-ready
* || any-rs-ready
* || any-ws-ready
* || (disconnect-active && run-on-disconnect) )
- * </code>
+ * }
*
- * @param prio how important is this task?
+ * @param p how important is this task?
* @param prerequisite_task run this task after the task with the given
* task identifier completes (and any of our other
* conditions, such as delay, read or
write-readiness
* are satisfied). Use GNUNET_SCHEDULER_NO_TASK
to not have any dependency
* on completion of other tasks.
+ * @param prereq Prerequisite Task
* @param delay how long should we wait? Use
GNUNET_TIME_UNIT_FOREVER_REL for "forever",
* which means that the task will only be run
after we receive SIGTERM
* @param rs set of file descriptors we want to read (can
be NULL)
* @param ws set of file descriptors we want to write (can
be NULL)
- * @param task main function of the task
- * @param task_cls closure of task
+ * @param t The Task to run
* @return unique task identifier for the job
* only valid until "task" is started!
*/
@@ -330,7 +441,8 @@
TaskIdentifier prereq, RelativeTime
delay,
Set<SelectableChannel> rs,
Set<SelectableChannel> ws,
Task t) {
- return new TaskIdentifier(t, p, getCurrentLiveness(), prereq, delay,
rs, ws);
+
+ return new TaskIdentifier(t, p, getCurrentLifeness(), prereq, delay,
rs, ws, null);
}
public static TaskIdentifier addRead(RelativeTime timeout,
@@ -350,7 +462,6 @@
Task t) {
return addSelect(prio, null, RelativeTime.ZERO, null, null, t);
}
-
/**
@@ -364,11 +475,11 @@
return true;
}
for (TaskIdentifier t : pending) {
- if (t.liveness) {
+ if (t.lifeness) {
return true;
}
}
- // trigger shutdown if we still have pending tasks, but none of them
has liveness
+ // trigger shutdown if we still have pending tasks, but none of them
has lifeness
if (!pending.isEmpty()) {
logger.debug("tasks pending but not alive -- disconnect");
shutdown();
@@ -382,7 +493,7 @@
/**
* Queue a Task for execution.
*
- * @param tid
+ * @param tid TaskIdentifier of the ready task
*/
private static void queueReady(TaskIdentifier tid) {
int idx = tid.priority.ordinal();
@@ -392,7 +503,105 @@
pending.remove(tid);
}
+
/**
+ * Queue all tasks with expired timeout.
+ *
+ * @return the minimum time to wait until the next timeout expiry
+ */
+ private static RelativeTime handleTimeouts() {
+ RelativeTime timeout = RelativeTime.FOREVER;
+
+ // check if any timeouts occured
+ while (true) {
+ TaskIdentifier t = pending.peek();
+ if (t == null) {
+ break;
+ }
+ RelativeTime remaining = t.deadline.getRemaining();
+ if (remaining.getMilliseconds() <= 0) {
+ // deadline occured
+ logger.debug("deadline " + t.deadline + " occured (now = " +
AbsoluteTime.now() + " )");
+ t.deregister();
+ t.ctx.reasons = EnumSet.of(Reason.TIMEOUT);
+ queueReady(t);
+ pending.remove(t);
+ } else {
+ timeout = remaining;
+ break;
+ }
+ }
+ return timeout;
+ }
+
+ private static void handleSelect(RelativeTime timeout) {
+ try {
+ // selector.select(0) would block indefinitely
+ if (timeout.getMilliseconds() == 0) {
+ selector.selectNow();
+ } else if (timeout.isForever()) {
+ selector.select(0);
+ } else {
+ //logger.debug("starting to select with deadline");
+ selector.select(timeout.getMilliseconds());
+ //logger.debug("select with deadline ended");
+ }
+ } catch (IOException e) {
+ throw new IOError(e);
+ }
+
+ Collection<TaskIdentifier> executableTasks = new
TreeSet<TaskIdentifier>();
+ for (SelectionKey sk : selector.selectedKeys()) {
+ Object obj = sk.attachment();
+ assert (obj instanceof SubscriberSet);
+ SubscriberSet ss = (SubscriberSet) obj;
+
+ Channel c = sk.channel();
+
+ if (sk.isReadable()) {
+ for (TaskIdentifier tt : ss.read) {
+ logger.debug("adding isReadable() task");
+ executableTasks.add(tt);
+ if (tt.ctx.reasons == null) {
+ tt.ctx.reasons = EnumSet.of(Reason.READ_READY);
+ } else {
+ tt.ctx.reasons.add(Reason.READ_READY);
+ }
+ }
+
+ }
+ if (sk.isWritable()) {
+ for (TaskIdentifier tt : ss.write) {
+ logger.debug("adding isWritable() task");
+ executableTasks.add(tt);
+ if (tt.ctx.reasons == null) {
+ tt.ctx.reasons = EnumSet.of(Reason.WRITE_READY);
+ } else {
+ tt.ctx.reasons.add(Reason.WRITE_READY);
+ }
+ }
+ }
+ if (sk.isConnectable()) {
+ logger.debug("adding isConnectable() task");
+ for (TaskIdentifier tt : ss.connect) {
+ executableTasks.add(tt);
+ if (tt.ctx.reasons == null) {
+ tt.ctx.reasons = EnumSet.of(Reason.CONNECT_READY);
+ } else {
+ tt.ctx.reasons.add(Reason.CONNECT_READY);
+ }
+ }
+ }
+ }
+ for (TaskIdentifier tt : executableTasks) {
+ // tasks must do this themselve to cancel subscriptions to other
channels
+ tt.deregister();
+ queueReady(tt);
+ }
+ }
+
+
+ /**
* Initialize and run scheduler. This function will return when all tasks
* have completed. On systems with signals, receiving a SIGTERM (and other
* similar signals) will cause "GNUNET_SCHEDULER_shutdown" to be run after
@@ -403,90 +612,23 @@
* @param task task to run immediately
*/
public static void run(Task task) {
+ addContinuation(task, EnumSet.of(Reason.STARTUP));
- RelativeTime timeout = RelativeTime.FOREVER;
+ while (checkLiveness()) {
- if (task != null) {
- addContinuation(task, EnumSet.of(Reason.STARTUP));
- }
+ RelativeTime nextTimeout = handleTimeouts();
- while (checkLiveness()) {
- AbsoluteTime now = AbsoluteTime.now();
-
- // check if any timeouts occured
- while (true) {
- TaskIdentifier t = pending.peek();
- if (t != null && t.deadline.isDue()) {
- // deadline occured
- logger.debug("deadline " + t.deadline + " occurent (now =
" + AbsoluteTime.now() + " )");
- t.deregister();
- t.ctx.reasons = EnumSet.of(Reason.TIMEOUT);
- queueReady(t);
- pending.remove(t);
- } else {
- break;
- }
+ // don't select if there are no tasks
+ if (readyCount == 0 && pending.isEmpty()) {
+ return;
}
if (readyCount > 0) {
- timeout = RelativeTime.ZERO;
+ handleSelect(RelativeTime.ZERO);
} else {
- if (pending.isEmpty()) {
- // we are done, completely!
- return;
- }
- timeout = pending.peek().deadline.getRemaining();
+ handleSelect(nextTimeout);
}
- try {
- // selector.select(0) would block indefinitely
- if (timeout.getMilliseconds() == 0) {
- selector.selectNow();
- } else if (timeout.isForever()) {
- selector.select(0);
- } else {
- //logger.debug("starting to select with deadline");
- selector.select(timeout.getMilliseconds());
- //logger.debug("select with deadline ended");
- }
- } catch (IOException e) {
- throw new IOError(e);
- }
-
- Set<TaskIdentifier> executableTasks = new
HashSet<TaskIdentifier>();
- for (SelectionKey sk : selector.selectedKeys()) {
- Object obj = sk.attachment();
- assert (obj instanceof SubscriberSet);
- SubscriberSet ss = (SubscriberSet) obj;
-
- if (sk.isReadable()) {
- for (TaskIdentifier tt : ss.readers) {
- executableTasks.add(tt);
- if (tt.ctx.reasons == null) {
- tt.ctx.reasons = EnumSet.of(Reason.READ_READY);
- } else {
- tt.ctx.reasons.add(Reason.READ_READY);
- }
- }
-
- }
- if (sk.isWritable()) {
- for (TaskIdentifier tt : ss.writers) {
- executableTasks.add(tt);
- if (tt.ctx.reasons == null) {
- tt.ctx.reasons = EnumSet.of(Reason.WRITE_READY);
- } else {
- tt.ctx.reasons.add(Reason.WRITE_READY);
- }
- }
- }
- }
- for (TaskIdentifier tt : executableTasks) {
- // tasks must do this themselve to cancel subscriptions to
other channels
- tt.deregister();
- queueReady(tt);
- }
-
runReady();
}
}
@@ -525,7 +667,11 @@
* scheduled AFTER this call may still be delayed arbitrarily.
*/
public static void shutdown() {
- logger.warn("disconnect not yet implemented");
+ // queueReady() while iterating would yield concurrent modification
exn otherwise
+ for (TaskIdentifier tid : new ArrayList<TaskIdentifier>(pending)) {
+ tid.ctx.reasons.add(Reason.SHUTDOWN);
+ queueReady(tid);
+ }
+ pending.clear();
}
-
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r19958 - in gnunet-java: . .idea .idea/inspectionProfiles src/org/gnunet/nse src/org/gnunet/util,
gnunet <=