Coder Social home page Coder Social logo

optionalg / jruby-utils Goto Github PK

View Code? Open in Web Editor NEW

This project forked from puppetlabs/jruby-utils

0.0 2.0 0.0 3.82 MB

Tools for working with JRuby from Clojure

License: Other

Makefile 3.05% Ruby 0.01% Shell 0.09% Clojure 78.25% Java 18.60%

jruby-utils's Introduction

JRuby Utils

A library for creating and interacting with a pool of JRuby instances in Clojure.

Build Status

Usage

This is a brief overview of the functionality of this library; TODO add more docs.

This library provides three public namespaces: puppetlabs.services.jruby-pool-manager.jruby-schemas, puppetlabs.services.jruby-pool-manager.jruby-pool-manager-service, and puppetlabs.services.jruby-pool-manager.jruby-core.

The entry-point into most of the functionality this library provides is the jruby-pool-manager-service Trapperkeeper service's create-pool, which creates and returns a pool context and asynchronously starts filling the pool.

create-pool takes a config matching the JRubyConfig schema; this config can be created and provided defaults by the jruby-core/initialize-config function. The non-optional config settings that you must provide are ruby-load-path and gem-home.

You can provide custom initialization and callback logic by providing lifecycle functions for initializing the scripting container, initializing the pool instance, cleaning up a pool instance, and cleaning up the pool for shutdown.

After the pool has been created, use the borrow and return functions to work with instances. There is a with-jruby-instance macro to make this easier. There is also a with-lock macro that holds a lock on the pool (so that no borrows can take place) while you execute some logic.

In most TK apps where you want to work with JRuby instances, you will want to call create-pool in the init lifecycle of your service, and then call jruby-core/flush-pool-for-shutdown! in the stop lifecycle function.

Running tests

Clojure unit tests can be run with either a 1.7-based JRuby or 9k-based JRuby version. To run tests with a 1.7-based JRuby, just run:

lein test

To run tests with a 9k-based JRuby, run:

lein with-profile +jruby9k test

License

See LICENSE.

Support

We use the Trapperkeeper project on JIRA for tickets on this project, although Github issues are welcome too.

jruby-utils's People

Contributors

camlow325 avatar cprice404 avatar nwolfe avatar kevincorcoran avatar haus avatar rlinehan avatar jpinsonault avatar mslilah avatar puppetlabs-jenkins avatar gguillotte avatar nfagerlund avatar dankreek avatar vilmibm avatar justinstoller avatar jtappa avatar nicklewis avatar adrienthebo avatar stahnma avatar waynr avatar briancain avatar elyscape avatar hunner avatar jasperla avatar scotje avatar mmckinst avatar melissa avatar petems avatar inhumantsar avatar steveax avatar call avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.