Re: Hazelcast - two web-apps on one server uses one Map<> - incremently allocating ports

120 views
Skip to first unread message

Enes Akar

unread,
May 22, 2013, 9:13:25 AM5/22/13
to haze...@googlegroups.com
Where do you call below line?
private static HazelcastInstance instance = Hazelcast.newHazelcastInstance();

It should be called once for each app. 


On Wed, May 22, 2013 at 4:03 PM, <michael.k...@gmail.com> wrote:
Hello, everyone. I'm a newbie at Hazelcast and i try to use it for my goals. I have to different web apps, both have the same logic layer (compiled into jar) and two different front ends. In my test environment they are both running the same Tomcat7. I want to use Hazelcast distributed map to cache some business logic data between these two apps. The code that uses Hazelcast seems pretty simple:

final static String DistributedMapName = "SystemUserActivityMap";
private static HazelcastInstance instance = Hazelcast.newHazelcastInstance();

I created hazelcast.xml and placed it in both web-apps into resources dir:
    <network>
        <port auto-increment="true">5701</port>
        <join>
            <multicast enabled="false">
                <multicast-group>224.2.2.3</multicast-group>
                <multicast-port>54327</multicast-port>
            </multicast>
            <tcp-ip enabled="true">
                <interface>127.0.0.1</interface>
            </tcp-ip>
            <aws enabled="false">
            </aws>
        </join>
    </network>
    <map name="SystemUserActivityMap">
        <backup-count>0</backup-count>
        <time-to-live-seconds>0</time-to-live-seconds>
        <max-idle-seconds>86400</max-idle-seconds>
        <eviction-policy>NONE</eviction-policy>
        <max-size>0</max-size>
        <eviction-percentage>25</eviction-percentage>
    </map>
</hazelcast>

And soon after starting my apps, i saw in Tomcat errorlog strange messages: it seems that Hazelcast starts allocationg new ports: 
initially it was
Members [1] {
Member [127.0.0.1]:5701 this
}
and soon it was
Members [9] {
Member [127.0.0.1]:5701
Member [127.0.0.1]:5702
Member [127.0.0.1]:5703
Member [127.0.0.1]:5704
Member [127.0.0.1]:5705
Member [127.0.0.1]:5706
Member [127.0.0.1]:5707 this
Member [127.0.0.1]:5708
Member [127.0.0.1]:5709
}
and it's continue incrementing and so on...
what's wrong with my config, code or usage scenario?
Thanks for any help..

--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+...@googlegroups.com.
To post to this group, send email to haze...@googlegroups.com.
Visit this group at http://groups.google.com/group/hazelcast?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Enes Akar
Hazelcast | Open source in-memory data grid
Mobile: +90.505.394.1668
Reply all
Reply to author
Forward
0 new messages