public interface ISessionPipeline<T extends ISession>
Thread-safe considerations: Any class implementing this interface should be thread safe as it is expected that the internal state of the pipeline can be changed at any time.
Modifier and Type | Method and Description |
---|---|
void |
add(Object key,
T session)
Appends a session at the last position of this pipeline.
|
void |
addAfter(Object baseKey,
Object key,
T session)
Inserts a session after an existing session of this pipeline.
|
void |
addBefore(Object baseKey,
Object key,
T session)
Inserts a session before an existing session of this pipeline.
|
void |
addFirst(Object key,
T session)
Inserts a session at the first position of this pipeline.
|
void |
close()
Marks this pipeline for closing and gently closes the currently processed
session in the pipeline.
|
void |
dirtyClose()
Marks this pipeline for closing and dirty closes the currently processed
session in the pipeline.
|
T |
get(Object key)
Returns the session identified by the specified key in this pipeline.
|
List<Object> |
getKeys()
Returns a list of keys that identify all session in this pipeline.
|
T |
getOwner()
Returns the session being the owner of this pipeline.
|
void |
markClosed()
Marks this pipeline for closing.
|
void |
markClosed(Throwable cause)
Marks this pipeline for closing with specified cause.
|
void |
markDone()
Marks this pipeline as done.
|
void |
markUndone()
Marks this pipeline as undone.
|
void |
markUndone(Throwable cause)
Marks this pipeline as undone with the specified cause.
|
void |
quickClose()
Marks this pipeline for closing and quickly closes the currently processed
session in the pipeline.
|
T |
remove(Object key)
Removes the session identified by the specified key from this pipeline.
|
T |
replace(Object oldKey,
Object key,
T session)
Replaces the session identified by the specified old key with a new session
in this pipeline.
|
void addFirst(Object key, T session)
key
- the key under which the session should be inserted firstsession
- the session to insert firstIllegalArgumentException
- if the session or the key already exists in
this pipelineNullPointerException
- if any of the arguments is null
void addAfter(Object baseKey, Object key, T session)
baseKey
- the key identifying the existing sessionkey
- the key under which the session should be inserted aftersession
- the session to insert afterNoSuchElementException
- if the session identified by the specified
base key does not exist in this pipelineIllegalArgumentException
- if the session or the key already exists in
this pipelineNullPointerException
- if any of the arguments is null
void add(Object key, T session)
key
- the key under which the session should be appendedsession
- the session to appendIllegalArgumentException
- if the session or the key already exists in
this pipelineNullPointerException
- if any of the arguments is null
void addBefore(Object baseKey, Object key, T session)
baseKey
- the key identifying the existing sessionkey
- the key under which the session should be inserted beforesession
- the session to insert beforeNoSuchElementException
- if the session identified by the specified
base key does not exist in this pipelineIllegalArgumentException
- if the session or the key already exists in
this pipelineNullPointerException
- if any of the arguments is null
T replace(Object oldKey, Object key, T session)
oldKey
- the key of the session to be replacedkey
- the key under which the replacement should be addedsession
- the session which is used as replacementNoSuchElementException
- if the session identified by the specified
old key does not exist in this pipelineIllegalArgumentException
- if the session or the key already exists in
this pipelineNullPointerException
- if any of the arguments is null
T remove(Object key)
key
- the key under which the session was storednull
if there's no such session in
this pipelineNullPointerException
- if the specified key is null
T get(Object key)
key
- the key under which the session was storednull
if there's no such session in this pipeline.T getOwner()
List<Object> getKeys()
void markClosed()
Marking a pipeline for closing changes the way the session's close methods work. Calling the close methods in such case will close the connection instead of passing the processing to the next session in the pipeline.
void markClosed(Throwable cause)
Marking a pipeline for closing changes the way the session's close methods work. Calling the close methods in such case will close the connection instead of passing the processing to the next session in the pipeline.
cause
- the closing causevoid markUndone()
Marking a pipeline as undone changes the way the session's close methods work. Calling the close methods in such state will close the connection instead of passing the processing to the next session in the pipeline.
void markUndone(Throwable cause)
Marking a pipeline as undone changes the way the session's close methods work. Calling the close methods in such state will close the connection instead of passing the processing to the next session in the pipeline.
cause
- the cause of the undone statevoid markDone()
void close()
If the session owning this pipeline has not been registered with a selector
loop all session in the pipeline will be closed by calling the
close()
method.
void quickClose()
If the session owning this pipeline has not been registered with a selector
loop all session in the pipeline will be closed by calling the
quickClose()
method.
void dirtyClose()
If the session owning this pipeline has not been registered with a selector
loop all session in the pipeline will be closed by calling the
dirtyClose()
method.
Copyright © 2017–2022 SNF4J.ORG. All rights reserved.