Skip to content

Commit

Permalink
use new timeout API in HttpSOAPConnection
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Jungmann <[email protected]>
  • Loading branch information
lukasj committed Dec 14, 2021
1 parent a50cc78 commit f5aca16
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion saaj-ri/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<groupId>com.sun.xml.messaging.saaj</groupId>
<artifactId>saaj-impl</artifactId>
<version>2.0.2-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>

<name>Jakarta SOAP Implementation</name>
<description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ class HttpSOAPConnection extends SOAPConnection {
/**
* URLConnection connect timeout
*/
private static int CONNECT_TIMEOUT;
private static int CONNECT_TIMEOUT = Integer.MIN_VALUE;

/**
* URLConnection read timeout
*/
private static int READ_TIMEOUT;
private static int READ_TIMEOUT = Integer.MIN_VALUE;

static {
Integer i = SAAJUtil.getSystemInteger("saaj.connect.timeout");
Expand Down Expand Up @@ -102,7 +102,23 @@ public void close() throws SOAPException {
}

@Override
public SOAPMessage call(SOAPMessage message, Object endPoint)
public int getConnectTimeout() {
if (Integer.MIN_VALUE != CONNECT_TIMEOUT) {
return CONNECT_TIMEOUT;
}
return super.getConnectTimeout();
}

@Override
public int getReadTimeout() {
if (Integer.MIN_VALUE != READ_TIMEOUT) {
return READ_TIMEOUT;
}
return super.getReadTimeout();
}

@Override
public SOAPMessage call(SOAPMessage message, Object endPoint)
throws SOAPException {
if (closed) {
log.severe("SAAJ0003.p2p.call.already.closed.conn");
Expand Down Expand Up @@ -167,8 +183,8 @@ SOAPMessage post(SOAPMessage message, URL endPoint) throws SOAPException, IOExce
httpConnection.setDoInput(true);
httpConnection.setUseCaches(false);
httpConnection.setInstanceFollowRedirects(true);
httpConnection.setConnectTimeout(CONNECT_TIMEOUT);
httpConnection.setReadTimeout(READ_TIMEOUT);
httpConnection.setConnectTimeout(getConnectTimeout());
httpConnection.setReadTimeout(getReadTimeout());

if (message.saveRequired())
message.saveChanges();
Expand Down Expand Up @@ -389,8 +405,8 @@ SOAPMessage doGet(URL endPoint) throws SOAPException, IOException {
httpConnection.setDoInput(true);
httpConnection.setUseCaches(false);
httpConnection.setInstanceFollowRedirects(true);
httpConnection.setConnectTimeout(CONNECT_TIMEOUT);
httpConnection.setReadTimeout(READ_TIMEOUT);
httpConnection.setConnectTimeout(getConnectTimeout());
httpConnection.setReadTimeout(getReadTimeout());

httpConnection.connect();

Expand Down

0 comments on commit f5aca16

Please sign in to comment.