Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Try to use Ehcache from CLASSPATH before bundled.

  • Loading branch information...
commit bc6f2a9be3329b1fdc27e484d86cd6e671107262 1 parent e68d78e
Jason Voegele authored
Showing with 12 additions and 1 deletion.
  1. +12 −1 lib/ehcache/java.rb
View
13 lib/ehcache/java.rb
@@ -1,6 +1,17 @@
-module Ehcache
+require 'java'
+
+begin
+ # If Ehcache is already on the classpath, use it.
+ ehcache_version = Java::NetSfEhcacheUtil::ProductInfo.new.getVersion()
+ puts("Using Ehcache #{ehcache_version} from CLASSPATH")
+rescue NameError
+ # If not, use the Ehcache bundled with the jruby-ehcache gem.
Dir["#{Ehcache::EHCACHE_HOME}/ext/**/*.jar"].sort.each {|l| require l}
+ ehcache_version = Java::NetSfEhcacheUtil::ProductInfo.new.getVersion()
+ puts("Using bundled Ehcache #{ehcache_version}")
+end
+module Ehcache
include_package 'net.sf.ehcache'
module Config

0 comments on commit bc6f2a9

Please sign in to comment.
Something went wrong with that request. Please try again.