Skip to content
Snippets Groups Projects
Commit cb44021e authored by Patrick Dowler's avatar Patrick Dowler
Browse files

made modest retry for all transient failures the default in ca.nrc.cadc.net;...

made modest retry for all transient failures the default in ca.nrc.cadc.net; improved some error handling for ldap timeout
parent 04bfc444
No related branches found
No related tags found
No related merge requests found
...@@ -345,11 +345,15 @@ public class LdapGroupDAO<T extends Principal> extends LdapDAO ...@@ -345,11 +345,15 @@ public class LdapGroupDAO<T extends Principal> extends LdapDAO
} }
catch (LDAPSearchException e) catch (LDAPSearchException e)
{ {
logger.debug("Could not find groups root", e);
if (e.getResultCode() == ResultCode.NO_SUCH_OBJECT) if (e.getResultCode() == ResultCode.NO_SUCH_OBJECT)
{ {
logger.debug("Could not find groups root", e);
throw new IllegalStateException("Could not find groups root"); throw new IllegalStateException("Could not find groups root");
} }
else if (e.getResultCode() == ResultCode.TIME_LIMIT_EXCEEDED)
throw new TransientException("time limit exceeded", e);
throw new IllegalStateException("unexpected failure", e);
} }
LdapDAO.checkLdapResult(searchResult.getResultCode()); LdapDAO.checkLdapResult(searchResult.getResultCode());
...@@ -366,7 +370,7 @@ public class LdapGroupDAO<T extends Principal> extends LdapDAO ...@@ -366,7 +370,7 @@ public class LdapGroupDAO<T extends Principal> extends LdapDAO
} }
catch (LDAPException e1) catch (LDAPException e1)
{ {
logger.debug("getGroupNames Exception: " + e1, e1); logger.debug("getGroupNames Exception: " + e1, e1);
LdapDAO.checkLdapResult(e1.getResultCode()); LdapDAO.checkLdapResult(e1.getResultCode());
throw new IllegalStateException("Unexpected exception: " + e1.getMatchedDN(), e1); throw new IllegalStateException("Unexpected exception: " + e1.getMatchedDN(), e1);
} }
......
...@@ -78,6 +78,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -78,6 +78,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import ca.nrc.cadc.auth.AuthenticationUtil; import ca.nrc.cadc.auth.AuthenticationUtil;
import ca.nrc.cadc.net.TransientException;
public class GroupsServlet extends HttpServlet public class GroupsServlet extends HttpServlet
{ {
......
...@@ -110,13 +110,15 @@ import ca.nrc.cadc.net.HttpPost; ...@@ -110,13 +110,15 @@ import ca.nrc.cadc.net.HttpPost;
import ca.nrc.cadc.net.HttpUpload; import ca.nrc.cadc.net.HttpUpload;
import ca.nrc.cadc.net.InputStreamWrapper; import ca.nrc.cadc.net.InputStreamWrapper;
import ca.nrc.cadc.net.NetUtil; import ca.nrc.cadc.net.NetUtil;
import ca.nrc.cadc.net.event.TransferEvent;
import ca.nrc.cadc.net.event.TransferListener;
/** /**
* Client class for performing group searching and group actions * Client class for performing group searching and group actions
* with the access control web service. * with the access control web service.
*/ */
public class GMSClient public class GMSClient implements TransferListener
{ {
private static final Logger log = Logger.getLogger(GMSClient.class); private static final Logger log = Logger.getLogger(GMSClient.class);
...@@ -159,6 +161,18 @@ public class GMSClient ...@@ -159,6 +161,18 @@ public class GMSClient
} }
} }
public void transferEvent(TransferEvent te)
{
if ( TransferEvent.RETRYING == te.getState() )
log.debug("retry after request failed, reason: " + te.getError());
}
public String getEventHeader()
{
return null; // no custom eventID header
}
/** /**
* Get a list of groups. * Get a list of groups.
* *
...@@ -392,8 +406,10 @@ public class GMSClient ...@@ -392,8 +406,10 @@ public class GMSClient
HttpPost transfer = new HttpPost(updateGroupURL, groupXML.toString(), HttpPost transfer = new HttpPost(updateGroupURL, groupXML.toString(),
"application/xml", true); "application/xml", true);
transfer.setSSLSocketFactory(getSSLSocketFactory()); transfer.setSSLSocketFactory(getSSLSocketFactory());
transfer.setTransferListener(this);
transfer.run(); transfer.run();
Throwable error = transfer.getThrowable(); Throwable error = transfer.getThrowable();
if (error != null) if (error != null)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment