CustomEntryTimeToLive Gemfire 8.2.11 entry does not expire
Good afternoon friends.
I need help with gemfire version 8.2.11.
My Class config
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScans;
import org.springframework.context.annotation.Configuration;
import com.gemstone.gemfire.cache.client.ClientCache;
import com.gemstone.gemfire.cache.client.ClientCacheFactory;
import com.gemstone.gemfire.pdx.ReflectionBasedAutoSerializer;
@Configuration
@ComponentScans({
@ComponentScan("br.com.teste.gemfire.ttl.util"),
@ComponentScan("br.com.teste.gemfire.ttl.writer")})
public class GemfireConfiguration {
private ClientCacheFactory clientCacheFactory() {
return new ClientCacheFactory()
.set("name", GemfireConfiguration.class.getSimpleName())
.set("mcast-port", "0")
.set("log-level", "config")
.set("jmx-manager", "false")
.set("jmx-manager-port", "1099")
.set("jmx-manager-start", "false")
.set("security-log-level","all")
.setPdxReadSerialized(false)
.setPdxSerializer(new ReflectionBasedAutoSerializer("br.com.teste.ExpirationObject"))
.setPdxIgnoreUnreadFields(true)
.setPdxPersistent(true)
.addPoolLocator("hostLocator1",10000)
.addPoolLocator("hostLocator2",10000);
}
@Bean(destroyMethod="close")
public ClientCache clientCache() {
return clientCacheFactory().create();
}
}
My Writer class
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.gemfire.ExpirationActionType;
import org.springframework.data.gemfire.support.GemfireCacheManager;
import org.springframework.stereotype.Component;
import com.gemstone.gemfire.cache.AttributesMutator;
import com.gemstone.gemfire.cache.ExpirationAttributes;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.client.ClientCache;
import com.gemstone.gemfire.cache.client.ClientRegionFactory;
import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
import com.gemstone.gemfire.cache.query.FunctionDomainException;
import com.gemstone.gemfire.cache.query.NameResolutionException;
import com.gemstone.gemfire.cache.query.Query;
import com.gemstone.gemfire.cache.query.QueryInvocationTargetException;
import com.gemstone.gemfire.cache.query.SelectResults;
import com.gemstone.gemfire.cache.query.TypeMismatchException;
import br.com.teste.gemfire.ttl.util.ObjectCustomExpiry;
@Component
public class WriterInRegion {
@Autowired
private ClientCache clientCache ;
public void writer() {
ClientRegionFactory<Long, ExpirationObject> clientRegionFactory = clientCache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY_HEAP_LRU);
clientRegionFactory.setStatisticsEnabled(true);
Region<Long, ExpirationObject> region = clientRegionFactory.create("ExpirationObject");
AttributesMutator<Long, ExpirationObject> attributesMutator = region.getAttributesMutator();
attributesMutator.setCustomEntryTimeToLive(new ObjectCustomExpiry());
ExpirationObject expirationObject= new ExpirationObject();
expirationObject.setId(11111111111L);
expirationObject.setValue(50);
expirationObject.setTimeToLive(15);
clientCache.getCacheTransactionManager().begin();
region.create(expirationObject.getId(), expirationObject);
clientCache.getCacheTransactionManager().commit();
region.localClear();
region.localDestroyRegion();
}
}
My CustomTTL class
import java.util.Properties;
import org.springframework.data.gemfire.ExpirationActionType;
import com.gemstone.gemfire.cache.CustomExpiry;
import com.gemstone.gemfire.cache.Declarable;
import com.gemstone.gemfire.cache.ExpirationAttributes;
import com.gemstone.gemfire.cache.Region.Entry;
public class ObjectCustomExpiry implements CustomExpiry<Long,ExpirationObject>,Declarable {
@Override
public void close() {
}
@Override
public ExpirationAttributes getExpiry(Entry<Long,ExpirationObject> entry) {
try {
System.out.println("Create expiration ttl");
ExpirationObject expirationObject = entry.getValue();
return new ExpirationAttributes(expirationObject.getTimeToLive(), ExpirationActionType.INVALIDATE.getExpirationAction());
} catch (Exception e) {
}
return new ExpirationAttributes(10, ExpirationActionType.INVALIDATE.getExpirationAction());
}
@Override
public void init(Properties props) {
}
}
Gemfire server result
Cluster gfsh>query --query="select * from /ExpirationObject"
Result : true
startCount : 0
endCount : 20
Rows : 1
Query Trace : Query Executed in 2.733096 ms; indexesUsed(0)
Id | value | timeToLive
-------------| ----- | ----------
11111111111L | 50 | 15
NEXT_STEP_NAME : END
My problem is that after 15 seconds the entry does not expire in locators and servers.
Can you help me ?
java gemfire
add a comment |
Good afternoon friends.
I need help with gemfire version 8.2.11.
My Class config
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScans;
import org.springframework.context.annotation.Configuration;
import com.gemstone.gemfire.cache.client.ClientCache;
import com.gemstone.gemfire.cache.client.ClientCacheFactory;
import com.gemstone.gemfire.pdx.ReflectionBasedAutoSerializer;
@Configuration
@ComponentScans({
@ComponentScan("br.com.teste.gemfire.ttl.util"),
@ComponentScan("br.com.teste.gemfire.ttl.writer")})
public class GemfireConfiguration {
private ClientCacheFactory clientCacheFactory() {
return new ClientCacheFactory()
.set("name", GemfireConfiguration.class.getSimpleName())
.set("mcast-port", "0")
.set("log-level", "config")
.set("jmx-manager", "false")
.set("jmx-manager-port", "1099")
.set("jmx-manager-start", "false")
.set("security-log-level","all")
.setPdxReadSerialized(false)
.setPdxSerializer(new ReflectionBasedAutoSerializer("br.com.teste.ExpirationObject"))
.setPdxIgnoreUnreadFields(true)
.setPdxPersistent(true)
.addPoolLocator("hostLocator1",10000)
.addPoolLocator("hostLocator2",10000);
}
@Bean(destroyMethod="close")
public ClientCache clientCache() {
return clientCacheFactory().create();
}
}
My Writer class
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.gemfire.ExpirationActionType;
import org.springframework.data.gemfire.support.GemfireCacheManager;
import org.springframework.stereotype.Component;
import com.gemstone.gemfire.cache.AttributesMutator;
import com.gemstone.gemfire.cache.ExpirationAttributes;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.client.ClientCache;
import com.gemstone.gemfire.cache.client.ClientRegionFactory;
import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
import com.gemstone.gemfire.cache.query.FunctionDomainException;
import com.gemstone.gemfire.cache.query.NameResolutionException;
import com.gemstone.gemfire.cache.query.Query;
import com.gemstone.gemfire.cache.query.QueryInvocationTargetException;
import com.gemstone.gemfire.cache.query.SelectResults;
import com.gemstone.gemfire.cache.query.TypeMismatchException;
import br.com.teste.gemfire.ttl.util.ObjectCustomExpiry;
@Component
public class WriterInRegion {
@Autowired
private ClientCache clientCache ;
public void writer() {
ClientRegionFactory<Long, ExpirationObject> clientRegionFactory = clientCache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY_HEAP_LRU);
clientRegionFactory.setStatisticsEnabled(true);
Region<Long, ExpirationObject> region = clientRegionFactory.create("ExpirationObject");
AttributesMutator<Long, ExpirationObject> attributesMutator = region.getAttributesMutator();
attributesMutator.setCustomEntryTimeToLive(new ObjectCustomExpiry());
ExpirationObject expirationObject= new ExpirationObject();
expirationObject.setId(11111111111L);
expirationObject.setValue(50);
expirationObject.setTimeToLive(15);
clientCache.getCacheTransactionManager().begin();
region.create(expirationObject.getId(), expirationObject);
clientCache.getCacheTransactionManager().commit();
region.localClear();
region.localDestroyRegion();
}
}
My CustomTTL class
import java.util.Properties;
import org.springframework.data.gemfire.ExpirationActionType;
import com.gemstone.gemfire.cache.CustomExpiry;
import com.gemstone.gemfire.cache.Declarable;
import com.gemstone.gemfire.cache.ExpirationAttributes;
import com.gemstone.gemfire.cache.Region.Entry;
public class ObjectCustomExpiry implements CustomExpiry<Long,ExpirationObject>,Declarable {
@Override
public void close() {
}
@Override
public ExpirationAttributes getExpiry(Entry<Long,ExpirationObject> entry) {
try {
System.out.println("Create expiration ttl");
ExpirationObject expirationObject = entry.getValue();
return new ExpirationAttributes(expirationObject.getTimeToLive(), ExpirationActionType.INVALIDATE.getExpirationAction());
} catch (Exception e) {
}
return new ExpirationAttributes(10, ExpirationActionType.INVALIDATE.getExpirationAction());
}
@Override
public void init(Properties props) {
}
}
Gemfire server result
Cluster gfsh>query --query="select * from /ExpirationObject"
Result : true
startCount : 0
endCount : 20
Rows : 1
Query Trace : Query Executed in 2.733096 ms; indexesUsed(0)
Id | value | timeToLive
-------------| ----- | ----------
11111111111L | 50 | 15
NEXT_STEP_NAME : END
My problem is that after 15 seconds the entry does not expire in locators and servers.
Can you help me ?
java gemfire
add a comment |
Good afternoon friends.
I need help with gemfire version 8.2.11.
My Class config
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScans;
import org.springframework.context.annotation.Configuration;
import com.gemstone.gemfire.cache.client.ClientCache;
import com.gemstone.gemfire.cache.client.ClientCacheFactory;
import com.gemstone.gemfire.pdx.ReflectionBasedAutoSerializer;
@Configuration
@ComponentScans({
@ComponentScan("br.com.teste.gemfire.ttl.util"),
@ComponentScan("br.com.teste.gemfire.ttl.writer")})
public class GemfireConfiguration {
private ClientCacheFactory clientCacheFactory() {
return new ClientCacheFactory()
.set("name", GemfireConfiguration.class.getSimpleName())
.set("mcast-port", "0")
.set("log-level", "config")
.set("jmx-manager", "false")
.set("jmx-manager-port", "1099")
.set("jmx-manager-start", "false")
.set("security-log-level","all")
.setPdxReadSerialized(false)
.setPdxSerializer(new ReflectionBasedAutoSerializer("br.com.teste.ExpirationObject"))
.setPdxIgnoreUnreadFields(true)
.setPdxPersistent(true)
.addPoolLocator("hostLocator1",10000)
.addPoolLocator("hostLocator2",10000);
}
@Bean(destroyMethod="close")
public ClientCache clientCache() {
return clientCacheFactory().create();
}
}
My Writer class
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.gemfire.ExpirationActionType;
import org.springframework.data.gemfire.support.GemfireCacheManager;
import org.springframework.stereotype.Component;
import com.gemstone.gemfire.cache.AttributesMutator;
import com.gemstone.gemfire.cache.ExpirationAttributes;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.client.ClientCache;
import com.gemstone.gemfire.cache.client.ClientRegionFactory;
import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
import com.gemstone.gemfire.cache.query.FunctionDomainException;
import com.gemstone.gemfire.cache.query.NameResolutionException;
import com.gemstone.gemfire.cache.query.Query;
import com.gemstone.gemfire.cache.query.QueryInvocationTargetException;
import com.gemstone.gemfire.cache.query.SelectResults;
import com.gemstone.gemfire.cache.query.TypeMismatchException;
import br.com.teste.gemfire.ttl.util.ObjectCustomExpiry;
@Component
public class WriterInRegion {
@Autowired
private ClientCache clientCache ;
public void writer() {
ClientRegionFactory<Long, ExpirationObject> clientRegionFactory = clientCache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY_HEAP_LRU);
clientRegionFactory.setStatisticsEnabled(true);
Region<Long, ExpirationObject> region = clientRegionFactory.create("ExpirationObject");
AttributesMutator<Long, ExpirationObject> attributesMutator = region.getAttributesMutator();
attributesMutator.setCustomEntryTimeToLive(new ObjectCustomExpiry());
ExpirationObject expirationObject= new ExpirationObject();
expirationObject.setId(11111111111L);
expirationObject.setValue(50);
expirationObject.setTimeToLive(15);
clientCache.getCacheTransactionManager().begin();
region.create(expirationObject.getId(), expirationObject);
clientCache.getCacheTransactionManager().commit();
region.localClear();
region.localDestroyRegion();
}
}
My CustomTTL class
import java.util.Properties;
import org.springframework.data.gemfire.ExpirationActionType;
import com.gemstone.gemfire.cache.CustomExpiry;
import com.gemstone.gemfire.cache.Declarable;
import com.gemstone.gemfire.cache.ExpirationAttributes;
import com.gemstone.gemfire.cache.Region.Entry;
public class ObjectCustomExpiry implements CustomExpiry<Long,ExpirationObject>,Declarable {
@Override
public void close() {
}
@Override
public ExpirationAttributes getExpiry(Entry<Long,ExpirationObject> entry) {
try {
System.out.println("Create expiration ttl");
ExpirationObject expirationObject = entry.getValue();
return new ExpirationAttributes(expirationObject.getTimeToLive(), ExpirationActionType.INVALIDATE.getExpirationAction());
} catch (Exception e) {
}
return new ExpirationAttributes(10, ExpirationActionType.INVALIDATE.getExpirationAction());
}
@Override
public void init(Properties props) {
}
}
Gemfire server result
Cluster gfsh>query --query="select * from /ExpirationObject"
Result : true
startCount : 0
endCount : 20
Rows : 1
Query Trace : Query Executed in 2.733096 ms; indexesUsed(0)
Id | value | timeToLive
-------------| ----- | ----------
11111111111L | 50 | 15
NEXT_STEP_NAME : END
My problem is that after 15 seconds the entry does not expire in locators and servers.
Can you help me ?
java gemfire
Good afternoon friends.
I need help with gemfire version 8.2.11.
My Class config
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScans;
import org.springframework.context.annotation.Configuration;
import com.gemstone.gemfire.cache.client.ClientCache;
import com.gemstone.gemfire.cache.client.ClientCacheFactory;
import com.gemstone.gemfire.pdx.ReflectionBasedAutoSerializer;
@Configuration
@ComponentScans({
@ComponentScan("br.com.teste.gemfire.ttl.util"),
@ComponentScan("br.com.teste.gemfire.ttl.writer")})
public class GemfireConfiguration {
private ClientCacheFactory clientCacheFactory() {
return new ClientCacheFactory()
.set("name", GemfireConfiguration.class.getSimpleName())
.set("mcast-port", "0")
.set("log-level", "config")
.set("jmx-manager", "false")
.set("jmx-manager-port", "1099")
.set("jmx-manager-start", "false")
.set("security-log-level","all")
.setPdxReadSerialized(false)
.setPdxSerializer(new ReflectionBasedAutoSerializer("br.com.teste.ExpirationObject"))
.setPdxIgnoreUnreadFields(true)
.setPdxPersistent(true)
.addPoolLocator("hostLocator1",10000)
.addPoolLocator("hostLocator2",10000);
}
@Bean(destroyMethod="close")
public ClientCache clientCache() {
return clientCacheFactory().create();
}
}
My Writer class
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.gemfire.ExpirationActionType;
import org.springframework.data.gemfire.support.GemfireCacheManager;
import org.springframework.stereotype.Component;
import com.gemstone.gemfire.cache.AttributesMutator;
import com.gemstone.gemfire.cache.ExpirationAttributes;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.client.ClientCache;
import com.gemstone.gemfire.cache.client.ClientRegionFactory;
import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
import com.gemstone.gemfire.cache.query.FunctionDomainException;
import com.gemstone.gemfire.cache.query.NameResolutionException;
import com.gemstone.gemfire.cache.query.Query;
import com.gemstone.gemfire.cache.query.QueryInvocationTargetException;
import com.gemstone.gemfire.cache.query.SelectResults;
import com.gemstone.gemfire.cache.query.TypeMismatchException;
import br.com.teste.gemfire.ttl.util.ObjectCustomExpiry;
@Component
public class WriterInRegion {
@Autowired
private ClientCache clientCache ;
public void writer() {
ClientRegionFactory<Long, ExpirationObject> clientRegionFactory = clientCache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY_HEAP_LRU);
clientRegionFactory.setStatisticsEnabled(true);
Region<Long, ExpirationObject> region = clientRegionFactory.create("ExpirationObject");
AttributesMutator<Long, ExpirationObject> attributesMutator = region.getAttributesMutator();
attributesMutator.setCustomEntryTimeToLive(new ObjectCustomExpiry());
ExpirationObject expirationObject= new ExpirationObject();
expirationObject.setId(11111111111L);
expirationObject.setValue(50);
expirationObject.setTimeToLive(15);
clientCache.getCacheTransactionManager().begin();
region.create(expirationObject.getId(), expirationObject);
clientCache.getCacheTransactionManager().commit();
region.localClear();
region.localDestroyRegion();
}
}
My CustomTTL class
import java.util.Properties;
import org.springframework.data.gemfire.ExpirationActionType;
import com.gemstone.gemfire.cache.CustomExpiry;
import com.gemstone.gemfire.cache.Declarable;
import com.gemstone.gemfire.cache.ExpirationAttributes;
import com.gemstone.gemfire.cache.Region.Entry;
public class ObjectCustomExpiry implements CustomExpiry<Long,ExpirationObject>,Declarable {
@Override
public void close() {
}
@Override
public ExpirationAttributes getExpiry(Entry<Long,ExpirationObject> entry) {
try {
System.out.println("Create expiration ttl");
ExpirationObject expirationObject = entry.getValue();
return new ExpirationAttributes(expirationObject.getTimeToLive(), ExpirationActionType.INVALIDATE.getExpirationAction());
} catch (Exception e) {
}
return new ExpirationAttributes(10, ExpirationActionType.INVALIDATE.getExpirationAction());
}
@Override
public void init(Properties props) {
}
}
Gemfire server result
Cluster gfsh>query --query="select * from /ExpirationObject"
Result : true
startCount : 0
endCount : 20
Rows : 1
Query Trace : Query Executed in 2.733096 ms; indexesUsed(0)
Id | value | timeToLive
-------------| ----- | ----------
11111111111L | 50 | 15
NEXT_STEP_NAME : END
My problem is that after 15 seconds the entry does not expire in locators and servers.
Can you help me ?
java gemfire
java gemfire
asked Nov 22 at 18:47
Daniel Maciel Araujo
12
12
add a comment |
add a comment |
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53436672%2fcustomentrytimetolive-gemfire-8-2-11-entry-does-not-expire%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53436672%2fcustomentrytimetolive-gemfire-8-2-11-entry-does-not-expire%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown