(add-gem-path env config)
Inputs: [env :- #:schema{Str schema/Str} config :- jruby-schemas/JRubyConfig]
Inputs: [env :- #:schema{Str schema/Str} config :- jruby-schemas/JRubyConfig]
(borrow-from-pool pool-context reason event-callbacks)
Inputs: [pool-context :- jruby-schemas/PoolContext reason :- schema/Any event-callbacks :- [IFn]] Returns: jruby-schemas/JRubyInstanceOrPill
Borrows a JRuby interpreter from the pool. If there are no instances left in the pool then this function will block until there is one available.
Inputs: [pool-context :- jruby-schemas/PoolContext reason :- schema/Any event-callbacks :- [IFn]] Returns: jruby-schemas/JRubyInstanceOrPill Borrows a JRuby interpreter from the pool. If there are no instances left in the pool then this function will block until there is one available.
(borrow-from-pool-with-timeout pool-context reason event-callbacks)
Inputs: [pool-context :- jruby-schemas/PoolContext reason :- schema/Any event-callbacks :- [IFn]] Returns: jruby-schemas/JRubyBorrowResult
Borrows a JRuby interpreter from the pool, like borrow-from-pool but a blocking timeout is taken from the config in the context. If an instance is available then it will be immediately returned to the caller, if not then this function will block waiting for an instance to be free for the number of milliseconds given in timeout. If the timeout runs out then nil will be returned, indicating that there were no instances available.
Inputs: [pool-context :- jruby-schemas/PoolContext reason :- schema/Any event-callbacks :- [IFn]] Returns: jruby-schemas/JRubyBorrowResult Borrows a JRuby interpreter from the pool, like borrow-from-pool but a blocking timeout is taken from the config in the context. If an instance is available then it will be immediately returned to the caller, if not then this function will block waiting for an instance to be free for the number of milliseconds given in timeout. If the timeout runs out then nil will be returned, indicating that there were no instances available.
(cli-ruby! config args)
Inputs: [config :- jruby-schemas/JRubyConfig args :- [schema/Str]] Returns: jruby-schemas/JRubyMainStatus
Run JRuby as though native ruby
were invoked with args on the CLI
Inputs: [config :- jruby-schemas/JRubyConfig args :- [schema/Str]] Returns: jruby-schemas/JRubyMainStatus Run JRuby as though native `ruby` were invoked with args on the CLI
(cli-run! config command args)
Inputs: [config :- jruby-schemas/JRubyConfig command :- schema/Str args :- [schema/Str]] Returns: (schema/maybe jruby-schemas/JRubyMainStatus)
Run a JRuby CLI command, e.g. gem, irb, etc...
Inputs: [config :- jruby-schemas/JRubyConfig command :- schema/Str args :- [schema/Str]] Returns: (schema/maybe jruby-schemas/JRubyMainStatus) Run a JRuby CLI command, e.g. gem, irb, etc...
Default timeout when borrowing instances from the JRuby pool in milliseconds. Current value is 1200000ms, or 20 minutes.
Default timeout when borrowing instances from the JRuby pool in milliseconds. Current value is 1200000ms, or 20 minutes.
Default timeout when flushing the JRuby pool in milliseconds. Current value is 1200000ms, or 20 minutes.
Default timeout when flushing the JRuby pool in milliseconds. Current value is 1200000ms, or 20 minutes.
(default-initialize-scripting-container scripting-container config)
Inputs: [scripting-container :- jruby-schemas/ConfigurableJRuby config :- jruby-schemas/JRubyConfig] Returns: jruby-schemas/ConfigurableJRuby
Default lifecycle fn for initializing the settings on the scripting container. Currently it just sets the environment variables.
Inputs: [scripting-container :- jruby-schemas/ConfigurableJRuby config :- jruby-schemas/JRubyConfig] Returns: jruby-schemas/ConfigurableJRuby Default lifecycle fn for initializing the settings on the scripting container. Currently it just sets the environment variables.
Default for JRuby's CompileMode setting. Defaults to JIT for Jruby 9k.
Default for JRuby's CompileMode setting. Defaults to JIT for Jruby 9k.
(default-pool-size num-cpus)
Calculate the default size of the JRuby pool, based on the number of cpus.
Calculate the default size of the JRuby pool, based on the number of cpus.
A list of environment variables that are allowed to be passed through from the environment.
A list of environment variables that are allowed to be passed through from the environment.
(flush-pool! pool-context)
Inputs: [pool-context]
Flush all the current JRubyInstances and repopulate the pool.
Inputs: [pool-context] Flush all the current JRubyInstances and repopulate the pool.
(flush-pool-for-shutdown! pool-context)
Inputs: [pool-context]
Flush all the current JRubyInstances so that the pool can be shutdown without any instances being active.
Inputs: [pool-context] Flush all the current JRubyInstances so that the pool can be shutdown without any instances being active.
(free-instance-count pool)
Inputs: [pool :- jruby-schemas/pool-queue-type]
Returns the number of JRubyInstances available in the pool.
Inputs: [pool :- jruby-schemas/pool-queue-type] Returns the number of JRubyInstances available in the pool.
(get-event-callbacks pool-context)
Inputs: [pool-context :- jruby-schemas/PoolContext] Returns: [IFn]
Gets the vector of event callbacks from the pool context.
Inputs: [pool-context :- jruby-schemas/PoolContext] Returns: [IFn] Gets the vector of event callbacks from the pool context.
(get-instance-state jruby-instance)
Inputs: [jruby-instance :- JRubyInstance] Returns: jruby-schemas/JRubyInstanceState
Get the state metadata for a JRubyInstance.
Inputs: [jruby-instance :- JRubyInstance] Returns: jruby-schemas/JRubyInstanceState Get the state metadata for a JRubyInstance.
(get-jruby-thread-dump pool-context)
Inputs: [pool-context :- jruby-schemas/PoolContext]
Get thread dumps from JRuby instances in the pool.
Inputs: [pool-context :- jruby-schemas/PoolContext] Get thread dumps from JRuby instances in the pool.
(get-pool context)
Inputs: [context :- jruby-schemas/PoolContext] Returns: jruby-schemas/pool-queue-type
Gets the JRuby pool object from the pool context.
Inputs: [context :- jruby-schemas/PoolContext] Returns: jruby-schemas/pool-queue-type Gets the JRuby pool object from the pool context.
(get-pool-state context)
Inputs: [context :- jruby-schemas/PoolContext] Returns: jruby-schemas/PoolState
Gets the PoolState from the pool context.
Inputs: [context :- jruby-schemas/PoolContext] Returns: jruby-schemas/PoolState Gets the PoolState from the pool context.
(get-system-env)
Inputs: [] Returns: jruby-schemas/EnvPersistentMap
Same as System/getenv, but returns a clojure persistent map instead of a Java unmodifiable map.
Inputs: [] Returns: jruby-schemas/EnvPersistentMap Same as System/getenv, but returns a clojure persistent map instead of a Java unmodifiable map.
(initialize-config config)
Inputs: [config :- #:schema{Keyword schema/Any}] Returns: jruby-schemas/JRubyConfig
Initialize keys with default settings if they are not given a value. The config is validated after these defaults are set.
Inputs: [config :- #:schema{Keyword schema/Any}] Returns: jruby-schemas/JRubyConfig Initialize keys with default settings if they are not given a value. The config is validated after these defaults are set.
(initialize-lifecycle-fns config)
Inputs: [config :- (schema/maybe {(schema/optional-key :initialize-pool-instance) IFn, (schema/optional-key :cleanup) IFn, (schema/optional-key :shutdown-on-error) IFn, (schema/optional-key :initialize-scripting-container) IFn})] Returns: jruby-schemas/LifecycleFns
Inputs: [config :- (schema/maybe {(schema/optional-key :initialize-pool-instance) IFn, (schema/optional-key :cleanup) IFn, (schema/optional-key :shutdown-on-error) IFn, (schema/optional-key :initialize-scripting-container) IFn})] Returns: jruby-schemas/LifecycleFns
Default version info string for jruby
Default version info string for jruby
(lock-pool pool-context reason event-callbacks)
Inputs: [pool-context :- jruby-schemas/PoolContext reason :- schema/Any event-callbacks :- [IFn]]
Locks the JRuby pool for exclusive access.
Inputs: [pool-context :- jruby-schemas/PoolContext reason :- schema/Any event-callbacks :- [IFn]] Locks the JRuby pool for exclusive access.
(lock-pool-with-timeout pool-context timeout-ms reason event-callbacks)
Inputs: [pool-context :- jruby-schemas/PoolContext timeout-ms :- schema/Int reason :- schema/Any event-callbacks :- [IFn]]
Locks the JRuby pool for exclusive access using a timeout in milliseconds. If the timeout is exceeded, a TimeoutException will be thrown and the pool will remain unlocked
Inputs: [pool-context :- jruby-schemas/PoolContext timeout-ms :- schema/Int reason :- schema/Any event-callbacks :- [IFn]] Locks the JRuby pool for exclusive access using a timeout in milliseconds. If the timeout is exceeded, a TimeoutException will be thrown and the pool will remain unlocked
(managed-environment env config)
Inputs: [env :- jruby-schemas/EnvMap config :- jruby-schemas/JRubyConfig] Returns: jruby-schemas/EnvMap
The environment variables that should be passed to the JRuby interpreters.
We don't want them to read any ruby environment variables, like $RUBY_LIB or anything like that, so pass it an empty environment map - except - most things needs HOME and PATH to work, so leave those, along with GEM_HOME and GEM_PATH, which are necessary for extensions that depend on gems.
We need to set the JARS..REQUIRE variables in order to instruct JRuby's 'jar-dependencies' to not try to load any dependent jars. This is being done specifically to avoid JRuby trying to load its own version of Bouncy Castle, which may not the same as the one that 'puppetlabs/ssl-utils' uses. JARS_NO_REQUIRE was the legacy way to turn off jar loading but is being phased out in favor of JARS_REQUIRE. As of JRuby 1.7.20, only JARS_NO_REQUIRE is honored. Setting both of those here for forward compatibility.
We also merge an environment-vars map with the config to allow for configured environment variables to be visible to the Ruby code. This map is by default set to {} if the user does not specify it in the configuration file.
Inputs: [env :- jruby-schemas/EnvMap config :- jruby-schemas/JRubyConfig] Returns: jruby-schemas/EnvMap The environment variables that should be passed to the JRuby interpreters. We don't want them to read any ruby environment variables, like $RUBY_LIB or anything like that, so pass it an empty environment map - except - most things needs HOME and PATH to work, so leave those, along with GEM_HOME and GEM_PATH, which are necessary for extensions that depend on gems. We need to set the JARS..REQUIRE variables in order to instruct JRuby's 'jar-dependencies' to not try to load any dependent jars. This is being done specifically to avoid JRuby trying to load its own version of Bouncy Castle, which may not the same as the one that 'puppetlabs/ssl-utils' uses. JARS_NO_REQUIRE was the legacy way to turn off jar loading but is being phased out in favor of JARS_REQUIRE. As of JRuby 1.7.20, only JARS_NO_REQUIRE is honored. Setting both of those here for forward compatibility. We also merge an environment-vars map with the config to allow for configured environment variables to be visible to the Ruby code. This map is by default set to {} if the user does not specify it in the configuration file.
A list of proxy-related variables that are allowed to be passed the environment
A list of proxy-related variables that are allowed to be passed the environment
(register-event-handler pool-context callback-fn)
Inputs: [pool-context :- jruby-schemas/PoolContext callback-fn :- IFn]
Register the callback function by adding it to the event callbacks atom on the pool context.
Inputs: [pool-context :- jruby-schemas/PoolContext callback-fn :- IFn] Register the callback function by adding it to the event callbacks atom on the pool context.
(registered-instances context)
Inputs: [context :- jruby-schemas/PoolContext] Returns: [JRubyInstance]
Inputs: [context :- jruby-schemas/PoolContext] Returns: [JRubyInstance]
(return-to-pool pool-context instance reason event-callbacks)
Inputs: [pool-context :- jruby-schemas/PoolContext instance :- jruby-schemas/JRubyInstanceOrPill reason :- schema/Any event-callbacks :- [IFn]]
Return a borrowed pool instance to its free pool.
Inputs: [pool-context :- jruby-schemas/PoolContext instance :- jruby-schemas/JRubyInstanceOrPill reason :- schema/Any event-callbacks :- [IFn]] Return a borrowed pool instance to its free pool.
(unlock-pool pool-context reason event-callbacks)
Inputs: [pool-context :- jruby-schemas/PoolContext reason :- schema/Any event-callbacks :- [IFn]]
Unlocks the JRuby pool, restoring concurernt access.
Inputs: [pool-context :- jruby-schemas/PoolContext reason :- schema/Any event-callbacks :- [IFn]] Unlocks the JRuby pool, restoring concurernt access.
(with-jruby-instance jruby-instance pool-context reason & body)
Encapsulates the behavior of borrowing and returning a JRubyInstance. Example usage:
(let [pool-manager-service (tk-app/get-service app :PoolManagerService) pool-context (pool-manager/create-pool pool-manager-service config)] (with-jruby-instance jruby-instance pool-context reason
(do-something-with-a-jruby-instance jruby-instance)))
Will throw an IllegalStateException if borrowing a JRubyInstance times out.
Encapsulates the behavior of borrowing and returning a JRubyInstance. Example usage: (let [pool-manager-service (tk-app/get-service app :PoolManagerService) pool-context (pool-manager/create-pool pool-manager-service config)] (with-jruby-instance jruby-instance pool-context reason (do-something-with-a-jruby-instance jruby-instance))) Will throw an IllegalStateException if borrowing a JRubyInstance times out.
(with-lock pool-context reason & body)
Acquires a lock on the pool, executes the body, and releases the lock.
Acquires a lock on the pool, executes the body, and releases the lock.
(with-lock-with-timeout pool-context timeout-ms reason & body)
Acquires a lock on the pool with a timeout in milliseconds, executes the body, and releases the lock. If the timeout is exceeded, a TimeoutException will be thrown
Acquires a lock on the pool with a timeout in milliseconds, executes the body, and releases the lock. If the timeout is exceeded, a TimeoutException will be thrown
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close