Class: AbstractServer

Inherits:
Object
  • Object
show all
Defined in:
lib/thrift_client/abstract_server.rb

Overview

abstract thrift server information encapsulation

hold client connection

Direct Known Subclasses

MultiClientServer, SingleClientServer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connect_string, options = {}) ⇒ AbstractServer

Returns a new instance of AbstractServer.



9
10
11
12
13
14
# File 'lib/thrift_client/abstract_server.rb', line 9

def initialize(connect_string, options = {})
  @host, @port = parse_connect_string(connect_string)
  @options = options
  @test_on_borrow = @options[:test_on_borrow]
  @test_on_return = @options[:test_on_return]
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



7
8
9
# File 'lib/thrift_client/abstract_server.rb', line 7

def client
  @client
end

#hostObject (readonly)

Returns the value of attribute host.



7
8
9
# File 'lib/thrift_client/abstract_server.rb', line 7

def host
  @host
end

#portObject (readonly)

Returns the value of attribute port.



7
8
9
# File 'lib/thrift_client/abstract_server.rb', line 7

def port
  @port
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


16
17
18
# File 'lib/thrift_client/abstract_server.rb', line 16

def active?
  raise NotImplementedError
end

#destroyObject

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/thrift_client/abstract_server.rb', line 20

def destroy
  raise NotImplementedError
end

#disconnect(client) ⇒ Object



24
25
26
# File 'lib/thrift_client/abstract_server.rb', line 24

def disconnect(client)
  client.close if client
end

#to_sObject



28
29
30
# File 'lib/thrift_client/abstract_server.rb', line 28

def to_s
  "#{host}:#{port}"
end