Skip to content

Commit 1ed6fbf

Browse files
author
Marcus Linke
committed
Warning comment on 'followStream'
1 parent a072d62 commit 1ed6fbf

File tree

2 files changed

+46
-21
lines changed

2 files changed

+46
-21
lines changed

src/main/java/com/github/dockerjava/api/command/AttachContainerCmd.java

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.io.InputStream;
44

5+
import com.github.dockerjava.api.DockerClient;
56
import com.github.dockerjava.api.NotFoundException;
67

78
/**
@@ -20,7 +21,7 @@
2021
* - true or false, if true, print timestamps for every log line.
2122
* Defaults to false.
2223
*/
23-
public interface AttachContainerCmd extends DockerCmd<InputStream>{
24+
public interface AttachContainerCmd extends DockerCmd<InputStream> {
2425

2526
public String getContainerId();
2627

@@ -36,8 +37,17 @@ public interface AttachContainerCmd extends DockerCmd<InputStream>{
3637

3738
public AttachContainerCmd withContainerId(String containerId);
3839

40+
/**
41+
* See {@link #withFollowStream(boolean)}
42+
*/
3943
public AttachContainerCmd withFollowStream();
4044

45+
/**
46+
* Following the stream means the resulting {@link InputStream} returned by
47+
* {@link #exec()} reads infinitely. So a {@link InputStream#read()} MAY
48+
* BLOCK FOREVER as long as no data is streamed from the docker host to
49+
* {@link DockerClient}!
50+
*/
4151
public AttachContainerCmd withFollowStream(boolean followStream);
4252

4353
public AttachContainerCmd withTimestamps(boolean timestamps);
@@ -51,19 +61,21 @@ public interface AttachContainerCmd extends DockerCmd<InputStream>{
5161
public AttachContainerCmd withStdErr(boolean stderr);
5262

5363
public AttachContainerCmd withLogs(boolean logs);
54-
64+
5565
public AttachContainerCmd withLogs();
5666

5767
/**
58-
* Its the responsibility of the caller to consume and/or close the {@link InputStream} to prevent
59-
* connection leaks.
68+
* Its the responsibility of the caller to consume and/or close the
69+
* {@link InputStream} to prevent connection leaks.
6070
*
61-
* @throws NotFoundException No such container
71+
* @throws NotFoundException
72+
* No such container
6273
*/
6374
@Override
6475
public InputStream exec() throws NotFoundException;
65-
66-
public static interface Exec extends DockerCmdExec<AttachContainerCmd, InputStream> {
76+
77+
public static interface Exec extends
78+
DockerCmdExec<AttachContainerCmd, InputStream> {
6779
}
6880

6981
}

src/main/java/com/github/dockerjava/api/command/LogContainerCmd.java

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
package com.github.dockerjava.api.command;
22

3+
import com.github.dockerjava.api.DockerClient;
34
import com.github.dockerjava.api.NotFoundException;
45

56
import java.io.InputStream;
67

78
/**
89
* Get container logs
9-
*
10+
*
1011
* @param followStream
1112
* - true or false, return stream. Defaults to false.
1213
* @param stdout
@@ -17,13 +18,15 @@
1718
* - true or false, if true, print timestamps for every log line.
1819
* Defaults to false.
1920
* @param tail
20-
* - `all` or `<number>`, Output specified number of lines at the end of logs
21-
*
22-
* Consider wrapping any input stream you get with a frame reader to make reading frame easier.
23-
*
21+
* - `all` or `<number>`, Output specified number of lines at the end
22+
* of logs
23+
*
24+
* Consider wrapping any input stream you get with a frame reader to
25+
* make reading frame easier.
26+
*
2427
* @see com.github.dockerjava.core.command.FrameReader
2528
*/
26-
public interface LogContainerCmd extends DockerCmd<InputStream>{
29+
public interface LogContainerCmd extends DockerCmd<InputStream> {
2730

2831
public String getContainerId();
2932

@@ -39,12 +42,21 @@ public interface LogContainerCmd extends DockerCmd<InputStream>{
3942

4043
public LogContainerCmd withContainerId(String containerId);
4144

45+
/**
46+
* See {@link #withFollowStream(boolean)}
47+
*/
4248
public LogContainerCmd withFollowStream();
4349

50+
/**
51+
* Following the stream means the resulting {@link InputStream} returned by
52+
* {@link #exec()} reads infinitely. So a {@link InputStream#read()} MAY
53+
* BLOCK FOREVER as long as no data is streamed from the docker host to
54+
* {@link DockerClient}!
55+
*/
4456
public LogContainerCmd withFollowStream(boolean followStream);
4557

4658
public LogContainerCmd withTimestamps();
47-
59+
4860
public LogContainerCmd withTimestamps(boolean timestamps);
4961

5062
public LogContainerCmd withStdOut();
@@ -60,16 +72,17 @@ public interface LogContainerCmd extends DockerCmd<InputStream>{
6072
public LogContainerCmd withTail(int tail);
6173

6274
/**
63-
* Its the responsibility of the caller to consume and/or close the {@link InputStream} to prevent
64-
* connection leaks.
65-
*
66-
* @throws NotFoundException No such container
75+
* Its the responsibility of the caller to consume and/or close the
76+
* {@link InputStream} to prevent connection leaks.
77+
*
78+
* @throws NotFoundException
79+
* No such container
6780
*/
6881
@Override
6982
public InputStream exec() throws NotFoundException;
70-
71-
public static interface Exec extends DockerCmdExec<LogContainerCmd, InputStream> {
72-
}
7383

84+
public static interface Exec extends
85+
DockerCmdExec<LogContainerCmd, InputStream> {
86+
}
7487

7588
}

0 commit comments

Comments
 (0)