Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.80 KB | None | 0 0
  1. <cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory" properties="peerDiscovery=manual"/>
  2. <cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory" properties="port=40001"/>
  3.  
  4. <cache name="adPreview"
  5. maxEntriesLocalHeap="5000"
  6. eternal="false"
  7. timeToIdleSeconds="86400"
  8. timeToLiveSeconds="86400"
  9. transactionalMode="off">
  10.  
  11. <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"/>
  12. <persistence strategy="localTempSwap"/>
  13.  
  14. </cache>
  15.  
  16. @EnableCaching
  17. class AppConfig {
  18.  
  19. @Bean
  20. PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
  21. new PropertySourcesPlaceholderConfigurer()
  22. }
  23.  
  24. @Bean
  25. public CacheManager getEhCacheManager() {
  26. EhCacheCacheManager ehCacheCacheManager = new EhCacheCacheManager(getEhCacheFactory().getObject());
  27. ehCacheCacheManager.cacheManager.cacheManagerEventListenerRegistry.notifyCacheAdded("adPreview")
  28. ehCacheCacheManager.cacheManager.cacheManagerEventListenerRegistry.notifyCacheRemoved("adPreview")
  29. updateCacheManagerPeerProviders(ehCacheCacheManager.cacheManager.cacheManagerPeerProviders)
  30. ehCacheCacheManager
  31. }
  32.  
  33. static void updateCacheManagerPeerProviders(Map<String, CacheManagerPeerProvider> cacheManagerPeerProviders) {
  34.  
  35. CacheManagerPeerProvider cacheManagerPeerProvider = (CacheManagerPeerProvider)cacheManagerPeerProviders.getAt("RMI")
  36. cacheManagerPeerProvider.registerPeer("//${BotCommandHelper.fetchPeerHost()}:40001/adPreview")
  37.  
  38. }
  39.  
  40. @Bean
  41. public EhCacheManagerFactoryBean getEhCacheFactory() {
  42. new EhCacheManagerFactoryBean(
  43. configLocation: new ClassPathResource("/WEB-INF/spring/integration/ehcache.xml"),
  44. shared: true)
  45. }
  46.  
  47. @RequestMapping(value = "/adpreview/{creativeId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_XHTML_XML_VALUE)
  48. @ResponseStatus(HttpStatus.OK)
  49. @ResponseBody
  50. @Cacheable(value = "adPreview", key = "#creativeId")
  51. String adPreview(@PathVariable("creativeId") String creativeId,
  52. @RequestParam("format") String adFormat, HttpServletRequest request) throws Exception {
  53. log.info("ad preview request received")
  54.  
  55. 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 [=, =]
  56. java.rmi.NotBoundException: adPreview
  57. at sun.rmi.registry.RegistryImpl.lookup(RegistryImpl.java:166)
  58. at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
  59. at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:410)
  60. at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:268)
  61. at sun.rmi.transport.Transport$1.run(Transport.java:178)
  62. at sun.rmi.transport.Transport$1.run(Transport.java:175)
  63. at java.security.AccessController.doPrivileged(Native Method)
  64. at sun.rmi.transport.Transport.serviceCall(Transport.java:174)
  65. at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:557)
  66. at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:812)
  67. at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:671)
  68. at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  69. at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  70. at java.lang.Thread.run(Thread.java:745)
  71. at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:276)
  72. at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:253)
  73. at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:379)
  74. at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
  75. at java.rmi.Naming.lookup(Naming.java:101)
  76. at net.sf.ehcache.distribution.RMICacheManagerPeerProvider.lookupRemoteCachePeer(RMICacheManagerPeerProvider.java:127)
  77. at net.sf.ehcache.distribution.ManualRMICacheManagerPeerProvider.listRemoteCachePeers(ManualRMICacheManagerPeerProvider.java:95)
  78. at net.sf.ehcache.distribution.RMISynchronousCacheReplicator.listRemoteCachePeers(RMISynchronousCacheReplicator.java:335)
  79. at net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator.writeReplicationQueue(RMIAsynchronousCacheReplicator.java:312)
  80. at net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator.replicationThreadMain(RMIAsynchronousCacheReplicator.java:127)
  81. at net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator.access$000(RMIAsynchronousCacheReplicator.java:58)
  82. at net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator$ReplicationThread.run(RMIAsynchronousCacheReplicator.java:389)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement