org.elasticsearch.nativeaccess.AbstractNativeAccess Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of elasticsearch-native Show documentation
Show all versions of elasticsearch-native Show documentation
Elasticsearch subproject :libs:elasticsearch-native
The newest version!
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
package org.elasticsearch.nativeaccess;
import org.elasticsearch.logging.LogManager;
import org.elasticsearch.logging.Logger;
import org.elasticsearch.nativeaccess.lib.JavaLibrary;
import org.elasticsearch.nativeaccess.lib.NativeLibraryProvider;
import org.elasticsearch.nativeaccess.lib.ZstdLibrary;
abstract class AbstractNativeAccess implements NativeAccess {
protected static final Logger logger = LogManager.getLogger(NativeAccess.class);
private final String name;
private final JavaLibrary javaLib;
private final Zstd zstd;
protected boolean isMemoryLocked = false;
protected ExecSandboxState execSandboxState = ExecSandboxState.NONE;
protected AbstractNativeAccess(String name, NativeLibraryProvider libraryProvider) {
this.name = name;
this.javaLib = libraryProvider.getLibrary(JavaLibrary.class);
this.zstd = new Zstd(libraryProvider.getLibrary(ZstdLibrary.class));
}
String getName() {
return name;
}
@Override
public Systemd systemd() {
return null;
}
@Override
public Zstd getZstd() {
return zstd;
}
@Override
public CloseableByteBuffer newBuffer(int len) {
assert len > 0;
return javaLib.newBuffer(len);
}
@Override
public boolean isMemoryLocked() {
return isMemoryLocked;
}
@Override
public ExecSandboxState getExecSandboxState() {
return execSandboxState;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy