/** * Starts up the remote cache server on this JVM, and binds it to the registry on the given host * and port. * <p> * A remote cache is either a local cache or a cluster cache. * <p> * @param host the host name * @param port the port number * @param props the remote cache hub configuration * @param propFile the remote cache hub configuration file * @throws IOException * * @deprecated Use startup(String, int, Properties) instead */ @Deprecated public static void startup( String host, int port, Properties props, String propFile ) throws IOException { if ( log.isWarnEnabled() ) { log.warn( "ConfigFileName = [" + propFile + "] ignored" ); } startup(host, port, props); }
if (RemoteCacheServerFactory.getRemoteCacheServer() == null) RemoteCacheServer<?, ?> remoteCacheServer = RemoteCacheServerFactory.getRemoteCacheServer(); remoteCacheServer.removeAll(cacheName);
/** * Configure. * <p> * jcs.remotecache.serverattributes.ATTRIBUTENAME=ATTRIBUTEVALUE * <p> * @param prop * @return RemoteCacheServerAttributesconfigureRemoteCacheServerAttributes */ protected static RemoteCacheServerAttributes configureRemoteCacheServerAttributes( Properties prop ) { RemoteCacheServerAttributes rcsa = new RemoteCacheServerAttributes(); // configure automatically PropertySetter.setProperties( rcsa, prop, CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + "." ); configureManuallyIfValuesArePresent( prop, rcsa ); return rcsa; }
RemoteCacheServerFactory.registerServer( registry, RemoteCacheServerFactory.getRemoteCacheServer() ); String message = "Successfully rebound server to registry [" + registry + "]."; if ( cacheEventLogger != null )
ICacheServiceAdmin admin = lookupCacheServiceAdmin(prop, port); admin.shutdown(); ICacheServiceAdmin admin = lookupCacheServiceAdmin(prop, port); startup( host, port, prop); log.debug( "main> done" );
RemoteCacheServerAttributes rcsa = configureRemoteCacheServerAttributes(props); setServiceName( rcsa.getRemoteServiceName() ); RMISocketFactory customRMISocketFactory = configureObjectSpecificCustomFactory( props ); ICacheEventLogger cacheEventLogger = configureCacheEventLogger( props ); registerServer( serviceName, remoteCacheServer );
/** verify that we get the startRegistry value */ public void testConfigureRemoteCacheServerAttributes_allowClusterGetPresent() { // SETUP boolean allowClusterGet = false; Properties props = new Properties(); props.put( IRemoteCacheConstants.CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".allowClusterGet", String.valueOf( allowClusterGet ) ); // DO WORK RemoteCacheServerAttributes result = RemoteCacheServerFactory.configureRemoteCacheServerAttributes( props ); // VERIFY assertEquals( "Wrong allowClusterGet", allowClusterGet, result.isAllowClusterGet() ); }
RemoteCacheServerFactory.startup( registryHost, registryPort, "/" + propsFileName ); return RemoteCacheServerFactory.getRemoteCacheServer();
/** verify that we get the timeout value */ public void testConfigureObjectSpecificCustomFactory_withProperty() { // SETUP String testValue = "123245"; Properties props = new Properties(); props.put( IRemoteCacheConstants.CUSTOM_RMI_SOCKET_FACTORY_PROPERTY_PREFIX, MockRMISocketFactory.class.getName() ); props.put( IRemoteCacheConstants.CUSTOM_RMI_SOCKET_FACTORY_PROPERTY_PREFIX + ".testStringProperty", testValue ); // DO WORK RMISocketFactory result = RemoteCacheServerFactory.configureObjectSpecificCustomFactory( props ); // VERIFY assertNotNull( "Should have a custom socket factory.", result ); assertEquals( "Wrong testValue", testValue, ((MockRMISocketFactory)result).getTestStringProperty() ); }
/** * shuts the cache down. */ @Override public void destroy() { super.destroy(); log.info("Shutting down remote cache "); try { RemoteCacheServerFactory.shutdownImpl(registryHost, registryPort); } catch (IOException e) { log.error("Problem shutting down.", e); } try { CompositeCacheManager.getInstance().shutDown(); } catch (CacheException e) { log.error("Could not retrieve cache manager instance", e); } }
log.info( "Unbinding host=" + host + ", port=" + port + ", serviceName=" + getServiceName() ); try Naming.unbind( RemoteUtils.getNamingURL(host, port, getServiceName()) ); + ", serviceName=" + getServiceName() );
RemoteCacheServerAttributes rcsa = configureRemoteCacheServerAttributes(props); rcsa.setConfigFileName( propFile ); setServiceName( rcsa.getRemoteServiceName() ); RMISocketFactory customRMISocketFactory = configureObjectSpecificCustomFactory( props ); ICacheEventLogger cacheEventLogger = configureCacheEventLogger( props ); registerServer( RemoteUtils.getNamingURL(host, port, serviceName), remoteCacheServer );
/** verify that we get the timeout value */ public void testConfigureRemoteCacheServerAttributes_timeoutPresent() { // SETUP int timeout = 123245; Properties props = new Properties(); props.put( IRemoteCacheConstants.SOCKET_TIMEOUT_MILLIS, String.valueOf( timeout ) ); // DO WORK RemoteCacheServerAttributes result = RemoteCacheServerFactory.configureRemoteCacheServerAttributes( props ); // VERIFY assertEquals( "Wrong timeout", timeout, result.getRmiSocketFactoryTimeoutMillis() ); }
RemoteCacheServerFactory.startup( registryHost, registryPort, props ); return RemoteCacheServerFactory.getRemoteCacheServer();
/** verify that we get the testStringProperty value */ public void testConfigureObjectSpecificCustomFactory_withProperty() { // SETUP String testValue = "123245"; Properties props = new Properties(); props.put( IRemoteCacheConstants.CUSTOM_RMI_SOCKET_FACTORY_PROPERTY_PREFIX, MockRMISocketFactory.class.getName() ); props.put( IRemoteCacheConstants.CUSTOM_RMI_SOCKET_FACTORY_PROPERTY_PREFIX + ".testStringProperty", testValue ); // DO WORK RMISocketFactory result = RemoteCacheServerFactory.configureObjectSpecificCustomFactory( props ); // VERIFY assertNotNull( "Should have a custom socket factory.", result ); assertEquals( "Wrong testValue", testValue, ((MockRMISocketFactory)result).getTestStringProperty() ); }
clusterListenersMap.clear(); RemoteCacheServerFactory.shutdownImpl( host, port ); this.cacheManager.shutDown();
log.info( "Unbinding host=" + host + ", port=" + port + ", serviceName=" + getServiceName() ); try Naming.unbind( RemoteUtils.getNamingURL(host, port, getServiceName()) ); + ", serviceName=" + getServiceName() );
/** verify that we get the allowClusterGet value */ public void testConfigureRemoteCacheServerAttributes_allowClusterGetPresent() { // SETUP boolean allowClusterGet = false; Properties props = new Properties(); props.put( IRemoteCacheConstants.CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".allowClusterGet", String.valueOf( allowClusterGet ) ); // DO WORK RemoteCacheServerAttributes result = RemoteCacheServerFactory.configureRemoteCacheServerAttributes( props ); // VERIFY assertEquals( "Wrong allowClusterGet", allowClusterGet, result.isAllowClusterGet() ); }
/** * Starts up the remote cache server on this JVM, and binds it to the registry on the given host * and port. * <p> * A remote cache is either a local cache or a cluster cache. * <p> * @param host the host name * @param port the port number * @param propFile the remote cache hub configuration file * @throws IOException * * @deprecated Use startup(String, int, Properties) instead */ @Deprecated public static void startup( String host, int port, String propFile ) throws IOException { if ( log.isInfoEnabled() ) { log.info( "ConfigFileName = [" + propFile + "]" ); } Properties props = RemoteUtils.loadProps( propFile ); startup(host, port, props); }
if (RemoteCacheServerFactory.getRemoteCacheServer() == null) RemoteCacheServer<?, ?> remoteCacheServer = RemoteCacheServerFactory.getRemoteCacheServer(); remoteCacheServer.removeAll(cacheName);