Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TeeTime-Framework
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
Nelson Tavares de Sousa
TeeTime-Framework
Commits
469105fc
Commit
469105fc
authored
9 years ago
by
Nelson Tavares de Sousa
Browse files
Options
Downloads
Patches
Plain Diff
added a check, if any config instance is executed multiple times
parent
4e9b00b6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/teetime/framework/Configuration.java
+11
-2
11 additions, 2 deletions
src/main/java/teetime/framework/Configuration.java
src/main/java/teetime/framework/Execution.java
+6
-2
6 additions, 2 deletions
src/main/java/teetime/framework/Execution.java
with
17 additions
and
4 deletions
src/main/java/teetime/framework/Configuration.java
+
11
−
2
View file @
469105fc
...
...
@@ -31,6 +31,7 @@ public abstract class Configuration extends AbstractCompositeStage {
private
final
IExceptionListenerFactory
<?>
factory
;
private
final
ConfigurationContext
context
;
private
boolean
initialized
;
private
boolean
executed
;
private
Stage
startStage
;
...
...
@@ -43,11 +44,19 @@ public abstract class Configuration extends AbstractCompositeStage {
this
.
context
=
new
ConfigurationContext
(
this
);
}
boolean
isExecuted
()
{
boolean
isInitialized
()
{
return
initialized
;
}
void
setInitialized
(
final
boolean
executed
)
{
this
.
initialized
=
executed
;
}
public
boolean
isExecuted
()
{
return
executed
;
}
void
setExecuted
(
final
boolean
executed
)
{
public
void
setExecuted
(
final
boolean
executed
)
{
this
.
executed
=
executed
;
}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/teetime/framework/Execution.java
+
6
−
2
View file @
469105fc
...
...
@@ -62,10 +62,10 @@ public final class Execution<T extends Configuration> {
public
Execution
(
final
T
configuration
,
final
boolean
validationEnabled
)
{
this
.
configuration
=
configuration
;
this
.
configurationContext
=
configuration
.
getContext
();
if
(
configuration
.
is
Execut
ed
())
{
if
(
configuration
.
is
Initializ
ed
())
{
throw
new
IllegalStateException
(
"Configuration was already executed"
);
}
configuration
.
set
Execut
ed
(
true
);
configuration
.
set
Initializ
ed
(
true
);
if
(
validationEnabled
)
{
validateStages
();
}
...
...
@@ -133,6 +133,10 @@ public final class Execution<T extends Configuration> {
* @since 2.0
*/
public
void
executeNonBlocking
()
{
if
(
configuration
.
isExecuted
())
{
throw
new
IllegalStateException
(
"Any configuration instance may only be executed once."
);
}
configuration
.
setExecuted
(
true
);
configurationContext
.
executeConfiguration
();
}
...
...
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