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

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

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

ServerSocket.setPerformancePreferences介绍

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

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

代码示例

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

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

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

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

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

@Override
public ServerSocketChannelConfig 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: libgdx/libgdx

public NetJavaServerSocketImpl (Protocol protocol, String hostname, int port, ServerSocketHints hints) {
  this.protocol = protocol;
  // create the server socket
  try {
    // initialize
    server = new java.net.ServerSocket();
    if (hints != null) {
      server.setPerformancePreferences(hints.performancePrefConnectionTime, hints.performancePrefLatency,
        hints.performancePrefBandwidth);
      server.setReuseAddress(hints.reuseAddress);
      server.setSoTimeout(hints.acceptTimeout);
      server.setReceiveBufferSize(hints.receiveBufferSize);
    }
    // and bind the server...
    InetSocketAddress address;
    if( hostname != null ) {
      address = new InetSocketAddress(hostname, port); 
    } else {
      address = new InetSocketAddress(port);
    }
    
    if (hints != null) {
      server.bind(address, hints.backlog);
    } else {
      server.bind(address);
    }
  } catch (Exception e) {
    throw new GdxRuntimeException("Cannot create a server socket at port " + port + ".", e);
  }
}

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

public NetJavaServerSocketImpl (Protocol protocol, String hostname, int port, ServerSocketHints hints) {
  this.protocol = protocol;
  // create the server socket
  try {
    // initialize
    server = new java.net.ServerSocket();
    if (hints != null) {
      server.setPerformancePreferences(hints.performancePrefConnectionTime, hints.performancePrefLatency,
        hints.performancePrefBandwidth);
      server.setReuseAddress(hints.reuseAddress);
      server.setSoTimeout(hints.acceptTimeout);
      server.setReceiveBufferSize(hints.receiveBufferSize);
    }
    // and bind the server...
    InetSocketAddress address;
    if( hostname != null ) {
      address = new InetSocketAddress(hostname, port); 
    } else {
      address = new InetSocketAddress(port);
    }
    
    if (hints != null) {
      server.bind(address, hints.backlog);
    } else {
      server.bind(address);
    }
  } catch (Exception e) {
    throw new GdxRuntimeException("Cannot create a server socket at port " + port + ".", e);
  }
}

代码示例来源:origin: pentaho/pentaho-kettle

private ServerSocket createServerSocket( int port ) throws IOException {
 ServerSocket serverSocket = new ServerSocket();
 serverSocket.setPerformancePreferences( 1, 2, 3 ); // order of importance: bandwidth, latency, connection time
 serverSocket.setReuseAddress( true );

代码示例来源: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: killme2008/xmemcached

@Override
protected void doStart() throws IOException {
 this.serverSocketChannel = ServerSocketChannel.open();
 this.serverSocketChannel.socket().setSoTimeout(this.soTimeout);
 if (this.connectionTime != 0 || this.latency != 0 || this.bandwidth != 0) {
  this.serverSocketChannel.socket().setPerformancePreferences(this.connectionTime, this.latency,
    this.bandwidth);
 }
 this.serverSocketChannel.configureBlocking(false);
 if (this.socketOptions.get(StandardSocketOption.SO_REUSEADDR) != null) {
  this.serverSocketChannel.socket().setReuseAddress(StandardSocketOption.SO_REUSEADDR.type()
    .cast(this.socketOptions.get(StandardSocketOption.SO_REUSEADDR)));
 }
 if (this.socketOptions.get(StandardSocketOption.SO_RCVBUF) != null) {
  this.serverSocketChannel.socket().setReceiveBufferSize(StandardSocketOption.SO_RCVBUF.type()
    .cast(this.socketOptions.get(StandardSocketOption.SO_RCVBUF)));
 }
 if (this.localSocketAddress != null) {
  this.serverSocketChannel.socket().bind(this.localSocketAddress, this.backlog);
 } else {
  this.serverSocketChannel.socket().bind(new InetSocketAddress("localhost", 0), this.backlog);
 }
 setLocalSocketAddress(
   (InetSocketAddress) this.serverSocketChannel.socket().getLocalSocketAddress());
 this.selectorManager.registerChannel(this.serverSocketChannel, SelectionKey.OP_ACCEPT, null);
}

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

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

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

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

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

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

代码示例来源:origin: org.apache.activemq/artemis-jms-client-all

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

代码示例来源:origin: EvoSuite/evosuite

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

代码示例来源:origin: com.couchbase.client/core-io

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

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

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

代码示例来源:origin: io.bitsensor/proto

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

代码示例来源:origin: jitsi/ice4j

/**
 * {@inheritDoc}
 *
 * Forwards to {@link #delegate}.
 */
@Override
public void setPerformancePreferences(int connectionTime,
                   int latency,
                   int bandwidth)
{
  delegate.setPerformancePreferences(connectionTime, latency, bandwidth);
}

代码示例来源:origin: org.apache.hbase.thirdparty/hbase-shaded-netty

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

代码示例来源:origin: org.jboss.eap/wildfly-client-all

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

相关文章