2015/07/26 - Apache DirectMemory has been retired.

For more information, please explore the Attic.

Create your server instance

In order to create a war file to serve a DirectMemory instance, you can:

  • package in a maven war project type
  • create it from the archetype

Server Configuration

In the first release, the DirectMemory Server use a single instance of DirectMemory cache and configured via System Properties:

  • numberOfBuffers: "directMemory.numberOfBuffers" (default: 10)
  • size: "directMemory.size" (default: 1000)
  • initialCapacity: "directMemory.initialCapacity" (default: 100000)
  • concurrencyLevel: "directMemory.concurrencyLevel" (default: 4)

Maven War project

Add a dependency to the server core artifact:

  <dependency>
    <groupId>org.apache.directmemory.server</groupId>
    <artifactId>directmemory-server</artifactId>
    <version>0.2</version>
  </dependency>

Map the DirectMemory servlet in your web.xml:

  <servlet>
    <servlet-name>DirectMemoryServlet</servlet-name>
    <servlet-class>org.apache.directmemory.server.services.DirectMemoryServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>DirectMemoryServlet</servlet-name>
    <url-pattern>/cache/*</url-pattern>
  </servlet-mapping>

Create from archetype

Use the following command line.

mvn archetype:generate \
   -DarchetypeGroupId=org.apache.directmemory.server \
   -DarchetypeArtifactId=server-example-archetype \
   -DarchetypeVersion=0.2

If you want to use a SNAPSHOT version you must add: -DarchetypeRepository=https://repository.apache.org/content/repositories/snapshots/

Now you have a simple war project configured to be a DirectMemory Server.

Try the provided sample with running mvn tomcat7:run and hit your browser to http://localhost:9091/dm/