4 Replies Latest reply on Aug 20, 2004 11:01 PM by Ben Wang

    Thread safety?

    Mark Frost Newbie

      We are planning to use the TreeCache in our clustered production JBoss environment.

      We will be invoking the TreeCache methods (via JMX MBean) from a Stateless Session Bean.

      Are there any threading issues to consider? We have currently not placed any synchronization around any method calls to TreeCache.

      Many thanks.


      Code example from SLSB:

       public void put(String cacheSystemName, CacheKey key, VersionedXml value) throws CacheException {
       //put into cache
       Fqn fqn = new Fqn(this.rootFqn, ((FqnCacheKey) key).getFqn());
       Object[] args = new Object[] {fqn, STANDARD_KEY, value};
       String[] sig = new String[] {FQN_CLASS_NAME, OBJECT_CLASS_NAME, OBJECT_CLASS_NAME};
       //Invoke the put() method
       _invoke("put", args, sig);
       private Object _invoke(String methodName, Object[] args, String[] sig) throws CacheException {
       try {
       return JBossUtils.locateJBoss().invoke(cacheService, methodName, args, sig);
       } catch (Exception ex) {
       throw new CacheException("Error invoking method " + methodName + " on TreeCache", ex);