Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kieker-TeeTime-Stages
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
Kieker-TeeTime-Stages
Commits
0fba96d7
Commit
0fba96d7
authored
10 years ago
by
Nelson Tavares de Sousa
Browse files
Options
Downloads
Patches
Plain Diff
changed signal field to a ConcurrentQueue
parent
57977e74
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/teetime/framework/pipe/InterThreadPipe.java
+9
-4
9 additions, 4 deletions
src/main/java/teetime/framework/pipe/InterThreadPipe.java
with
9 additions
and
4 deletions
src/main/java/teetime/framework/pipe/InterThreadPipe.java
+
9
−
4
View file @
0fba96d7
package
teetime.framework.pipe
;
package
teetime.framework.pipe
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.Queue
;
import
org.jctools.queues.QueueFactory
;
import
org.jctools.queues.spec.ConcurrentQueueSpec
;
import
org.jctools.queues.spec.Ordering
;
import
org.jctools.queues.spec.Preference
;
import
teetime.framework.InputPort
;
import
teetime.framework.InputPort
;
import
teetime.framework.OutputPort
;
import
teetime.framework.OutputPort
;
...
@@ -8,7 +13,7 @@ import teetime.framework.signal.ISignal;
...
@@ -8,7 +13,7 @@ import teetime.framework.signal.ISignal;
public
abstract
class
InterThreadPipe
extends
AbstractPipe
{
public
abstract
class
InterThreadPipe
extends
AbstractPipe
{
private
final
AtomicReferenc
e
<
ISignal
>
signal
=
new
AtomicReference
<
ISignal
>()
;
private
final
Queu
e
<
ISignal
>
signal
Queue
=
QueueFactory
.
newQueue
(
new
ConcurrentQueueSpec
(
1
,
1
,
0
,
Ordering
.
FIFO
,
Preference
.
THROUGHPUT
));
;
<
T
>
InterThreadPipe
(
final
OutputPort
<?
extends
T
>
sourcePort
,
final
InputPort
<
T
>
targetPort
)
{
<
T
>
InterThreadPipe
(
final
OutputPort
<?
extends
T
>
sourcePort
,
final
InputPort
<
T
>
targetPort
)
{
super
(
sourcePort
,
targetPort
);
super
(
sourcePort
,
targetPort
);
...
@@ -16,11 +21,11 @@ public abstract class InterThreadPipe extends AbstractPipe {
...
@@ -16,11 +21,11 @@ public abstract class InterThreadPipe extends AbstractPipe {
@Override
@Override
public
void
setSignal
(
final
ISignal
signal
)
{
public
void
setSignal
(
final
ISignal
signal
)
{
this
.
signal
.
lazySet
(
signal
);
// lazySet is legal due to our single-writer requirement
this
.
signal
Queue
.
offer
(
signal
);
}
}
public
ISignal
getSignal
()
{
public
ISignal
getSignal
()
{
return
this
.
signal
.
get
();
return
this
.
signal
Queue
.
poll
();
}
}
@Override
@Override
...
...
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