提交 51b76b36 编写于 作者: A alanb

6726309: Compiler warnings in nio code

Reviewed-by: sherman, iris
上级 ef0b0d2b
...@@ -82,7 +82,7 @@ public abstract class AbstractSelector ...@@ -82,7 +82,7 @@ public abstract class AbstractSelector
this.provider = provider; this.provider = provider;
} }
private final Set cancelledKeys = new HashSet(); private final Set<SelectionKey> cancelledKeys = new HashSet<SelectionKey>();
void cancel(SelectionKey k) { // package-private void cancel(SelectionKey k) { // package-private
synchronized (cancelledKeys) { synchronized (cancelledKeys) {
......
...@@ -303,7 +303,7 @@ public abstract class Charset$Coder$ { ...@@ -303,7 +303,7 @@ public abstract class Charset$Coder$ {
#if[encoder] #if[encoder]
private WeakReference cachedDecoder = null; private WeakReference<CharsetDecoder> cachedDecoder = null;
/** /**
* Tells whether or not the given byte array is a legal replacement value * Tells whether or not the given byte array is a legal replacement value
...@@ -322,13 +322,13 @@ public abstract class Charset$Coder$ { ...@@ -322,13 +322,13 @@ public abstract class Charset$Coder$ {
* is a legal replacement value for this encoder * is a legal replacement value for this encoder
*/ */
public boolean isLegalReplacement(byte[] repl) { public boolean isLegalReplacement(byte[] repl) {
WeakReference wr = cachedDecoder; WeakReference<CharsetDecoder> wr = cachedDecoder;
CharsetDecoder dec = null; CharsetDecoder dec = null;
if ((wr == null) || ((dec = (CharsetDecoder)wr.get()) == null)) { if ((wr == null) || ((dec = wr.get()) == null)) {
dec = charset().newDecoder(); dec = charset().newDecoder();
dec.onMalformedInput(CodingErrorAction.REPORT); dec.onMalformedInput(CodingErrorAction.REPORT);
dec.onUnmappableCharacter(CodingErrorAction.REPORT); dec.onUnmappableCharacter(CodingErrorAction.REPORT);
cachedDecoder = new WeakReference(dec); cachedDecoder = new WeakReference<CharsetDecoder>(dec);
} else { } else {
dec.reset(); dec.reset();
} }
......
...@@ -379,7 +379,7 @@ public abstract class Charset ...@@ -379,7 +379,7 @@ public abstract class Charset
} }
// Thread-local gate to prevent recursive provider lookups // Thread-local gate to prevent recursive provider lookups
private static ThreadLocal gate = new ThreadLocal(); private static ThreadLocal<ThreadLocal> gate = new ThreadLocal<ThreadLocal>();
private static Charset lookupViaProviders(final String charsetName) { private static Charset lookupViaProviders(final String charsetName) {
...@@ -539,9 +539,9 @@ public abstract class Charset ...@@ -539,9 +539,9 @@ public abstract class Charset
// Fold charsets from the given iterator into the given map, ignoring // Fold charsets from the given iterator into the given map, ignoring
// charsets whose names already have entries in the map. // charsets whose names already have entries in the map.
// //
private static void put(Iterator i, Map m) { private static void put(Iterator<Charset> i, Map<String,Charset> m) {
while (i.hasNext()) { while (i.hasNext()) {
Charset cs = (Charset)i.next(); Charset cs = i.next();
if (!m.containsKey(cs.name())) if (!m.containsKey(cs.name()))
m.put(cs.name(), cs); m.put(cs.name(), cs);
} }
...@@ -623,7 +623,7 @@ public abstract class Charset ...@@ -623,7 +623,7 @@ public abstract class Charset
private final String name; // tickles a bug in oldjavac private final String name; // tickles a bug in oldjavac
private final String[] aliases; // tickles a bug in oldjavac private final String[] aliases; // tickles a bug in oldjavac
private Set aliasSet = null; private Set<String> aliasSet = null;
/** /**
* Initializes a new charset with the given canonical name and alias * Initializes a new charset with the given canonical name and alias
...@@ -665,7 +665,7 @@ public abstract class Charset ...@@ -665,7 +665,7 @@ public abstract class Charset
if (aliasSet != null) if (aliasSet != null)
return aliasSet; return aliasSet;
int n = aliases.length; int n = aliases.length;
HashSet hs = new HashSet(n); HashSet<String> hs = new HashSet<String>(n);
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
hs.add(aliases[i]); hs.add(aliases[i]);
aliasSet = Collections.unmodifiableSet(hs); aliasSet = Collections.unmodifiableSet(hs);
......
...@@ -194,7 +194,7 @@ public class CoderResult { ...@@ -194,7 +194,7 @@ public class CoderResult {
private static abstract class Cache { private static abstract class Cache {
private Map cache = null; private Map<Integer,WeakReference<CoderResult>> cache = null;
protected abstract CoderResult create(int len); protected abstract CoderResult create(int len);
...@@ -202,16 +202,16 @@ public class CoderResult { ...@@ -202,16 +202,16 @@ public class CoderResult {
if (len <= 0) if (len <= 0)
throw new IllegalArgumentException("Non-positive length"); throw new IllegalArgumentException("Non-positive length");
Integer k = new Integer(len); Integer k = new Integer(len);
WeakReference w; WeakReference<CoderResult> w;
CoderResult e = null; CoderResult e = null;
if (cache == null) { if (cache == null) {
cache = new HashMap(); cache = new HashMap<Integer,WeakReference<CoderResult>>();
} else if ((w = (WeakReference)cache.get(k)) != null) { } else if ((w = cache.get(k)) != null) {
e = (CoderResult)w.get(); e = w.get();
} }
if (e == null) { if (e == null) {
e = create(len); e = create(len);
cache.put(k, new WeakReference(e)); cache.put(k, new WeakReference<CoderResult>(e));
} }
return e; return e;
} }
......
...@@ -42,19 +42,19 @@ abstract class SelectorImpl ...@@ -42,19 +42,19 @@ abstract class SelectorImpl
{ {
// The set of keys with data ready for an operation // The set of keys with data ready for an operation
protected Set selectedKeys; protected Set<SelectionKey> selectedKeys;
// The set of keys registered with this Selector // The set of keys registered with this Selector
protected HashSet keys; protected HashSet<SelectionKey> keys;
// Public views of the key sets // Public views of the key sets
private Set publicKeys; // Immutable private Set<SelectionKey> publicKeys; // Immutable
private Set publicSelectedKeys; // Removal allowed, but not addition private Set<SelectionKey> publicSelectedKeys; // Removal allowed, but not addition
protected SelectorImpl(SelectorProvider sp) { protected SelectorImpl(SelectorProvider sp) {
super(sp); super(sp);
keys = new HashSet(); keys = new HashSet<SelectionKey>();
selectedKeys = new HashSet(); selectedKeys = new HashSet<SelectionKey>();
if (Util.atBugLevel("1.4")) { if (Util.atBugLevel("1.4")) {
publicKeys = keys; publicKeys = keys;
publicSelectedKeys = selectedKeys; publicSelectedKeys = selectedKeys;
...@@ -64,13 +64,13 @@ abstract class SelectorImpl ...@@ -64,13 +64,13 @@ abstract class SelectorImpl
} }
} }
public Set keys() { public Set<SelectionKey> keys() {
if (!isOpen() && !Util.atBugLevel("1.4")) if (!isOpen() && !Util.atBugLevel("1.4"))
throw new ClosedSelectorException(); throw new ClosedSelectorException();
return publicKeys; return publicKeys;
} }
public Set selectedKeys() { public Set<SelectionKey> selectedKeys() {
if (!isOpen() && !Util.atBugLevel("1.4")) if (!isOpen() && !Util.atBugLevel("1.4"))
throw new ClosedSelectorException(); throw new ClosedSelectorException();
return publicSelectedKeys; return publicSelectedKeys;
......
...@@ -51,9 +51,13 @@ class Util { ...@@ -51,9 +51,13 @@ class Util {
// Per-thread soft cache of the last temporary direct buffer // Per-thread soft cache of the last temporary direct buffer
private static ThreadLocal<SoftReference<ByteBuffer>>[] bufferPool; private static ThreadLocal<SoftReference<ByteBuffer>>[] bufferPool;
@SuppressWarnings("unchecked")
static ThreadLocal<SoftReference<ByteBuffer>>[] createThreadLocalBufferPool() {
return new ThreadLocal[TEMP_BUF_POOL_SIZE];
}
static { static {
bufferPool = (ThreadLocal<SoftReference<ByteBuffer>>[]) bufferPool = createThreadLocalBufferPool();
new ThreadLocal[TEMP_BUF_POOL_SIZE];
for (int i=0; i<TEMP_BUF_POOL_SIZE; i++) for (int i=0; i<TEMP_BUF_POOL_SIZE; i++)
bufferPool[i] = new ThreadLocal<SoftReference<ByteBuffer>>(); bufferPool[i] = new ThreadLocal<SoftReference<ByteBuffer>>();
} }
......
...@@ -116,7 +116,7 @@ Java_java_nio_Bits_copyFromShortArray(JNIEnv *env, jobject this, jobject src, ...@@ -116,7 +116,7 @@ Java_java_nio_Bits_copyFromShortArray(JNIEnv *env, jobject this, jobject src,
jshort *srcShort, *dstShort, *endShort; jshort *srcShort, *dstShort, *endShort;
jshort tmpShort; jshort tmpShort;
dstShort = (jshort *)dstAddr; dstShort = (jshort *)jlong_to_ptr(dstAddr);
while (length > 0) { while (length > 0) {
/* do not change this if-else statement, see WARNING above */ /* do not change this if-else statement, see WARNING above */
...@@ -151,7 +151,7 @@ Java_java_nio_Bits_copyToShortArray(JNIEnv *env, jobject this, jlong srcAddr, ...@@ -151,7 +151,7 @@ Java_java_nio_Bits_copyToShortArray(JNIEnv *env, jobject this, jlong srcAddr,
jshort *srcShort, *dstShort, *endShort; jshort *srcShort, *dstShort, *endShort;
jshort tmpShort; jshort tmpShort;
srcShort = (jshort *)srcAddr; srcShort = (jshort *)jlong_to_ptr(srcAddr);
while (length > 0) { while (length > 0) {
/* do not change this if-else statement, see WARNING above */ /* do not change this if-else statement, see WARNING above */
...@@ -186,7 +186,7 @@ Java_java_nio_Bits_copyFromIntArray(JNIEnv *env, jobject this, jobject src, ...@@ -186,7 +186,7 @@ Java_java_nio_Bits_copyFromIntArray(JNIEnv *env, jobject this, jobject src,
jint *srcInt, *dstInt, *endInt; jint *srcInt, *dstInt, *endInt;
jint tmpInt; jint tmpInt;
dstInt = (jint *)dstAddr; dstInt = (jint *)jlong_to_ptr(dstAddr);
while (length > 0) { while (length > 0) {
/* do not change this code, see WARNING above */ /* do not change this code, see WARNING above */
...@@ -221,7 +221,7 @@ Java_java_nio_Bits_copyToIntArray(JNIEnv *env, jobject this, jlong srcAddr, ...@@ -221,7 +221,7 @@ Java_java_nio_Bits_copyToIntArray(JNIEnv *env, jobject this, jlong srcAddr,
jint *srcInt, *dstInt, *endInt; jint *srcInt, *dstInt, *endInt;
jint tmpInt; jint tmpInt;
srcInt = (jint *)srcAddr; srcInt = (jint *)jlong_to_ptr(srcAddr);
while (length > 0) { while (length > 0) {
/* do not change this code, see WARNING above */ /* do not change this code, see WARNING above */
...@@ -256,7 +256,7 @@ Java_java_nio_Bits_copyFromLongArray(JNIEnv *env, jobject this, jobject src, ...@@ -256,7 +256,7 @@ Java_java_nio_Bits_copyFromLongArray(JNIEnv *env, jobject this, jobject src,
jlong *srcLong, *dstLong, *endLong; jlong *srcLong, *dstLong, *endLong;
jlong tmpLong; jlong tmpLong;
dstLong = (jlong *)dstAddr; dstLong = (jlong *)jlong_to_ptr(dstAddr);
while (length > 0) { while (length > 0) {
/* do not change this code, see WARNING above */ /* do not change this code, see WARNING above */
...@@ -291,7 +291,7 @@ Java_java_nio_Bits_copyToLongArray(JNIEnv *env, jobject this, jlong srcAddr, ...@@ -291,7 +291,7 @@ Java_java_nio_Bits_copyToLongArray(JNIEnv *env, jobject this, jlong srcAddr,
jlong *srcLong, *dstLong, *endLong; jlong *srcLong, *dstLong, *endLong;
jlong tmpLong; jlong tmpLong;
srcLong = (jlong *)srcAddr; srcLong = (jlong *)jlong_to_ptr(srcAddr);
while (length > 0) { while (length > 0) {
/* do not change this code, see WARNING above */ /* do not change this code, see WARNING above */
......
...@@ -50,7 +50,7 @@ class DevPollSelectorImpl ...@@ -50,7 +50,7 @@ class DevPollSelectorImpl
private int totalChannels; private int totalChannels;
// Maps from file descriptors to keys // Maps from file descriptors to keys
private HashMap fdToKey; private Map<Integer,SelectionKeyImpl> fdToKey;
// True if this Selector has been closed // True if this Selector has been closed
private boolean closed = false; private boolean closed = false;
...@@ -71,7 +71,7 @@ class DevPollSelectorImpl ...@@ -71,7 +71,7 @@ class DevPollSelectorImpl
fd1 = fdes[1]; fd1 = fdes[1];
pollWrapper = new DevPollArrayWrapper(); pollWrapper = new DevPollArrayWrapper();
pollWrapper.initInterrupt(fd0, fd1); pollWrapper.initInterrupt(fd0, fd1);
fdToKey = new HashMap(); fdToKey = new HashMap<Integer,SelectionKeyImpl>();
totalChannels = 1; totalChannels = 1;
} }
...@@ -110,8 +110,7 @@ class DevPollSelectorImpl ...@@ -110,8 +110,7 @@ class DevPollSelectorImpl
int numKeysUpdated = 0; int numKeysUpdated = 0;
for (int i=0; i<entries; i++) { for (int i=0; i<entries; i++) {
int nextFD = pollWrapper.getDescriptor(i); int nextFD = pollWrapper.getDescriptor(i);
SelectionKeyImpl ski = (SelectionKeyImpl) fdToKey.get( SelectionKeyImpl ski = fdToKey.get(Integer.valueOf(nextFD));
new Integer(nextFD));
// ski is null in the case of an interrupt // ski is null in the case of an interrupt
if (ski != null) { if (ski != null) {
int rOps = pollWrapper.getReventOps(i); int rOps = pollWrapper.getReventOps(i);
...@@ -169,7 +168,7 @@ class DevPollSelectorImpl ...@@ -169,7 +168,7 @@ class DevPollSelectorImpl
protected void implRegister(SelectionKeyImpl ski) { protected void implRegister(SelectionKeyImpl ski) {
int fd = IOUtil.fdVal(ski.channel.getFD()); int fd = IOUtil.fdVal(ski.channel.getFD());
fdToKey.put(new Integer(fd), ski); fdToKey.put(Integer.valueOf(fd), ski);
totalChannels++; totalChannels++;
keys.add(ski); keys.add(ski);
} }
...@@ -178,7 +177,7 @@ class DevPollSelectorImpl ...@@ -178,7 +177,7 @@ class DevPollSelectorImpl
int i = ski.getIndex(); int i = ski.getIndex();
assert (i >= 0); assert (i >= 0);
int fd = ski.channel.getFDVal(); int fd = ski.channel.getFDVal();
fdToKey.remove(new Integer(fd)); fdToKey.remove(Integer.valueOf(fd));
pollWrapper.release(fd); pollWrapper.release(fd);
totalChannels--; totalChannels--;
ski.setIndex(-1); ski.setIndex(-1);
......
...@@ -48,7 +48,7 @@ class EPollSelectorImpl ...@@ -48,7 +48,7 @@ class EPollSelectorImpl
EPollArrayWrapper pollWrapper; EPollArrayWrapper pollWrapper;
// Maps from file descriptors to keys // Maps from file descriptors to keys
private HashMap fdToKey; private Map<Integer,SelectionKeyImpl> fdToKey;
// True if this Selector has been closed // True if this Selector has been closed
private boolean closed = false; private boolean closed = false;
...@@ -69,7 +69,7 @@ class EPollSelectorImpl ...@@ -69,7 +69,7 @@ class EPollSelectorImpl
fd1 = fdes[1]; fd1 = fdes[1];
pollWrapper = new EPollArrayWrapper(); pollWrapper = new EPollArrayWrapper();
pollWrapper.initInterrupt(fd0, fd1); pollWrapper.initInterrupt(fd0, fd1);
fdToKey = new HashMap(); fdToKey = new HashMap<Integer,SelectionKeyImpl>();
} }
protected int doSelect(long timeout) protected int doSelect(long timeout)
...@@ -107,8 +107,7 @@ class EPollSelectorImpl ...@@ -107,8 +107,7 @@ class EPollSelectorImpl
int numKeysUpdated = 0; int numKeysUpdated = 0;
for (int i=0; i<entries; i++) { for (int i=0; i<entries; i++) {
int nextFD = pollWrapper.getDescriptor(i); int nextFD = pollWrapper.getDescriptor(i);
SelectionKeyImpl ski = (SelectionKeyImpl) fdToKey.get( SelectionKeyImpl ski = fdToKey.get(Integer.valueOf(nextFD));
new Integer(nextFD));
// ski is null in the case of an interrupt // ski is null in the case of an interrupt
if (ski != null) { if (ski != null) {
int rOps = pollWrapper.getEventOps(i); int rOps = pollWrapper.getEventOps(i);
...@@ -164,7 +163,7 @@ class EPollSelectorImpl ...@@ -164,7 +163,7 @@ class EPollSelectorImpl
protected void implRegister(SelectionKeyImpl ski) { protected void implRegister(SelectionKeyImpl ski) {
int fd = IOUtil.fdVal(ski.channel.getFD()); int fd = IOUtil.fdVal(ski.channel.getFD());
fdToKey.put(new Integer(fd), ski); fdToKey.put(Integer.valueOf(fd), ski);
pollWrapper.add(fd); pollWrapper.add(fd);
keys.add(ski); keys.add(ski);
} }
...@@ -172,7 +171,7 @@ class EPollSelectorImpl ...@@ -172,7 +171,7 @@ class EPollSelectorImpl
protected void implDereg(SelectionKeyImpl ski) throws IOException { protected void implDereg(SelectionKeyImpl ski) throws IOException {
assert (ski.getIndex() >= 0); assert (ski.getIndex() >= 0);
int fd = ski.channel.getFDVal(); int fd = ski.channel.getFDVal();
fdToKey.remove(new Integer(fd)); fdToKey.remove(Integer.valueOf(fd));
pollWrapper.release(fd); pollWrapper.release(fd);
ski.setIndex(-1); ski.setIndex(-1);
keys.remove(ski); keys.remove(ski);
......
...@@ -43,7 +43,11 @@ Java_java_nio_MappedByteBuffer_isLoaded0(JNIEnv *env, jobject obj, ...@@ -43,7 +43,11 @@ Java_java_nio_MappedByteBuffer_isLoaded0(JNIEnv *env, jobject obj,
int result = 0; int result = 0;
int i = 0; int i = 0;
void *a = (void *) jlong_to_ptr(address); void *a = (void *) jlong_to_ptr(address);
char * vec = (char *)malloc(numPages * sizeof(char)); #ifdef __linux__
unsigned char *vec = (unsigned char *)malloc(numPages * sizeof(char));
#else
char *vec = (char *)malloc(numPages * sizeof(char));
#endif
if (vec == NULL) { if (vec == NULL) {
JNU_ThrowOutOfMemoryError(env, NULL); JNU_ThrowOutOfMemoryError(env, NULL);
......
...@@ -123,7 +123,7 @@ Java_sun_nio_ch_DatagramChannelImpl_receive0(JNIEnv *env, jobject this, ...@@ -123,7 +123,7 @@ Java_sun_nio_ch_DatagramChannelImpl_receive0(JNIEnv *env, jobject this,
jint fd = fdval(env, fdo); jint fd = fdval(env, fdo);
void *buf = (void *)jlong_to_ptr(address); void *buf = (void *)jlong_to_ptr(address);
SOCKADDR sa; SOCKADDR sa;
int sa_len = SOCKADDR_LEN; socklen_t sa_len = SOCKADDR_LEN;
jboolean retry = JNI_FALSE; jboolean retry = JNI_FALSE;
jint n = 0; jint n = 0;
jobject senderAddr; jobject senderAddr;
......
...@@ -88,7 +88,8 @@ Java_sun_nio_ch_InheritedChannel_peerPort0(JNIEnv *env, jclass cla, jint fd) ...@@ -88,7 +88,8 @@ Java_sun_nio_ch_InheritedChannel_peerPort0(JNIEnv *env, jclass cla, jint fd)
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_sun_nio_ch_InheritedChannel_soType0(JNIEnv *env, jclass cla, jint fd) Java_sun_nio_ch_InheritedChannel_soType0(JNIEnv *env, jclass cla, jint fd)
{ {
int sotype, arglen=sizeof(sotype); int sotype;
socklen_t arglen=sizeof(sotype);
if (getsockopt(fd, SOL_SOCKET, SO_TYPE, (void *)&sotype, &arglen) == 0) { if (getsockopt(fd, SOL_SOCKET, SO_TYPE, (void *)&sotype, &arglen) == 0) {
if (sotype == SOCK_STREAM) if (sotype == SOCK_STREAM)
return sun_nio_ch_InheritedChannel_SOCK_STREAM; return sun_nio_ch_InheritedChannel_SOCK_STREAM;
......
...@@ -138,7 +138,7 @@ JNIEXPORT jint JNICALL ...@@ -138,7 +138,7 @@ JNIEXPORT jint JNICALL
Java_sun_nio_ch_Net_localPort(JNIEnv *env, jclass clazz, jobject fdo) Java_sun_nio_ch_Net_localPort(JNIEnv *env, jclass clazz, jobject fdo)
{ {
SOCKADDR sa; SOCKADDR sa;
int sa_len = SOCKADDR_LEN; socklen_t sa_len = SOCKADDR_LEN;
if (getsockname(fdval(env, fdo), (struct sockaddr *)&sa, &sa_len) < 0) { if (getsockname(fdval(env, fdo), (struct sockaddr *)&sa, &sa_len) < 0) {
handleSocketError(env, errno); handleSocketError(env, errno);
return -1; return -1;
...@@ -150,7 +150,7 @@ JNIEXPORT jobject JNICALL ...@@ -150,7 +150,7 @@ JNIEXPORT jobject JNICALL
Java_sun_nio_ch_Net_localInetAddress(JNIEnv *env, jclass clazz, jobject fdo) Java_sun_nio_ch_Net_localInetAddress(JNIEnv *env, jclass clazz, jobject fdo)
{ {
SOCKADDR sa; SOCKADDR sa;
int sa_len = SOCKADDR_LEN; socklen_t sa_len = SOCKADDR_LEN;
int port; int port;
if (getsockname(fdval(env, fdo), (struct sockaddr *)&sa, &sa_len) < 0) { if (getsockname(fdval(env, fdo), (struct sockaddr *)&sa, &sa_len) < 0) {
handleSocketError(env, errno); handleSocketError(env, errno);
......
...@@ -81,12 +81,12 @@ Java_sun_nio_ch_ServerSocketChannelImpl_accept0(JNIEnv *env, jobject this, ...@@ -81,12 +81,12 @@ Java_sun_nio_ch_ServerSocketChannelImpl_accept0(JNIEnv *env, jobject this,
jint ssfd = (*env)->GetIntField(env, ssfdo, fd_fdID); jint ssfd = (*env)->GetIntField(env, ssfdo, fd_fdID);
jint newfd; jint newfd;
struct sockaddr *sa; struct sockaddr *sa;
int sa_len; int alloc_len;
jobject remote_ia = 0; jobject remote_ia = 0;
jobject isa; jobject isa;
jint remote_port; jint remote_port;
NET_AllocSockaddr(&sa, &sa_len); NET_AllocSockaddr(&sa, &alloc_len);
/* /*
* accept connection but ignore ECONNABORTED indicating that * accept connection but ignore ECONNABORTED indicating that
...@@ -94,6 +94,7 @@ Java_sun_nio_ch_ServerSocketChannelImpl_accept0(JNIEnv *env, jobject this, ...@@ -94,6 +94,7 @@ Java_sun_nio_ch_ServerSocketChannelImpl_accept0(JNIEnv *env, jobject this,
* accept() was called. * accept() was called.
*/ */
for (;;) { for (;;) {
socklen_t sa_len = alloc_len;
newfd = accept(ssfd, sa, &sa_len); newfd = accept(ssfd, sa, &sa_len);
if (newfd >= 0) { if (newfd >= 0) {
break; break;
......
...@@ -55,7 +55,7 @@ Java_sun_nio_ch_SocketChannelImpl_checkConnect(JNIEnv *env, jobject this, ...@@ -55,7 +55,7 @@ Java_sun_nio_ch_SocketChannelImpl_checkConnect(JNIEnv *env, jobject this,
jboolean ready) jboolean ready)
{ {
int error = 0; int error = 0;
int n = sizeof(int); socklen_t n = sizeof(int);
jint fd = fdval(env, fdo); jint fd = fdval(env, fdo);
int result = 0; int result = 0;
struct pollfd poller; struct pollfd poller;
......
...@@ -67,7 +67,7 @@ class PipeImpl ...@@ -67,7 +67,7 @@ class PipeImpl
} }
private class Initializer private class Initializer
implements PrivilegedExceptionAction implements PrivilegedExceptionAction<Void>
{ {
private final SelectorProvider sp; private final SelectorProvider sp;
...@@ -76,7 +76,7 @@ class PipeImpl ...@@ -76,7 +76,7 @@ class PipeImpl
this.sp = sp; this.sp = sp;
} }
public Object run() throws IOException { public Void run() throws IOException {
ServerSocketChannel ssc = null; ServerSocketChannel ssc = null;
SocketChannel sc1 = null; SocketChannel sc1 = null;
SocketChannel sc2 = null; SocketChannel sc2 = null;
......
...@@ -72,7 +72,7 @@ final class WindowsSelectorImpl extends SelectorImpl { ...@@ -72,7 +72,7 @@ final class WindowsSelectorImpl extends SelectorImpl {
private int threadsCount = 0; private int threadsCount = 0;
// A list of helper threads for select. // A list of helper threads for select.
private final List threads = new ArrayList(); private final List<Thread> threads = new ArrayList<Thread>();
//Pipe used as a wakeup object. //Pipe used as a wakeup object.
private final Pipe wakeupPipe; private final Pipe wakeupPipe;
...@@ -82,6 +82,7 @@ final class WindowsSelectorImpl extends SelectorImpl { ...@@ -82,6 +82,7 @@ final class WindowsSelectorImpl extends SelectorImpl {
// Maps file descriptors to their indices in pollArray // Maps file descriptors to their indices in pollArray
private final static class FdMap extends HashMap<Integer, MapEntry> { private final static class FdMap extends HashMap<Integer, MapEntry> {
static final long serialVersionUID = 0L;
private MapEntry get(int desc) { private MapEntry get(int desc) {
return get(new Integer(desc)); return get(new Integer(desc));
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册