Search in sources :

Example 1 with FlushableGZIPOutputStream

use of org.apache.openejb.client.FlushableGZIPOutputStream in project tomee by apache.

the class EjbDaemon method service.

public void service(final Socket socket) throws IOException {
    InputStream in = null;
    OutputStream out = null;
    try {
        if (socket.isClosed()) {
            return;
        }
        socket.setSoTimeout(this.timeout);
        if (gzip) {
            in = new GZIPInputStream(new BufferedInputStream(socket.getInputStream()));
            out = new BufferedOutputStream(new FlushableGZIPOutputStream(socket.getOutputStream()));
        } else {
            in = new BufferedInputStream(socket.getInputStream());
            out = new BufferedOutputStream(socket.getOutputStream());
        }
        RequestInfos.initRequestInfo(socket);
        service(in, out);
    } finally {
        if (null != out) {
            try {
                out.flush();
            } catch (Throwable e) {
            //Ignore
            }
            try {
                out.close();
            } catch (Throwable e) {
            //Ignore
            }
        }
        if (null != in) {
            try {
                in.close();
            } catch (Throwable e) {
            //Ignore
            }
        }
        if (null != socket) {
            try {
                socket.close();
            } catch (Throwable t) {
            //Ignore
            }
        }
        RequestInfos.clearRequestInfo();
    }
}
Also used : GZIPInputStream(java.util.zip.GZIPInputStream) FlushableGZIPOutputStream(org.apache.openejb.client.FlushableGZIPOutputStream) BufferedInputStream(java.io.BufferedInputStream) GZIPInputStream(java.util.zip.GZIPInputStream) BufferedInputStream(java.io.BufferedInputStream) ObjectInputStream(java.io.ObjectInputStream) EjbObjectInputStream(org.apache.openejb.client.EjbObjectInputStream) CountingInputStream(org.apache.openejb.server.stream.CountingInputStream) InputStream(java.io.InputStream) FlushableGZIPOutputStream(org.apache.openejb.client.FlushableGZIPOutputStream) BufferedOutputStream(java.io.BufferedOutputStream) ObjectOutputStream(java.io.ObjectOutputStream) OutputStream(java.io.OutputStream) CountingOutputStream(org.apache.openejb.server.stream.CountingOutputStream) BufferedOutputStream(java.io.BufferedOutputStream)

Aggregations

BufferedInputStream (java.io.BufferedInputStream)1 BufferedOutputStream (java.io.BufferedOutputStream)1 InputStream (java.io.InputStream)1 ObjectInputStream (java.io.ObjectInputStream)1 ObjectOutputStream (java.io.ObjectOutputStream)1 OutputStream (java.io.OutputStream)1 GZIPInputStream (java.util.zip.GZIPInputStream)1 EjbObjectInputStream (org.apache.openejb.client.EjbObjectInputStream)1 FlushableGZIPOutputStream (org.apache.openejb.client.FlushableGZIPOutputStream)1 CountingInputStream (org.apache.openejb.server.stream.CountingInputStream)1 CountingOutputStream (org.apache.openejb.server.stream.CountingOutputStream)1