Top Description Inners Fields Constructors Methods
org.glassfish.tyrus.container.jdk.client

pack-priv Class TaskQueueFilter

extends Filter
Class Inheritance
Imports
java.nio.ByteBuffer, java.util.Queue, java.util.concurrent.ConcurrentLinkedQueue, java.util.concurrent.atomic.AtomicBoolean, org.glassfish.tyrus.spi.CompletionHandler

Queues write(java.nio.ByteBuffer, org.glassfish.tyrus.spi.CompletionHandler), close() and startSsl() method calls and passes them to a downstream filter one at a time. Both org.glassfish.tyrus.container.jdk.client.SslFilter and org.glassfish.tyrus.container.jdk.client.TransportFilter allow write(java.nio.ByteBuffer, org.glassfish.tyrus.spi.CompletionHandler) method call only after the previous one has completed. Queueing close() method calls ensures that write(java.nio.ByteBuffer, org.glassfish.tyrus.spi.CompletionHandler) methods called before close() will be processed. Including startSsl() methods in the queue ensures that no write(java.nio.ByteBuffer, org.glassfish.tyrus.spi.CompletionHandler) method will be passed to org.glassfish.tyrus.container.jdk.client.SslFilter while it performs SSL handshake.
Author
Petr Janouch

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static interface
TaskQueueFilter.Task

A task to be queued in order to be processed one at a time.

pack-priv static class
TaskQueueFilter.WriteTask

A task that writes data to the downstreamFilter.

Field Summary

Modifier and TypeField and Description
private final AtomicBoolean
private final Queue<TaskQueueFilter.Task>
Inherited from org.glassfish.tyrus.container.jdk.client.Filter:
downstreamFilterupstreamFilter

Constructor Summary

AccessConstructor and Description
pack-priv
TaskQueueFilter(Filter
a filter that is positioned directly under this filter.
downstreamFilter
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
close()

Overrides org.glassfish.tyrus.container.jdk.client.Filter.close.

Close the filter, invokes close operation on the next filter in the filter chain.

pack-priv void
private void
pack-priv void
startSsl()

Overrides org.glassfish.tyrus.container.jdk.client.Filter.startSsl.

Signal to turn on SSL, it is passed on in the filter chain until a filter responsible for SSL is reached.

pack-priv void
write(ByteBuffer
on which write operation is performed.
data
,
CompletionHandler<ByteBuffer>
will be invoked when the write operation is completed or has failed.
completionHandler
)

Overrides org.glassfish.tyrus.container.jdk.client.Filter.write.

Perform write operation for this filter and invokes write method on the next filter in the filter chain.

Inherited from org.glassfish.tyrus.container.jdk.client.Filter:
connecthandleConnectonConnectonConnectionClosedonErroronReadonSslHandshakeCompletedprocessConnectprocessConnectionClosedprocessErrorprocessRead

Field Detail

taskLockback to summary
private final AtomicBoolean taskLock
taskQueueback to summary
private final Queue<TaskQueueFilter.Task> taskQueue

Constructor Detail

TaskQueueFilterback to summary
pack-priv TaskQueueFilter(Filter downstreamFilter)

Constructor.

Parameters
downstreamFilter:Filter

a filter that is positioned directly under this filter.

Method Detail

closeback to summary
pack-priv void close()

Overrides org.glassfish.tyrus.container.jdk.client.Filter.close.

Doc from org.glassfish.tyrus.container.jdk.client.Filter.close.

Close the filter, invokes close operation on the next filter in the filter chain.

The filter is expected to clean up any allocated resources and pass the invocation to downstream filter.

Annotations
@Override
processSslHandshakeCompletedback to summary
pack-priv void processSslHandshakeCompleted()

Overrides org.glassfish.tyrus.container.jdk.client.Filter.processSslHandshakeCompleted.

Doc from org.glassfish.tyrus.container.jdk.client.Filter.processSslHandshakeCompleted.

Process onSslHandshakeCompleted().

Annotations
@Override
processTaskback to summary
private void processTask()
startSslback to summary
pack-priv void startSsl()

Overrides org.glassfish.tyrus.container.jdk.client.Filter.startSsl.

Doc from org.glassfish.tyrus.container.jdk.client.Filter.startSsl.

Signal to turn on SSL, it is passed on in the filter chain until a filter responsible for SSL is reached.

Annotations
@Override
writeback to summary
pack-priv void write(ByteBuffer data, CompletionHandler<ByteBuffer> completionHandler)

Overrides org.glassfish.tyrus.container.jdk.client.Filter.write.

Doc from org.glassfish.tyrus.container.jdk.client.Filter.write.

Perform write operation for this filter and invokes write method on the next filter in the filter chain.

Parameters
data:ByteBuffer

on which write operation is performed.

completionHandler:CompletionHandler<ByteBuffer>

will be invoked when the write operation is completed or has failed.

Annotations
@Override
org.glassfish.tyrus.container.jdk.client back to summary

pack-priv Interface TaskQueueFilter.Task

Known Direct Implementers
org.glassfish.tyrus.container.jdk.client.TaskQueueFilter.WriteTask

A task to be queued in order to be processed one at a time.

Method Summary

Modifier and TypeMethod and Description
public void
execute(TaskQueueFilter
write queue filter this task should be executed in.
queueFilter
)

Execute the task.

Method Detail

executeback to summary
public void execute(TaskQueueFilter queueFilter)

Execute the task.

Parameters
queueFilter:TaskQueueFilter

write queue filter this task should be executed in.

org.glassfish.tyrus.container.jdk.client back to summary

pack-priv Class TaskQueueFilter.WriteTask

extends Object
implements Task
Class Inheritance
  • java.lang.Object
  • org.glassfish.tyrus.container.jdk.client.TaskQueueFilter.WriteTask
All Implemented Interfaces
org.glassfish.tyrus.container.jdk.client.TaskQueueFilter.Task

A task that writes data to the downstreamFilter.

Field Summary

Modifier and TypeField and Description
private final CompletionHandler<ByteBuffer>
private final ByteBuffer

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
execute(final TaskQueueFilter
write queue filter this task should be executed in.
queueFilter
)

Implements org.glassfish.tyrus.container.jdk.client.TaskQueueFilter.Task.execute.

Execute the task.

pack-priv CompletionHandler<ByteBuffer>
pack-priv ByteBuffer
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

completionHandlerback to summary
private final CompletionHandler<ByteBuffer> completionHandler
databack to summary
private final ByteBuffer data

Constructor Detail

WriteTaskback to summary
pack-priv WriteTask(ByteBuffer data, CompletionHandler<ByteBuffer> completionHandler)

Method Detail

executeback to summary
public void execute(final TaskQueueFilter queueFilter)

Implements org.glassfish.tyrus.container.jdk.client.TaskQueueFilter.Task.execute.

Doc from org.glassfish.tyrus.container.jdk.client.TaskQueueFilter.Task.execute.

Execute the task.

Parameters
queueFilter:TaskQueueFilter

write queue filter this task should be executed in.

Annotations
@Override
getCompletionHandlerback to summary
pack-priv CompletionHandler<ByteBuffer> getCompletionHandler()
getDataback to summary
pack-priv ByteBuffer getData()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override