Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

A cluster question

Ilyschenko, Vlad

2004-05-26

Replies:

Hello,

I have a session bean that changes its state as pages call methods on that bean. I want this bean to be replictated to other cluster members but it seems like it gets replicated only once, straight after it is created.

Is there any other way to force replication apart from calling session.setAttribute(name, bean) ? I have tried useDirtyFlag true and false - no luck.

The application is "distributed" and all other things do get replicated.

Regards,
Vlad

This is a little test case for my problem:

test.jsp:
---------

<jsp:useBean id="mybean" class="TestBean" scope="session" />
<%
  out.print(mybean.a());
%>


TestBean.java
-------------

import org.apache.log4j.Logger;

import java.io.Serializable;
import java.io.IOException;
import java.util.Random;

public class TestBean implements Serializable{

  private static Logger logger = Logger.getLogger(TestBean.class);

  private long m_a = 0;
  private Random rnd = new Random(System.currentTimeMillis());

  public long a() {
    m_a = rnd.nextLong();
    return m_a;
  }

  private void writeObject(java.io.ObjectOutputStream out) throws IOException {
    //logger.debug("Serialized");
    System.out.println("Serialized");
    out.defaultWriteObject();
  }

  private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();
//     logger.debug("Deserialized");
    System.out.println("Deserialized");

  }
}





********************************************************************************
The information contained in this email message may be confidential. If you are not the intended recipient, any use, interference with, disclosure or copying of this material is unauthorised and prohibited. Although this message and any attachments are believed to be free of viruses, no responsibility is accepted by Informa for any loss or damage arising in any way from receipt or use thereof. Messages to and from the company are monitored for operational reasons and in accordance with lawful business practices.
If you have received this message in error, please notify us by return and delete the message and any attachments. Further enquiries/returns can be sent to postmaster@(protected)


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.