Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
TeeTime
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeeTime
TeeTime
Commits
f00d362f
Commit
f00d362f
authored
9 years ago
by
Nelson Tavares de Sousa
Browse files
Options
Downloads
Patches
Plain Diff
minor refactoring and solved issue with one junit test
parent
82acdaf7
No related branches found
No related tags found
1 merge request
!41
Pipe instantiation
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/teetime/framework/Analysis.java
+10
-8
10 additions, 8 deletions
src/main/java/teetime/framework/Analysis.java
src/test/java/teetime/framework/RunnableConsumerStageTestConfiguration.java
+2
-1
2 additions, 1 deletion
...ime/framework/RunnableConsumerStageTestConfiguration.java
with
12 additions
and
9 deletions
src/main/java/teetime/framework/Analysis.java
+
10
−
8
View file @
f00d362f
...
@@ -73,7 +73,7 @@ public final class Analysis<T extends AnalysisConfiguration> implements Uncaught
...
@@ -73,7 +73,7 @@ public final class Analysis<T extends AnalysisConfiguration> implements Uncaught
private
final
IPipeFactory
interBoundedThreadPipeFactory
=
new
SpScPipeFactory
();
private
final
IPipeFactory
interBoundedThreadPipeFactory
=
new
SpScPipeFactory
();
private
final
IPipeFactory
interUnboundedThreadPipeFactory
=
new
UnboundedSpScPipeFactory
();
private
final
IPipeFactory
interUnboundedThreadPipeFactory
=
new
UnboundedSpScPipeFactory
();
private
final
IPipeFactory
intraThreadPipeFactory
=
new
SingleElementPipeFactory
();
private
final
IPipeFactory
intraThreadPipeFactory
=
new
SingleElementPipeFactory
();
private
Integer
connect
ed
=
new
Integer
(
0
);
private
Integer
c
reatedC
onnect
ions
=
new
Integer
(
0
);
/**
/**
* Creates a new {@link Analysis} that skips validating the port connections and uses the default listener.
* Creates a new {@link Analysis} that skips validating the port connections and uses the default listener.
...
@@ -143,7 +143,7 @@ public final class Analysis<T extends AnalysisConfiguration> implements Uncaught
...
@@ -143,7 +143,7 @@ public final class Analysis<T extends AnalysisConfiguration> implements Uncaught
}
}
for
(
Stage
stage
:
threadableStageJobs
)
{
for
(
Stage
stage
:
threadableStageJobs
)
{
final
Thread
thread
=
initializeStages
(
stage
);
final
Thread
thread
=
initialize
Threadable
Stages
(
stage
);
final
Set
<
Stage
>
intraStages
=
traverseIntraStages
(
stage
);
final
Set
<
Stage
>
intraStages
=
traverseIntraStages
(
stage
);
final
AbstractExceptionListener
newListener
=
factory
.
createInstance
();
final
AbstractExceptionListener
newListener
=
factory
.
createInstance
();
...
@@ -152,7 +152,7 @@ public final class Analysis<T extends AnalysisConfiguration> implements Uncaught
...
@@ -152,7 +152,7 @@ public final class Analysis<T extends AnalysisConfiguration> implements Uncaught
}
}
private
Thread
initializeStages
(
final
Stage
stage
)
{
private
Thread
initialize
Threadable
Stages
(
final
Stage
stage
)
{
final
Thread
thread
;
final
Thread
thread
;
final
TerminationStrategy
terminationStrategy
=
stage
.
getTerminationStrategy
();
final
TerminationStrategy
terminationStrategy
=
stage
.
getTerminationStrategy
();
...
@@ -209,8 +209,11 @@ public final class Analysis<T extends AnalysisConfiguration> implements Uncaught
...
@@ -209,8 +209,11 @@ public final class Analysis<T extends AnalysisConfiguration> implements Uncaught
colors
.
put
(
threadableStage
,
i
);
// Markiere den threadHead
colors
.
put
(
threadableStage
,
i
);
// Markiere den threadHead
colorAndConnectStages
(
i
,
colors
,
threadableStage
);
colorAndConnectStages
(
i
,
colors
,
threadableStage
);
}
}
if
(
configuration
.
getConnections
().
size
()
!=
connected
)
{
if
(
configuration
.
getConnections
().
size
()
!=
createdConnections
)
{
throw
new
IllegalStateException
(
"remaining "
+
(
configuration
.
getConnections
().
size
()
-
connected
)
+
" connections"
);
for
(
Connection
<?>
conn
:
configuration
.
getConnections
())
{
System
.
out
.
println
(
conn
.
getSourcePort
().
getOwningStage
().
getId
()
+
" connects with "
+
conn
.
getTargetPort
().
getOwningStage
().
getId
());
}
throw
new
IllegalStateException
(
"Remaining "
+
(
configuration
.
getConnections
().
size
()
-
createdConnections
)
+
" connection(s)"
);
}
}
}
}
...
@@ -233,15 +236,14 @@ public final class Analysis<T extends AnalysisConfiguration> implements Uncaught
...
@@ -233,15 +236,14 @@ public final class Analysis<T extends AnalysisConfiguration> implements Uncaught
}
else
{
}
else
{
if
(
colors
.
containsKey
(
targetStage
))
{
if
(
colors
.
containsKey
(
targetStage
))
{
if
(
colors
.
get
(
targetStage
).
equals
(
i
))
{
if
(
colors
.
get
(
targetStage
).
equals
(
i
))
{
throw
new
IllegalStateException
(
"Crossing threads"
);
// One stage is connected to a stage of another thread (not
the
"headstage")
throw
new
IllegalStateException
(
"Crossing threads"
);
// One stage is connected to a stage of another thread (
but
not
its
"headstage")
}
}
}
}
intraThreadPipeFactory
.
create
(
connection
.
getSourcePort
(),
connection
.
getTargetPort
());
intraThreadPipeFactory
.
create
(
connection
.
getSourcePort
(),
connection
.
getTargetPort
());
colors
.
put
(
targetStage
,
i
);
colors
.
put
(
targetStage
,
i
);
colorAndConnectStages
(
i
,
colors
,
targetStage
);
colorAndConnectStages
(
i
,
colors
,
targetStage
);
}
}
connected
++;
createdConnections
++;
// configuration.getConnections().remove(connection); remove connection to increase performance
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/test/java/teetime/framework/RunnableConsumerStageTestConfiguration.java
+
2
−
1
View file @
f00d362f
...
@@ -35,7 +35,8 @@ public class RunnableConsumerStageTestConfiguration extends AnalysisConfiguratio
...
@@ -35,7 +35,8 @@ public class RunnableConsumerStageTestConfiguration extends AnalysisConfiguratio
CollectorSink
<
Integer
>
collectorSink
=
new
CollectorSink
<
Integer
>(
collectedElements
);
CollectorSink
<
Integer
>
collectorSink
=
new
CollectorSink
<
Integer
>(
collectedElements
);
addThreadableStage
(
collectorSink
);
addThreadableStage
(
collectorSink
);
connectPorts
(
producer
.
getOutputPort
(),
collectorSink
.
getInputPort
());
// Can not use createPorts, as the if condition above will lead to an exception
connectBoundedInterThreads
(
producer
.
getOutputPort
(),
collectorSink
.
getInputPort
());
this
.
collectorSink
=
collectorSink
;
this
.
collectorSink
=
collectorSink
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment