[JBossCache] - How to access TreeCache from MBean ?
by raameshwar
Hi ,
I am new to both JBoss Cache and MBeans.
I am trying to deploy JBoss TreeCache as MBean in Sun Java Application Server 9. I am able to deploy it and start successfully and i am able to access the cache through the following code.
ObjectInstance object = server.getObjectInstance(name);
TreeCache cache = (TreeCache)server.instantiate(object.getClassName(),null);
cache.createService();
cache.put("/a/b/c", map);
The problem i face is, i cannot access the same instance of cache if i access the MBean from other applications. What is the api i should use if i want to access the JBoss Cache from different applications. The server.instantiate() method always gives a new instance.
Any pointers would be of great help.
Thanks,
Raameshwar.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4032079#4032079
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4032079
19Â years
[JBoss Seam] - Re: Question on Stateless Session Bean
by hasc
after a while i got this working.
@Stateless
| @Name("building")
| public class BuildingListAction implements BuildingList,Serializable{
|
| private static final long serialVersionUID = 1L;
|
| private List<BuildingType> objects;
| Map<String,BuildingType> buildingsMap;
|
| @PersistenceContext
| EntityManager em;
|
| public Map<String,BuildingType> getBuildings()
| {
| objects = em.createQuery("select b from BuildingType b")
| .setHint("org.hibernate.cacheable", true)
| .getResultList();
|
| Map<String,BuildingType> results = new TreeMap<String,BuildingType>();
|
| for (BuildingType buildingtype: objects)
| {
| results.put(buildingtype.getName(),buildingtype);
| }
|
| buildingsMap = results;
|
| return buildingsMap;
| }
|
| public Converter getConverter()
| {
| return new BuildingTypeConverter(objects);
| }
| }
im not familiar with ejb but this obviously leads to a query every time the method getBuildings() is called. My goal is to load the objects only once and then return a list every time the methos is called. Can somone help me with that or point me to an example or tutorial which describes that?
regards,
hasc
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4032071#4032071
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4032071
19Â years