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
7fff8d6d
Commit
7fff8d6d
authored
10 years ago
by
Nelson Tavares de Sousa
Browse files
Options
Downloads
Patches
Plain Diff
Added Javadoc to PipeFactoryRegistry and IPipeFactory
parent
d33d2d5c
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/pipe/IPipeFactory.java
+31
-2
31 additions, 2 deletions
src/main/java/teetime/framework/pipe/IPipeFactory.java
src/main/java/teetime/framework/pipe/PipeFactoryRegistry.java
+32
-12
32 additions, 12 deletions
...main/java/teetime/framework/pipe/PipeFactoryRegistry.java
with
63 additions
and
14 deletions
src/main/java/teetime/framework/pipe/IPipeFactory.java
+
31
−
2
View file @
7fff8d6d
...
...
@@ -7,24 +7,53 @@ import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication;
public
interface
IPipeFactory
{
/**
* @deprecated Use {@link #create(OutputPort, InputPort)} or {@link #create(OutputPort, InputPort, int)} instead
*
* @param capacity
* Number of elements the pipe can carry
* @return instance of the created pipe
*/
@Deprecated
IPipe
create
(
int
capacity
);
/**
*
with the
default capacity
*
Connects two stages with a pipe of
default capacity
.
*
* @param sourcePort
* OutputPort of the stage, which produces data.
* @param targetPort
* @return
* Input port of the receiving stage.
* @return The connecting pipe.
*/
<
T
>
IPipe
create
(
OutputPort
<?
extends
T
>
sourcePort
,
InputPort
<
T
>
targetPort
);
/**
* Connects two stages with a pipe.
*
* @param sourcePort
* OutputPort of the stage, which produces data.
* @param targetPort
* Input port of the receiving stage.
* @param capacity
* Number of elements the pipe can carry.
* @return The connecting pipe.
*/
<
T
>
IPipe
create
(
OutputPort
<?
extends
T
>
sourcePort
,
InputPort
<
T
>
targetPort
,
int
capacity
);
/**
* @return Type of ThreadCommunication, which is used by the created pipes.
*/
ThreadCommunication
getThreadCommunication
();
/**
* @return Ordering type, which is used by the created pipes.
*/
PipeOrdering
getOrdering
();
/**
* @return Wether or not the created pipes are growable
*/
boolean
isGrowable
();
}
This diff is collapsed.
Click to expand it.
src/main/java/teetime/framework/pipe/PipeFactoryRegistry.java
+
32
−
12
View file @
7fff8d6d
...
...
@@ -8,14 +8,27 @@ import java.util.Map;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* Provides PipeFactories, which are used to connect stages.
* The instance of this singleton class is saved in <code>PipeFactoryRegistry.INSTANCE</code>.
* <p>
* To get a PipeFactory instance, call {@link #getPipeFactory(ThreadCommunication, PipeOrdering, boolean)}.
*
*/
public
class
PipeFactoryRegistry
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
PipeFactoryRegistry
.
class
);
/**
* Communication type between two connected stages
*/
public
enum
ThreadCommunication
{
INTER
,
INTRA
}
/**
* Specifies the ordering behavior of the pipe
*/
public
enum
PipeOrdering
{
/**
* FIFO
...
...
@@ -43,6 +56,16 @@ public class PipeFactoryRegistry {
}
}
/**
* @deprecated Use {@link IPipeFactory#create(OutputPort, InputPort, int)} instead,
* after obtaining a PipeFactory with {@link #getPipeFactory(ThreadCommunication, PipeOrdering, boolean)}.
*
* @param tc
* @param ordering
* @param growable
* @param capacity
* @return
*/
@Deprecated
public
IPipe
create
(
final
ThreadCommunication
tc
,
final
PipeOrdering
ordering
,
final
boolean
growable
,
final
int
capacity
)
{
IPipeFactory
pipeFactory
=
getPipeFactory
(
tc
,
ordering
,
growable
);
...
...
@@ -50,16 +73,16 @@ public class PipeFactoryRegistry {
}
/**
* Returns a PipeFactory Instance
* Returns a PipeFactory Instance
.
*
* @param tc
* Communication type between two connected stages
* Communication type between two connected stages
. These are defined in PipeFactoryRegistry.ThreadCommunication
* @param ordering
* Specifies the ordering behavior of the pipe
* Specifies the ordering behavior of the pipe
. See PipeFactoryRegistry.PipeOrdering
* @param growable
* Whether the queue size is fixed or not
* Whether the queue size is fixed or not
.
* @return
* A PipeFactory, which provides suitable pipes
* A PipeFactory, which provides suitable pipes
.
*/
public
IPipeFactory
getPipeFactory
(
final
ThreadCommunication
tc
,
final
PipeOrdering
ordering
,
final
boolean
growable
)
{
String
key
=
this
.
buildKey
(
tc
,
ordering
,
growable
);
...
...
@@ -71,8 +94,12 @@ public class PipeFactoryRegistry {
}
/**
* Registers a new PipeFactory to the registry.<br />
* The new PipeFactory will be automatically selected by the Registry, if it is the most suitable Factory
* corresponding to the requirements.
*
* @param pipeFactory
* A PipeFactory which will be added to the registry
*/
public
void
register
(
final
IPipeFactory
pipeFactory
)
{
String
key
=
this
.
buildKey
(
pipeFactory
.
getThreadCommunication
(),
pipeFactory
.
getOrdering
(),
pipeFactory
.
isGrowable
());
...
...
@@ -80,13 +107,6 @@ public class PipeFactoryRegistry {
LOGGER
.
info
(
"Registered pipe factory: "
+
pipeFactory
.
getClass
().
getCanonicalName
());
}
/**
*
* @param tc
* @param ordering
* @param growable
* @return
*/
private
String
buildKey
(
final
ThreadCommunication
tc
,
final
PipeOrdering
ordering
,
final
boolean
growable
)
{
return
tc
.
toString
()
+
ordering
.
toString
()
+
growable
;
}
...
...
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