java.net.Socket.isOutputShutdown()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(388)

本文整理了Java中java.net.Socket.isOutputShutdown()方法的一些代码示例,展示了Socket.isOutputShutdown()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Socket.isOutputShutdown()方法的具体详情如下:
包路径:java.net.Socket
类名称:Socket
方法名:isOutputShutdown

Socket.isOutputShutdown介绍

[英]Returns whether the outgoing channel of the socket has already been closed.
[中]返回套接字的传出通道是否已关闭。

代码示例

代码示例来源:origin: aws/aws-sdk-java

@Override
public boolean isOutputShutdown() {
  return sock.isOutputShutdown();
}

代码示例来源:origin: netty/netty

@Override
public boolean isOutputShutdown() {
  return socket.isOutputShutdown() || !isActive();
}

代码示例来源:origin: redisson/redisson

@Override
public boolean isOutputShutdown() {
  return socket.isOutputShutdown() || !isActive();
}

代码示例来源:origin: apache/zookeeper

/**
 * See {@link Socket#isOutputShutdown()}. Calling this method does not trigger mode detection.
 */
@Override
public boolean isOutputShutdown() {
  return getSocketAllowUnknownMode().isOutputShutdown();
}

代码示例来源:origin: CarGuo/GSYVideoPlayer

private void closeSocketOutput(Socket socket) {
  try {
    if (!socket.isOutputShutdown()) {
      socket.shutdownOutput();
    }
  } catch (IOException e) {
    HttpProxyCacheDebuger.printfWarning("Failed to close socket on proxy side: {}. It seems client have already closed connection.", e.getMessage());
  }
}

代码示例来源:origin: netty/netty

@Override
public boolean isOutputShutdown() {
  return javaChannel().socket().isOutputShutdown() || !isActive();
}

代码示例来源:origin: wildfly/wildfly

@Override
public boolean isOutputShutdown() {
  return socket.isOutputShutdown() || !isActive();
}

代码示例来源:origin: netty/netty

@Override
public boolean isShutdown() {
  return socket.isInputShutdown() && socket.isOutputShutdown() || !isActive();
}

代码示例来源:origin: netty/netty

@Override
public boolean isShutdown() {
  Socket socket = javaChannel().socket();
  return socket.isInputShutdown() && socket.isOutputShutdown() || !isActive();
}

代码示例来源:origin: jphp-group/jphp

@Signature
public Memory isOutputShutdown(Environment env, Memory... args) {
  return socket.isOutputShutdown() ? Memory.TRUE : Memory.FALSE;
}

代码示例来源:origin: redisson/redisson

@Override
public boolean isOutputShutdown() {
  return javaChannel().socket().isOutputShutdown() || !isActive();
}

代码示例来源:origin: square/okhttp

/** Returns true if this connection is ready to host new streams. */
public boolean isHealthy(boolean doExtensiveChecks) {
 if (socket.isClosed() || socket.isInputShutdown() || socket.isOutputShutdown()) {
  return false;
 }
 if (http2Connection != null) {
  return !http2Connection.isShutdown();
 }
 if (doExtensiveChecks) {
  try {
   int readTimeout = socket.getSoTimeout();
   try {
    socket.setSoTimeout(1);
    if (source.exhausted()) {
     return false; // Stream is exhausted; socket is closed.
    }
    return true;
   } finally {
    socket.setSoTimeout(readTimeout);
   }
  } catch (SocketTimeoutException ignored) {
   // Read timed out; socket is good.
  } catch (IOException e) {
   return false; // Couldn't read; socket is closed.
  }
 }
 return true;
}

代码示例来源:origin: sohutv/cachecloud

public boolean isConnected() {
 return socket != null && socket.isBound() && !socket.isClosed() && socket.isConnected()
   && !socket.isInputShutdown() && !socket.isOutputShutdown();
}

代码示例来源:origin: redisson/redisson

@Override
public boolean isShutdown() {
  return socket.isInputShutdown() && socket.isOutputShutdown() || !isActive();
}

代码示例来源:origin: redisson/redisson

@Override
public boolean isShutdown() {
  Socket socket = javaChannel().socket();
  return socket.isInputShutdown() && socket.isOutputShutdown() || !isActive();
}

代码示例来源:origin: wildfly/wildfly

@Override
public boolean isOutputShutdown() {
  return javaChannel().socket().isOutputShutdown() || !isActive();
}

代码示例来源:origin: prestodb/presto

/** Returns true if this connection is ready to host new streams. */
public boolean isHealthy(boolean doExtensiveChecks) {
 if (socket.isClosed() || socket.isInputShutdown() || socket.isOutputShutdown()) {
  return false;
 }
 if (http2Connection != null) {
  return !http2Connection.isShutdown();
 }
 if (doExtensiveChecks) {
  try {
   int readTimeout = socket.getSoTimeout();
   try {
    socket.setSoTimeout(1);
    if (source.exhausted()) {
     return false; // Stream is exhausted; socket is closed.
    }
    return true;
   } finally {
    socket.setSoTimeout(readTimeout);
   }
  } catch (SocketTimeoutException ignored) {
   // Read timed out; socket is good.
  } catch (IOException e) {
   return false; // Couldn't read; socket is closed.
  }
 }
 return true;
}

代码示例来源:origin: robovm/robovm

/**
 * Returns an output stream to write data into this socket.
 *
 * @return the byte-oriented output stream.
 * @throws IOException
 *             if an error occurs while creating the output stream or the
 *             socket is in an invalid state.
 */
public OutputStream getOutputStream() throws IOException {
  checkOpenAndCreate(false);
  if (isOutputShutdown()) {
    throw new SocketException("Socket output is shutdown");
  }
  return impl.getOutputStream();
}

代码示例来源:origin: wildfly/wildfly

@Override
public boolean isShutdown() {
  return socket.isInputShutdown() && socket.isOutputShutdown() || !isActive();
}

代码示例来源:origin: wildfly/wildfly

@Override
public boolean isShutdown() {
  Socket socket = javaChannel().socket();
  return socket.isInputShutdown() && socket.isOutputShutdown() || !isActive();
}

相关文章