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
9c63f086
Commit
9c63f086
authored
10 years ago
by
Christian Wulf
Browse files
Options
Downloads
Patches
Plain Diff
added SpScIntraThreadPipe
parent
e5724db5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/teetime/framework/pipe/SpScIntraThreadPipe.java
+48
-0
48 additions, 0 deletions
...main/java/teetime/framework/pipe/SpScIntraThreadPipe.java
src/site/markdown/wiki
+1
-1
1 addition, 1 deletion
src/site/markdown/wiki
with
49 additions
and
1 deletion
src/main/java/teetime/framework/pipe/SpScIntraThreadPipe.java
0 → 100644
+
48
−
0
View file @
9c63f086
package
teetime.framework.pipe
;
import
java.util.Queue
;
import
org.jctools.queues.QueueFactory
;
import
org.jctools.queues.spec.ConcurrentQueueSpec
;
import
teetime.framework.AbstractIntraThreadPipe
;
import
teetime.framework.InputPort
;
import
teetime.framework.OutputPort
;
/**
* Represents a less efficient implementation of an intra-thread pipe.
*
* @author Christian Wulf
*
* @param <T>
*/
public
final
class
SpScIntraThreadPipe
<
T
>
extends
AbstractIntraThreadPipe
{
private
final
Queue
<
Object
>
queue
;
public
SpScIntraThreadPipe
(
final
OutputPort
<?
extends
T
>
sourcePort
,
final
InputPort
<
T
>
targetPort
)
{
super
(
sourcePort
,
targetPort
);
queue
=
QueueFactory
.
newQueue
(
ConcurrentQueueSpec
.
createBoundedSpsc
(
1
));
}
@Override
public
boolean
add
(
final
Object
element
)
{
return
queue
.
offer
(
element
);
}
@Override
public
boolean
isEmpty
()
{
return
queue
.
isEmpty
();
}
@Override
public
int
size
()
{
return
queue
.
size
();
}
@Override
public
Object
removeLast
()
{
return
queue
.
poll
();
}
}
This diff is collapsed.
Click to expand it.
wiki
@
0e447457
Subproject commit
63ccbbc87bd2c0e6599ca91502149dba3cfb99de
Subproject commit
0e4474577e1f49bc96e734c286b2d9e0363895e8
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