This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static java.lang.Integer.bitCount; | |
final class IntervalCalculator | |
{ | |
private final int lengthAsPowerOfTwo; | |
private final int mask; | |
private int lastIntervalSize; | |
private int currentIntervalSize; | |
private int pointer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void writeMessage(final long sequence, final byte[] data, final int length) throws IOException | |
{ | |
final long startTime = System.nanoTime(); | |
delegate.writeMessage(sequence, data, length); | |
valueRecorder.recordValue(System.nanoTime() - startTime); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
From http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c#l111 | |
*/ | |
Java_sun_nio_ch_FileDispatcherImpl_pwrite0(JNIEnv *env, jclass clazz, jobject fdo, | |
jlong address, jint len, jlong offset) | |
{ | |
jint fd = fdval(env, fdo); | |
void *buf = (void *)jlong_to_ptr(address); | |
return convertReturnVal(env, pwrite64(fd, buf, len, offset), JNI_FALSE); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
From http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/solaris/native/java/io/io_util_md.h#l71 | |
*/ | |
#define IO_Write handleWrite | |
#define IO_Append handleWrite | |
// ... | |
/* | |
http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/solaris/native/java/io/io_util_md.c#l160 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
From http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/native/java/io/io_util.c#l145 | |
*/ | |
void | |
writeBytes(JNIEnv *env, jobject this, jbyteArray bytes, | |
jint off, jint len, jboolean append, jfieldID fid) | |
{ | |
jint n; | |
char stackBuf[BUF_SIZE]; | |
char *buf = NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
From http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/classes/java/io/RandomAccessFile.java#l521 | |
*/ | |
public void seek(long pos) throws IOException { | |
if (pos < 0) { | |
throw new IOException("Negative seek offset"); | |
} else { | |
seek0(pos); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
From http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/native/java/io/RandomAccessFile.c#l126 | |
*/ | |
Java_java_io_RandomAccessFile_seek0(JNIEnv *env, | |
jobject this, jlong pos) { | |
FD fd; | |
fd = GET_FD(this, raf_fd); | |
if (fd == -1) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
From http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/solaris/native/java/io/io_util_md.h#l76 | |
*/ | |
#ifdef _ALLBSD_SOURCE | |
#define open64 open | |
#define fstat64 fstat | |
#define stat64 stat | |
#define lseek64 lseek | |
#define ftruncate64 ftruncate | |
#define IO_Lseek lseek |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
From http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/classes/java/io/RandomAccessFile.java#l492 | |
*/ | |
public void write(byte b[], int off, int len) throws IOException { | |
writeBytes(b, off, len); | |
} | |
// ... | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
From http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/native/java/io/RandomAccessFile.c#l83 | |
*/ | |
Java_java_io_RandomAccessFile_writeBytes(JNIEnv *env, | |
jobject this, jbyteArray bytes, jint off, jint len) { | |
writeBytes(env, this, bytes, off, len, JNI_FALSE, raf_fd); | |
} |
OlderNewer