summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/cmscore/connector/HttpConnector.java
diff options
context:
space:
mode:
authorAde Lee <alee@redhat.com>2011-12-08 21:15:59 -0500
committerAde Lee <alee@redhat.com>2011-12-08 21:15:59 -0500
commit171aaece4f23709d33d180cf36eb3af5e454b0c9 (patch)
tree1485f9f0a7bd10de4ff25030db575dbb8dafae74 /pki/base/common/src/com/netscape/cmscore/connector/HttpConnector.java
parentadad2fcee8a29fdb82376fbce07dedb11fccc182 (diff)
downloadpki-171aaece4f23709d33d180cf36eb3af5e454b0c9.tar.gz
pki-171aaece4f23709d33d180cf36eb3af5e454b0c9.tar.xz
pki-171aaece4f23709d33d180cf36eb3af5e454b0c9.zip
Revert "Formatting"
This reverts commit 32150d3ee32f8ac27118af7c792794b538c78a2f.
Diffstat (limited to 'pki/base/common/src/com/netscape/cmscore/connector/HttpConnector.java')
-rw-r--r--pki/base/common/src/com/netscape/cmscore/connector/HttpConnector.java96
1 files changed, 44 insertions, 52 deletions
diff --git a/pki/base/common/src/com/netscape/cmscore/connector/HttpConnector.java b/pki/base/common/src/com/netscape/cmscore/connector/HttpConnector.java
index 83635b50..fefbe0f3 100644
--- a/pki/base/common/src/com/netscape/cmscore/connector/HttpConnector.java
+++ b/pki/base/common/src/com/netscape/cmscore/connector/HttpConnector.java
@@ -17,6 +17,7 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cmscore.connector;
+
import java.util.Vector;
import com.netscape.certsrv.apps.CMS;
@@ -35,6 +36,7 @@ import com.netscape.certsrv.request.RequestStatus;
import com.netscape.cmsutil.http.JssSSLSocketFactory;
import com.netscape.cmsutil.net.ISocketFactory;
+
public class HttpConnector implements IConnector {
protected IAuthority mSource = null;
protected IRemoteAuthority mDest = null;
@@ -43,15 +45,13 @@ public class HttpConnector implements IConnector {
// XXX todo make this a pool.
// XXX use CMMF in the future.
protected IHttpConnection mConn = null;
- private Thread mResendThread = null;
+ private Thread mResendThread = null;
private IResender mResender = null;
private int mTimeout;
private HttpConnFactory mConnFactory = null;
-
public HttpConnector(IAuthority source, String nickName,
- IRemoteAuthority dest, int resendInterval, IConfigStore config)
- throws EBaseException {
+ IRemoteAuthority dest, int resendInterval, IConfigStore config) throws EBaseException {
mTimeout = 0;
mSource = source;
@@ -65,48 +65,46 @@ public class HttpConnector implements IConnector {
CMS.debug("HttpConn: max " + maxConns);
try {
- mConnFactory = new HttpConnFactory(minConns, maxConns, source,
- dest, nickName, 0);
+ mConnFactory = new HttpConnFactory(minConns, maxConns, source, dest, nickName, 0);
} catch (EBaseException e) {
CMS.debug("can't create new HttpConnFactory " + e.toString());
}
- // mConn = CMS.getHttpConnection(dest, mFactory);
- // this will start resending past requests in parallel.
- mResender = CMS.getResender(mSource, nickName, dest, resendInterval);
+ // mConn = CMS.getHttpConnection(dest, mFactory);
+ // this will start resending past requests in parallel.
+ mResender = CMS.getResender(mSource, nickName, dest, resendInterval);
mResendThread = new Thread(mResender, "HttpConnector");
}
-
+
// Inserted by beomsuk
public HttpConnector(IAuthority source, String nickName,
- IRemoteAuthority dest, int resendInterval, IConfigStore config,
- int timeout) throws EBaseException {
+ IRemoteAuthority dest, int resendInterval, IConfigStore config, int timeout) throws EBaseException {
mSource = source;
mDest = dest;
mTimeout = timeout;
mFactory = new JssSSLSocketFactory(nickName);
int minConns = config.getInteger("minHttpConns", 1);
- int maxConns = config.getInteger("maxHttpConns", 15);
+ int maxConns = config.getInteger("maxHttpConns", 15);
CMS.debug("HttpConn: min " + minConns);
CMS.debug("HttpConn: max " + maxConns);
try {
- mConnFactory = new HttpConnFactory(minConns, maxConns, source,
- dest, nickName, timeout);
+ mConnFactory = new HttpConnFactory(minConns, maxConns, source, dest, nickName, timeout);
} catch (EBaseException e) {
CMS.debug("can't create new HttpConnFactory");
}
- // this will start resending past requests in parallel.
- mResender = CMS.getResender(mSource, nickName, dest, resendInterval);
+ // this will start resending past requests in parallel.
+ mResender = CMS.getResender(mSource, nickName, dest, resendInterval);
mResendThread = new Thread(mResender, "HttpConnector");
}
// Insert end
-
- public boolean send(IRequest r) throws EBaseException {
+
+ public boolean send(IRequest r)
+ throws EBaseException {
IHttpConnection curConn = null;
try {
@@ -143,61 +141,55 @@ public class HttpConnector implements IConnector {
CMS.debug("reply status " + replyStatus);
// non terminal states.
- // XXX hack: don't resend get revocation info requests since
+ // XXX hack: don't resend get revocation info requests since
// resent results are ignored.
- if ((!r.getRequestType().equals(IRequest.GETREVOCATIONINFO_REQUEST))
- && (replyStatus == RequestStatus.BEGIN
- || replyStatus == RequestStatus.PENDING
- || replyStatus == RequestStatus.SVC_PENDING || replyStatus == RequestStatus.APPROVED)) {
- CMS.debug("HttpConn: remote request id still pending "
- + r.getRequestId() + " state " + replyStatus);
- mSource.log(ILogger.LL_INFO, CMS.getLogMessage(
- "CMSCORE_CONNECTOR_REQUEST_NOT_COMPLETED", r
- .getRequestId().toString()));
+ if ((!r.getRequestType().equals(
+ IRequest.GETREVOCATIONINFO_REQUEST)) &&
+ (replyStatus == RequestStatus.BEGIN ||
+ replyStatus == RequestStatus.PENDING ||
+ replyStatus == RequestStatus.SVC_PENDING ||
+ replyStatus == RequestStatus.APPROVED)) {
+ CMS.debug("HttpConn: remote request id still pending " +
+ r.getRequestId() + " state " + replyStatus);
+ mSource.log(ILogger.LL_INFO, CMS.getLogMessage("CMSCORE_CONNECTOR_REQUEST_NOT_COMPLETED", r.getRequestId().toString()));
mResender.addRequest(r);
return false;
}
// request was completed.
- replymsg.toRequest(r); // this only copies contents.
+ replymsg.toRequest(r); // this only copies contents.
// terminal states other than completed
- if (replyStatus == RequestStatus.REJECTED
- || replyStatus == RequestStatus.CANCELED) {
- CMS.debug("remote request id " + r.getRequestId()
- + " was rejected or cancelled.");
+ if (replyStatus == RequestStatus.REJECTED ||
+ replyStatus == RequestStatus.CANCELED) {
+ CMS.debug(
+ "remote request id " + r.getRequestId() +
+ " was rejected or cancelled.");
r.setExtData(IRequest.REMOTE_STATUS, replyStatus.toString());
r.setExtData(IRequest.RESULT, IRequest.RES_ERROR);
- r.setExtData(
- IRequest.ERROR,
- new EBaseException(
- CMS.getUserMessage("CMS_BASE_REMOTE_AUTHORITY_ERROR")));
- // XXX overload svcerrors for now.
- Vector policyErrors = r
- .getExtDataInStringVector(IRequest.ERRORS);
+ r.setExtData(IRequest.ERROR,
+ new EBaseException(CMS.getUserMessage("CMS_BASE_REMOTE_AUTHORITY_ERROR")));
+ // XXX overload svcerrors for now.
+ Vector policyErrors = r.getExtDataInStringVector(IRequest.ERRORS);
if (policyErrors != null && policyErrors.size() > 0) {
r.setExtData(IRequest.SVCERRORS, policyErrors);
}
}
- CMS.debug("remote request id " + r.getRequestId()
- + " was completed");
+ CMS.debug(
+ "remote request id " + r.getRequestId() + " was completed");
return true;
} catch (EBaseException e) {
CMS.debug("HttpConn: inside EBaseException " + e.toString());
-
+
if (!r.getRequestType().equals(IRequest.GETREVOCATIONINFO_REQUEST))
mResender.addRequest(r);
- CMS.debug("HttpConn: error sending request to cert "
- + e.toString());
- mSource.log(ILogger.LL_FAILURE, CMS.getLogMessage(
- "CMSCORE_CONNECTOR_SEND_REQUEST", r.getRequestId()
- .toString(), mDest.getHost(), Integer
- .toString(mDest.getPort())));
- // mSource.log(ILogger.LL_INFO,
- // "Queing " + r.getRequestId() + " for resend.");
+ CMS.debug("HttpConn: error sending request to cert " + e.toString());
+ mSource.log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_CONNECTOR_SEND_REQUEST", r.getRequestId().toString(), mDest.getHost(), Integer.toString(mDest.getPort())));
+ // mSource.log(ILogger.LL_INFO,
+ // "Queing " + r.getRequestId() + " for resend.");
return false;
} finally {