immutant.util documentation

Various utility functions.

app-name

(app-name)
Returns the internal name for the app as Immutant sees it

app-relative

(app-relative & path)
Returns an absolute file relative to app-root

app-root

(app-root)
Returns a file pointing to the root dir of the application

app-uri

(app-uri & [host])
Returns the base URI for the app, given a host [localhost]

at-exit

(at-exit f)
Registers a function to be called when the application is undeployed.
Used internally to shutdown various services, but can be used by
application code as well.

backoff

macro

(backoff start end & body)
A simple backoff strategy that retries body in the event of error.
The first retry occurs after sleeping start milliseconds, the next
after start*2 ms, and so on, until the sleep time exceeds end ms,
at which point the caught error is tossed.

classpath

(classpath)
Returns the effective classpath for the app

context-path

(context-path)
Returns the HTTP context path for the deployed app

dev-mode?

(dev-mode?)
Returns true if the app is running in dev mode.

hornetq-remoting-port

(hornetq-remoting-port)
Returns the port that HornetQ is listening on for remote connections

http-port

(http-port)
Returns the HTTP port for the embedded web server

in-immutant?

(in-immutant?)
Returns true if running inside an Immutant container

lookup-interface-address

(lookup-interface-address iface)
Looks up the ip address from the proper service for the given name.

management-interface-address

Looks up the ip address for the AS management interface.

maybe-deref

(maybe-deref v & args)
derefs v if it is derefable, otherwise returns v

port

(port socket-binding-name)
Returns the (possibly offset) port from the socket-binding in standalone.xml

profile-active?

(profile-active? id)
Returns true if the leiningen profile is active

public-interface-address

Looks up the ip address for the AS public interface.

require-resolve

(require-resolve sym)
Requires and resolves the given namespace-qualified symbol.

set-bean-property

(set-bean-property bean prop value)
Calls a java bean-style setter (.setFooBar) for the given property (:foo-bar) and value.

try-import

(try-import sym)
Tries to import the given symbol, returning the class on success.

try-resolve

(try-resolve sym)
Tries to require and resolve the given namespace-qualified symbol, returning nil if not found.

try-resolve-any

(try-resolve-any & syms)
Tries to resolve the given namespace-qualified symbols. Returns the
first successfully resolved symbol, or nil if none of the given symbols
resolve.

unsecure-interface-address

Looks up the ip address for the AS unsecure interface.

wait-for

(wait-for t)(wait-for t f)(wait-for t f attempts)
Waits for (t) to be true before invoking f, if passed. Evaluates
test every 100 ms attempts times before giving up. Attempts
defaults to 300. Passing :forever for attempts will loop until the
end of time or (t) is true, whichever comes first.

wait-for-start

(wait-for-start x)(wait-for-start x f)(wait-for-start x f attempts)
Waits for (.isStarted x) to be true before returning or invoking f.

waiting-derefable

(waiting-derefable t x)
Returns an IDeref/IBlockingDeref that completes the deref and returns x when
(t) is true.

when-import

macro

(when-import sym & body)
Executes body when sym is successfully imported