Make IBpfMap extends AutoCloseable and BpfMap implements IBpfMap
IBpfMap defines all required functions of BpfMap interface.
Ex: close() from AutoCloseable
After:
AutoCloseable ---> IBpfMap ---> BpfMap
Before:
AutoCloseable -+
|
+---> BpfMap
|
IBpfMap -------+
Test: BpfMapTest
Change-Id: I5266d9bfdfcb68f632c13d214705309893dded95
This commit is contained in:
@@ -39,7 +39,7 @@ import java.util.Objects;
|
||||
* @param <K> the key of the map.
|
||||
* @param <V> the value of the map.
|
||||
*/
|
||||
public class BpfMap<K extends Struct, V extends Struct> implements IBpfMap<K, V>, AutoCloseable {
|
||||
public class BpfMap<K extends Struct, V extends Struct> implements IBpfMap<K, V> {
|
||||
static {
|
||||
System.loadLibrary(JniUtil.getJniLibraryName(BpfMap.class.getPackage()));
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import android.system.ErrnoException;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
/**
|
||||
* The interface of BpfMap. This could be used to inject for testing.
|
||||
@@ -29,7 +28,7 @@ import java.util.function.BiConsumer;
|
||||
* @param <K> the key of the map.
|
||||
* @param <V> the value of the map.
|
||||
*/
|
||||
public interface IBpfMap<K extends Struct, V extends Struct> {
|
||||
public interface IBpfMap<K extends Struct, V extends Struct> extends AutoCloseable {
|
||||
/** Update an existing or create a new key -> value entry in an eBbpf map. */
|
||||
void updateEntry(K key, V value) throws ErrnoException;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user