public abstract class NativeCalls extends Object
getInstance().
This class is also referenced by ODBC/.NET drivers so it should not refer to
any classes other than standard JDK or those within the same package.| Modifier and Type | Class and Description |
|---|---|
static class |
NativeCalls.NativeCallsGeneric
A generic fallback implementation of
NativeCalls when no JNA based
implementation could be initialized (e.g. |
static interface |
NativeCalls.RehashServerOnSIGHUP
Callback invoked when an OS-level SIGHUP signal is caught after handler has
been installed by
daemonize(com.gemstone.gemfire.internal.shared.NativeCalls.RehashServerOnSIGHUP). |
| Modifier and Type | Field and Description |
|---|---|
static int |
CLOCKID_MONOTONIC |
static int |
CLOCKID_MONOTONIC_RAW |
static int |
CLOCKID_PROCESS_CPUTIME_ID |
static int |
CLOCKID_REALTIME |
static int |
CLOCKID_THREAD_CPUTIME_ID |
protected static int |
OPT_IPPROTO_TCP |
static HashSet<String> |
TEST_CHK_FALLOC_DIRS
For testing - to keep track of files for which fallocate happened
|
static HashSet<String> |
TEST_NO_FALLOC_DIRS |
protected static int |
UNSUPPORTED_OPTION |
| Constructor and Description |
|---|
NativeCalls() |
| Modifier and Type | Method and Description |
|---|---|
long |
clockResolution(int clock_id) |
void |
daemonize(NativeCalls.RehashServerOnSIGHUP callback)
Perform the steps necessary to make the current JVM a proper UNIX daemon.
|
abstract String |
getEnvironment(String name)
Get the value of given environment variable.
|
static NativeCalls |
getInstance()
Get an instance of implementation of
NativeCalls for the current
platform. |
protected static Map<String,String> |
getModifiableJavaEnv() |
protected static Map<String,String> |
getModifiableJavaEnvWIN() |
abstract OSType |
getOSType()
Get the
OSType of current system. |
protected int |
getPlatformOption(TCPSocketOptions opt) |
abstract int |
getProcessId()
Get the process ID of the current process.
|
long |
getSessionThreadLimit() |
protected int |
getSocketKernelDescriptor(Socket sock,
InputStream sockStream)
Get the native kernel descriptor given the java Socket.
|
protected String |
getUnsupportedSocketOptionMessage(TCPSocketOptions opt) |
boolean |
isNativeTimerEnabled()
whether o/s supports high resolution clock or equivalent
perf counter.
|
protected boolean |
isNoProtocolOptionCode(int errno) |
boolean |
isOnLocalFileSystem(String path)
This will return whether the path passed in as arg is
part of a local file system or a remote file system.
|
abstract boolean |
isProcessActive(int processId)
Check whether a process with given ID is still running.
|
boolean |
isTTY() |
abstract boolean |
killProcess(int processId)
Kill the process with given process ID immediately (i.e.
|
boolean |
loadNativeLibrary()
Indicates whether to native library using JNI is supported or not.
|
void |
lockCurrentMemory()
Locks all pages mapped into the address space of the calling process.
|
long |
nanoTime(int clock_id)
This is fall back for jni based library implementation of NanoTimer which
is more efficient than current impl through jna.
|
void |
preBlow(String path,
long maxSize,
boolean preAllocate) |
abstract void |
setCurrentWorkingDirectory(String path)
Set the current working directory to the given path.
|
abstract void |
setEnvironment(String name,
String value)
Set the value of an environment variable.
|
protected Map<TCPSocketOptions,Throwable> |
setGenericSocketOptions(Socket sock,
InputStream sockStream,
Map<TCPSocketOptions,Object> optValueMap)
A generic implementation of
setSocketOptions(java.net.Socket, java.io.InputStream, java.util.Map<com.gemstone.gemfire.internal.shared.TCPSocketOptions, java.lang.Object>) for POSIX like
systems that requires the child classes to implement a few platform
specific methods. |
protected int |
setPlatformSocketOption(int sockfd,
int level,
int optName,
TCPSocketOptions opt,
Integer optVal,
int optSize) |
abstract Map<TCPSocketOptions,Throwable> |
setSocketOptions(Socket sock,
InputStream sockStream,
Map<TCPSocketOptions,Object> optValueMap)
Set given extended socket options on a Java
Socket. |
public static final int CLOCKID_REALTIME
public static final int CLOCKID_MONOTONIC
public static final int CLOCKID_PROCESS_CPUTIME_ID
public static final int CLOCKID_THREAD_CPUTIME_ID
public static final int CLOCKID_MONOTONIC_RAW
public static volatile HashSet<String> TEST_CHK_FALLOC_DIRS
protected static final int OPT_IPPROTO_TCP
protected static final int UNSUPPORTED_OPTION
public static NativeCalls getInstance()
NativeCalls for the current
platform.protected int getSocketKernelDescriptor(Socket sock, InputStream sockStream) throws UnsupportedOperationException
sock - the java socketsockStream - the InputStream of the java socket, if availableUnsupportedOperationException - if the kernel descriptor could not be extractedprotected String getUnsupportedSocketOptionMessage(TCPSocketOptions opt)
public abstract String getEnvironment(String name)
System.getenv(String) in that it returns the current value of the
environment variable in the process rather than from a static unmodifiable
map created on the first call.name - the name of the environment variable to be modifiedpublic abstract void setEnvironment(String name, String value)
System.getenv(String) will also return the
modified value.name - the name of the environment variable to be modifiedvalue - the new value of the environment variable; a value of null clears
the existing valuepublic abstract void setCurrentWorkingDirectory(String path)
path - new working directory (preferably a full absolute path)public abstract int getProcessId()
public abstract boolean isProcessActive(int processId)
throws UnsupportedOperationException
UnsupportedOperationException - if no native API to determine the process status could be invokedpublic abstract boolean killProcess(int processId)
throws UnsupportedOperationException
processId - the PID of the process to be killUnsupportedOperationException - if no native API to kill the process could be invokedpublic void daemonize(NativeCalls.RehashServerOnSIGHUP callback) throws UnsupportedOperationException, IllegalStateException
callback - register callback to be invoked on catching a SIGHUP signal;
SIGHUP signal is ignored if the callback is nullUnsupportedOperationException - if the native calls could not be completed for some reason or are
not availableIllegalStateException - for a non-UNIX platformpublic void preBlow(String path, long maxSize, boolean preAllocate) throws IOException
IOExceptionpublic boolean isOnLocalFileSystem(String path)
public abstract Map<TCPSocketOptions,Throwable> setSocketOptions(Socket sock, InputStream sockStream, Map<TCPSocketOptions,Object> optValueMap) throws UnsupportedOperationException
Socket.TCPSocketOptions for the current platform
and the underlying exceptionSocketException - if there was an exception setting the option on the socketUnsupportedOperationException - if the native API to set the option could not be found or invokedTCPSocketOptionspublic void lockCurrentMemory()
throws UnsupportedOperationException
UnsupportedOperationExceptionprotected final Map<TCPSocketOptions,Throwable> setGenericSocketOptions(Socket sock, InputStream sockStream, Map<TCPSocketOptions,Object> optValueMap) throws UnsupportedOperationException
setSocketOptions(java.net.Socket, java.io.InputStream, java.util.Map<com.gemstone.gemfire.internal.shared.TCPSocketOptions, java.lang.Object>) for POSIX like
systems that requires the child classes to implement a few platform
specific methods.UnsupportedOperationExceptionprotected int getPlatformOption(TCPSocketOptions opt) throws UnsupportedOperationException
UnsupportedOperationExceptionprotected int setPlatformSocketOption(int sockfd,
int level,
int optName,
TCPSocketOptions opt,
Integer optVal,
int optSize)
throws UnsupportedOperationException,
NativeErrorException
protected boolean isNoProtocolOptionCode(int errno)
throws UnsupportedOperationException
UnsupportedOperationExceptionpublic boolean loadNativeLibrary()
public boolean isNativeTimerEnabled()
public long nanoTime(int clock_id)
clock_id - public long clockResolution(int clock_id)
public boolean isTTY()
public long getSessionThreadLimit()
Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.