[jboss-user] [JBossCache] - New Bie JBoss Cache Replication
chandra_88
do-not-reply at jboss.com
Tue Feb 26 02:30:05 EST 2008
Hi,
I have two jboss instances running on a single machine with different ports
VM1 - port 8280
VM2 - port 8380
The jboss instances are participating in a cluster. I have a simple war containing a servlet and i have deployed in the farm folder of VM1 so that the war gets replicated in the other VM2 instance.
I have a simple servlet which creates a cache and echoes its value.
| public class MyServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
| static final long serialVersionUID = 1L;
| TreeCacheMBean cache;
| private int count = 0;
| public MyServlet() {
| super();
| init();
| }
|
| public void init()
| {
| MBeanServer server=MBeanServerLocator.locateJBoss();
|
| try{
| cache=(TreeCacheMBean)MBeanProxyExt.create(TreeCacheMBean.class, "jboss.cache:service=TreeCache", server);
|
| }
| catch(Exception exp)
| {
| exp.printStackTrace();
| }
|
| }
|
| protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
| // TODO Auto-generated method stub
| try{
| count++;
| cache.put("/a/b/c","Key1",count);
| cache.put("/a/b/d","Key2",count);
| response.setContentType("text/html");
| PrintWriter out = response.getWriter();
| out.println("<HTML><HEAD><TITLE>");
| Integer cachevalue = (Integer)cache.get("/a/b/c", "Key1");
| out.println(cachevalue.intValue());
|
>From this code i expected when i do http://:8280 the cache to be created and put some values in the cache . Say i made a request 10 times to this location the count val should be 10 .
Now when i hit the url http://:8380 the value should be 10 it echoes 0 . Is it a wrong test case to test if so how i can make sure the cache gets replicated in this scenario. Note I have copied a rep-Syncservice.xml in the deploy folders of both the vm instanaces.
let me know how do i fix this
- Many Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4132045#4132045
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4132045
More information about the jboss-user
mailing list