0 Replies Latest reply on Mar 3, 2014 5:43 PM by Srinivasan Ram

    Do infinispan provide a way to unregister externalizer ?

    Srinivasan Ram Newbie

      I am running the infinispan core api inside a osgi container. When other service started in osgi, they will register their externalizer through the core api.

      I used the following for registration. I am looking for  a way unregister the externalizer when client service stops.

       

      public void registerExternalizer(Map<Integer,Serializable> classnames) throws IllegalArgumentException

          {

           boolean hasInvalidArg = false;  

           StringBuffer invalidclassNames =new StringBuffer();

           Set<Integer> keys = classnames.keySet();

          for(Iterator iterator = keys.iterator(); iterator.hasNext();)

          {

              Integer key = (Integer)iterator.next();

              Serializable classname  =classnames.get(key);

             

                 

                if(classname instanceof AdvancedExternalizer){

                  

                  GlobalConfiguration gc =  cacheManager.getGlobalComponentRegistry().getGlobalConfiguration();

                  GlobalConfigurationBuilder gcb = new GlobalConfigurationBuilder().read(gc).nonClusteredDefault();

                 

                  gcb.serialization().addAdvancedExternalizer(key,(AdvancedExternalizer)classname);

                  gcb.build();

                 }

                else

                {

                    hasInvalidArg = true;

                    invalidclassNames.append(classname + "  ");

                   

                }

               

          }

            if(hasInvalidArg){

                throw new IllegalArgumentException("The following class is not instance of AdvancedExternalizer.So Cant Register it as Externalizer.  " + invalidclassNames.toString());

            }

            

             

          }

      }