Shm (Apache Tomcat 9.0.118 API Documentation)
Description: declaration: package: org.apache.tomcat.jni, class: Shm

# Class Shm

java.lang.Object
org.apache.tomcat.jni.Shm

@Deprecated public class Shm extends Object
Deprecated.
The scope of the APR/Native Library will be reduced in Tomcat 9.1.x / Tomcat Native 2.x and has been reduced in Tomcat 10.1.x / Tomcat Native 2.x onwards to only include those components required to provide OpenSSL integration with the NIO and NIO2 connectors.
Shm.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Shm()`
  Deprecated.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static long`
  `attach(String filename, long pool)`
  Deprecated.
  Attach to a shared memory segment that was created by another process.
  `static long`
  `baseaddr(long m)`
  Deprecated.
  Retrieve the base address of the shared memory segment.
  `static ByteBuffer`
  `buffer(long m)`
  Deprecated.
  Retrieve new ByteBuffer base address of the shared memory segment.
  `static long`
  `create(long reqsize, String filename, long pool)`
  Deprecated.
  Create and make accessible a shared memory segment.
  `static int`
  `destroy(long m)`
  Deprecated.
  Destroy a shared memory segment and associated memory.
  `static int`
  `detach(long m)`
  Deprecated.
  Detach from a shared memory segment without destroying it.
  `static int`
  `remove(String filename, long pool)`
  Deprecated.
  Remove shared memory segment associated with a filename.
  `static long`
  `size(long m)`
  Deprecated.
  Retrieve the length of a shared memory segment in bytes.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Shm

    public Shm()
    Deprecated.

- ## Method Details

  - ### create

    public static long create(long reqsize, String filename, long pool) throws Error
    Deprecated.
    Create and make accessible a shared memory segment.
    A note about Anonymous vs. Named shared memory segments:
    Not all platforms support anonymous shared memory segments, but in some cases it is preferred over other types of shared memory implementations. Passing a NULL 'file' parameter to this function will cause the subsystem to use anonymous shared memory segments. If such a system is not available, APR_ENOTIMPL is returned.
    A note about allocation sizes:
    On some platforms it is necessary to store some metainformation about the segment within the actual segment. In order to supply the caller with the requested size it may be necessary for the implementation to request a slightly greater segment length from the subsystem. In all cases, the apr_shm_baseaddr_get() function will return the first usable byte of memory.
    Parameters:
      `reqsize` - The desired size of the segment.
      `filename` - The file to use for shared memory on platforms that require it.
      `pool` - the pool from which to allocate the shared memory structure.
    Returns:
      The created shared memory structure.
    Throws:
      `Error` - An error occurred

  - ### remove

    public static int remove(String filename, long pool)
    Deprecated.
    Remove shared memory segment associated with a filename.
    This function is only supported on platforms which support name-based shared memory segments, and will return APR_ENOTIMPL on platforms without such support.
    Parameters:
      `filename` - The filename associated with shared-memory segment which needs to be removed
      `pool` - The pool used for file operations
    Returns:
      the operation status

  - ### destroy

    public static int destroy(long m)
    Deprecated.
    Destroy a shared memory segment and associated memory.
    Parameters:
      `m` - The shared memory segment structure to destroy.
    Returns:
      the operation status

  - ### attach

    public static long attach(String filename, long pool) throws Error
    Deprecated.
    Attach to a shared memory segment that was created by another process.
    Parameters:
      `filename` - The file used to create the original segment. (This MUST match the original filename.)
      `pool` - the pool from which to allocate the shared memory structure for this process.
    Returns:
      The created shared memory structure.
    Throws:
      `Error` - An error occurred

  - ### detach

    public static int detach(long m)
    Deprecated.
    Detach from a shared memory segment without destroying it.
    Parameters:
      `m` - The shared memory structure representing the segment to detach from.
    Returns:
      the operation status

  - ### baseaddr

    public static long baseaddr(long m)
    Deprecated.
    Retrieve the base address of the shared memory segment. NOTE: This address is only usable within the callers address space, since this API does not guarantee that other attaching processes will maintain the same address mapping.
    Parameters:
      `m` - The shared memory segment from which to retrieve the base address.
    Returns:
      address, aligned by APR_ALIGN_DEFAULT.

  - ### size

    public static long size(long m)
    Deprecated.
    Retrieve the length of a shared memory segment in bytes.
    Parameters:
      `m` - The shared memory segment from which to retrieve the segment length.
    Returns:
      the length of the segment

  - ### buffer

    public static ByteBuffer buffer(long m)
    Deprecated.
    Retrieve new ByteBuffer base address of the shared memory segment. NOTE: This address is only usable within the callers address space, since this API does not guarantee that other attaching processes will maintain the same address mapping.
    Parameters:
      `m` - The shared memory segment from which to retrieve the base address.
    Returns:
      address, aligned by APR_ALIGN_DEFAULT.