Problems with caching

From: Ayhan Kondoz (Ayhan.Kondo..reenet-ag.de)
Date: Thu Feb 09 2006 - 10:53:03 EST

  • Next message: Cris Daniluk: "Re: queries in TransactionDelegate spawn new connection"

    Hi,

    i am trying to use the caching feature of cayenne but i can't get it to
    work
    properly. I have 2 different problems but first a quick explanation of
    my
    environment.

    I have multiple servers and each of them has it's own tomcat5
    installation.
    Within the tomcat5 I have an axis webservice that uses cayenne 1.1.3 to
    interface with a database and provides SOAP services.

    Each SOAP Service uses a similar logic.
     (a) Get the customer object, using a SelectQuery.
     (b) Perform the job using accounts and other object that are related to
         this customer.

    What I would like to have is something like this
     (1) Cacheing of the SelectQuery (used in step (a))to prevent
    unnecessary
         database IO for subsequent SOAP calls with the same customer.
     (2) Caching of objects that have a relationship to the customer.
    Meaning
         that if the first SOAP call accesses the accounts of a customer
         subsequent SOAP calls should NOT read them from the database again.
    The
         accounts should be cached along with the customer and calls to
         Customer().getAccount() should read the accounts from cache.
     (3) Changes made on one Server should be send to all other servers so
    that
         Objects that are cached can be refreshed.

    The first objective is easy and I had no problems with it.

    Expression exp = Expression.fromString("cid=" + cid);
    SelectQuery query = new SelectQuery(Customer.class, exp);
    query.setName("Customer"+cid);
    query.setCachePolicy(GenericSelectQuery.SHARED_CACHE);
    query.setRefreshingObjects(false);
    query.addPrefetch("accounts");

    It is the second and third objective I am having problems with. No
    matter what I try the snapshot events are not relayed to the other
    servers.

    My cayenne.xml looks like this:

    <property name="cayenne.JavaGroupsBridge.mcast.port" value="42000"/>
    <property name="cayenne.DataDomain.validatingObjectsOnCommit"
    value="true"/>
    <property name="cayenne.DataRowStore.remote.notify" value="true"/>
    <property name="cayenne.DataDomain.sharedCache" value="true"/>
    <property name="cayenne.JavaGroupsBridge.mcast.address"
    value="228.1.1.5"/>
    <property name="cayenne.DataRowStore.EventBridge.factory"
    value="org.objectstyle.cayenne.event.JavaGroupsBridgeFactory"/>

    JavaGroups seems to work fine, at least the McastReceiverTest and
    McastSenderTest from the JavaGroups documentation works.
    Nevertheless the snapshot events do not reach the other servers.

    Ideas? Comments?

    Thanks
    Ayhan Kondoz



    This archive was generated by hypermail 2.0.0 : Thu Feb 09 2006 - 10:53:42 EST