Search code examples
rubyjrubyjrubyonrails

Jruby Glassfish Memory split


I have a very strange problem where after a day or two, it seems that my app splits the memory in half.

So I have a:

class Persist
    @@hash ||= Hash.new

    def store(k, v)
        @@hash[k] = v
    end

    def get(k)
        return @@hash[k]
    end

    def dumpHash()
        @@hash.each do |k, v|
            p k, v
        end
    end
end

Now I have something in the controller calling get and store. At first it works fine, but after a day or two...

Call: store(1, 1), store(2, 2), store(3, 3), store(4, 4), store(5, 5)

Now, when I call dumpHash()

I get: 2, 2 and 4, 4.

I call it again and:

1, 1 and 3, 3 and 5, 5

this is jruby 1.6.0 r3 warbled and put on glassfish.

Is there any way that glassfish redeploys my app without me knowing and it breaks stuff?

any help is appreciated. I am so confused...


Solution

  • Underlying problem:

    glassfish/tomcat Java Server load class once