Class: Vertx::NetServer
- Inherits:
-
Object
- Object
- Vertx::NetServer
- Includes:
- Measured
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/net_server.rb
Overview
Represents a TCP server
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (Fixnum) actual_port
The actual port the server is listening on.
-
- (void) close { ... }
Like #close but supplying a handler that will be notified when close is complete.
-
- (::Vertx::NetServer) connect_handler { ... }
Supply a connect handler for this server.
-
- (::Vertx::ReadStream) connect_stream
Return the connect stream for this server.
-
- (self) listen(param_1 = nil, param_2 = nil)
Like #listen but providing a handler that will be notified when the server is listening, or fails.
-
- (true, false) metrics_enabled?
Whether the metrics are enabled for this measured object.
Class Method Details
+ (Boolean) accept?(obj)
23 24 25 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/net_server.rb', line 23 def @@j_api_type.accept?(obj) obj.class == NetServer end |
+ (Object) j_api_type
32 33 34 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/net_server.rb', line 32 def self.j_api_type @@j_api_type end |
+ (Object) j_class
35 36 37 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/net_server.rb', line 35 def self.j_class Java::IoVertxCoreNet::NetServer.java_class end |
+ (Object) unwrap(obj)
29 30 31 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/net_server.rb', line 29 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
26 27 28 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/net_server.rb', line 26 def @@j_api_type.wrap(obj) NetServer.new(obj) end |
Instance Method Details
- (Fixnum) actual_port
The actual port the server is listening on. This is useful if you bound the server specifying 0 as port number
signifying an ephemeral port
109 110 111 112 113 114 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/net_server.rb', line 109 def actual_port if !block_given? return @j_del.java_method(:actualPort, []).call() end raise ArgumentError, "Invalid arguments when calling actual_port()" end |
- (void) close { ... }
This method returns an undefined value.
Like #close but supplying a handler that will be notified when close is complete.
100 101 102 103 104 105 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/net_server.rb', line 100 def close if true return @j_del.java_method(:close, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) } unless !block_given?)) end raise ArgumentError, "Invalid arguments when calling close()" end |
- (::Vertx::NetServer) connect_handler { ... }
Supply a connect handler for this server. The server can only have at most one connect handler at any one time.
As the server accepts TCP or SSL connections it creates an instance of Vertx::NetSocket and passes it to the
connect handler.
61 62 63 64 65 66 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/net_server.rb', line 61 def connect_handler if true return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:connectHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::NetSocket)) unless !block_given? })),::Vertx::NetServer) end raise ArgumentError, "Invalid arguments when calling connect_handler()" end |
- (::Vertx::ReadStream) connect_stream
Return the connect stream for this server. The server can only have at most one handler at any one time.
As the server accepts TCP or SSL connections it creates an instance of Vertx::NetSocket and passes it to the
connect stream .
50 51 52 53 54 55 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/net_server.rb', line 50 def connect_stream if !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:connectStream, []).call(),::Vertx::ReadStreamImpl,::Vertx::NetSocket.j_api_type) end raise ArgumentError, "Invalid arguments when calling connect_stream()" end |
- (self) listen(listenHandler) { ... } - (self) listen(port, listenHandler) { ... } - (self) listen(localAddress, listenHandler) { ... } - (self) listen(port, host, listenHandler) { ... }
Like #listen but providing a handler that will be notified when the server is listening, or fails.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/net_server.rb', line 81 def listen(param_1=nil,param_2=nil) if true && param_1 == nil && param_2 == nil @j_del.java_method(:listen, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::NetServer) : nil) } unless !block_given?)) return self elsif param_1.class == Fixnum && true && param_2 == nil @j_del.java_method(:listen, [Java::int.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::NetServer) : nil) } unless !block_given?)) return self elsif param_1.class.method_defined?(:j_del) && true && param_2 == nil @j_del.java_method(:listen, [Java::IoVertxCoreNet::SocketAddress.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1.j_del,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::NetServer) : nil) } unless !block_given?)) return self elsif param_1.class == Fixnum && param_2.class == String && true @j_del.java_method(:listen, [Java::int.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1,param_2,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::NetServer) : nil) } unless !block_given?)) return self end raise ArgumentError, "Invalid arguments when calling listen(#{param_1},#{param_2})" end |
- (true, false) metrics_enabled?
Whether the metrics are enabled for this measured object
40 41 42 43 44 45 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/net_server.rb', line 40 def metrics_enabled? if !block_given? return @j_del.java_method(:isMetricsEnabled, []).call() end raise ArgumentError, "Invalid arguments when calling metrics_enabled?()" end |