62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
# File 'lib/server.rb', line 62
def initialize(args, &block)
unless args[:log_level].nil?
if args[:log_level] > Options::LogLevel::FINE.ordinal
puts "Arguments: "
args.each do |k, v|
puts "\t#{k}=>#{v}"
end
end
if args[:log_level] > Options::LogLevel::INFO.ordinal
debug = true
end
end
java.lang.System.getProperties().put("jruby.runtime", JRuby.runtime) unless args[:daemon]
@opts = Options.new
@opts.runtimes = args[:runtimes]
@opts.runtimes_min = args[:runtimes_min]
@opts.runtimes_max = args[:runtimes_max]
@opts.environment = args[:environment]
@opts.port = args[:port]
@opts.address = args[:address]
@opts.contextRoot = args[:contextroot]
@opts.appDir = args[:app_dir]
@opts.daemon = args[:daemon]
@opts.pid = args[:pid]
@opts.log = args[:log]
@opts.log_console = args[:log_console]
@opts.domainDir = args[:domain_dir]
@opts.log_level = Options::LogLevel.values()[args[:log_level]]
@opts.jvm_opts = args[:jvm_options]
unless args[:grizzly_config].nil?
args[:grizzly_config].each do |key, val|
case key
when "chunking-enabled"
@opts.grizzlyConfig.chunkingEnabled = val unless val.nil?
when "request-timeout"
@opts.grizzlyConfig.requestTimeout = val unless val.nil?
when "send-buffer-size"
@opts.grizzlyConfig.sendBufferSize = val unless val.nil?
when "max-keepalive-connextions"
@opts.grizzlyConfig.maxKeepaliveConnections = val unless val.nil?
when "keepalive-timeout"
@opts.grizzlyConfig.keepaliveTimeout = val unless val.nil?
when "thread-pool"
unless val.nil?
val.each do |k, v|
case k
when "idle-thread-timeout-seconds"
@opts.grizzlyConfig.threadPool.idleThreadTimeoutSeconds = v unless v.nil?
when "max-queue-size"
@opts.grizzlyConfig.threadPool.maxQueueSize = v unless v.nil?
when "max-thread-pool-size"
@opts.grizzlyConfig.threadPool.maxThreadPoolSize = v unless v.nil?
when "min-thread-pool-size"
@opts.grizzlyConfig.threadPool.minThreadPoolSize = v unless v.nil?
end
end
end
end
end
end
if block_given?
app = Rack::Builder.new(&block).to_app
app = Rack::CommonLogger.new(@app) if debug
if app.nil?
app = block
end
@opts.app = app;
java.lang.System.getProperties().put("glassfish.rackupApp", app)
end
end
|