--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/924ef7cd-d674-44c3-b81f-d32fea667f61%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
If it works programmatically, what is wrong with my hazelcast.xml? Can you please share a working sample xml or point out where is wrong? Or do XML config works differently from the programmatic way? Thanks!
If it works programmatically, what is wrong with my hazelcast.xml? Can you please share a working sample xml or point out where is wrong? Or do XML config works differently from the programmatic way? Thanks!
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/6912e717-b81b-4484-bdf4-0fa192f393b1%40googlegroups.com.
Weird. If I run that in a program (without connecting to hazelcast mancenter 3.1.5), then I can't repro (i.e. the map entry is evicted when ttl expires). However, if I start a standalone/dedicated node using com.hazelcast.examples.StartServer, then the map entry is not evicted. But both useHazelcast.newHazelcastInstance(null) with hazelcast.xml in same dir/classpath to initiate hazelcast. Any clue what went wrong?
Weird. If I run that in a program (without connecting to hazelcast mancenter 3.1.5), then I can't repro (i.e. the map entry is evicted when ttl expires). However, if I start a standalone/dedicated node using com.hazelcast.examples.StartServer, then the map entry is not evicted. But both useHazelcast.newHazelcastInstance(null) with hazelcast.xml in same dir/classpath to initiate hazelcast. Any clue what went wrong?
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/696600ca-c907-42ce-a845-799a728166ba%40googlegroups.com.
I am able to reproduce this by calling the REST interface (I used the Apached common HTTP Client 3.0.1) to put the key/value. It seems to do with the Hazelcast REST interface implementation. Enclosed is the test and attached is the hazelcast.xml used by the test.
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import org.junit.Assert;
import com.hazelcast.client.HazelcastClient;
import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.config.ClasspathXmlConfig;
import com.hazelcast.config.Config;
import com.hazelcast.config.FileSystemXmlConfig;
import com.hazelcast.config.MapConfig;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.IMap;
public class HazelcastTest {
public static void main(String[] args) throws Exception {
HazelcastTest c = new HazelcastTest();
c.testTtlUsingHttpClientAgainstRestInterface();
}
public void testTtlUsingHttpClientAgainstRestInterface() throws Exception {
Config config = new FileSystemXmlConfig("hazelcast.xml");
final MapConfig mapConfig = config.getMapConfig("testMap");
System.out.println(mapConfig.getBackupCount());
System.out.println(mapConfig.getTimeToLiveSeconds());
System.out.println(mapConfig.getMaxIdleSeconds());
System.out.println(mapConfig.getName());
final HazelcastInstance instance = Hazelcast.newHazelcastInstance(config);
HttpClient client = new HttpClient();
String url = "http://localhost:5701/hazelcast/rest/maps/testMap/key2";
PostMethod post = new PostMethod(url);
post.setRequestBody("value2");
int resp = client.executeMethod(post);
// System.out.println(resp);
GetMethod get = new GetMethod(url);
Thread.sleep(1000);
client.executeMethod(get);
System.out.println(get.getStatusCode());
System.out.println(get.getResponseBodyAsString());
Assert.assertNotNull(get.getResponseBodyAsString());
Thread.sleep(1000);
client.executeMethod(get);
System.out.println(get.getStatusCode());
System.out.println(get.getResponseBodyAsString());
Assert.assertNotNull(get.getResponseBodyAsString());
Thread.sleep(5000);
client.executeMethod(get);
System.out.println(get.getStatusCode());
System.out.println(get.getResponseBodyAsString());
Assert.assertNull(get.getResponseBodyAsString());
}
}--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/4a1db87f-a0d5-46de-a6f1-b890d6e9c323%40googlegroups.com.