Liking cljdoc? Tell your friends :D

puppetlabs.services.jruby-pool-manager.jruby-core


add-gem-pathclj

(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]
sourceraw docstring

borrow-from-poolclj

(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.
sourceraw docstring

borrow-from-pool-with-timeoutclj

(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.
sourceraw docstring

cli-ruby!clj

(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
sourceraw docstring

cli-run!clj

(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...
sourceraw docstring

default-borrow-timeoutclj

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.
sourceraw docstring

default-flush-timeoutclj

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.
sourceraw docstring

default-initialize-scripting-containerclj

(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.
sourceraw docstring

default-jruby-compile-modeclj

Default for JRuby's CompileMode setting. Defaults to JIT for Jruby 9k.

Default for JRuby's CompileMode setting. Defaults to JIT for Jruby
9k.
sourceraw docstring

default-pool-sizeclj

(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.
sourceraw docstring

env-vars-allowed-listclj

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.
sourceraw docstring

flush-pool!clj

(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.
sourceraw docstring

flush-pool-for-shutdown!clj

(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.
sourceraw docstring

free-instance-countclj

(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.
sourceraw docstring

get-event-callbacksclj

(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.
sourceraw docstring

get-instance-stateclj

(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.
sourceraw docstring

get-jruby-thread-dumpclj

(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.
sourceraw docstring

get-poolclj

(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.
sourceraw docstring

get-pool-stateclj

(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.
sourceraw docstring

get-system-envclj

(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.
sourceraw docstring

initialize-configclj

(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.
sourceraw docstring

initialize-lifecycle-fnsclj

(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
sourceraw docstring

jruby-version-infoclj

Default version info string for jruby

Default version info string for jruby
sourceraw docstring

lock-poolclj

(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.
sourceraw docstring

lock-pool-with-timeoutclj

(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
sourceraw docstring

managed-environmentclj

(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.
sourceraw docstring

proxy-vars-allowed-listclj

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
sourceraw docstring

register-event-handlerclj

(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.
sourceraw docstring

registered-instancesclj

(registered-instances context)

Inputs: [context :- jruby-schemas/PoolContext] Returns: [JRubyInstance]

Inputs: [context :- jruby-schemas/PoolContext]
Returns: [JRubyInstance]
sourceraw docstring

return-to-poolclj

(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.
sourceraw docstring

unlock-poolclj

(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.
sourceraw docstring

with-jruby-instancecljmacro

(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.
sourceraw docstring

with-lockcljmacro

(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.
sourceraw docstring

with-lock-with-timeoutcljmacro

(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
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close