aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichaelm <none@none>2008-09-22 15:53:58 +0100
committermichaelm <none@none>2008-09-22 15:53:58 +0100
commit5627db0934a8391f6ceacd5b8435fe98de66480e (patch)
tree82319e76a0df4cd9ce1256b6f48090aaca0f8a8e
parent3983280611d6c1f2cebafbbc76330a2fbe0b04b5 (diff)
6739920: java 6u4~ use larger C heap if there are many threads
Reviewed-by: chegar
-rw-r--r--src/share/classes/java/net/AbstractPlainSocketImpl.java6
-rw-r--r--src/solaris/native/java/net/PlainSocketImpl.c26
2 files changed, 6 insertions, 26 deletions
diff --git a/src/share/classes/java/net/AbstractPlainSocketImpl.java b/src/share/classes/java/net/AbstractPlainSocketImpl.java
index 2e5ea31cb..597783bf7 100644
--- a/src/share/classes/java/net/AbstractPlainSocketImpl.java
+++ b/src/share/classes/java/net/AbstractPlainSocketImpl.java
@@ -308,6 +308,12 @@ abstract class AbstractPlainSocketImpl extends SocketImpl
FileDescriptor fd = acquireFD();
try {
socketConnect(address, port, timeout);
+ /* socket may have been closed during poll/select */
+ synchronized (fdLock) {
+ if (closePending) {
+ throw new SocketException ("Socket closed");
+ }
+ }
// If we have a ref. to the Socket, then sets the flags
// created, bound & connected to true.
// This is normally done in Socket.connect() but some
diff --git a/src/solaris/native/java/net/PlainSocketImpl.c b/src/solaris/native/java/net/PlainSocketImpl.c
index 1cf324b73..ea07c777e 100644
--- a/src/solaris/native/java/net/PlainSocketImpl.c
+++ b/src/solaris/native/java/net/PlainSocketImpl.c
@@ -491,27 +491,6 @@ Java_java_net_PlainSocketImpl_socketConnect(JNIEnv *env, jobject this,
return;
}
- /*
- * The socket may have been closed (dup'ed) while we were
- * poll/select. In that case SO_ERROR will return 0 making
- * it appear that the connection has been established.
- * To avoid any race conditions we therefore grab the
- * fd lock, check if the socket has been closed, and
- * set the various fields whilst holding the lock
- */
- fdLock = (*env)->GetObjectField(env, this, psi_fdLockID);
- (*env)->MonitorEnter(env, fdLock);
-
- if ((*env)->GetBooleanField(env, this, psi_closePendingID)) {
-
- /* release fdLock */
- (*env)->MonitorExit(env, fdLock);
-
- JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
- "Socket closed");
- return;
- }
-
(*env)->SetIntField(env, fdObj, IO_fd_fdID, fd);
/* set the remote peer address and port */
@@ -536,11 +515,6 @@ Java_java_net_PlainSocketImpl_socketConnect(JNIEnv *env, jobject this,
(*env)->SetIntField(env, this, psi_localportID, localport);
}
}
-
- /*
- * Finally release fdLock
- */
- (*env)->MonitorExit(env, fdLock);
}
/*