Package org.eclipse.jetty.io
Class WriteFlusher
- java.lang.Object
-
- org.eclipse.jetty.io.WriteFlusher
-
@Deprecated(since="2021-05-27") public abstract class WriteFlusher extends java.lang.Object
Deprecated.The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.A Utility class to help implementEndPoint.write(Callback, ByteBuffer...)
by callingEndPoint.flush(ByteBuffer...)
until all content is written. The abstract methodonIncompleteFlush()
is called when not all content has been written after a call to flush and should organize for thecompleteWrite()
method to be called when a subsequent call to flush should be able to make more progress.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
WriteFlusher.Listener
Deprecated.The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
completeWrite()
Deprecated.Complete a write that has not completed and that calledonIncompleteFlush()
to request a call to this method when a call toEndPoint.flush(ByteBuffer...)
is likely to be able to progress.Invocable.InvocationType
getCallbackInvocationType()
Deprecated.boolean
isPending()
Deprecated.void
onClose()
Deprecated.boolean
onFail(java.lang.Throwable cause)
Deprecated.Notify the flusher of a failurejava.lang.String
toStateString()
Deprecated.java.lang.String
toString()
Deprecated.void
write(Callback callback, java.nio.ByteBuffer... buffers)
Deprecated.Tries to switch state to WRITING.
-
-
-
Method Detail
-
getCallbackInvocationType
public Invocable.InvocationType getCallbackInvocationType()
Deprecated.
-
write
public void write(Callback callback, java.nio.ByteBuffer... buffers) throws java.nio.channels.WritePendingException
Deprecated.Tries to switch state to WRITING. If successful it writes the given buffers to the EndPoint. If state transition fails it will fail the callback and leave the WriteFlusher in a terminal FAILED state. If not all buffers can be written in one go it creates a newPendingState
object to preserve the state and then callsonIncompleteFlush()
. The remaining buffers will be written incompleteWrite()
. If all buffers have been written it calls callback.complete().- Parameters:
callback
- the callback to call on either failed or completebuffers
- the buffers to flush to the endpoint- Throws:
java.nio.channels.WritePendingException
- if unable to write due to prior pending write
-
completeWrite
public void completeWrite()
Deprecated.Complete a write that has not completed and that calledonIncompleteFlush()
to request a call to this method when a call toEndPoint.flush(ByteBuffer...)
is likely to be able to progress. It tries to switch from PENDING to COMPLETING. If state transition fails, then it does nothing as the callback should have been already failed. That's because the only way to switch from PENDING outside this method isonFail(Throwable)
oronClose()
-
onFail
public boolean onFail(java.lang.Throwable cause)
Deprecated.Notify the flusher of a failure- Parameters:
cause
- The cause of the failure- Returns:
- true if the flusher passed the failure to a
Callback
instance
-
onClose
public void onClose()
Deprecated.
-
isPending
public boolean isPending()
Deprecated.
-
toStateString
public java.lang.String toStateString()
Deprecated.
-
toString
public java.lang.String toString()
Deprecated.- Overrides:
toString
in classjava.lang.Object
-
-