Top Description Inners Fields Constructors Methods
org.glassfish.grizzly.filterchain

public Class FilterChainContext

extends Object
implements AttributeStorage
Class Inheritance
All Implemented Interfaces
org.glassfish.grizzly.attributes.AttributeStorage
Annotations
@SuppressWarnings:deprecation
Imports
java.io.IOException, java.util.ArrayList, .List, java.util.logging.Level, .Logger, org.glassfish.grizzly.Appendable, .Appender, .Buffer, .Closeable, .CompletionHandler, .Connection, .Context, .Grizzly, .IOEvent, .ProcessorExecutor, .ReadResult, .ThreadCache, .WriteResult, org.glassfish.grizzly.asyncqueue.MessageCloner, org.glassfish.grizzly.attributes.AttributeHolder, .AttributeStorage, org.glassfish.grizzly.memory.Buffers, .MemoryManager, org.glassfish.grizzly.utils.Holder

FilterChain Context implementation.
Author
Alexey Stashok
See Also
Context, FilterChain

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
FilterChainContext.CompletionListener

The interface, which represents a listener, which will be notified, once FilterChainContext processing is complete.

public static interface
FilterChainContext.CopyListener

The interface, which represents a listener, which will be notified, after FilterChainContext#copy() is called.

public static enum
public static enum
public static class

Field Summary

Modifier and TypeField and Description
private Holder<?>
addressHolder

Holder, which contains address, associated with the current org.glassfish.grizzly.IOEvent processing.

private static final ThreadCache.CachedTypeIndex<FilterChainContext>
private final InvokeAction
private final StopAction
private Closeable
closeable

The Closeable object associated with the filter chain processing

private final List<FilterChainContext.CompletionListener>
private final Runnable
private final List<FilterChainContext.CopyListener>
private int
protected FilterChainEvent
event

Context associated event, if EVENT operation

private int
filterIdx

Index of the currently executing Filter in the FilterChainContext list.

pack-priv final InternalContextImpl
private static final NextAction
INVOKE_ACTION

Cached NextAction instance for "Invoke action" implementation

private static final Logger
private Object
message

Context associated message

public static final int
private FilterChainContext.Operation
protected CompletionHandler<FilterChainContext>
operationCompletionHandler

CompletionHandler, which will be notified, when operation will be complete.

pack-priv NextAction
private static final NextAction
RERUN_FILTER_ACTION

Cached NextAction instance for "Rerun filter action" implementation

private int
private volatile FilterChainContext.State
state

Context task state

private static final NextAction
STOP_ACTION

Cached NextAction instance for "Stop action" implementation

private static final NextAction
SUSPEND_ACTION

Cached NextAction instance for "Suspend action" implementation

pack-priv final FilterChainContext.TransportContext

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final void
addCompletionListener(final FilterChainContext.CompletionListener
the CompletionListener, which will be notified, when this FilterChainContext processing will be completed.
listener
)

Add the CompletionListener, which will be notified, when this FilterChainContext processing will be completed.

public final void
addCopyListener(final FilterChainContext.CopyListener
the CopyListener, which will be notified, right after this FilterChainContext#copy() is called.
listener
)

Add the CopyListener, which will be notified, right after this FilterChainContext#copy() is called.

public void
public void
public FilterChainContext
copy()

public static FilterChainContext
create(final Connection<L> connection)

public static FilterChainContext
create(final Connection<L> connection, final Closeable closeable)

public void
fail(final Throwable error)

public void
flush(final CompletionHandler<E> completionHandler)

public void
fork()

This method invocation suggests the FilterChain to create a copy of this FilterChainContext and resume/fork its execution starting from the current Filter.

public void
fork(final NextAction nextAction)

This method invocation suggests the FilterChain to create a copy of this FilterChainContext and resume/fork its execution starting from the current Filter.

public Object

Returns:

address, associated with the current org.glassfish.grizzly.IOEvent processing.
getAddress
()

Get address, associated with the current org.glassfish.grizzly.IOEvent processing.

public Holder<?>

Returns:

Holder, which contains address, associated with the current org.glassfish.grizzly.IOEvent processing.
getAddressHolder
()

Get a Holder, which contains address, associated with the current org.glassfish.grizzly.IOEvent processing.

public AttributeHolder
public Closeable

Returns:

Closeable object, associated with the current processing.
getCloseable
()

Get the Closeable, associated with the current processing.

public Connection<L>

Returns:

Connection object, associated with the current processing.
getConnection
()

Get the Connection, associated with the current processing.

public int
public FilterChain

Returns:

FilterChain, which runs the Filter.
getFilterChain
()

Get FilterChain, which runs the Filter.

public int
public NextAction
getForkAction()

Returns: NextAction implementation, which suggests the FilterChain to forget about the current FilterChainContext, create a copy of it and continue/fork FilterChain processing using the copied FilterChainContext starting from the current Filter.

public NextAction
getForkAction(final NextAction nextAction)

Returns: NextAction implementation, which suggests the FilterChain to forget about the current FilterChainContext, create a copy of it and continue/fork FilterChain processing using the copied FilterChainContext starting from the current Filter.

public final Context

Returns:

the general Grizzly Context this filter context wraps.
getInternalContext
()

Get the general Grizzly Context this filter context wraps.

public NextAction

Returns:

NextAction implementation, which instructs FilterChain to process next Filter in chain.
getInvokeAction
()

Get NextAction implementation, which instructs FilterChain to process next Filter in chain.

public NextAction

Returns:

NextAction implementation, which instructs FilterChain to process next Filter in chain.
getInvokeAction
(final Object
signals, that there is some unparsed data remaining in the source message, so FilterChain could be rerun.
unparsedChunk
)

Get NextAction implementation, which instructs FilterChain to process next Filter in chain.

public <E> NextAction

Returns:

NextAction implementation, which instructs FilterChain to process next Filter in chain.
getInvokeAction
(final E
signals, that there is a data chunk remaining, which doesn't represent complete message. As more data becomes available but before FilterChain calls the current Filter, it will check if the Filter has any data stored after the last invocation. If a remainder is present it will append the new data to the stored one and pass the result as the FilterChainContext message.
incompleteChunk
,
Appender<E>
the org.glassfish.grizzly.Appender, which knows how to append chunks of type <E>.
appender
)

Get NextAction implementation, which instructs FilterChain to process next Filter in chain.

public final MemoryManager<E extends Buffer>

Returns:

the MemoryManager associated with the Connection of this FilterChainContext.
getMemoryManager
()

A simple alias for FilterChainContext.getConnection().getMemoryManager().

public <T> T

Returns:

message object, associated with the current processing.
getMessage
()

Get message object, associated with the current processing.

pack-priv FilterChainContext.Operation
public NextAction

Returns:

NextAction, which instructs FilterChain to rerun the filter.
getRerunFilterAction
()

Get NextAction, which instructs FilterChain to rerun the filter.

protected final Runnable
public int
public NextAction

Returns:

NextAction implementation, which instructs FilterChain to stop executing phase.
getStopAction
()

Get NextAction implementation, which instructs FilterChain to stop executing phase.

public NextAction

Returns:

NextAction implementation, which instructs FilterChain to stop executing phase.
getStopAction
(final Object
signals, that there is a data chunk remaining, which doesn't represent complete message. As more data becomes available but before FilterChain calls the current Filter, it will check if the Filter has any data stored after the last invocation. If a remainder is present it will append the new data to the stored one and pass the result as the FilterChainContext message.
incompleteChunk
)

Get NextAction implementation, which instructs FilterChain stop executing phase.

public <E> NextAction

Returns:

NextAction implementation, which instructs FilterChain to stop executing phase.
getStopAction
(final E
signals, that there is a data chunk remaining, which doesn't represent complete message. As more data becomes available but before FilterChain calls the current Filter, it will check if the Filter has any data stored after the last invocation. If a remainder is present it will append the new data to the stored one and pass the result as the FilterChainContext message.
incompleteChunk
,
final Appender<E>
the org.glassfish.grizzly.Appender, which knows how to append chunks of type <E>.
appender
)

Get NextAction implementation, which instructs FilterChain stop executing phase.

public NextAction

Returns:

NextAction, which instructs FilterChain to suspend filter chain execution.
getSuspendAction
()

Get NextAction, which instructs FilterChain to suspend filter chain execution.

public NextAction
getSuspendingStopAction()
Deprecated use getForkAction()

Returns: NextAction implementation, which instructs the FilterChain to suspend the current FilterChainContext and invoke similar logic as instructed by StopAction with a clean FilterChainContext.

public FilterChainContext.TransportContext

Returns:

TransportFilter.
getTransportContext
()

Get the TransportFilter related context.

pack-priv static FilterChainContext.Operation
ioEvent2Operation(final IOEvent ioEvent)

public boolean
public int
pack-priv static void
notifyComplete(final FilterChainContext context, final List<FilterChainContext.CompletionListener> completionListeners)

pack-priv static void
notifyCopy(final FilterChainContext srcContext, final FilterChainContext copiedContext, final List<FilterChainContext.CopyListener> copyListeners)

public void
public void
public void
public void
public int
public ReadResult<K, L>

Returns:

the result of the read operation.
read
()

Performs a blocking read.

public final boolean

Returns:

true, if the listener was removed from the list, or false, if the listener wasn't on the list.
removeCompletionListener
(final FilterChainContext.CompletionListener
the CompletionListener to be removed.
listener
)

Remove the CompletionListener.

public final boolean

Returns:

true, if the listener was removed from the list, or false, if the listener wasn't on the list.
removeCopyListener
(final FilterChainContext.CopyListener
the CopyListener to be removed.
listener
)

Remove the CopyListener.

public void
reset()

Release the context associated resources.

public void
resume()

Resume processing of the current task

public void
resume(final NextAction
the NextAction, based on which FilterChain will continue processing.
nextAction
)

Resume the current FilterChain task processing by completing the current Filter (the Filter, which suspended the processing) with the passed NextAction.

public void
resumeNext()

Resume processing of the current task starting from the Filter, which follows the Filter, which suspend the processing.

public void
setAddress(final Object
address, associated with the current org.glassfish.grizzly.IOEvent processing.
address
)

Set address, associated with the current org.glassfish.grizzly.IOEvent processing.

public void
setAddressHolder(final Holder<?>
Holder, which contains address, associated with the current org.glassfish.grizzly.IOEvent processing.
addressHolder
)

Set address, associated with the current org.glassfish.grizzly.IOEvent processing.

pack-priv void
setCloseable(final Closeable
Closeable object, associated with the current processing. If null the getConnection() value will be assigned
closeable
)

Set the Closeable, associated with the current processing.

pack-priv void
setConnection(final Connection<L>
Connection object, associated with the current processing.
connection
)

Set the Connection, associated with the current processing.

public void
setEndIdx(int endIdx)

public void
setFilterIdx(int index)

public void
setMessage(Object
message object, associated with the current processing.
message
)

Set message object, associated with the current processing.

pack-priv void
public void
setStartIdx(int startIdx)

public FilterChainContext.State

Returns:

the current processing task state.
state
()

Get the current processing task state.

public Runnable
suspend()

Suspend processing of the current task

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public void
write(final Object message)

public void
write(final Object message, final boolean blocking)

public void
write(final Object message, final CompletionHandler<WriteResult<K, L>> completionHandler)

public void
write(final Object message, final CompletionHandler<WriteResult<K, L>> completionHandler, final boolean blocking)

public void
write(final Object address, final Object message, final CompletionHandler<WriteResult<K, L>> completionHandler)

public void
write(final Object address, final Object message, final CompletionHandler<WriteResult<K, L>> completionHandler, final boolean blocking)

public void
write(final Object address, final Object message, final CompletionHandler<WriteResult<K, L>> completionHandler, final PushBackHandler pushBackHandler)
Deprecated

public void
write(final Object address, final Object message, final CompletionHandler<WriteResult<K, L>> completionHandler, final PushBackHandler pushBackHandler, final boolean blocking)
Deprecated

public void
write(final Object address, final Object message, final CompletionHandler<WriteResult<K, L>> completionHandler, final MessageCloner<E> cloner)

public void
write(final Object address, final Object message, final CompletionHandler<WriteResult<K, L>> completionHandler, final PushBackHandler pushBackHandler, final MessageCloner<E> cloner)
Deprecated

public void
write(final Object address, final Object message, final CompletionHandler<WriteResult<K, L>> completionHandler, final MessageCloner<E> cloner, final boolean blocking)

public void
write(final Object address, final Object message, final CompletionHandler<WriteResult<K, L>> completionHandler, final PushBackHandler pushBackHandler, final MessageCloner<E> cloner, final boolean blocking)
Deprecated

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait