Hi, 

I have an OSGI (Karaf) setup where I have two isolated instances of Clojure 
deployed & running in two bundles (within the same JVM), 
and I am seeing a problem where passing Clojure Objects (such as 
PersistentArrayMaps) from one clojure bundle to another, breaks clojure 
interfaces 
at the receiving end. The two bundles communicate via a OSGI services.

The specific problem/example is as follows:

Lets say that I have two Clojure bundle instances running in Apache Karaf 
(clj-bundle-A) and (clj-bundle-B)

clj-bundle-A registers an interface implementation with the OSGI registry. 
 The interface looks like:
   public interface clojureCall {
     Object callMethod(Object request);
 }
 
clj-bundle-B looks up the interface from the OSGI registry and calls the 
method, the code looks like this:
(defn call-bundle-a []
    ; service is an instance of clojureCall implemented in clj-bundle-a
   (let [service (lookup-osgi-registry-bundle-a)]
     ; send a map as a request 
     (.callMethod service {"hello" "world"})))


An instance of the PersistentHashMap {"hello" "world"} is sent from 
clj-bundle-B to clj-bundle-A; 
However, clj-bundle-A only sees it as a Java object with its clojure 
interfaces not realized.
      
For example on clj-bundle-A, the passed in argument looks like
> (println request)
#<PersistentArrayMap {"hello" "world"}  *<== I would expect it to print 
{"hello" "map"} instead it is realizing this as a Java object.*

> (println (type request))
clojure.lang.PersistentHashMap  *<== The type information is saved, but the 
interface is broken*

> (map? request)
false

> (instance? java.util.Map request)  *<== the java interfaces are realized 
correctly*
true
          
I figure that the problem may be related to the two Clojure-Bundles are not 
sharing any classes between them, since they are running in different 
isolated bundles. 
I want to have to multiple instances of clojures running so as to run 
multiple versions of the sample clj file in the same JVM 

I am wondering if anyone has any suggestions on how to avoid this problem.

Thanks,
Rama

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to