Class RemoteCacheServerFactory

java.lang.Object
org.apache.commons.jcs3.auxiliary.remote.server.RemoteCacheServerFactory
All Implemented Interfaces:
IRemoteCacheConstants

public class RemoteCacheServerFactory extends Object implements IRemoteCacheConstants
Provides remote cache services. This creates remote cache servers and can proxy command line requests to a running server.
  • Method Details

    • getRemoteCacheServer

      public static <K, V> RemoteCacheServer<K,V> getRemoteCacheServer()
      This will allow you to get stats from the server, etc. Perhaps we should provide methods on the factory to do this instead.

      A remote cache is either a local cache or a cluster cache.

      Returns:
      Returns the remoteCacheServer.
    • startup

      public static void startup(String host, int port, Properties props) throws IOException
      Starts up the remote cache server on this JVM, and binds it to the registry on the given host and port.

      A remote cache is either a local cache or a cluster cache.

      Parameters:
      host -
      port -
      props -
      Throws:
      IOException
    • keepAlive

      protected static void keepAlive(String registryHost, int registryPort, ICacheEventLogger cacheEventLogger)
      Tries to lookup the server. If unsuccessful it will rebind the server using the factory rebind method.
      Parameters:
      registryHost - - Hostname of the registry
      registryPort - - the port on which to start the registry
      cacheEventLogger - the event logger for error messages
      Since:
      3.1
    • configureCacheEventLogger

      Tries to get the event logger.

      Parameters:
      props - configuration properties
      Returns:
      ICacheEventLogger, may be null
    • configureObjectSpecificCustomFactory

      This configures an object specific custom factory. This will be configured for just this object in the registry. This can be null.

      Parameters:
      props -
      Returns:
      RMISocketFactory
    • registerServer

      protected static void registerServer(String serviceName, Remote server) throws RemoteException
      Registers the server with the registry. I broke this off because we might want to have code that will restart a dead registry. It will need to rebind the server.

      Parameters:
      serviceName - the name of the service
      server - the server object to bind
      Throws:
      RemoteException
    • configureRemoteCacheServerAttributes

      Configure.

      jcs.remotecache.serverattributes.ATTRIBUTENAME=ATTRIBUTEVALUE

      Parameters:
      prop -
      Returns:
      RemoteCacheServerAttributesconfigureRemoteCacheServerAttributes
    • main

      public static void main(String[] args) throws Exception
      Creates an local RMI registry on the default port, starts up the remote cache server, and binds it to the registry.

      A remote cache is either a local cache or a cluster cache.

      Parameters:
      args - The command line arguments
      Throws:
      Exception
    • setServiceName

      protected static void setServiceName(String serviceName)
      Parameters:
      serviceName - the serviceName to set
    • getServiceName

      protected static String getServiceName()
      Returns:
      the serviceName