Donglai Zhang wrote:
Hi, Martin:

I added a logging statement to the remove method in both RgbWSDFAttHome class and the PersistentRgbWSDFAtt class. According http://www.globus.org/api/javadoc-4.0/globus_java_ws_core/index.html

public void *remove*(ResourceKey 
<http://www.globus.org/api/javadoc-4.0/globus_java_ws_core/org/globus/wsrf/ResourceKey.html>
 key)
            throws ResourceException 
<http://www.globus.org/api/javadoc-4.0/globus_java_ws_core/org/globus/wsrf/ResourceException.html>

"If the resource implements the |RemoveCallback| <http://www.globus.org/api/javadoc-4.0/globus_java_ws_core/org/globus/wsrf/RemoveCallback.html> interface the |RemoveCallback.remove()| <http://www.globus.org/api/javadoc-4.0/globus_java_ws_core/org/globus/wsrf/RemoveCallback.html#remove%28%29> operation will be called."
I overwrote the 'public void remove(ResourceKey key)' method in the 
RgbWSDFAttHome class anyway. But still could
not see the remove logging information. I did see the create() logging information within the same class.

Is there a reason why you overwrote the remove(...) method in your home?
Do you do a call to super.remove(...) in RgbWSDFAttHome.remove(ResourceKey key)?
If not this might be the problem.

Check http://tinyurl.com/83tev3 for ResourceHomeImpl.remove(...). There you can 
see
that remove() is called for the resource before it's removed from the resources 
map,
if it implements RemoveCallback.
I'm rather confident that this mechanism generally works, because it works for
ws-gram (can't say much about the CounterService right now).


I also tried with the Counter service originally packaged in the source code 
and all timeout are set to 120000( 2minutes).

Do you mean the timeout value of the LRUCache as defined in the JNDI 
configuration?
This is not a resource lifetime timeout.

Do you test this only via lifetime expiration, or do you also provide a way for
immediate destruction of a resource in your service, e.g. by making use of the
DestroyProvider?

I just wonder if there's a misunderstanding about lifetime handling here and a
resource is actually never removed.

Martin

They have the same problem. Donglai


On Tue, Jan 20, 2009 at 12:30 PM, Martin Feller <[email protected] <mailto:[email protected]>> wrote:

    Hmm, just to make sure, i assume you know it: Do you feel or do you
    know that the
    remove() method of your resource objects is not invoked when a
    resource is destroyed
    (adding a logging statement should clarify this)?

    How does RgbWSDFAttHome look like: Does it extend from
    org.globus.wsrf.impl.ResourceHomeImpl?
    If so: Do you maybe overwrite 'public void remove(ResourceKey key)'?

    Btw: Your timeout value of 600 in the LRUCache is pretty low: The
    unit is ms

    Martin

    Donglai Zhang wrote:

        Hi, Martin:

        Thanks for your hints!

        I have got a service named RgbWSDFAtt and the "resourceClass" is
        "PersistentRgbWSDFAtt" and the signature of this class is:

        public class PersistentRgbWSDFAtt
           extends RgbWSDFAtt
           implements PersistenceCallback, RemoveCallback {
        ...
        // I also implemented the  remove() method
        public void remove() throws ResourceException {
        //Remove the resource...
        }
        ...
        }

        However, I feel this has never been invoked.  I am not sure if
        the parameters in the deploy-jndi-config.xml has been configured
        properly so the wscore server understands when it should remove
        the resource.
        Donglai

        On Tue, Jan 20, 2009 at 3:25 AM, Martin Feller
        <[email protected] <mailto:[email protected]>
        <mailto:[email protected] <mailto:[email protected]>>> wrote:

           The remove() method of a resource is called by ResourceHome
        if the
           resource
           is removed, if the resource implements the interface
        RemoveCallback.
           (see
http://www.mcs.anl.gov/~gawor/javawscore/HEAD/doc/javadocs/org/globus/wsrf/RemoveCallback.html
        
<http://www.mcs.anl.gov/%7Egawor/javawscore/HEAD/doc/javadocs/org/globus/wsrf/RemoveCallback.html>
<http://www.mcs.anl.gov/%7Egawor/javawscore/HEAD/doc/javadocs/org/globus/wsrf/RemoveCallback.html>)


           But there is no magic that deletes persistence data of a resource
           automatically.
           You have to implement in remove() whatever resource-specific you
           want to happen
           in case a resource is removed, including handling of
        persistence data.

           Martin



           Donglai Zhang wrote:

               Hi,

               I am writing a web service with WS-CORE. I found under
        the directory
/home/globus/.globus/persisted/129.127.XX.XXX-8010/PersistentRgbWSDFAtt,
               there are lots of .ser file.  I have a remove() method in
        class
               org.globus.wsrf.samples.rgbwsdfatt.PersistentRgbWSDFAtt
        (Same as
               the following one in red). I thought this method could
        help me
               remove the reference, but seems not. The following is the
               deploy-jndi-config.xml file of my RgbWSDFAtt service.


               <?xml version="1.0" encoding="UTF-8"?>
               <jndiConfig xmlns="http://wsrf.globus.org/jndi/config";>
                  <service name="RgbWSDFAttService">
                      <resource
                          name="home"
type="org.globus.wsrf.samples.rgbwsdfatt.RgbWSDFAttHome">
                          <resourceParams>
                              <parameter>
                                  <name>resourceClass</name>
<value>org.globus.wsrf.samples.rgbwsdfatt.PersistentRgbWSDFAtt</value>
                              </parameter>
                              <parameter>
                                  <name>resourceKeyName</name>
<value>{http://rgbwsdfatt.com}RgbWSDFAttKey</value>
                              </parameter>
                              <parameter>
                                  <name>resourceKeyType</name>
                                  <value>java.lang.Integer</value>
                              </parameter>
                              <parameter>
                                  <name>cacheLocation</name>
<value>java:comp/env/services/RgbWSDFAttService/cache</value>
                              </parameter>
                          </resourceParams>
                      </resource>
                    <resource name="cache"
                              type="org.globus.wsrf.utils.cache.LRUCache">
                          <resourceParams>
                              <parameter>
                                  <name>timeout</name>
                                  <value>600</value>
                              </parameter>
                          </resourceParams>
                     </resource>
                  </service>
               .....

               I thought the timeout should remove the reference, but it
        seems
               not. Can I (How can I) remove the used resource by
        setting the
               configuration file?
               --        Cheers,


               Donglai Zhang

               School of Computer Science
               University of Adelaide,
               SA, Australia  5083



-- Donglai Zhang

        Ph.D Candidate
        School of Computer Science
        University of Adelaide,
        SA, Australia  5083

        Tel: 0061 8 83036166







--
Donglai Zhang

Ph.D Candidate
School of Computer Science
University of Adelaide,
SA, Australia  5083

Tel: 0061 8 83036166




Reply via email to