org.glassfish.grizzly.filterchain
Class DefaultFilterChain
java.lang.Object
org.glassfish.grizzly.filterchain.AbstractFilterChain
org.glassfish.grizzly.filterchain.ListFacadeFilterChain
org.glassfish.grizzly.filterchain.DefaultFilterChain
- All Implemented Interfaces:
- Iterable<Filter>, Collection<Filter>, List<Filter>, FilterChain, Processor
public final class DefaultFilterChain
- extends ListFacadeFilterChain
Default FilterChain implementation
- Author:
- Alexey Stashok
- See Also:
FilterChain,
Filter
|
Method Summary |
protected boolean |
checkRemainder(FilterChainContext ctx,
FilterExecutor executor,
int start,
int end)
Sequentially lets each executed Filter to post process
IOEvent. |
ProcessorResult |
execute(FilterChainContext ctx)
Execute this FilterChain. |
protected DefaultFilterChain.FilterExecution |
executeChainPart(FilterChainContext ctx,
FilterExecutor executor,
int start,
int end)
Sequentially lets each Filter in chain to process IOEvent. |
protected NextAction |
executeFilter(FilterExecutor executor,
Filter currentFilter,
FilterChainContext ctx)
Execute the Filter, using specific FilterExecutor and
FilterChainContext. |
void |
fail(FilterChainContext context,
Throwable failure)
|
GrizzlyFuture<FilterChainContext> |
fireEventDownstream(Connection connection,
FilterChainEvent event,
CompletionHandler<FilterChainContext> completionHandler)
|
GrizzlyFuture<FilterChainContext> |
fireEventUpstream(Connection connection,
FilterChainEvent event,
CompletionHandler<FilterChainContext> completionHandler)
|
|
flush(Connection connection,
CompletionHandler<WriteResult> completionHandler)
|
ProcessorResult |
process(Context context)
Method will be called by framework to process some event, which
occurred on a connection |
GrizzlyFuture<ReadResult> |
read(Connection connection,
CompletionHandler completionHandler)
|
ReadResult |
read(FilterChainContext context)
|
DefaultFilterChain |
subList(int fromIndex,
int toIndex)
|
GrizzlyFuture<WriteResult> |
write(Connection connection,
Object dstAddress,
Object message,
CompletionHandler completionHandler)
|
| Methods inherited from class org.glassfish.grizzly.filterchain.ListFacadeFilterChain |
add, add, addAll, addAll, clear, contains, containsAll, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, notifyChangedExcept, remove, remove, removeAll, retainAll, set, size, toArray, toArray |
FILTERS_STATE_ATTR
protected final Attribute<DefaultFilterChain.FiltersState> FILTERS_STATE_ATTR
DefaultFilterChain
public DefaultFilterChain()
DefaultFilterChain
public DefaultFilterChain(Collection<Filter> initialFilters)
process
public ProcessorResult process(Context context)
throws IOException
- Description copied from interface:
Processor
- Method will be called by framework to process some event, which
occurred on a connection
- Parameters:
context - processing context
- Returns:
- the result of I/O event processing
- Throws:
IOException
read
public GrizzlyFuture<ReadResult> read(Connection connection,
CompletionHandler completionHandler)
throws IOException
- Throws:
IOException
read
public ReadResult read(FilterChainContext context)
throws IOException
- Throws:
IOException
write
public GrizzlyFuture<WriteResult> write(Connection connection,
Object dstAddress,
Object message,
CompletionHandler completionHandler)
throws IOException
- Throws:
IOException
flush
public <M> GrizzlyFuture<WriteResult> flush(Connection connection,
CompletionHandler<WriteResult> completionHandler)
throws IOException
- Throws:
IOException
fireEventDownstream
public GrizzlyFuture<FilterChainContext> fireEventDownstream(Connection connection,
FilterChainEvent event,
CompletionHandler<FilterChainContext> completionHandler)
throws IOException
- Throws:
IOException
fireEventUpstream
public GrizzlyFuture<FilterChainContext> fireEventUpstream(Connection connection,
FilterChainEvent event,
CompletionHandler<FilterChainContext> completionHandler)
throws IOException
- Throws:
IOException
fail
public void fail(FilterChainContext context,
Throwable failure)
execute
public ProcessorResult execute(FilterChainContext ctx)
- Execute this FilterChain.
- Parameters:
ctx - FilterChainContext processing context
- Returns:
ProcessorResult
- Throws:
Exception
executeChainPart
protected final DefaultFilterChain.FilterExecution executeChainPart(FilterChainContext ctx,
FilterExecutor executor,
int start,
int end)
throws IOException
- Sequentially lets each
Filter in chain to process IOEvent.
- Parameters:
ctx - FilterChainContext processing contextexecutor - FilterExecutor, which will call appropriate
filter operation to process IOEvent.
- Returns:
- TODO: Update
- Throws:
IOException
executeFilter
protected NextAction executeFilter(FilterExecutor executor,
Filter currentFilter,
FilterChainContext ctx)
throws IOException
- Execute the
Filter, using specific FilterExecutor and
FilterChainContext.
- Parameters:
executor - currentFilter - ctx -
- Returns:
NextAction.
- Throws:
IOException
checkRemainder
protected boolean checkRemainder(FilterChainContext ctx,
FilterExecutor executor,
int start,
int end)
- Sequentially lets each executed
Filter to post process
IOEvent. The Filters will be called in opposite order
they were called on processing phase.
- Parameters:
ctx - FilterChainContext processing contextexecutor - FilterExecutor, which will call appropriate
filter operation to post process IOEvent.
- Returns:
- false to terminate execution, or true for
normal execution process
subList
public DefaultFilterChain subList(int fromIndex,
int toIndex)
Copyright © 2011 Oracle Corpration. All Rights Reserved.