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

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

本文整理了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

  1. @Override
  2. public ServerSocketChannelConfig setPerformancePreferences(int connectionTime, int latency, int bandwidth) {
  3. javaSocket.setPerformancePreferences(connectionTime, latency, bandwidth);
  4. return this;
  5. }

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

  1. @Override
  2. public ServerSocketChannelConfig setPerformancePreferences(int connectionTime, int latency, int bandwidth) {
  3. javaSocket.setPerformancePreferences(connectionTime, latency, bandwidth);
  4. return this;
  5. }

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

  1. @Override
  2. public ServerSocketChannelConfig setPerformancePreferences(int connectionTime, int latency, int bandwidth) {
  3. javaSocket.setPerformancePreferences(connectionTime, latency, bandwidth);
  4. return this;
  5. }

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

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

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

  1. public NetJavaServerSocketImpl (Protocol protocol, String hostname, int port, ServerSocketHints hints) {
  2. this.protocol = protocol;
  3. // create the server socket
  4. try {
  5. // initialize
  6. server = new java.net.ServerSocket();
  7. if (hints != null) {
  8. server.setPerformancePreferences(hints.performancePrefConnectionTime, hints.performancePrefLatency,
  9. hints.performancePrefBandwidth);
  10. server.setReuseAddress(hints.reuseAddress);
  11. server.setSoTimeout(hints.acceptTimeout);
  12. server.setReceiveBufferSize(hints.receiveBufferSize);
  13. }
  14. // and bind the server...
  15. InetSocketAddress address;
  16. if( hostname != null ) {
  17. address = new InetSocketAddress(hostname, port);
  18. } else {
  19. address = new InetSocketAddress(port);
  20. }
  21. if (hints != null) {
  22. server.bind(address, hints.backlog);
  23. } else {
  24. server.bind(address);
  25. }
  26. } catch (Exception e) {
  27. throw new GdxRuntimeException("Cannot create a server socket at port " + port + ".", e);
  28. }
  29. }

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

  1. public NetJavaServerSocketImpl (Protocol protocol, String hostname, int port, ServerSocketHints hints) {
  2. this.protocol = protocol;
  3. // create the server socket
  4. try {
  5. // initialize
  6. server = new java.net.ServerSocket();
  7. if (hints != null) {
  8. server.setPerformancePreferences(hints.performancePrefConnectionTime, hints.performancePrefLatency,
  9. hints.performancePrefBandwidth);
  10. server.setReuseAddress(hints.reuseAddress);
  11. server.setSoTimeout(hints.acceptTimeout);
  12. server.setReceiveBufferSize(hints.receiveBufferSize);
  13. }
  14. // and bind the server...
  15. InetSocketAddress address;
  16. if( hostname != null ) {
  17. address = new InetSocketAddress(hostname, port);
  18. } else {
  19. address = new InetSocketAddress(port);
  20. }
  21. if (hints != null) {
  22. server.bind(address, hints.backlog);
  23. } else {
  24. server.bind(address);
  25. }
  26. } catch (Exception e) {
  27. throw new GdxRuntimeException("Cannot create a server socket at port " + port + ".", e);
  28. }
  29. }

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

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

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

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

代码示例来源:origin: killme2008/xmemcached

  1. @Override
  2. protected void doStart() throws IOException {
  3. this.serverSocketChannel = ServerSocketChannel.open();
  4. this.serverSocketChannel.socket().setSoTimeout(this.soTimeout);
  5. if (this.connectionTime != 0 || this.latency != 0 || this.bandwidth != 0) {
  6. this.serverSocketChannel.socket().setPerformancePreferences(this.connectionTime, this.latency,
  7. this.bandwidth);
  8. }
  9. this.serverSocketChannel.configureBlocking(false);
  10. if (this.socketOptions.get(StandardSocketOption.SO_REUSEADDR) != null) {
  11. this.serverSocketChannel.socket().setReuseAddress(StandardSocketOption.SO_REUSEADDR.type()
  12. .cast(this.socketOptions.get(StandardSocketOption.SO_REUSEADDR)));
  13. }
  14. if (this.socketOptions.get(StandardSocketOption.SO_RCVBUF) != null) {
  15. this.serverSocketChannel.socket().setReceiveBufferSize(StandardSocketOption.SO_RCVBUF.type()
  16. .cast(this.socketOptions.get(StandardSocketOption.SO_RCVBUF)));
  17. }
  18. if (this.localSocketAddress != null) {
  19. this.serverSocketChannel.socket().bind(this.localSocketAddress, this.backlog);
  20. } else {
  21. this.serverSocketChannel.socket().bind(new InetSocketAddress("localhost", 0), this.backlog);
  22. }
  23. setLocalSocketAddress(
  24. (InetSocketAddress) this.serverSocketChannel.socket().getLocalSocketAddress());
  25. this.selectorManager.registerChannel(this.serverSocketChannel, SelectionKey.OP_ACCEPT, null);
  26. }

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

  1. @Override
  2. public void setPerformancePreferences(int connectionTime, int latency, int bandwidth) {
  3. ss.setPerformancePreferences(connectionTime, latency, bandwidth);
  4. }
  5. }

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

  1. @Override
  2. public ServerSocketChannelConfig setPerformancePreferences(int connectionTime, int latency, int bandwidth) {
  3. javaSocket.setPerformancePreferences(connectionTime, latency, bandwidth);
  4. return this;
  5. }

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

  1. @Override
  2. public ServerSocketChannelConfig setPerformancePreferences(int connectionTime, int latency, int bandwidth) {
  3. javaSocket.setPerformancePreferences(connectionTime, latency, bandwidth);
  4. return this;
  5. }

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

  1. @Override
  2. public ServerSocketChannelConfig setPerformancePreferences(int connectionTime, int latency, int bandwidth) {
  3. javaSocket.setPerformancePreferences(connectionTime, latency, bandwidth);
  4. return this;
  5. }

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

  1. @Override
  2. public void setPerformancePreferences(int connectionTime,
  3. int latency,
  4. int bandwidth){
  5. super.setPerformancePreferences(connectionTime, latency, bandwidth);
  6. }

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

  1. @Override
  2. public ServerSocketChannelConfig setPerformancePreferences(int connectionTime, int latency, int bandwidth) {
  3. javaSocket.setPerformancePreferences(connectionTime, latency, bandwidth);
  4. return this;
  5. }

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

  1. @Override
  2. public ServerSocketChannelConfig setPerformancePreferences(int connectionTime, int latency, int bandwidth) {
  3. javaSocket.setPerformancePreferences(connectionTime, latency, bandwidth);
  4. return this;
  5. }

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

  1. @Override
  2. public ServerSocketChannelConfig setPerformancePreferences(int connectionTime, int latency, int bandwidth) {
  3. javaSocket.setPerformancePreferences(connectionTime, latency, bandwidth);
  4. return this;
  5. }

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

  1. /**
  2. * {@inheritDoc}
  3. *
  4. * Forwards to {@link #delegate}.
  5. */
  6. @Override
  7. public void setPerformancePreferences(int connectionTime,
  8. int latency,
  9. int bandwidth)
  10. {
  11. delegate.setPerformancePreferences(connectionTime, latency, bandwidth);
  12. }

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

  1. @Override
  2. public ServerSocketChannelConfig setPerformancePreferences(int connectionTime, int latency, int bandwidth) {
  3. javaSocket.setPerformancePreferences(connectionTime, latency, bandwidth);
  4. return this;
  5. }

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

  1. @Override
  2. public ServerSocketChannelConfig setPerformancePreferences(int connectionTime, int latency, int bandwidth) {
  3. javaSocket.setPerformancePreferences(connectionTime, latency, bandwidth);
  4. return this;
  5. }

相关文章