X Tutup
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.github.dockerjava.api.async.ResultCallback;
Expand All @@ -23,20 +24,21 @@ public class JsonStreamProcessor<T> implements ResponseStreamProcessor<T> {

private static final JsonFactory JSON_FACTORY = new JsonFactory();

private final Class<T> clazz;
private final TypeReference<T> typeReference;

private final ObjectMapper objectMapper;

@Deprecated
public JsonStreamProcessor(Class<T> clazz) {
this(
DefaultDockerClientConfig.createDefaultConfigBuilder().build().getObjectMapper(),
clazz
new TypeReference<T>() {
}
);
}

public JsonStreamProcessor(ObjectMapper objectMapper, Class<T> clazz) {
this.clazz = clazz;
public JsonStreamProcessor(ObjectMapper objectMapper, TypeReference<T> typeReference) {
this.typeReference = typeReference;
this.objectMapper = objectMapper.copy().enable(JsonParser.Feature.AUTO_CLOSE_SOURCE);
}

Expand All @@ -54,7 +56,7 @@ public void processResponseStream(InputStream response, ResultCallback<T> result
ObjectNode objectNode = objectMapper.readTree(jp);
// exclude empty item serialization into class #461
if (!objectNode.isEmpty(null)) {
T next = objectMapper.treeToValue(objectNode, clazz);
T next = objectMapper.convertValue(objectNode, typeReference);
resultCallback.onNext(next);
}
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import com.github.dockerjava.core.MediaType;
import com.github.dockerjava.core.WebTarget;

import java.io.IOException;

public class StartContainerCmdExec extends AbstrSyncDockerCmdExec<StartContainerCmd, Void> implements
StartContainerCmd.Exec {

Expand All @@ -23,9 +25,14 @@ protected Void execute(StartContainerCmd command) {
command.getContainerId());

LOGGER.trace("POST: {}", webResource);
webResource.request()
.accept(MediaType.APPLICATION_JSON)
.post(command);
try {
webResource.request()
.accept(MediaType.APPLICATION_JSON)
.post(null)
.close();
} catch (IOException e) {
throw new RuntimeException(e);
}

return null;
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
*
* This class also noop's any calls to setReuseAddress, which is called by the Apache client but isn't supported by AFUnixSocket.
*/
@Deprecated
public class ApacheUnixSocket extends Socket {

private final AFUNIXSocket inner;
Expand Down

This file was deleted.

This file was deleted.

Loading
X Tutup