MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / SockIO

Class SockIO

cdb2jdbc/src/main/java/com/bloomberg/comdb2/jdbc/SockIO.java:22–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20import java.util.logging.Logger;
21
22public class SockIO implements IO {
23 private static Logger logger = Logger.getLogger(SockIO.class.getName());
24
25 protected Socket sock;
26 protected BufferedOutputStream out;
27 protected BufferedInputStream in;
28
29 protected String host;
30 protected int port;
31 protected int tcpbufsz;
32 protected String pmuxrtedb = null;
33 protected int soTimeout;
34 protected int connectTimeout;
35
36 protected boolean opened = false;
37
38 @Override
39 public void close() throws IOException {
40 if (in != null) {
41 in.close();
42 in = null;
43 }
44 if (out != null) {
45 out.close();
46 out = null;
47 }
48 if (sock != null) {
49 sock.close();
50 sock = null;
51 }
52 opened = false;
53 }
54
55 public SockIO(String host, int port, int tcpbufsz, String pmuxrtedb, int soTimeout, int connectTimeout) {
56 this.host = host;
57 this.port = port;
58 this.tcpbufsz = tcpbufsz;
59 this.pmuxrtedb = pmuxrtedb;
60 this.soTimeout = soTimeout;
61 this.connectTimeout = connectTimeout;
62 }
63
64 public SockIO(String host, int port) {
65 this(host, port, 0, null, 0, 0);
66 }
67
68 public SockIO(String host, int port, String pmuxrtedb) {
69 this(host, port, 0, pmuxrtedb, 0, 0);
70 }
71
72 public SockIO(String host, int port, String pmuxrtedb, int soTimeout, int connectTimeout) {
73 this(host, port, 0, pmuxrtedb, soTimeout, connectTimeout);
74 }
75
76 public SockIO() {
77 }
78
79 public void write(byte[] bytes) throws IOException {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected