Commit 0837d469 authored by Brian Major's avatar Brian Major
Browse files

added profiling to augment user path

parent 46207e97
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -243,6 +243,7 @@ public class LdapUserPersistence<T extends Principal> implements UserPersistenc
            if (userDAO != null)
            if (userDAO != null)
            {
            {
                userDAO.close();
                userDAO.close();
                profiler.checkpoint("close");
            }
            }
        }
        }
    }
    }
+9 −2
Original line number Original line Diff line number Diff line
@@ -85,6 +85,8 @@ import ca.nrc.cadc.ac.xml.UserReader;
import ca.nrc.cadc.ac.xml.UserRequestReader;
import ca.nrc.cadc.ac.xml.UserRequestReader;
import ca.nrc.cadc.ac.xml.UserWriter;
import ca.nrc.cadc.ac.xml.UserWriter;
import ca.nrc.cadc.net.TransientException;
import ca.nrc.cadc.net.TransientException;
import ca.nrc.cadc.profiler.Profiler;

import org.apache.log4j.Logger;
import org.apache.log4j.Logger;


import java.io.IOException;
import java.io.IOException;
@@ -100,6 +102,7 @@ public abstract class AbstractUserAction implements PrivilegedExceptionAction<Ob
    private static final Logger log = Logger.getLogger(AbstractUserAction.class);
    private static final Logger log = Logger.getLogger(AbstractUserAction.class);
    public static final String DEFAULT_CONTENT_TYPE = "text/xml";
    public static final String DEFAULT_CONTENT_TYPE = "text/xml";
    public static final String JSON_CONTENT_TYPE = "application/json";
    public static final String JSON_CONTENT_TYPE = "application/json";
    private Profiler profiler = new Profiler(AbstractUserAction.class);


    protected boolean isAugmentUser;
    protected boolean isAugmentUser;
    protected UserLogInfo logInfo;
    protected UserLogInfo logInfo;
@@ -139,6 +142,7 @@ public abstract class AbstractUserAction implements PrivilegedExceptionAction<Ob
        try
        try
        {
        {
            doAction();
            doAction();
            profiler.checkpoint("doAction");
        }
        }
        catch (AccessControlException e)
        catch (AccessControlException e)
        {
        {
@@ -221,6 +225,7 @@ public abstract class AbstractUserAction implements PrivilegedExceptionAction<Ob
                log.warn("Could not write error message to output stream");
                log.warn("Could not write error message to output stream");
            }
            }
        }
        }
        profiler.checkpoint("sendError");
    }
    }


    @SuppressWarnings("unchecked")
    @SuppressWarnings("unchecked")
@@ -269,7 +274,7 @@ public abstract class AbstractUserAction implements PrivilegedExceptionAction<Ob
            throw new IOException("Unknown content being asked for: "
            throw new IOException("Unknown content being asked for: "
                                  + acceptedContentType);
                                  + acceptedContentType);
        }
        }

        profiler.checkpoint("readUserRequest");
        return userRequest;
        return userRequest;
    }
    }


@@ -303,7 +308,7 @@ public abstract class AbstractUserAction implements PrivilegedExceptionAction<Ob
            throw new IOException("Unknown content being asked for: "
            throw new IOException("Unknown content being asked for: "
                                  + acceptedContentType);
                                  + acceptedContentType);
        }
        }

        profiler.checkpoint("readUser");
        return user;
        return user;
    }
    }


@@ -329,6 +334,7 @@ public abstract class AbstractUserAction implements PrivilegedExceptionAction<Ob
            JsonUserWriter userWriter = new JsonUserWriter();
            JsonUserWriter userWriter = new JsonUserWriter();
            userWriter.write(user, writer);
            userWriter.write(user, writer);
        }
        }
        profiler.checkpoint("writeUser");
    }
    }


    /**
    /**
@@ -352,6 +358,7 @@ public abstract class AbstractUserAction implements PrivilegedExceptionAction<Ob
            JsonUserListWriter userListWriter = new JsonUserListWriter();
            JsonUserListWriter userListWriter = new JsonUserListWriter();
            userListWriter.write(users, writer);
            userListWriter.write(users, writer);
        }
        }
        profiler.checkpoint("writeUsers");
    }
    }


}
}