Пример #1
0
  @Override
  public void close() {
    if (debug)
      OLogManager.instance()
          .info(
              this,
              "%s - Closing socket...",
              socket != null ? " null possible previous close" : socket.getRemoteSocketAddress());

    try {
      if (in != null) {
        in.close();
        // in = null;
      }
    } catch (IOException e) {
      OLogManager.instance().debug(this, "Error during closing of input stream", e);
    }

    try {
      if (out != null) {
        out.close();
        // out = null;
      }
    } catch (IOException e) {
      OLogManager.instance().debug(this, "Error during closing of output stream", e);
    }

    super.close();
  }
Пример #2
0
  @Override
  public void flush() throws IOException {
    if (debug) OLogManager.instance().info(this, "%s - Flush", socket.getRemoteSocketAddress());

    updateMetricFlushes();

    super.flush();
    out.flush();
  }
 public String getListeningAddress(final boolean resolveMultiIfcWithLocal) {
   String address = serverSocket.getInetAddress().getHostAddress().toString();
   if (resolveMultiIfcWithLocal && address.equals("0.0.0.0"))
     try {
       address = InetAddress.getLocalHost().getHostAddress().toString();
     } catch (UnknownHostException e) {
       try {
         address = OChannel.getLocalIpAddress(true);
       } catch (Exception ex) {
       }
     }
   return address + ":" + serverSocket.getLocalPort();
 }
Пример #4
0
  @Override
  public void flush() throws IOException {
    if (debug)
      OLogManager.instance()
          .info(
              this,
              "%s - Flush",
              socket != null ? " null possible previous close" : socket.getRemoteSocketAddress());

    updateMetricFlushes();

    super.flush();
    if (out != null) out.flush();
  }
Пример #5
0
  @Override
  public void close() {
    if (debug)
      OLogManager.instance().info(this, "%s - Closing socket...", socket.getRemoteSocketAddress());

    try {
      if (in != null) in.close();
    } catch (IOException e) {
    }

    try {
      if (out != null) out.close();
    } catch (IOException e) {
    }

    super.close();
  }