@@ -75,11 +75,6 @@ def release
7575
7676 private_constant :HEAP_RATIO , :KILO
7777
78- # Installs the Downloaded InstallAnywhere (tm) BIN file to the target directory
79- #
80- # @param [String] target_directory, Where the java needs to be installed
81- # @param [File] file, InstallAnywhere (tm) BIN file
82- # @return [Void]
8378 def install_bin ( target_directory , file )
8479 FileUtils . mkdir_p target_directory
8580 response_file = Tempfile . new ( 'response.properties' )
@@ -92,7 +87,6 @@ def install_bin(target_directory, file)
9287 shell "#{ file . path } -i silent -f #{ response_file . path } 2>&1"
9388 end
9489
95- # Returns the max heap size ('-Xmx') value
9690 def mem_opts
9791 mopts = [ ]
9892 total_memory = memory_limit_finder
@@ -106,12 +100,10 @@ def mem_opts
106100 mopts
107101 end
108102
109- # Returns the heap_ratio attribute in config file (if specified) or the HEAP_RATIO constant value
110103 def heap_ratio
111104 @configuration [ 'heap_ratio' ] || HEAP_RATIO
112105 end
113106
114- # Returns the container total memory limit in bytes
115107 def memory_limit_finder
116108 memory_limit = ENV [ 'MEMORY_LIMIT' ]
117109 return nil unless memory_limit
@@ -120,10 +112,6 @@ def memory_limit_finder
120112 memory_limit_size
121113 end
122114
123- # Returns the no. of bytes for a given string of minified size representation
124- #
125- # @param [String] size, A minified memory representation string
126- # @return [Integer] bytes, value of size in bytes
127115 def memory_size_bytes ( size )
128116 if size == '0'
129117 bytes = 0
@@ -139,11 +127,6 @@ def memory_size_bytes(size)
139127 bytes
140128 end
141129
142- # Returns the no. of bytes for a given memory size unit
143- #
144- # @param [String] unit, Represents a Memory Size Unit
145- # @param [Integer] value
146- # @return [Integer] bytes, value of size in bytes
147130 def calculate_bytes ( unit , value )
148131 if %w[ b B ] . include? ( unit )
149132 bytes = value
@@ -159,25 +142,15 @@ def calculate_bytes(unit, value)
159142 bytes
160143 end
161144
162- # Checks whether the given value is an Integer
163- #
164- # @param [String] v, value as a string
165145 def check_is_integer? ( v )
166146 v = Float ( v )
167147 v && v . floor == v
168148 end
169149
170- # Calculates the Heap size as per the Heap ratio
171- #
172- # @param [Integer] membytes, total memory in bytes
173- # @param [Numeric] heapratio, Desired/Default Heap Ratio
174150 def heap_size_calculator ( membytes , heapratio )
175151 memory_size_minified ( membytes * heapratio )
176152 end
177153
178- # Calculates the Memory Size in a Minified String Representation
179- #
180- # @param [Numeric] membytes, calculated heap size
181154 def memory_size_minified ( membytes )
182155 giga = membytes / 2 **( 10 * 3 )
183156 mega = membytes / 2 **( 10 * 2 )
@@ -191,16 +164,10 @@ def memory_size_minified(membytes)
191164 end
192165 end
193166
194- # Returns the minified memory string
195- #
196- # @param [Integer] order, calculated memory value
197- # @param [String] char, calculated memory unit
198- # @return [String] minified memory string
199167 def minified_size_calculator ( order , char )
200168 order . to_i . to_s + char
201169 end
202170
203- # Verifies whether heap ratio is valid
204171 def heap_ratio_verification ( ratio )
205172 raise 'Invalid heap ratio' unless ratio . is_a? Numeric
206173 raise 'heap ratio cannot be greater than 100%' unless ratio <= 1
0 commit comments