All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.datastax.oss.driver.shaded.netty.buffer.PoolArenasCache Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2023 The Netty Project
 *
 * The Netty Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package com.datastax.oss.driver.shaded.netty.buffer;

import com.datastax.oss.driver.shaded.netty.buffer.PoolArena.SizeClass;

import java.nio.ByteBuffer;

class PoolArenasCache {
    private static final int INTEGER_SIZE_MINUS_ONE = Integer.SIZE - 1;
    final PoolArena heapArena;
    final PoolArena directArena;

    PoolArenasCache(PoolArena heapArena, PoolArena directArena) {
        this.heapArena = heapArena;
        this.directArena = directArena;
    }

    boolean allocateSmall(PoolArena area, PooledByteBuf buf, int reqCapacity, int sizeIdx) {
        return false;
    }

    boolean allocateNormal(PoolArena area, PooledByteBuf buf, int reqCapacity, int sizeIdx) {
        return false;
    }

    @SuppressWarnings({ "unchecked", "rawtypes" })
    boolean add(PoolArena area, PoolChunk chunk, ByteBuffer nioBuffer,
                long handle, int normCapacity, SizeClass sizeClass) {
        return false;
    }

    void trim() {
    }

    void free(boolean b) {
    }

    // val > 0
    static int log2(int val) {
        return INTEGER_SIZE_MINUS_ONE - Integer.numberOfLeadingZeros(val);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy