CAG v5.7.4版本的 MD5 值为:bc57ead76a7a30559f0708e9d60d749f

以下内容为反编译后的 u.java 源代码,内容仅作参考


package d.b.a.f;

import d.b.a.f.g;
import d.b.a.g.f1;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Locale;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.lucene.store.IOContext;
import org.lukhnos.portmobile.file.StandardOpenOption;
public class u extends k {
    public static final int f5653n;
    public static final boolean f5654o;
    public static final g.a f5655p;
    public boolean f5656l;
    public final int f5657m;

    public class a implements PrivilegedAction<Boolean> {
        @Override
        public Boolean run() {
            try {
                Class.forName("java.nio.DirectByteBuffer").getMethod("cleaner", new Class[0]).setAccessible(true);
                return Boolean.TRUE;
            } catch (Exception unused) {
                return Boolean.FALSE;
            }
        }
    }

    public class b implements g.a {
    }

    static {
        f5653n = d.b.a.g.y.f6007l ? 1073741824 : 268435456;
        f5654o = ((Boolean) AccessController.doPrivileged(new a())).booleanValue();
        f5655p = new b();
    }

    public u(d.g.a.b.b bVar, s sVar) throws IOException {
        super(bVar, sVar);
        int i2 = f5653n;
        this.f5656l = f5654o;
        if (i2 > 0) {
            this.f5657m = 31 - Integer.numberOfLeadingZeros(i2);
            return;
        }
        throw new IllegalArgumentException("Maximum chunk size for mmap must be >0");
    }

    @Override
    public p D(String str, IOContext iOContext) throws IOException {
        d.g.a.b.b b2;
        p bVar;
        O();
        FileChannel e0 = d.c.a.m.a.e0(this.f5647k.b(str), StandardOpenOption.READ);
        try {
            String str2 = "MMapIndexInput(path=\"" + b2.toString() + "\")";
            boolean z = this.f5656l;
            ByteBuffer[] e02 = e0(str2, e0, 0L, e0.size());
            long size = e0.size();
            int i2 = this.f5657m;
            g.a aVar = z ? f5655p : null;
            int i3 = g.f5625t;
            f1 f1Var = z ? new f1(new ConcurrentHashMap(), true) : null;
            if (e02.length == 1) {
                bVar = new g.c(str2, e02[0], size, i2, aVar, f1Var);
            } else {
                bVar = new g.b(str2, e02, 0, size, i2, aVar, f1Var);
            }
            e0.close();
            return bVar;
        } catch (Throwable th) {
            if (e0 != null) {
                try {
                    e0.close();
                } catch (Throwable th2) {
                    th.addSuppressed(th2);
                }
            }
            throw th;
        }
    }

    public final ByteBuffer[] e0(String str, FileChannel fileChannel, long j2, long j3) throws IOException {
        String message;
        Throwable cause;
        String str2;
        int i2 = this.f5657m;
        long j4 = j3 >>> i2;
        if (j4 < 2147483647L) {
            long j5 = 1 << i2;
            int i3 = ((int) j4) + 1;
            ByteBuffer[] byteBufferArr = new ByteBuffer[i3];
            long j6 = 0;
            int i4 = 0;
            while (i4 < i3) {
                int i5 = (int) (j3 > j6 + j5 ? j5 : j3 - j6);
                try {
                    long j7 = j5;
                    long j8 = i5;
                    byteBufferArr[i4] = fileChannel.map(FileChannel.MapMode.READ_ONLY, j2 + j6, j8);
                    j6 += j8;
                    i4++;
                    j5 = j7;
                } catch (IOException e2) {
                    if (e2.getCause() instanceof OutOfMemoryError) {
                        cause = null;
                        message = "Map failed";
                    } else {
                        message = e2.getMessage();
                        cause = e2.getCause();
                    }
                    if (!d.b.a.g.y.f6007l) {
                        str2 = "MMapDirectory should only be used on 64bit platforms, because the address space on 32bit operating systems is too small. ";
                    } else if (d.b.a.g.y.f6000e) {
                        str2 = "Windows is unfortunately very limited on virtual address space. If your index size is several hundred Gigabytes, consider changing to Linux. ";
                    } else {
                        str2 = d.b.a.g.y.f5999d ? "Please review 'ulimit -v', 'ulimit -m' (both should return 'unlimited'), and 'sysctl vm.max_map_count'. " : "Please review 'ulimit -v', 'ulimit -m' (both should return 'unlimited'). ";
                    }
                    IOException iOException = new IOException(String.format(Locale.ENGLISH, "%s: %s [this may be caused by lack of enough unfragmented virtual address space or too restrictive virtual memory limits enforced by the operating system, preventing us to map a chunk of %d bytes. %sMore information: http://blog.thetaphi.de/2012/07/use-lucenes-mmapdirectory-on-64bit.html]", message, str, Integer.valueOf(i5), str2), cause);
                    iOException.setStackTrace(e2.getStackTrace());
                    throw iOException;
                }
            }
            return byteBufferArr;
        }
        throw new IllegalArgumentException(i.a.b.a.a.r("RandomAccessFile too big for chunk size: ", str));
    }
}