executors 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,7 @@ module Executors
9
9
  attr_accessor :logger
10
10
  @@executors = {}
11
11
 
12
- # Gets an executor with the specified identifer.
12
+ # Gets an executor with the specified identifer symbol.
13
13
  def get(id)
14
14
  @@executors[id]
15
15
  end
@@ -34,8 +34,14 @@ module Executors
34
34
  get_executor "single"
35
35
  end
36
36
 
37
- # Sets an executor against the specified identifer.
37
+ # Returns a single ScheduledExecutorService[http://download.oracle.com/javase/6/docs/api/java/util/concurrent/Executors.html#newSingleThreadScheduledExecutor()].
38
+ def get_single_scheduled_executor()
39
+ get_executor "single_scheduled"
40
+ end
41
+
42
+ # Sets an executor against the specified identifer symbol.
38
43
  def set(id, executor)
44
+ id = id.to_sym unless id.is_a? Symbol
39
45
  @@executors[id] = executor
40
46
  end
41
47
  end
@@ -1,3 +1,3 @@
1
1
  module Executors
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -7,7 +7,7 @@ module Executors
7
7
  module YamlParser
8
8
  YAML_EXECUTOR_ID_KEY = "id"
9
9
  YAML_EXECUTOR_TYPE_KEY = "type"
10
- YAML_EXECUTOR_TYPE_VALID = [ "cached", "fixed", "scheduled", "single" ]
10
+ YAML_EXECUTOR_TYPE_VALID = [ "cached", "fixed", "scheduled", "single", "single_scheduled" ]
11
11
  YAML_EXECUTOR_SIZE_KEY = "size"
12
12
  YAML_EXECUTOR_TYPES_REQUIRING_SIZE = [ "fixed", "scheduled" ]
13
13
 
@@ -141,6 +141,8 @@ module Executors
141
141
  return java.util.concurrent.Executors.new_scheduled_thread_pool size
142
142
  when "single"
143
143
  return java.util.concurrent.Executors.new_single_thread_executor
144
+ when "single_scheduled"
145
+ return java.util.concurrent.Executors.new_single_thread_scheduled_executor
144
146
  else
145
147
  return nil
146
148
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Phil Ostler
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-18 00:00:00 +00:00
17
+ date: 2011-01-20 00:00:00 +00:00
18
18
  default_executable:
19
19
  dependencies: []
20
20