/** * Gets the instance attribute of the LateralCacheTCPListener class. * <p> * @param ilca ITCPLateralCacheAttributes * @param cacheMgr * @return The instance value */ public synchronized static <K, V> LateralTCPListener<K, V> getInstance( ITCPLateralCacheAttributes ilca, ICompositeCacheManager cacheMgr ) { @SuppressWarnings("unchecked") // Need to cast because of common map for all instances LateralTCPListener<K, V> ins = (LateralTCPListener<K, V>) instances.get( String.valueOf( ilca.getTcpListenerPort() ) ); if ( ins == null ) { ins = new LateralTCPListener<K, V>( ilca ); ins.init(); ins.setCacheManager( cacheMgr ); instances.put( String.valueOf( ilca.getTcpListenerPort() ), ins ); if ( log.isInfoEnabled() ) { log.info( "Created new listener " + ilca.getTcpListenerPort() ); } } return ins; }
/** * Gets the instance attribute of the LateralCacheTCPListener class. * <p> * @param ilca ITCPLateralCacheAttributes * @param cacheMgr * @return The instance value */ public synchronized static <K, V> LateralTCPListener<K, V> getInstance( ITCPLateralCacheAttributes ilca, ICompositeCacheManager cacheMgr ) { @SuppressWarnings("unchecked") // Need to cast because of common map for all instances LateralTCPListener<K, V> ins = (LateralTCPListener<K, V>) instances.get( String.valueOf( ilca.getTcpListenerPort() ) ); if ( ins == null ) { ins = new LateralTCPListener<K, V>( ilca ); ins.init(); ins.setCacheManager( cacheMgr ); instances.put( String.valueOf( ilca.getTcpListenerPort() ), ins ); if ( log.isInfoEnabled() ) { log.info( "Created new listener " + ilca.getTcpListenerPort() ); } } return ins; }
/** * Gets the cacheManager attribute of the LateralCacheTCPListener object. * <p> * Normally this is set by the factory. If it wasn't set the listener defaults to the expected * singleton behavior of the cache manager. * <p> * @param name * @return CompositeCache */ protected CompositeCache<K, V> getCache( String name ) { if ( getCacheManager() == null ) { // revert to singleton on failure try { setCacheManager( CompositeCacheManager.getInstance() ); } catch (CacheException e) { throw new RuntimeException("Could not retrieve cache manager instance", e); } if ( log.isDebugEnabled() ) { log.debug( "cacheMgr = " + getCacheManager() ); } } return getCacheManager().getCache( name ); }
/** * Gets the cacheManager attribute of the LateralCacheTCPListener object. * <p> * Normally this is set by the factory. If it wasn't set the listener defaults to the expected * singleton behavior of the cache manager. * <p> * @param name * @return CompositeCache */ protected CompositeCache<K, V> getCache( String name ) { if ( getCacheManager() == null ) { // revert to singleton on failure try { setCacheManager( CompositeCacheManager.getInstance() ); } catch (CacheException e) { throw new RuntimeException("Could not retrieve cache manager instance", e); } if ( log.isDebugEnabled() ) { log.debug( "cacheMgr = " + getCacheManager() ); } } return getCacheManager().getCache( name ); }