热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

java.lang.UnsatisfiedLinkError:…….io.nativeio.NativeIO$Windows.access0(Ljava/lang/String;I)Z

在利用hadoop运行MapReduce项目时,提示报错(注意最后是Z):Exceptioninthreadmainj

  在利用 hadoop 运行 MapReduce 项目时,提示报错(注意最后是Z):

Exception in thread "main" java.lang.UnsatisfiedLinkError:
org.apache.hadoop.io.nativeio.NativeIO$Windows.access0(Ljava/lang/String;I)Z

  这个主要是因为本地启动运行,需要更改源代码中的对应配置。
  在项目的根目录下(本项目为WordCount,根目录也就是java)新建包 org.apache.hadoop.io.nativeio ,添加类 NativeIO 即可。
在这里插入图片描述

package org.apache.hadoop.io.nativeio;/*** Licensed to the Apache Software Foundation (ASF) under one* or more contributor license agreements. See the NOTICE file* distributed with this work for additional information* regarding copyright ownership. The ASF 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** http://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.*/import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.lang.reflect.Field;
import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.CommonConfigurationKeys;
import org.apache.hadoop.io.SecureIOUtils.AlreadyExistsException;
import org.apache.hadoop.util.NativeCodeLoader;
import org.apache.hadoop.util.Shell;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;import sun.misc.Unsafe;import com.google.common.annotations.VisibleForTesting;/*** JNI wrappers for various native IO-related calls not available in Java. These* functions should generally be used alongside a fallback to another more* portable mechanism.*/
@InterfaceAudience.Private
@InterfaceStability.Unstable
public class NativeIO {public static class POSIX {// Flags for open() call from bits/fcntl.hpublic static final int O_RDONLY &#61; 00;public static final int O_WRONLY &#61; 01;public static final int O_RDWR &#61; 02;public static final int O_CREAT &#61; 0100;public static final int O_EXCL &#61; 0200;public static final int O_NOCTTY &#61; 0400;public static final int O_TRUNC &#61; 01000;public static final int O_APPEND &#61; 02000;public static final int O_NONBLOCK &#61; 04000;public static final int O_SYNC &#61; 010000;public static final int O_ASYNC &#61; 020000;public static final int O_FSYNC &#61; O_SYNC;public static final int O_NDELAY &#61; O_NONBLOCK;// Flags for posix_fadvise() from bits/fcntl.h/* No further special treatment. */public static final int POSIX_FADV_NORMAL &#61; 0;/* Expect random page references. */public static final int POSIX_FADV_RANDOM &#61; 1;/* Expect sequential page references. */public static final int POSIX_FADV_SEQUENTIAL &#61; 2;/* Will need these pages. */public static final int POSIX_FADV_WILLNEED &#61; 3;/* Don&#39;t need these pages. */public static final int POSIX_FADV_DONTNEED &#61; 4;/* Data will be accessed once. */public static final int POSIX_FADV_NOREUSE &#61; 5;/** Wait upon writeout of all pages in the range before performing the* write.*/public static final int SYNC_FILE_RANGE_WAIT_BEFORE &#61; 1;/** Initiate writeout of all those dirty pages in the range which are not* presently under writeback.*/public static final int SYNC_FILE_RANGE_WRITE &#61; 2;/** Wait upon writeout of all pages in the range after performing the* write.*/public static final int SYNC_FILE_RANGE_WAIT_AFTER &#61; 4;private static final Log LOG &#61; LogFactory.getLog(NativeIO.class);private static boolean nativeLoaded &#61; false;private static boolean fadvisePossible &#61; true;private static boolean syncFileRangePossible &#61; true;static final String WORKAROUND_NON_THREADSAFE_CALLS_KEY &#61; "hadoop.workaround.non.threadsafe.getpwuid";static final boolean WORKAROUND_NON_THREADSAFE_CALLS_DEFAULT &#61; true;private static long cacheTimeout &#61; -1;private static CacheManipulator cacheManipulator &#61; new CacheManipulator();public static CacheManipulator getCacheManipulator() {return cacheManipulator;}public static void setCacheManipulator(CacheManipulator cacheManipulator) {POSIX.cacheManipulator &#61; cacheManipulator;}/*** Used to manipulate the operating system cache.*/&#64;VisibleForTestingpublic static class CacheManipulator {public void mlock(String identifier, ByteBuffer buffer, long len) throws IOException {POSIX.mlock(buffer, len);}public long getMemlockLimit() {return NativeIO.getMemlockLimit();}public long getOperatingSystemPageSize() {return NativeIO.getOperatingSystemPageSize();}public void posixFadviseIfPossible(String identifier, FileDescriptor fd, long offset, long len, int flags)throws NativeIOException {POSIX.posixFadviseIfPossible(identifier, fd, offset, len, flags);}public boolean verifyCanMlock() {return NativeIO.isAvailable();}}/*** A CacheManipulator used for testing which does not actually call* mlock. This allows many tests to be run even when the operating* system does not allow mlock, or only allows limited mlocking.*/&#64;VisibleForTestingpublic static class NoMlockCacheManipulator extends CacheManipulator {public void mlock(String identifier, ByteBuffer buffer, long len) throws IOException {LOG.info("mlocking " &#43; identifier);}public long getMemlockLimit() {return 1125899906842624L;}public long getOperatingSystemPageSize() {return 4096;}public boolean verifyCanMlock() {return true;}}static {if (NativeCodeLoader.isNativeCodeLoaded()) {try {Configuration conf &#61; new Configuration();workaroundNonThreadSafePasswdCalls &#61; conf.getBoolean(WORKAROUND_NON_THREADSAFE_CALLS_KEY,WORKAROUND_NON_THREADSAFE_CALLS_DEFAULT);initNative();nativeLoaded &#61; true;cacheTimeout &#61; conf.getLong(CommonConfigurationKeys.HADOOP_SECURITY_UID_NAME_CACHE_TIMEOUT_KEY,CommonConfigurationKeys.HADOOP_SECURITY_UID_NAME_CACHE_TIMEOUT_DEFAULT) * 1000;LOG.debug("Initialized cache for IDs to User/Group mapping with a " &#43; " cache timeout of "&#43; cacheTimeout / 1000 &#43; " seconds.");} catch (Throwable t) {// This can happen if the user has an older version of// libhadoop.so// installed - in this case we can continue without native// IO// after warningLOG.error("Unable to initialize NativeIO libraries", t);}}}/*** Return true if the JNI-based native IO extensions are available.*/public static boolean isAvailable() {return NativeCodeLoader.isNativeCodeLoaded() && nativeLoaded;}private static void assertCodeLoaded() throws IOException {if (!isAvailable()) {throw new IOException("NativeIO was not loaded");}}/** Wrapper around open(2) */public static native FileDescriptor open(String path, int flags, int mode) throws IOException;/** Wrapper around fstat(2) */private static native Stat fstat(FileDescriptor fd) throws IOException;/*** Native chmod implementation. On UNIX, it is a wrapper around chmod(2)*/private static native void chmodImpl(String path, int mode) throws IOException;public static void chmod(String path, int mode) throws IOException {if (!Shell.WINDOWS) {chmodImpl(path, mode);} else {try {chmodImpl(path, mode);} catch (NativeIOException nioe) {if (nioe.getErrorCode() &#61;&#61; 3) {throw new NativeIOException("No such file or directory", Errno.ENOENT);} else {LOG.warn(String.format("NativeIO.chmod error (%d): %s", nioe.getErrorCode(), nioe.getMessage()));throw new NativeIOException("Unknown error", Errno.UNKNOWN);}}}}/** Wrapper around posix_fadvise(2) */static native void posix_fadvise(FileDescriptor fd, long offset, long len, int flags) throws NativeIOException;/** Wrapper around sync_file_range(2) */static native void sync_file_range(FileDescriptor fd, long offset, long nbytes, int flags)throws NativeIOException;/*** Call posix_fadvise on the given file descriptor. See the manpage for* this syscall for more information. On systems where this call is not* available, does nothing.** &#64;throws NativeIOException* if there is an error with the syscall*/static void posixFadviseIfPossible(String identifier, FileDescriptor fd, long offset, long len, int flags)throws NativeIOException {if (nativeLoaded && fadvisePossible) {try {posix_fadvise(fd, offset, len, flags);} catch (UnsupportedOperationException uoe) {fadvisePossible &#61; false;} catch (UnsatisfiedLinkError ule) {fadvisePossible &#61; false;}}}/*** Call sync_file_range on the given file descriptor. See the manpage* for this syscall for more information. On systems where this call is* not available, does nothing.** &#64;throws NativeIOException* if there is an error with the syscall*/public static void syncFileRangeIfPossible(FileDescriptor fd, long offset, long nbytes, int flags)throws NativeIOException {if (nativeLoaded && syncFileRangePossible) {try {sync_file_range(fd, offset, nbytes, flags);} catch (UnsupportedOperationException uoe) {syncFileRangePossible &#61; false;} catch (UnsatisfiedLinkError ule) {syncFileRangePossible &#61; false;}}}static native void mlock_native(ByteBuffer buffer, long len) throws NativeIOException;static native void munlock_native(ByteBuffer buffer, long len) throws NativeIOException;/*** Locks the provided direct ByteBuffer into memory, preventing it from* swapping out. After a buffer is locked, future accesses will not* incur a page fault.** See the mlock(2) man page for more information.** &#64;throws NativeIOException*/static void mlock(ByteBuffer buffer, long len) throws IOException {assertCodeLoaded();if (!buffer.isDirect()) {throw new IOException("Cannot mlock a non-direct ByteBuffer");}mlock_native(buffer, len);}/*** Unlocks a locked direct ByteBuffer, allowing it to swap out of* memory. This is a no-op if the ByteBuffer was not previously locked.** See the munlock(2) man page for more information.** &#64;throws NativeIOException*/public static void munlock(ByteBuffer buffer, long len) throws IOException {assertCodeLoaded();if (!buffer.isDirect()) {throw new IOException("Cannot munlock a non-direct ByteBuffer");}munlock_native(buffer, len);}/*** Unmaps the block from memory. See munmap(2).** There isn&#39;t any portable way to unmap a memory region in Java. So we* use the sun.nio method here. Note that unmapping a memory region* could cause crashes if code continues to reference the unmapped code.* However, if we don&#39;t manually unmap the memory, we are dependent on* the finalizer to do it, and we have no idea when the finalizer will* run.** &#64;param buffer* The buffer to unmap.*/public static void munmap(MappedByteBuffer buffer) {if (buffer instanceof sun.nio.ch.DirectBuffer) {sun.misc.Cleaner cleaner &#61; ((sun.nio.ch.DirectBuffer) buffer).cleaner();cleaner.clean();}}/** Linux only methods used for getOwner() implementation */private static native long getUIDforFDOwnerforOwner(FileDescriptor fd) throws IOException;private static native String getUserName(long uid) throws IOException;/*** Result type of the fstat call*/public static class Stat {private int ownerId, groupId;private String owner, group;private int mode;// Mode constantspublic static final int S_IFMT &#61; 0170000; /* type of file */public static final int S_IFIFO &#61; 0010000; /* named pipe (fifo) */public static final int S_IFCHR &#61; 0020000; /* character special */public static final int S_IFDIR &#61; 0040000; /* directory */public static final int S_IFBLK &#61; 0060000; /* block special */public static final int S_IFREG &#61; 0100000; /* regular */public static final int S_IFLNK &#61; 0120000; /* symbolic link */public static final int S_IFSOCK &#61; 0140000; /* socket */public static final int S_IFWHT &#61; 0160000; /* whiteout */public static final int S_ISUID &#61; 0004000; /** set user id on* execution*/public static final int S_ISGID &#61; 0002000; /** set group id on* execution*/public static final int S_ISVTX &#61; 0001000; /** save swapped text even* after use*/public static final int S_IRUSR &#61; 0000400; /** read permission, owner*/public static final int S_IWUSR &#61; 0000200; /** write permission,* owner*/public static final int S_IXUSR &#61; 0000100; /** execute/search* permission, owner*/Stat(int ownerId, int groupId, int mode) {this.ownerId &#61; ownerId;this.groupId &#61; groupId;this.mode &#61; mode;}Stat(String owner, String group, int mode) {if (!Shell.WINDOWS) {this.owner &#61; owner;} else {this.owner &#61; stripDomain(owner);}if (!Shell.WINDOWS) {this.group &#61; group;} else {this.group &#61; stripDomain(group);}this.mode &#61; mode;}&#64;Overridepublic String toString() {return "Stat(owner&#61;&#39;" &#43; owner &#43; "&#39;, group&#61;&#39;" &#43; group &#43; "&#39;" &#43; ", mode&#61;" &#43; mode &#43; ")";}public String getOwner() {return owner;}public String getGroup() {return group;}public int getMode() {return mode;}}/*** Returns the file stat for a file descriptor.** &#64;param fd* file descriptor.* &#64;return the file descriptor file stat.* &#64;throws IOException* thrown if there was an IO error while obtaining the file* stat.*/public static Stat getFstat(FileDescriptor fd) throws IOException {Stat stat &#61; null;if (!Shell.WINDOWS) {stat &#61; fstat(fd);stat.owner &#61; getName(IdCache.USER, stat.ownerId);stat.group &#61; getName(IdCache.GROUP, stat.groupId);} else {try {stat &#61; fstat(fd);} catch (NativeIOException nioe) {if (nioe.getErrorCode() &#61;&#61; 6) {throw new NativeIOException("The handle is invalid.", Errno.EBADF);} else {LOG.warn(String.format("NativeIO.getFstat error (%d): %s", nioe.getErrorCode(),nioe.getMessage()));throw new NativeIOException("Unknown error", Errno.UNKNOWN);}}}return stat;}private static String getName(IdCache domain, int id) throws IOException {Map idNameCache &#61; (domain &#61;&#61; IdCache.USER) ? USER_ID_NAME_CACHE : GROUP_ID_NAME_CACHE;String name;CachedName cachedName &#61; idNameCache.get(id);long now &#61; System.currentTimeMillis();if (cachedName !&#61; null && (cachedName.timestamp &#43; cacheTimeout) > now) {name &#61; cachedName.name;} else {name &#61; (domain &#61;&#61; IdCache.USER) ? getUserName(id) : getGroupName(id);if (LOG.isDebugEnabled()) {String type &#61; (domain &#61;&#61; IdCache.USER) ? "UserName" : "GroupName";LOG.debug("Got " &#43; type &#43; " " &#43; name &#43; " for ID " &#43; id &#43; " from the native implementation");}cachedName &#61; new CachedName(name, now);idNameCache.put(id, cachedName);}return name;}static native String getUserName(int uid) throws IOException;static native String getGroupName(int uid) throws IOException;private static class CachedName {final long timestamp;final String name;public CachedName(String name, long timestamp) {this.name &#61; name;this.timestamp &#61; timestamp;}}private static final Map USER_ID_NAME_CACHE &#61; new ConcurrentHashMap();private static final Map GROUP_ID_NAME_CACHE &#61; new ConcurrentHashMap();private enum IdCache {USER, GROUP}public final static int MMAP_PROT_READ &#61; 0x1;public final static int MMAP_PROT_WRITE &#61; 0x2;public final static int MMAP_PROT_EXEC &#61; 0x4;public static native long mmap(FileDescriptor fd, int prot, boolean shared, long length) throws IOException;public static native void munmap(long addr, long length) throws IOException;}private static boolean workaroundNonThreadSafePasswdCalls &#61; false;public static class Windows {// Flags for CreateFile() call on Windowspublic static final long GENERIC_READ &#61; 0x80000000L;public static final long GENERIC_WRITE &#61; 0x40000000L;public static final long FILE_SHARE_READ &#61; 0x00000001L;public static final long FILE_SHARE_WRITE &#61; 0x00000002L;public static final long FILE_SHARE_DELETE &#61; 0x00000004L;public static final long CREATE_NEW &#61; 1;public static final long CREATE_ALWAYS &#61; 2;public static final long OPEN_EXISTING &#61; 3;public static final long OPEN_ALWAYS &#61; 4;public static final long TRUNCATE_EXISTING &#61; 5;public static final long FILE_BEGIN &#61; 0;public static final long FILE_CURRENT &#61; 1;public static final long FILE_END &#61; 2;/** Wrapper around CreateFile() on Windows */public static native FileDescriptor createFile(String path, long desiredAccess, long shareMode,long creationDisposition) throws IOException;/** Wrapper around SetFilePointer() on Windows */public static native long setFilePointer(FileDescriptor fd, long distanceToMove, long moveMethod)throws IOException;/** Windows only methods used for getOwner() implementation */private static native String getOwner(FileDescriptor fd) throws IOException;/** Supported list of Windows access right flags */public static enum AccessRight {ACCESS_READ(0x0001), // FILE_READ_DATAACCESS_WRITE(0x0002), // FILE_WRITE_DATAACCESS_EXECUTE(0x0020); // FILE_EXECUTEprivate final int accessRight;AccessRight(int access) {accessRight &#61; access;}public int accessRight() {return accessRight;}};/*** Windows only method used to check if the current process has* requested access rights on the given path.*/private static native boolean access0(String path, int requestedAccess);/*** Checks whether the current process has desired access rights on the* given path.** Longer term this native function can be substituted with JDK7* function Files#isReadable, isWritable, isExecutable.** &#64;param path* input path* &#64;param desiredAccess* ACCESS_READ, ACCESS_WRITE or ACCESS_EXECUTE* &#64;return true if access is allowed* &#64;throws IOException* I/O exception on error*/public static boolean access(String path, AccessRight desiredAccess) throws IOException {return true;// return access0(path, desiredAccess.accessRight());}static {if (NativeCodeLoader.isNativeCodeLoaded()) {try {initNative();nativeLoaded &#61; true;} catch (Throwable t) {// This can happen if the user has an older version of// libhadoop.so// installed - in this case we can continue without native// IO// after warningLOG.error("Unable to initialize NativeIO libraries", t);}}}}private static final Log LOG &#61; LogFactory.getLog(NativeIO.class);private static boolean nativeLoaded &#61; false;static {if (NativeCodeLoader.isNativeCodeLoaded()) {try {initNative();nativeLoaded &#61; true;} catch (Throwable t) {// This can happen if the user has an older version of// libhadoop.so// installed - in this case we can continue without native IO// after warningLOG.error("Unable to initialize NativeIO libraries", t);}}}/*** Return true if the JNI-based native IO extensions are available.*/public static boolean isAvailable() {return NativeCodeLoader.isNativeCodeLoaded() && nativeLoaded;}/** Initialize the JNI method ID and class ID cache */private static native void initNative();/*** Get the maximum number of bytes that can be locked into memory at any* given point.** &#64;return 0 if no bytes can be locked into memory; Long.MAX_VALUE if there* is no limit; The number of bytes that can be locked into memory* otherwise.*/static long getMemlockLimit() {return isAvailable() ? getMemlockLimit0() : 0;}private static native long getMemlockLimit0();/*** &#64;return the operating system&#39;s page size.*/static long getOperatingSystemPageSize() {try {Field f &#61; Unsafe.class.getDeclaredField("theUnsafe");f.setAccessible(true);Unsafe unsafe &#61; (Unsafe) f.get(null);return unsafe.pageSize();} catch (Throwable e) {LOG.warn("Unable to get operating system page size. Guessing 4096.", e);return 4096;}}private static class CachedUid {final long timestamp;final String username;public CachedUid(String username, long timestamp) {this.timestamp &#61; timestamp;this.username &#61; username;}}private static final Map<Long, CachedUid> uidCache &#61; new ConcurrentHashMap<Long, CachedUid>();private static long cacheTimeout;private static boolean initialized &#61; false;/*** The Windows logon name has two part, NetBIOS domain name and user account* name, of the format DOMAIN\UserName. This method will remove the domain* part of the full logon name.** &#64;param //the* full principal name containing the domain* &#64;return name with domain removed*/private static String stripDomain(String name) {int i &#61; name.indexOf(&#39;\\&#39;);if (i !&#61; -1)name &#61; name.substring(i &#43; 1);return name;}public static String getOwner(FileDescriptor fd) throws IOException {ensureInitialized();if (Shell.WINDOWS) {String owner &#61; Windows.getOwner(fd);owner &#61; stripDomain(owner);return owner;} else {long uid &#61; POSIX.getUIDforFDOwnerforOwner(fd);CachedUid cUid &#61; uidCache.get(uid);long now &#61; System.currentTimeMillis();if (cUid !&#61; null && (cUid.timestamp &#43; cacheTimeout) > now) {return cUid.username;}String user &#61; POSIX.getUserName(uid);LOG.info("Got UserName " &#43; user &#43; " for UID " &#43; uid &#43; " from the native implementation");cUid &#61; new CachedUid(user, now);uidCache.put(uid, cUid);return user;}}/*** Create a FileInputStream that shares delete permission on the file* opened, i.e. other process can delete the file the FileInputStream is* reading. Only Windows implementation uses the native interface.*/public static FileInputStream getShareDeleteFileInputStream(File f) throws IOException {if (!Shell.WINDOWS) {// On Linux the default FileInputStream shares delete permission// on the file opened.//return new FileInputStream(f);} else {// Use Windows native interface to create a FileInputStream that// shares delete permission on the file opened.//FileDescriptor fd &#61; Windows.createFile(f.getAbsolutePath(), Windows.GENERIC_READ,Windows.FILE_SHARE_READ | Windows.FILE_SHARE_WRITE | Windows.FILE_SHARE_DELETE,Windows.OPEN_EXISTING);return new FileInputStream(fd);}}/*** Create a FileInputStream that shares delete permission on the file opened* at a given offset, i.e. other process can delete the file the* FileInputStream is reading. Only Windows implementation uses the native* interface.*/public static FileInputStream getShareDeleteFileInputStream(File f, long seekOffset) throws IOException {if (!Shell.WINDOWS) {RandomAccessFile rf &#61; new RandomAccessFile(f, "r");if (seekOffset > 0) {rf.seek(seekOffset);}return new FileInputStream(rf.getFD());} else {// Use Windows native interface to create a FileInputStream that// shares delete permission on the file opened, and set it to the// given offset.//FileDescriptor fd &#61; Windows.createFile(f.getAbsolutePath(), Windows.GENERIC_READ, Windows.FILE_SHARE_READ| Windows.FILE_SHARE_WRITE | Windows.FILE_SHARE_DELETE,Windows.OPEN_EXISTING);if (seekOffset > 0)Windows.setFilePointer(fd, seekOffset, Windows.FILE_BEGIN);return new FileInputStream(fd);}}/*** Create the specified File for write access, ensuring that it does not* exist.** &#64;param f* the file that we want to create* &#64;param permissions* we want to have on the file (if security is enabled)** &#64;throws AlreadyExistsException* if the file already exists* &#64;throws IOException* if any other error occurred*/public static FileOutputStream getCreateForWriteFileOutputStream(File f, int permissions) throws IOException {if (!Shell.WINDOWS) {// Use the native wrapper around open(2)try {FileDescriptor fd &#61; POSIX.open(f.getAbsolutePath(),POSIX.O_WRONLY | POSIX.O_CREAT | POSIX.O_EXCL, permissions);return new FileOutputStream(fd);} catch (NativeIOException nioe) {if (nioe.getErrno() &#61;&#61; Errno.EEXIST) {throw new AlreadyExistsException(nioe);}throw nioe;}} else {// Use the Windows native APIs to create equivalent FileOutputStreamtry {FileDescriptor fd &#61; Windows.createFile(f.getCanonicalPath(),Windows.GENERIC_WRITE, Windows.FILE_SHARE_DELETE| Windows.FILE_SHARE_READ | Windows.FILE_SHARE_WRITE,Windows.CREATE_NEW);POSIX.chmod(f.getCanonicalPath(), permissions);return new FileOutputStream(fd);} catch (NativeIOException nioe) {if (nioe.getErrorCode() &#61;&#61; 80) {// ERROR_FILE_EXISTS// 80 (0x50)// The file existsthrow new AlreadyExistsException(nioe);}throw nioe;}}}private synchronized static void ensureInitialized() {if (!initialized) {cacheTimeout &#61; new Configuration().getLong("hadoop.security.uid.cache.secs", 4 * 60 * 60) * 1000;LOG.info("Initialized cache for UID to User mapping with a cache" &#43; " timeout of " &#43; cacheTimeout / 1000&#43; " seconds.");initialized &#61; true;}}/*** A version of renameTo that throws a descriptive exception when it fails.** &#64;param src* The source path* &#64;param dst* The destination path** &#64;throws NativeIOException* On failure.*/public static void renameTo(File src, File dst) throws IOException {if (!nativeLoaded) {if (!src.renameTo(dst)) {throw new IOException("renameTo(src&#61;" &#43; src &#43; ", dst&#61;" &#43; dst &#43; ") failed.");}} else {renameTo0(src.getAbsolutePath(), dst.getAbsolutePath());}}/*** A version of renameTo that throws a descriptive exception when it fails.** &#64;param src* The source path* &#64;param dst* The destination path** &#64;throws NativeIOException* On failure.*/private static native void renameTo0(String src, String dst) throws NativeIOException;
}


推荐阅读
  • 本文深入探讨了CGLIB BeanCopier在Bean对象复制中的应用及其优化技巧。相较于Spring的BeanUtils和Apache的BeanUtils,CGLIB BeanCopier在性能上具有显著优势。通过详细分析其内部机制和使用场景,本文提供了多种优化方法,帮助开发者在实际项目中更高效地利用这一工具。此外,文章还讨论了CGLIB BeanCopier在复杂对象结构和大规模数据处理中的表现,为读者提供了实用的参考和建议。 ... [详细]
  • 《Intel IA-32 架构软件开发人员手册详尽指南》提供了详尽的 IA-32 架构技术文档,涵盖指令集、系统编程和硬件接口等内容,为软件开发人员提供全面的技术支持和参考。该手册不仅包括详细的架构说明,还提供了丰富的编程示例和最佳实践,帮助开发人员更好地理解和应用 IA-32 架构。 ... [详细]
  • 本文介绍了UUID(通用唯一标识符)的概念及其在JavaScript中生成Java兼容UUID的代码实现与优化技巧。UUID是一个128位的唯一标识符,广泛应用于分布式系统中以确保唯一性。文章详细探讨了如何利用JavaScript生成符合Java标准的UUID,并提供了多种优化方法,以提高生成效率和兼容性。 ... [详细]
  • 2018年9月21日,Destoon官方发布了安全更新,修复了一个由用户“索马里的海贼”报告的前端GETShell漏洞。该漏洞存在于20180827版本的某CMS中,攻击者可以通过构造特定的HTTP请求,利用该漏洞在服务器上执行任意代码,从而获得对系统的控制权。此次更新建议所有用户尽快升级至最新版本,以确保系统的安全性。 ... [详细]
  • 本文探讨了利用Java实现WebSocket实时消息推送技术的方法。与传统的轮询、长连接或短连接等方案相比,WebSocket提供了一种更为高效和低延迟的双向通信机制。通过建立持久连接,服务器能够主动向客户端推送数据,从而实现真正的实时消息传递。此外,本文还介绍了WebSocket在实际应用中的优势和应用场景,并提供了详细的实现步骤和技术细节。 ... [详细]
  • AIX编程挑战赛:AIX正方形问题的算法解析与Java代码实现
    在昨晚的阅读中,我注意到了CSDN博主西部阿呆-小草屋发表的一篇文章《AIX程序设计大赛——AIX正方形问题》。该文详细阐述了AIX正方形问题的背景,并提供了一种基于Java语言的解决方案。本文将深入解析这一算法的核心思想,并展示具体的Java代码实现,旨在为参赛者和编程爱好者提供有价值的参考。 ... [详细]
  • 在前文探讨了Spring如何为特定的bean选择合适的通知器后,本文将进一步深入分析Spring AOP框架中代理对象的生成机制。具体而言,我们将详细解析如何通过代理技术将通知器(Advisor)中包含的通知(Advice)应用到目标bean上,以实现切面编程的核心功能。 ... [详细]
  • 本文详细介绍了如何安全地手动卸载Exchange Server 2003,以确保系统的稳定性和数据的完整性。根据微软官方支持文档(https://support.microsoft.com/kb833396/zh-cn),在进行卸载操作前,需要特别注意备份重要数据,并遵循一系列严格的步骤,以避免对现有网络环境造成不利影响。此外,文章还提供了详细的故障排除指南,帮助管理员在遇到问题时能够迅速解决,确保整个卸载过程顺利进行。 ... [详细]
  • 动态壁纸 LiveWallPaper:让您的桌面栩栩如生(第二篇)
    在本文中,我们将继续探讨如何开发动态壁纸 LiveWallPaper,使您的桌面更加生动有趣。作为 2010 年 Google 暑期大学生博客分享大赛 Android 篇的一部分,我们将详细介绍 Ed Burnette 的《Hello, Android》第三版中的相关内容,并分享一些实用的开发技巧和经验。通过本篇文章,您将了解到如何利用 Android SDK 创建引人入胜的动态壁纸,提升用户体验。 ... [详细]
  • 在Ubuntu系统中配置Python环境变量是确保项目顺利运行的关键步骤。本文介绍了如何将Windows上的Django项目迁移到Ubuntu,并解决因虚拟环境导致的模块缺失问题。通过详细的操作指南,帮助读者正确配置虚拟环境,确保所有第三方库都能被正确识别和使用。此外,还提供了一些实用的技巧,如如何检查环境变量配置是否正确,以及如何在多个虚拟环境之间切换。 ... [详细]
  • HBase Java API 进阶:过滤器详解与应用实例
    本文详细探讨了HBase 1.2.6版本中Java API的高级应用,重点介绍了过滤器的使用方法和实际案例。首先,文章对几种常见的HBase过滤器进行了概述,包括列前缀过滤器(ColumnPrefixFilter)和时间戳过滤器(TimestampsFilter)。此外,还详细讲解了分页过滤器(PageFilter)的实现原理及其在大数据查询中的应用场景。通过具体的代码示例,读者可以更好地理解和掌握这些过滤器的使用技巧,从而提高数据处理的效率和灵活性。 ... [详细]
  • 如何高效启动大数据应用之旅?
    在前一篇文章中,我探讨了大数据的定义及其与数据挖掘的区别。本文将重点介绍如何高效启动大数据应用项目,涵盖关键步骤和最佳实践,帮助读者快速踏上大数据之旅。 ... [详细]
  • 本文深入探讨了 hCalendar 微格式在事件与时间、地点相关活动标记中的应用。作为微格式系列文章的第四篇,前文已分别介绍了 rel 属性用于定义链接关系、XFN 微格式增强链接的人际关系描述以及 hCard 微格式对个人和组织信息的描述。本次将重点解析 hCalendar 如何通过结构化数据标记,提高事件信息的可读性和互操作性。 ... [详细]
  • 在过去,我曾使用过自建MySQL服务器中的MyISAM和InnoDB存储引擎(也曾尝试过Memory引擎)。今年初,我开始转向阿里云的关系型数据库服务,并深入研究了其高效的压缩存储引擎TokuDB。TokuDB在数据压缩和处理大规模数据集方面表现出色,显著提升了存储效率和查询性能。通过实际应用,我发现TokuDB不仅能够有效减少存储成本,还能显著提高数据处理速度,特别适用于高并发和大数据量的场景。 ... [详细]
  • Hadoop 2.6 主要由 HDFS 和 YARN 两大部分组成,其中 YARN 包含了运行在 ResourceManager 的 JVM 中的组件以及在 NodeManager 中运行的部分。本文深入探讨了 Hadoop 2.6 日志文件的解析方法,并详细介绍了 MapReduce 日志管理的最佳实践,旨在帮助用户更好地理解和优化日志处理流程,提高系统运维效率。 ... [详细]
author-avatar
手机用户2502856053
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有