mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8216978: Drop support for pre JDK 1.4 SocketImpl implementations
Reviewed-by: chegar, alanb, dfuchs
This commit is contained in:
parent
5a496e21d5
commit
70ea5ab6e1
14 changed files with 109 additions and 463 deletions
|
@ -74,6 +74,12 @@ abstract class AbstractPlainSocketImpl extends SocketImpl implements PlatformSoc
|
|||
/* indicates connection reset state */
|
||||
private volatile boolean connectionReset;
|
||||
|
||||
/* indicates whether impl is bound */
|
||||
boolean isBound;
|
||||
|
||||
/* indicates whether impl is connected */
|
||||
volatile boolean isConnected;
|
||||
|
||||
/* whether this Socket is a stream (TCP) socket or not (UDP)
|
||||
*/
|
||||
protected boolean stream;
|
||||
|
@ -105,6 +111,10 @@ abstract class AbstractPlainSocketImpl extends SocketImpl implements PlatformSoc
|
|||
return isReusePortAvailable;
|
||||
}
|
||||
|
||||
AbstractPlainSocketImpl(boolean isServer) {
|
||||
super(isServer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a set of SocketOptions supported by this impl and by this impl's
|
||||
* socket (Socket or ServerSocket)
|
||||
|
@ -148,10 +158,6 @@ abstract class AbstractPlainSocketImpl extends SocketImpl implements PlatformSoc
|
|||
socketCreate(true);
|
||||
SocketCleanable.register(fd);
|
||||
}
|
||||
if (socket != null)
|
||||
socket.setCreated();
|
||||
if (serverSocket != null)
|
||||
serverSocket.setCreated();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -180,6 +186,7 @@ abstract class AbstractPlainSocketImpl extends SocketImpl implements PlatformSoc
|
|||
it will be passed up the call stack */
|
||||
}
|
||||
}
|
||||
isConnected = connected;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -195,6 +202,7 @@ abstract class AbstractPlainSocketImpl extends SocketImpl implements PlatformSoc
|
|||
|
||||
try {
|
||||
connectToAddress(address, port, timeout);
|
||||
isConnected = true;
|
||||
return;
|
||||
} catch (IOException e) {
|
||||
// everything failed
|
||||
|
@ -236,6 +244,7 @@ abstract class AbstractPlainSocketImpl extends SocketImpl implements PlatformSoc
|
|||
it will be passed up the call stack */
|
||||
}
|
||||
}
|
||||
isConnected = connected;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -393,7 +402,7 @@ abstract class AbstractPlainSocketImpl extends SocketImpl implements PlatformSoc
|
|||
|
||||
synchronized void doConnect(InetAddress address, int port, int timeout) throws IOException {
|
||||
synchronized (fdLock) {
|
||||
if (!closePending && (socket == null || !socket.isBound())) {
|
||||
if (!closePending && !isBound) {
|
||||
NetHooks.beforeTcpConnect(fd, address, port);
|
||||
}
|
||||
}
|
||||
|
@ -407,14 +416,6 @@ abstract class AbstractPlainSocketImpl extends SocketImpl implements PlatformSoc
|
|||
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
|
||||
// subclasses of Socket may call impl.connect() directly!
|
||||
if (socket != null) {
|
||||
socket.setBound();
|
||||
socket.setConnected();
|
||||
}
|
||||
} finally {
|
||||
releaseFD();
|
||||
}
|
||||
|
@ -433,15 +434,12 @@ abstract class AbstractPlainSocketImpl extends SocketImpl implements PlatformSoc
|
|||
throws IOException
|
||||
{
|
||||
synchronized (fdLock) {
|
||||
if (!closePending && (socket == null || !socket.isBound())) {
|
||||
if (!closePending && !isBound) {
|
||||
NetHooks.beforeTcpBind(fd, address, lport);
|
||||
}
|
||||
}
|
||||
socketBind(address, lport);
|
||||
if (socket != null)
|
||||
socket.setBound();
|
||||
if (serverSocket != null)
|
||||
serverSocket.setBound();
|
||||
isBound = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -727,7 +725,7 @@ abstract class AbstractPlainSocketImpl extends SocketImpl implements PlatformSoc
|
|||
socketClose0(false);
|
||||
}
|
||||
|
||||
abstract void socketCreate(boolean isServer) throws IOException;
|
||||
abstract void socketCreate(boolean stream) throws IOException;
|
||||
abstract void socketConnect(InetAddress address, int port, int timeout)
|
||||
throws IOException;
|
||||
abstract void socketBind(InetAddress address, int port)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue