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

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

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

Socket.setPerformancePreferences介绍

[英]Sets performance preferences for connectionTime, latency and bandwidth.

This method does currently nothing.
[中]设置连接时间、延迟和带宽的性能首选项。
这种方法目前不起任何作用。

代码示例

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

@Override
public SocketChannelConfig setPerformancePreferences(
    int connectionTime, int latency, int bandwidth) {
  javaSocket.setPerformancePreferences(connectionTime, latency, bandwidth);
  return this;
}

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

@Override
public SocketChannelConfig setPerformancePreferences(
    int connectionTime, int latency, int bandwidth) {
  javaSocket.setPerformancePreferences(connectionTime, latency, bandwidth);
  return this;
}

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

@Override
  public void setPerformancePreferences(int connectionTime, int latency,
      int bandwidth) {
    sock.setPerformancePreferences(connectionTime, latency, bandwidth);
  }
}

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

@Override
public SocketChannelConfig setPerformancePreferences(
    int connectionTime, int latency, int bandwidth) {
  javaSocket.setPerformancePreferences(connectionTime, latency, bandwidth);
  return this;
}

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

public void setPerformancePreferences(
    int connectionTime, int latency, int bandwidth) {
  socket.setPerformancePreferences(connectionTime, latency, bandwidth);
}

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

/**
   * See {@link Socket#setPerformancePreferences(int, int, int)}. Calling this method does not trigger
   * mode detection.
   */
  @Override
  public void setPerformancePreferences(int connectionTime, int latency, int bandwidth) {
    getSocketAllowUnknownMode().setPerformancePreferences(connectionTime, latency, bandwidth);
  }
}

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

private void applyHints (SocketHints hints) {
  if (hints != null) {
    try {
      socket.setPerformancePreferences(hints.performancePrefConnectionTime, hints.performancePrefLatency,
        hints.performancePrefBandwidth);
      socket.setTrafficClass(hints.trafficClass);
      socket.setTcpNoDelay(hints.tcpNoDelay);
      socket.setKeepAlive(hints.keepAlive);
      socket.setSendBufferSize(hints.sendBufferSize);
      socket.setReceiveBufferSize(hints.receiveBufferSize);
      socket.setSoLinger(hints.linger, hints.lingerDuration);
      socket.setSoTimeout(hints.socketTimeout);
    } catch (Exception e) {
      throw new GdxRuntimeException("Error setting socket hints.", e);
    }
  }
}

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

private void applyHints (SocketHints hints) {
  if (hints != null) {
    try {
      socket.setPerformancePreferences(hints.performancePrefConnectionTime, hints.performancePrefLatency,
        hints.performancePrefBandwidth);
      socket.setTrafficClass(hints.trafficClass);
      socket.setTcpNoDelay(hints.tcpNoDelay);
      socket.setKeepAlive(hints.keepAlive);
      socket.setSendBufferSize(hints.sendBufferSize);
      socket.setReceiveBufferSize(hints.receiveBufferSize);
      socket.setSoLinger(hints.linger, hints.lingerDuration);
      socket.setSoTimeout(hints.socketTimeout);
    } catch (Exception e) {
      throw new GdxRuntimeException("Error setting socket hints.", e);
    }
  }
}

代码示例来源:origin: alibaba/cobar

socket.setTcpNoDelay(true);
socket.setTrafficClass(0x04 | 0x10);
socket.setPerformancePreferences(0, 2, 1);
socket.setReceiveBufferSize(RECV_BUFFER_SIZE);
socket.setSendBufferSize(SEND_BUFFER_SIZE);

代码示例来源:origin: scouter-project/scouter

public void open(int serverId) {
  close();
  Server server = ServerManager.getInstance().getServer(serverId);
  if (server == null) {
    return;
  }
  try {
    socket = new Socket();
    socket.setKeepAlive(false);
    socket.setTcpNoDelay(true);
    socket.setPerformancePreferences(0, 2, 1);
    socket.setReuseAddress(true);
    socket.setSoLinger(true, 1000);
    socket.connect(new InetSocketAddress(server.getIp(), server.getPort()),3000);
    socket.setSoTimeout(server.getSoTimeOut());
    in = new DataInputX(new BufferedInputStream(socket.getInputStream()));
    out = new DataOutputX(new BufferedOutputStream(socket.getOutputStream()));
    
    out.writeInt(NetCafe.TCP_CLIENT);
    out.flush();
    log.info("Connected {} to {}:{}", this, server.getIp(), server.getPort());
  } catch (Throwable t) {
    log.error(t.getMessage());
    close();
  }
}

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

@Signature({@Arg("connectTime"), @Arg("latency"), @Arg("bandWidth")})
public Memory setPerformancePreferences(Environment env, Memory... args) throws SocketException {
  socket.setPerformancePreferences(args[0].toInteger(), args[1].toInteger(), args[2].toInteger());
  return Memory.NULL;
}

代码示例来源:origin: org.apache.hadoop/hadoop-common

this.socket.setPerformancePreferences(1, 2, 0);

代码示例来源:origin: stackoverflow.com

delegate.setPerformancePreferences(connectionTime, latency, bandwidth);

代码示例来源:origin: stackoverflow.com

delegate.setPerformancePreferences(connectionTime, latency, bandwidth);

代码示例来源:origin: stackoverflow.com

delegate.setPerformancePreferences(connectionTime, latency, bandwidth);

代码示例来源:origin: camunda/camunda-bpm-platform

@Override
public void setPerformancePreferences(int connectionTime, int latency,
                   int bandwidth) {
  socket.setPerformancePreferences(connectionTime, latency, bandwidth);
}

代码示例来源:origin: com.amazonaws/aws-java-sdk-core

@Override
  public void setPerformancePreferences(int connectionTime, int latency,
      int bandwidth) {
    sock.setPerformancePreferences(connectionTime, latency, bandwidth);
  }
}

代码示例来源:origin: com.sun.mail/javax.mail

@Override
public void setPerformancePreferences(int connectionTime, int latency,
                   int bandwidth) {
  socket.setPerformancePreferences(connectionTime, latency, bandwidth);
}

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

@Override
  public void setPerformancePreferences(int connectionTime, int latency,
                     int bandwidth) {
    sock.setPerformancePreferences(connectionTime, latency, bandwidth);
  }
}

代码示例来源:origin: apache/activemq-artemis

@Override
public SocketChannelConfig setPerformancePreferences(
    int connectionTime, int latency, int bandwidth) {
  javaSocket.setPerformancePreferences(connectionTime, latency, bandwidth);
  return this;
}

相关文章