manticore 0.5.4-java → 0.5.5-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40995659e9b7257957446803d3e19d4ff633fa58
4
- data.tar.gz: 351c5343d32e1944663d5c796bc221ef3b2453b6
3
+ metadata.gz: 111c250ba25bbaa0452c9bee6bd1ad09b589a007
4
+ data.tar.gz: a6dac53321a576076f418e47729a90bdfd85504e
5
5
  SHA512:
6
- metadata.gz: 025f7f1769aa67b0edb3bb567be722df970d827d6060802c992b09f24672cc839f74f3a2e7a37aa5cb76ec2ce1e7437dc47c667f2be8b89c666040ed68c1e563
7
- data.tar.gz: 861b575e15e8a10a6f072495472e693541c7576e172e665320b807a190f50ed95279cb77c92bf2ecd1ce77a2cc433d85132f18d2c8a36452eb8607d6690b90a1
6
+ metadata.gz: e20565e5b7a754d475c894eca5a4d718fcea9848e47dea4bb836747fd12cf166486faf4d0604a9eb72addf319833f0c8a54bec45e5c099315b361e5cda251695
7
+ data.tar.gz: 7ef91033ae1aff1dffea2ba44816e0665d76c951267a4832f5175cb25b732fece0a656a39c13dc09ac5c847fe3e7a6b129dd35d2370d6365981d060f42c4fe6f
@@ -1,12 +1,19 @@
1
1
  language: ruby
2
2
  sudo: false
3
+ cache:
4
+ - bundler
5
+ - directories:
6
+ - $HOME/.m2
3
7
  rvm:
4
8
  - jruby-1.7
5
- - jruby-9.0.0.0
9
+ - jruby-9.0.5.0
6
10
  jdk:
7
11
  - oraclejdk8
8
12
  - oraclejdk7
9
13
  - openjdk7
14
+ before_install:
15
+ - gem install ruby-maven
16
+ - bundle install
10
17
  matrix:
11
18
  include:
12
19
  - rvm: jruby-head
@@ -1,6 +1,20 @@
1
1
  ## v0.5
2
2
 
3
- ### v0.5.2 (pending)
3
+ ### v0.5.6 (pending)
4
+
5
+ ### v0.5.5
6
+
7
+ * Marked Executor threads as daemon threads, so they won't impede host process shutdown
8
+
9
+ ### v0.5.4
10
+
11
+ * Fixed a memory leak caused by at_exit hooks, which would cause allocated HttpClient resources to remain in scope even if a Client instance was collected
12
+
13
+ ### v0.5.3
14
+
15
+ * Reduce the stale connection check default time to 2000ms for consistency with the HttpClient defaults
16
+
17
+ ### v0.5.2
4
18
 
5
19
  * Added Client#close to shut down the connection pool.
6
20
 
data/Gemfile CHANGED
@@ -3,10 +3,12 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in manticore.gemspec
4
4
  gemspec
5
5
 
6
- gem "net-http-server", "~> 0.2"
7
- gem "rspec", "~> 3.0"
8
- gem "rspec-its"
9
- gem "httpclient", "~> 2.3"
10
- gem "rack", "~> 1.5"
11
- gem "rake-compiler"
12
- gem "gserver"
6
+ group :development, :test do
7
+ gem "net-http-server", "~> 0.2"
8
+ gem "rspec", "~> 3.0"
9
+ gem "rspec-its"
10
+ gem "httpclient", "~> 2.3"
11
+ gem "rack", "~> 1.5"
12
+ gem "rake-compiler"
13
+ gem "gserver"
14
+ end
@@ -1,5 +1,6 @@
1
1
  require 'thread'
2
2
  require 'base64'
3
+ require 'weakref'
3
4
 
4
5
  module Manticore
5
6
  # @!macro [new] http_method_shared
@@ -89,6 +90,18 @@ module Manticore
89
90
  java_import "org.manticore.HttpDeleteWithEntity"
90
91
  java_import "org.apache.http.auth.UsernamePasswordCredentials"
91
92
 
93
+ # This is a class rather than a proc because the proc holds a closure around
94
+ # the instance of the Client that creates it.
95
+ class ExecutorThreadFactory
96
+ include ::Java::JavaUtilConcurrent::ThreadFactory
97
+
98
+ def newThread(runnable)
99
+ thread = Executors.defaultThreadFactory.newThread(runnable)
100
+ thread.daemon = true
101
+ return thread
102
+ end
103
+ end
104
+
92
105
  include ProxiesInterface
93
106
 
94
107
  # The default maximum pool size for requests
@@ -207,6 +220,7 @@ module Manticore
207
220
 
208
221
  builder.set_default_request_config request_config.build
209
222
  @client = builder.build
223
+ finalize @client, :close
210
224
  @options = options
211
225
  @async_requests = []
212
226
  @stubs = {}
@@ -353,7 +367,7 @@ module Manticore
353
367
  # a proc to avoid creating a closure that would maintain a reference to this client, which
354
368
  # would prevent the client from being cleaned up.
355
369
  def finalize(object, args)
356
- @finalizers << [object, Array(args)]
370
+ @finalizers << [WeakRef.new(object), Array(args)]
357
371
  end
358
372
 
359
373
  def url_as_regex(url)
@@ -396,7 +410,7 @@ module Manticore
396
410
 
397
411
  def create_executor_if_needed
398
412
  return @executor if @executor
399
- @executor = Executors.new_cached_thread_pool
413
+ @executor = Executors.new_cached_thread_pool(ExecutorThreadFactory.new)
400
414
  finalize @executor, :shutdown
401
415
  end
402
416
 
@@ -1,3 +1,3 @@
1
1
  module Manticore
2
- VERSION = "0.5.4"
2
+ VERSION = "0.5.5"
3
3
  end
@@ -1,8 +1,8 @@
1
1
  # this is a generated file, to avoid over-writing it just delete this comment
2
2
  require 'jar_dependencies'
3
3
 
4
- require_jar( 'org.apache.httpcomponents', 'httpclient', '4.5' )
5
4
  require_jar( 'org.apache.httpcomponents', 'httpcore', '4.4.1' )
6
5
  require_jar( 'commons-codec', 'commons-codec', '1.9' )
7
6
  require_jar( 'commons-logging', 'commons-logging', '1.2' )
8
7
  require_jar( 'org.apache.httpcomponents', 'httpmime', '4.5' )
8
+ require_jar( 'org.apache.httpcomponents', 'httpclient', '4.5' )
@@ -27,6 +27,7 @@ Gem::Specification.new do |spec|
27
27
 
28
28
  spec.add_development_dependency "bundler", "~> 1.3"
29
29
  spec.add_development_dependency "rake"
30
+ spec.add_development_dependency 'ruby-maven', '~> 3.3'
30
31
 
31
32
  spec.add_runtime_dependency "jar-dependencies"
32
33
  spec.requirements << "jar org.apache.httpcomponents:httpclient, 4.5"
@@ -13,32 +13,23 @@ describe Manticore::Client do
13
13
  end
14
14
 
15
15
  context "for synchronous requests" do
16
- it "responds only stub the next subsequent response" do
16
+ it "stubs the request" do
17
17
  stub = client.respond_with(body: "body", code: 200)
18
18
 
19
19
  stub.get(local_server) do |response|
20
20
  expect(response).to be_a Manticore::StubbedResponse
21
21
  end
22
-
23
- stub.get(local_server) do |response|
24
- expect(response).to be_a Manticore::Response
25
- end
26
22
  end
27
23
  end
28
24
 
29
- context "for synchronous requests" do
30
- it "responds only stub the next subsequent response" do
25
+ context "for asynchronous requests" do
26
+ it "stubs all response made through the proxy" do
31
27
  stub = client.respond_with(body: "body", code: 200)
32
28
 
33
- stub.async.get(local_server).on_success do |response|
34
- expect(response).to be_a Manticore::StubbedResponse
35
- end
36
-
37
- stub.async.get(local_server).on_success do |response|
38
- expect(response).to be_a Manticore::Response
39
- end
29
+ stub.async.get(local_server)
30
+ stub.async.get(local_server)
40
31
 
41
- client.execute!
32
+ expect( client.execute!.map(&:class) ).to eq [Manticore::StubbedResponse, Manticore::StubbedResponse]
42
33
  end
43
34
  end
44
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: manticore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: java
6
6
  authors:
7
7
  - Chris Heald
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-14 00:00:00.000000000 Z
11
+ date: 2016-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '3.3'
47
+ name: ruby-maven
48
+ prerelease: false
49
+ type: :development
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.3'
41
55
  - !ruby/object:Gem::Dependency
42
56
  requirement: !ruby/object:Gem::Requirement
43
57
  requirements: