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:
- java.lang.Iterable<Filter>, java.util.Collection<Filter>, java.util.List<Filter>, FilterChain, Processor
public final class DefaultFilterChain
- extends ListFacadeFilterChain
Default FilterChain implementation
- Author:
- Alexey Stashok
- See Also:
FilterChain,
Filter
|
Method Summary |
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,
java.lang.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)
|
protected static int |
indexOfRemainder(DefaultFilterChain.FiltersState filtersState,
FilterChainContext.Operation operation,
int start,
int end)
Locates a message remainder in the FilterChain, associated with the
Connection. |
protected static boolean |
prepareRemainder(FilterChainContext ctx,
DefaultFilterChain.FiltersState filtersState,
int start,
int end)
Locates a message remainder in the FilterChain, associated with the
Connection and prepares the Context for remainder processing. |
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,
java.lang.Object dstAddress,
java.lang.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 |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.List |
equals, hashCode |
FILTERS_STATE_ATTR
protected final Attribute<DefaultFilterChain.FiltersState> FILTERS_STATE_ATTR
DefaultFilterChain
public DefaultFilterChain()
DefaultFilterChain
public DefaultFilterChain(java.util.Collection<Filter> initialFilters)
process
public ProcessorResult process(Context context)
throws java.io.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:
java.io.IOException
execute
public ProcessorResult execute(FilterChainContext ctx)
- Execute this FilterChain.
- Parameters:
ctx - FilterChainContext processing context
- Returns:
ProcessorResult
- Throws:
java.lang.Exception
executeChainPart
protected final DefaultFilterChain.FilterExecution executeChainPart(FilterChainContext ctx,
FilterExecutor executor,
int start,
int end)
throws java.io.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:
java.io.IOException
executeFilter
protected NextAction executeFilter(FilterExecutor executor,
Filter currentFilter,
FilterChainContext ctx)
throws java.io.IOException
- Execute the
Filter, using specific FilterExecutor and
FilterChainContext.
- Parameters:
executor - currentFilter - ctx -
- Returns:
NextAction.
- Throws:
java.io.IOException
prepareRemainder
protected static boolean prepareRemainder(FilterChainContext ctx,
DefaultFilterChain.FiltersState filtersState,
int start,
int end)
- Locates a message remainder in the
FilterChain, associated with the
Connection and prepares the Context for remainder processing.
indexOfRemainder
protected static int indexOfRemainder(DefaultFilterChain.FiltersState filtersState,
FilterChainContext.Operation operation,
int start,
int end)
- Locates a message remainder in the
FilterChain, associated with the
Connection.
read
public GrizzlyFuture<ReadResult> read(Connection connection,
CompletionHandler completionHandler)
throws java.io.IOException
- Throws:
java.io.IOException
read
public ReadResult read(FilterChainContext context)
throws java.io.IOException
- Throws:
java.io.IOException
write
public GrizzlyFuture<WriteResult> write(Connection connection,
java.lang.Object dstAddress,
java.lang.Object message,
CompletionHandler completionHandler)
throws java.io.IOException
- Throws:
java.io.IOException
flush
public <M> GrizzlyFuture<WriteResult> flush(Connection connection,
CompletionHandler<WriteResult> completionHandler)
throws java.io.IOException
- Throws:
java.io.IOException
fireEventDownstream
public GrizzlyFuture<FilterChainContext> fireEventDownstream(Connection connection,
FilterChainEvent event,
CompletionHandler<FilterChainContext> completionHandler)
throws java.io.IOException
- Throws:
java.io.IOException
fireEventUpstream
public GrizzlyFuture<FilterChainContext> fireEventUpstream(Connection connection,
FilterChainEvent event,
CompletionHandler<FilterChainContext> completionHandler)
throws java.io.IOException
- Throws:
java.io.IOException
fail
public void fail(FilterChainContext context,
java.lang.Throwable failure)
subList
public DefaultFilterChain subList(int fromIndex,
int toIndex)
Copyright © 2011 Oracle Corpration. All Rights Reserved.