Enum Class RemoteInputStream.Flag
- All Implemented Interfaces:
Serializable
,Comparable<RemoteInputStream.Flag>
,Constable
- Enclosing class:
- RemoteInputStream
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionSet this flag to greedily drain the input stream wrapped inRemoteInputStream
and send data to the other side.If a Callable captures aRemoteInputStream
on its way to the other wide,RemoteInputStream
gets unexported automatically when the callable returns.A dummy flag to make it explicit that the particular use case prevents you from settingGREEDY
flag. -
Method Summary
Modifier and TypeMethodDescriptionstatic RemoteInputStream.Flag
Returns the enum constant of this class with the specified name.static RemoteInputStream.Flag[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
GREEDY
Set this flag to greedily drain the input stream wrapped inRemoteInputStream
and send data to the other side.RemoteInputStream
is normally unbuffered, in the sense that it will never attempt to read ahead and only read bytes that are explicitly requested viaInputStream.read(byte[], int, int)
methods (and other overloads.)This is sometimes important, for example if you are going to pass InputStream to the other side, read specific amount of bytes from the other side, then come back to this side and keep reading.
But inability to read ahead means every
RemoteInputStream.read(byte[], int, int)
call incurs a remote roundtrip. A local buffering viaBufferedInputStream
would help, but you'd still block on a roundtrip whenever a buffer goes empty.When this flag is set, it changes the underlying data transfer model of
RemoteInputStream
from pull to push. The side that createdRemoteInputStream
will launch a thread and start proactively sending data to the other side. The side that receivedRemoteInputStream
will buffer this content, and so nowRemoteInputStream.read(byte[], int, int)
will only block when there's no data. In this way, it hides the network latency completely when you send a large amount of data.When communicating with earlier version of the remoting library on the other side, the channel falls back and behaves as if this flag was not specified.
-
NOT_GREEDY
-
MANUAL_UNEXPORT
If a Callable captures aRemoteInputStream
on its way to the other wide,RemoteInputStream
gets unexported automatically when the callable returns. If this flag is set, this will not happen, and the input stream must be explicitly closed to get unexported.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-