String message; Pipeline hispipe = null;  hispipe = new Pipeline(myClientInputStream,stack.readTimeout,((SIPTransactionStack)stack).timer);   myParser = new PipelinedMsgParser(this, hispipe,this.stack.getMaxMessageSize());  myParser.processInput();  int bufferSize = 4096; this.tcpMessageProcessor.useCount ++; this.isRunning = true; try { while (true) { try { byte[] msg = new byte[bufferSize]; int nbytes = myClientInputStream.read(msg, 0, bufferSize);  if (nbytes == -1) { hispipe.write("\r\n\r\n".getBytes("UTF-8")); try { if (stack.maxConnections != -1) { synchronized (tcpMessageProcessor) { tcpMessageProcessor.nConnections--; tcpMessageProcessor.notify(); } } hispipe.close(); mySock.close(); } catch (IOException ioex) { } return; } hispipe.write(msg, 0, nbytes);  } catch (IOException ex) {  try { hispipe.write("\r\n\r\n".getBytes("UTF-8")); } catch (Exception e) {  }  try { if (LogWriter.needsLogging) stack.logWriter.logMessage("IOException  closing sock " + ex); try { if (stack.maxConnections != -1) { synchronized (tcpMessageProcessor) { tcpMessageProcessor.nConnections--;  tcpMessageProcessor.notify(); } } mySock.close(); hispipe.close(); } catch (IOException ioex) { } } catch (Exception ex1) {  } return; } catch (Exception ex) { InternalErrorHandler.handleException(ex); } } } finally { this.isRunning = false; this.tcpMessageProcessor.remove(this); this.tcpMessageProcessor.useCount --; }  }
String message; Pipeline hispipe = null;  hispipe = new Pipeline(myClientInputStream, sipStack.readTimeout, ((SIPTransactionStack) sipStack).timer);   myParser = new PipelinedMsgParser(this, hispipe, this.sipStack .getMaxMessageSize());  myParser.processInput();  int bufferSize = 4096; this.tcpMessageProcessor.useCount++; this.isRunning = true; try { while (true) { try { byte[] msg = new byte[bufferSize]; int nbytes = myClientInputStream.read(msg, 0, bufferSize);  if (nbytes == -1) { hispipe.write("\r\n\r\n".getBytes("UTF-8")); try { if (sipStack.maxConnections != -1) { synchronized (tcpMessageProcessor) { tcpMessageProcessor.nConnections--; tcpMessageProcessor.notify(); } } hispipe.close(); mySock.close(); } catch (IOException ioex) { } return; } hispipe.write(msg, 0, nbytes);  } catch (IOException ex) {  try { hispipe.write("\r\n\r\n".getBytes("UTF-8")); } catch (Exception e) {  }  try { if (sipStack.isLoggingEnabled()) sipStack.logWriter .logDebug("IOException  closing sock " + ex); try { if (sipStack.maxConnections != -1) { synchronized (tcpMessageProcessor) { tcpMessageProcessor.nConnections--;  tcpMessageProcessor.notify(); } } mySock.close(); hispipe.close(); } catch (IOException ioex) { } } catch (Exception ex1) {  } return; } catch (Exception ex) { InternalErrorHandler .handleException(ex, sipStack.logWriter); } } } finally { this.isRunning = false; this.tcpMessageProcessor.remove(this); this.tcpMessageProcessor.useCount--; }  }
    public void run() {        String message;        Pipeline hispipe = null;        // Create a pipeline to connect to our message parser.        hispipe = new Pipeline(myClientInputStream,stack.readTimeout,((SIPTransactionStack)stack).timer);        // Create a pipelined message parser to read and parse        // messages that we write out to him.        myParser = new PipelinedMsgParser(this, hispipe,this.stack.getMaxMessageSize());        // Start running the parser thread.        myParser.processInput();        // bug fix by Emmanuel Proulx        int bufferSize = 4096;        this.tcpMessageProcessor.useCount ++;        this.isRunning = true;        try {            while (true) {                try {                    byte[] msg = new byte[bufferSize];                    int nbytes = myClientInputStream.read(msg, 0, bufferSize);                    // no more bytes to read...                    if (nbytes == -1) {                        hispipe.write("\r\n\r\n".getBytes("UTF-8"));                        try {                            if (stack.maxConnections != -1) {                                synchronized (tcpMessageProcessor) {                                    tcpMessageProcessor.nConnections--;                                    tcpMessageProcessor.notify();                                }                            }                            hispipe.close();                            mySock.close();                        } catch (IOException ioex) {                        }                        return;                    }                    hispipe.write(msg, 0, nbytes);                                    } catch (IOException ex) {                    // Terminate the message.                    try {                        hispipe.write("\r\n\r\n".getBytes("UTF-8"));                    } catch (Exception e) {                        // InternalErrorHandler.handleException(e);                    }                                        try {                        if (LogWriter.needsLogging)                            stack.logWriter.logMessage("IOException  closing sock " + ex);                        try {                            if (stack.maxConnections != -1) {                                synchronized (tcpMessageProcessor) {                                    tcpMessageProcessor.nConnections--;                                    // System.out.println("Notifying!");                                    tcpMessageProcessor.notify();                                }                            }                            mySock.close();                            hispipe.close();                        } catch (IOException ioex) {                        }                    } catch (Exception ex1) {                        // Do nothing.                    }                    return;                } catch (Exception ex) {                    InternalErrorHandler.handleException(ex);                }            }        } finally {            this.isRunning = false;            this.tcpMessageProcessor.remove(this);            this.tcpMessageProcessor.useCount --;        }            }