Enum RemoteInputStream.Flag
- java.lang.Object
-
- java.lang.Enum<RemoteInputStream.Flag>
-
- hudson.remoting.RemoteInputStream.Flag
-
- All Implemented Interfaces:
Serializable
,Comparable<RemoteInputStream.Flag>
- Enclosing class:
- RemoteInputStream
public static enum RemoteInputStream.Flag extends Enum<RemoteInputStream.Flag>
-
-
Enum Constant Summary
Enum Constants Enum Constant Description GREEDY
Set this flag to greedily drain the input stream wrapped inRemoteInputStream
and send data to the other side.MANUAL_UNEXPORT
If a Callable captures aRemoteInputStream
on its way to the other wide,RemoteInputStream
gets unexported automatically when the callable returns.NOT_GREEDY
A dummy flag to make it explicit that the particular use case prevents you from settingGREEDY
flag.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static RemoteInputStream.Flag
valueOf(String name)
Returns the enum constant of this type with the specified name.static RemoteInputStream.Flag[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
GREEDY
public static final RemoteInputStream.Flag 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
public static final RemoteInputStream.Flag NOT_GREEDY
-
MANUAL_UNEXPORT
public static final RemoteInputStream.Flag 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 Detail
-
values
public static RemoteInputStream.Flag[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (RemoteInputStream.Flag c : RemoteInputStream.Flag.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static RemoteInputStream.Flag valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException
- if the argument is null
-
-