Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory" properties="peerDiscovery=manual"/>
- <cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory" properties="port=40001"/>
- <cache name="adPreview"
- maxEntriesLocalHeap="5000"
- eternal="false"
- timeToIdleSeconds="86400"
- timeToLiveSeconds="86400"
- transactionalMode="off">
- <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"/>
- <persistence strategy="localTempSwap"/>
- </cache>
- @EnableCaching
- class AppConfig {
- @Bean
- PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
- new PropertySourcesPlaceholderConfigurer()
- }
- @Bean
- public CacheManager getEhCacheManager() {
- EhCacheCacheManager ehCacheCacheManager = new EhCacheCacheManager(getEhCacheFactory().getObject());
- ehCacheCacheManager.cacheManager.cacheManagerEventListenerRegistry.notifyCacheAdded("adPreview")
- ehCacheCacheManager.cacheManager.cacheManagerEventListenerRegistry.notifyCacheRemoved("adPreview")
- updateCacheManagerPeerProviders(ehCacheCacheManager.cacheManager.cacheManagerPeerProviders)
- ehCacheCacheManager
- }
- static void updateCacheManagerPeerProviders(Map<String, CacheManagerPeerProvider> cacheManagerPeerProviders) {
- CacheManagerPeerProvider cacheManagerPeerProvider = (CacheManagerPeerProvider)cacheManagerPeerProviders.getAt("RMI")
- cacheManagerPeerProvider.registerPeer("//${BotCommandHelper.fetchPeerHost()}:40001/adPreview")
- }
- @Bean
- public EhCacheManagerFactoryBean getEhCacheFactory() {
- new EhCacheManagerFactoryBean(
- configLocation: new ClassPathResource("/WEB-INF/spring/integration/ehcache.xml"),
- shared: true)
- }
- @RequestMapping(value = "/adpreview/{creativeId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_XHTML_XML_VALUE)
- @ResponseStatus(HttpStatus.OK)
- @ResponseBody
- @Cacheable(value = "adPreview", key = "#creativeId")
- String adPreview(@PathVariable("creativeId") String creativeId,
- @RequestParam("format") String adFormat, HttpServletRequest request) throws Exception {
- log.info("ad preview request received")
- 2016-12-07 17:28:58,076 DEBUG [Replication Thread] distribution.ManualRMICacheManagerPeerProvider.listRemoteCachePeers (ManualRMICacheManagerPeerProvider.java:99) - Looking up rmiUrl //shim-usa-app01.qa.wh.com:40001/adPreview through exception adPreview. This may be normal if a node has gone offline. Or it may indicate network connectivity difficulties [=, =]
- java.rmi.NotBoundException: adPreview
- at sun.rmi.registry.RegistryImpl.lookup(RegistryImpl.java:166)
- at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
- at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:410)
- at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:268)
- at sun.rmi.transport.Transport$1.run(Transport.java:178)
- at sun.rmi.transport.Transport$1.run(Transport.java:175)
- at java.security.AccessController.doPrivileged(Native Method)
- at sun.rmi.transport.Transport.serviceCall(Transport.java:174)
- at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:557)
- at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:812)
- at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:671)
- at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
- at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
- at java.lang.Thread.run(Thread.java:745)
- at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:276)
- at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:253)
- at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:379)
- at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
- at java.rmi.Naming.lookup(Naming.java:101)
- at net.sf.ehcache.distribution.RMICacheManagerPeerProvider.lookupRemoteCachePeer(RMICacheManagerPeerProvider.java:127)
- at net.sf.ehcache.distribution.ManualRMICacheManagerPeerProvider.listRemoteCachePeers(ManualRMICacheManagerPeerProvider.java:95)
- at net.sf.ehcache.distribution.RMISynchronousCacheReplicator.listRemoteCachePeers(RMISynchronousCacheReplicator.java:335)
- at net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator.writeReplicationQueue(RMIAsynchronousCacheReplicator.java:312)
- at net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator.replicationThreadMain(RMIAsynchronousCacheReplicator.java:127)
- at net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator.access$000(RMIAsynchronousCacheReplicator.java:58)
- at net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator$ReplicationThread.run(RMIAsynchronousCacheReplicator.java:389)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement