Top Description Inners Fields Constructors Methods
org.glassfish.grizzly

public Class Context

extends Object
implements AttributeStorage, Cacheable
Class Inheritance
All Implemented Interfaces
org.glassfish.grizzly.Cacheable, org.glassfish.grizzly.attributes.AttributeStorage
Known Direct Subclasses
org.glassfish.grizzly.filterchain.InternalContextImpl
Annotations
@SuppressWarnings:deprecation
Imports
java.io.IOException, java.lang.reflect.Array, java.util.Arrays, java.util.logging.Logger, org.glassfish.grizzly.asyncqueue.MessageCloner, org.glassfish.grizzly.attributes.AttributeHolder, .AttributeStorage

Object, which is responsible for holding context during I/O event processing.
Author
Alexey Stashok

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
private static class

Field Summary

Modifier and TypeField and Description
private final AttributeHolder
attributes

Attributes, associated with the processing Context

private static final ThreadCache.CachedTypeIndex<Context>
private Connection<L>
connection

Processing Connection

protected IOEvent
ioEvent

Processing IOEvent

protected boolean
protected final Context.MinimalisticArrayList<IOEventLifeCycleListener>
lifeCycleListeners

IOEventProcessingHandler is called to notify about IOEvent processing life-cycle events like suspend, resume, complete.

private static final Logger
private static final Processor<E extends Context>
private Processor<E extends Context>
processor

Processor, responsible for I/O event processing

protected boolean
wasSuspended

true if this IOEvent processing was suspended during its processing, or false otherwise.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public void
complete(final ProcessorResult result)

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

public static Context
create(final Connection<L> connection, final Processor<E extends Context> processor, final IOEvent ioEvent, final IOEventLifeCycleListener lifeCycleListener)

public AttributeHolder

Returns:

attributes (AttributeHolder), associated with the processing Context.
getAttributes
()

Implements org.glassfish.grizzly.attributes.AttributeStorage.getAttributes.

Get attributes (AttributeHolder), associated with the processing Context.

public Connection<L>

Returns:

the processing Connection.
getConnection
()

Get the processing Connection.

public IOEvent

Returns:

the processing IOEvent.
getIoEvent
()

Get the processing IOEvent.

public Processor<E extends Context>

Returns:

the Processor, which is responsible to process the IOEvent.
getProcessor
()

Get the Processor, which is responsible to process the IOEvent.

public boolean
public boolean
isManualIOEventControl()

Returns: true, if processing was switched to the manual IOEvent control, or false otherwise.

public void
protected void
release()

Alternative to recycle() that allows cleanup actions to be performed without returning this instance to the cache.

public void
public boolean
public void
reset()

If implementation uses org.glassfish.grizzly.utils.ObjectPool to store and reuse Context instances - this method will be called before Context will be offered to pool.

public void
resume()

Notify Context its processing will be resumed in the current thread.

public void
setConnection(final Connection<L>
the processing Connection.
connection
)

Set the processing Connection.

public void
setIoEvent(final IOEvent
the processing IOEvent.
ioEvent
)

Set the processing IOEvent.

public void
setManualIOEventControl()

Switches processing to the manual IOEvent control.

public void
setProcessor(final Processor<E extends Context>
the Processor, which is responsible to process the IOEvent.
processor
)

Set the Processor, which is responsible to process the IOEvent.

public void
suspend()

Notify Context its processing will be suspended in the current thread.

public boolean
wasSuspended()

Returns: true if this IOEvent processing was suspended during its processing, or false otherwise.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attributesback to summary
private final AttributeHolder attributes

Attributes, associated with the processing Context

CACHE_IDXback to summary
private static final ThreadCache.CachedTypeIndex<Context> CACHE_IDX
connectionback to summary
private Connection<L> connection

Processing Connection

ioEventback to summary
protected IOEvent ioEvent

Processing IOEvent

isManualIOEventControlback to summary
protected boolean isManualIOEventControl
lifeCycleListenersback to summary
protected final Context.MinimalisticArrayList<IOEventLifeCycleListener> lifeCycleListeners

IOEventProcessingHandler is called to notify about IOEvent processing life-cycle events like suspend, resume, complete.

LOGGERback to summary
private static final Logger LOGGER
NULL_PROCESSORback to summary
private static final Processor<E extends Context> NULL_PROCESSOR
processorback to summary
private Processor<E extends Context> processor

Processor, responsible for I/O event processing

wasSuspendedback to summary
protected boolean wasSuspended

true if this IOEvent processing was suspended during its processing, or false otherwise.

Constructor Detail

Contextback to summary
public Context()

Method Detail

addLifeCycleListenerback to summary
public void addLifeCycleListener(final IOEventLifeCycleListener listener)
completeback to summary
public void complete(final ProcessorResult result)
createback to summary
public static Context create(final Connection<L> connection)
createback to summary
public static Context create(final Connection<L> connection, final Processor<E extends Context> processor, final IOEvent ioEvent, final IOEventLifeCycleListener lifeCycleListener)
getAttributesback to summary
public AttributeHolder getAttributes()

Implements org.glassfish.grizzly.attributes.AttributeStorage.getAttributes.

Get attributes (AttributeHolder), associated with the processing Context. AttributeHolder is cleared after each I/O event processing. Method may return null, if there were no attributes added before.

Returns:AttributeHolder

attributes (AttributeHolder), associated with the processing Context.

Annotations
@Override
getConnectionback to summary
public Connection<L> getConnection()

Get the processing Connection.

Returns:Connection<L>

the processing Connection.

getIoEventback to summary
public IOEvent getIoEvent()

Get the processing IOEvent.

Returns:IOEvent

the processing IOEvent.

getProcessorback to summary
public Processor<E extends Context> getProcessor()

Get the Processor, which is responsible to process the IOEvent.

Returns:Processor<E extends Context>

the Processor, which is responsible to process the IOEvent.

hasLifeCycleListenerback to summary
public boolean hasLifeCycleListener(final IOEventLifeCycleListener listener)
isManualIOEventControlback to summary
public boolean isManualIOEventControl()
Returns:boolean

true, if processing was switched to the manual IOEvent control, or false otherwise.

recycleback to summary
public void recycle()

Implements org.glassfish.grizzly.Cacheable.recycle.

Recycle this Context

Annotations
@Override
releaseback to summary
protected void release()

Alternative to recycle() that allows cleanup actions to be performed without returning this instance to the cache. By default, this is a no-op.

Since
2.3.29
removeAllLifeCycleListenersback to summary
public void removeAllLifeCycleListeners()
removeLifeCycleListenerback to summary
public boolean removeLifeCycleListener(final IOEventLifeCycleListener listener)
resetback to summary
public void reset()

If implementation uses org.glassfish.grizzly.utils.ObjectPool to store and reuse Context instances - this method will be called before Context will be offered to pool.

resumeback to summary
public void resume()

Notify Context its processing will be resumed in the current thread.

setConnectionback to summary
public void setConnection(final Connection<L> connection)

Set the processing Connection.

Parameters
connection:Connection<L>

the processing Connection.

setIoEventback to summary
public void setIoEvent(final IOEvent ioEvent)

Set the processing IOEvent.

Parameters
ioEvent:IOEvent

the processing IOEvent.

setManualIOEventControlback to summary
public void setManualIOEventControl()

Switches processing to the manual IOEvent control. Connection#enableIOEvent(org.glassfish.grizzly.IOEvent) or Connection#disableIOEvent(org.glassfish.grizzly.IOEvent) might be explicitly called.

setProcessorback to summary
public void setProcessor(final Processor<E extends Context> processor)

Set the Processor, which is responsible to process the IOEvent.

Parameters
processor:Processor<E extends Context>

the Processor, which is responsible to process the IOEvent.

suspendback to summary
public void suspend()

Notify Context its processing will be suspended in the current thread.

wasSuspendedback to summary
public boolean wasSuspended()
Returns:boolean

true if this IOEvent processing was suspended during its processing, or false otherwise.

org.glassfish.grizzly back to summary

protected final Class Context.MinimalisticArrayList<E>

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private E[]
private int

Constructor Summary

AccessConstructor and Description
private
MinimalisticArrayList(final Class<E> clazz, final int initialCapacity)

Method Summary

Modifier and TypeMethod and Description
public void
add(final E listener)

public E[]
public void
public boolean
contains(final E listener)

public void
private void
private int
indexOf(final E listener)

private boolean
remove(final E listener)

public int
size()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

arrayback to summary
private E[] array
sizeback to summary
private int size

Constructor Detail

MinimalisticArrayListback to summary
private MinimalisticArrayList(final Class<E> clazz, final int initialCapacity)
Annotations
@SuppressWarnings:unchecked

Method Detail

addback to summary
public void add(final E listener)
arrayback to summary
public E[] array()
clearback to summary
public void clear()
containsback to summary
public boolean contains(final E listener)
copyFromback to summary
public void copyFrom(final Context.MinimalisticArrayList<E> list)
ensureCapacityback to summary
private void ensureCapacity()
indexOfback to summary
private int indexOf(final E listener)
removeback to summary
private boolean remove(final E listener)
sizeback to summary
public int size()
org.glassfish.grizzly back to summary

private final Class Context.NullProcessor

extends Object
implements Processor
Class Inheritance
All Implemented Interfaces
org.glassfish.grizzly.Processor

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
isInterested(IOEvent ioEvent)

Implements org.glassfish.grizzly.Processor.isInterested.

Is this Processor interested in processing the i/o event

public Context
public ProcessorResult
process(Context context)

Implements org.glassfish.grizzly.Processor.process.

Method will be called by framework to process some event, which occurred on a connection

public void
read(Connection<L> connection, CompletionHandler<E> completionHandler)

Implements org.glassfish.grizzly.Processor.read.

public void
setInterested(IOEvent ioEvent, boolean isInterested)

Implements org.glassfish.grizzly.Processor.setInterested.

Set the the i/o event, this Processor is interested in

public void
write(Connection<L> connection, Object dstAddress, Object message, CompletionHandler<E> completionHandler)

Implements org.glassfish.grizzly.Processor.write.

public void
write(Connection<L> connection, Object dstAddress, Object message, CompletionHandler<E> completionHandler, MessageCloner<E> messageCloner)

Implements org.glassfish.grizzly.Processor.write.

public void
write(Connection<L> connection, Object dstAddress, Object message, CompletionHandler<E> completionHandler, PushBackHandler pushBackHandler)

Implements org.glassfish.grizzly.Processor.write.

Deprecated

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

NullProcessorback to summary
private NullProcessor()

Method Detail

isInterestedback to summary
public boolean isInterested(IOEvent ioEvent)

Implements org.glassfish.grizzly.Processor.isInterested.

Doc from org.glassfish.grizzly.Processor.isInterested.

Is this Processor interested in processing the i/o event

Annotations
@Override
obtainContextback to summary
public Context obtainContext(Connection<L> connection)

Implements org.glassfish.grizzly.Processor.obtainContext.

Doc from org.glassfish.grizzly.Processor.obtainContext.

Creates Context

Annotations
@Override
processback to summary
public ProcessorResult process(Context context)

Implements org.glassfish.grizzly.Processor.process.

Doc from org.glassfish.grizzly.Processor.process.

Method will be called by framework to process some event, which occurred on a connection

Annotations
@Override
readback to summary
public void read(Connection<L> connection, CompletionHandler<E> completionHandler)

Implements org.glassfish.grizzly.Processor.read.

Annotations
@Override
setInterestedback to summary
public void setInterested(IOEvent ioEvent, boolean isInterested)

Implements org.glassfish.grizzly.Processor.setInterested.

Doc from org.glassfish.grizzly.Processor.setInterested.

Set the the i/o event, this Processor is interested in

Annotations
@Override
writeback to summary
public void write(Connection<L> connection, Object dstAddress, Object message, CompletionHandler<E> completionHandler)

Implements org.glassfish.grizzly.Processor.write.

Annotations
@Override
writeback to summary
public void write(Connection<L> connection, Object dstAddress, Object message, CompletionHandler<E> completionHandler, MessageCloner<E> messageCloner)

Implements org.glassfish.grizzly.Processor.write.

Annotations
@Override
writeback to summary
public void write(Connection<L> connection, Object dstAddress, Object message, CompletionHandler<E> completionHandler, PushBackHandler pushBackHandler)

Implements org.glassfish.grizzly.Processor.write.

Deprecated

Annotations
@Override
@Deprecated