lens-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amareshw...@apache.org
Subject [08/10] incubator-lens git commit: LENS-249 : Fix check style issues in lens-server module (Rajat Khandelwal via amareshwari)
Date Thu, 05 Feb 2015 06:01:51 GMT
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a18896b4/lens-server/src/main/java/org/apache/lens/server/query/LensServerDAO.java
----------------------------------------------------------------------
diff --git a/lens-server/src/main/java/org/apache/lens/server/query/LensServerDAO.java b/lens-server/src/main/java/org/apache/lens/server/query/LensServerDAO.java
index 4dc8daf..dd2cff2 100644
--- a/lens-server/src/main/java/org/apache/lens/server/query/LensServerDAO.java
+++ b/lens-server/src/main/java/org/apache/lens/server/query/LensServerDAO.java
@@ -18,25 +18,28 @@
  */
 package org.apache.lens.server.query;
 
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.sql.DataSource;
+
+import org.apache.lens.api.LensException;
+import org.apache.lens.api.query.QueryHandle;
+import org.apache.lens.server.api.query.FinishedLensQuery;
+import org.apache.lens.server.util.UtilityMethods;
+
 import org.apache.commons.dbutils.QueryRunner;
 import org.apache.commons.dbutils.ResultSetHandler;
 import org.apache.commons.dbutils.handlers.BeanHandler;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.hadoop.conf.Configuration;
-import org.apache.lens.api.LensException;
-import org.apache.lens.api.query.QueryHandle;
-import org.apache.lens.server.api.query.FinishedLensQuery;
-import org.apache.lens.server.util.UtilityMethods;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.sql.DataSource;
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-
 /**
  * Top level class which logs and retrieves finished query from Database.
  */
@@ -51,8 +54,7 @@ public class LensServerDAO {
   /**
    * Inits the.
    *
-   * @param conf
-   *          the conf
+   * @param conf the conf
    */
   public void init(Configuration conf) {
     ds = UtilityMethods.getDataSourceFromConf(conf);
@@ -65,10 +67,8 @@ public class LensServerDAO {
   /**
    * Creates the table.
    *
-   * @param sql
-   *          the sql
-   * @throws SQLException
-   *           the SQL exception
+   * @param sql the sql
+   * @throws SQLException the SQL exception
    */
   private void createTable(String sql) throws SQLException {
     QueryRunner runner = new QueryRunner(ds);
@@ -91,15 +91,14 @@ public class LensServerDAO {
    * Method to create finished queries table, this is required for embedded lens server. For production server we will
    * not be creating tables as it would be created upfront.
    *
-   * @throws Exception
-   *           the exception
+   * @throws Exception the exception
    */
   public void createFinishedQueriesTable() throws Exception {
     String sql = "CREATE TABLE if not exists finished_queries (handle varchar(255) not null unique,"
-        + "userquery varchar(10000) not null," + "submitter varchar(255) not null," + "starttime bigint, "
-        + "endtime bigint," + "result varchar(255)," + "status varchar(255), " + "metadata varchar(100000), "
-        + "rows int, " + "errormessage varchar(10000), " + "driverstarttime bigint, " + "driverendtime bigint, "
-        + "metadataclass varchar(10000)," + "queryname varchar(255)," + "submissiontime bigint" + ")";
+      + "userquery varchar(10000) not null," + "submitter varchar(255) not null," + "starttime bigint, "
+      + "endtime bigint," + "result varchar(255)," + "status varchar(255), " + "metadata varchar(100000), "
+      + "rows int, " + "errormessage varchar(10000), " + "driverstarttime bigint, " + "driverendtime bigint, "
+      + "metadataclass varchar(10000)," + "queryname varchar(255)," + "submissiontime bigint" + ")";
     try {
       createTable(sql);
       ds.getConnection().commit();
@@ -112,22 +111,20 @@ public class LensServerDAO {
   /**
    * DAO method to insert a new Finished query into Table.
    *
-   * @param query
-   *          to be inserted
-   * @throws Exception
-   *           the exception
+   * @param query to be inserted
+   * @throws Exception the exception
    */
   public void insertFinishedQuery(FinishedLensQuery query) throws Exception {
     String sql = "insert into finished_queries (handle, userquery,submitter,"
-        + "starttime,endtime,result,status,metadata,rows,"
-        + "errormessage,driverstarttime,driverendtime, metadataclass, queryname, submissiontime)"
-        + " values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
+      + "starttime,endtime,result,status,metadata,rows,"
+      + "errormessage,driverstarttime,driverendtime, metadataclass, queryname, submissiontime)"
+      + " values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
     QueryRunner runner = new QueryRunner(ds);
     try {
       runner.update(sql, query.getHandle(), query.getUserQuery(), query.getSubmitter(), query.getStartTime(),
-          query.getEndTime(), query.getResult(), query.getStatus(), query.getMetadata(), query.getRows(),
-          query.getErrorMessage(), query.getDriverStartTime(), query.getDriverEndTime(), query.getMetadataClass(),
-          query.getQueryName(), query.getSubmissionTime());
+        query.getEndTime(), query.getResult(), query.getStatus(), query.getMetadata(), query.getRows(),
+        query.getErrorMessage(), query.getDriverStartTime(), query.getDriverEndTime(), query.getMetadataClass(),
+        query.getQueryName(), query.getSubmissionTime());
     } catch (SQLException e) {
       throw new Exception(e);
     }
@@ -136,8 +133,7 @@ public class LensServerDAO {
   /**
    * Fetch Finished query from Database.
    *
-   * @param handle
-   *          to be fetched
+   * @param handle to be fetched
    * @return Finished query.
    */
   public FinishedLensQuery getQuery(String handle) {
@@ -155,24 +151,18 @@ public class LensServerDAO {
   /**
    * Find finished queries.
    *
-   * @param state
-   *          the state
-   * @param user
-   *          the user
-   * @param queryName
-   *          the query name
-   * @param fromDate
-   *          the from date
-   * @param toDate
-   *          the to date
+   * @param state     the state
+   * @param user      the user
+   * @param queryName the query name
+   * @param fromDate  the from date
+   * @param toDate    the to date
    * @return the list
-   * @throws LensException
-   *           the lens exception
+   * @throws LensException the lens exception
    */
   public List<QueryHandle> findFinishedQueries(String state, String user, String queryName, long fromDate, long toDate)
-      throws LensException {
+    throws LensException {
     boolean addFilter = StringUtils.isNotBlank(state) || StringUtils.isNotBlank(user)
-        || StringUtils.isNotBlank(queryName);
+      || StringUtils.isNotBlank(queryName);
     StringBuilder builder = new StringBuilder("SELECT handle FROM finished_queries");
     List<Object> params = null;
     if (addFilter) {

http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a18896b4/lens-server/src/main/java/org/apache/lens/server/query/QueryApp.java
----------------------------------------------------------------------
diff --git a/lens-server/src/main/java/org/apache/lens/server/query/QueryApp.java b/lens-server/src/main/java/org/apache/lens/server/query/QueryApp.java
index 90e7a48..0d23726 100644
--- a/lens-server/src/main/java/org/apache/lens/server/query/QueryApp.java
+++ b/lens-server/src/main/java/org/apache/lens/server/query/QueryApp.java
@@ -25,6 +25,7 @@ import javax.ws.rs.ApplicationPath;
 import javax.ws.rs.core.Application;
 
 import org.apache.lens.server.LensApplicationListener;
+
 import org.glassfish.jersey.filter.LoggingFilter;
 import org.glassfish.jersey.media.multipart.MultiPartFeature;
 

http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a18896b4/lens-server/src/main/java/org/apache/lens/server/query/QueryEndNotifier.java
----------------------------------------------------------------------
diff --git a/lens-server/src/main/java/org/apache/lens/server/query/QueryEndNotifier.java b/lens-server/src/main/java/org/apache/lens/server/query/QueryEndNotifier.java
index d4a7106..70f9dba 100644
--- a/lens-server/src/main/java/org/apache/lens/server/query/QueryEndNotifier.java
+++ b/lens-server/src/main/java/org/apache/lens/server/query/QueryEndNotifier.java
@@ -18,9 +18,18 @@
  */
 package org.apache.lens.server.query;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.hive.conf.HiveConf;
+import java.util.Date;
+import java.util.Properties;
+
+import javax.mail.Message;
+import javax.mail.Multipart;
+import javax.mail.Session;
+import javax.mail.Transport;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeBodyPart;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeMultipart;
+
 import org.apache.lens.api.query.QueryStatus;
 import org.apache.lens.server.LensServices;
 import org.apache.lens.server.api.LensConfConstants;
@@ -29,13 +38,11 @@ import org.apache.lens.server.api.metrics.MetricsService;
 import org.apache.lens.server.api.query.QueryContext;
 import org.apache.lens.server.api.query.QueryEnded;
 
-import javax.mail.*;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
-import java.util.Date;
-import java.util.Properties;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.hive.conf.HiveConf;
+
+import lombok.Data;
 
 /**
  * The Class QueryEndNotifier.
@@ -72,10 +79,8 @@ public class QueryEndNotifier extends AsyncEventListener<QueryEnded> {
   /**
    * Instantiates a new query end notifier.
    *
-   * @param queryService
-   *          the query service
-   * @param hiveConf
-   *          the hive conf
+   * @param queryService the query service
+   * @param hiveConf     the hive conf
    */
   public QueryEndNotifier(QueryExecutionServiceImpl queryService, HiveConf hiveConf) {
     this.queryService = queryService;
@@ -84,15 +89,15 @@ public class QueryEndNotifier extends AsyncEventListener<QueryEnded> {
     host = conf.get(LensConfConstants.MAIL_HOST);
     port = conf.get(LensConfConstants.MAIL_PORT);
     mailSmtpTimeout = Integer.parseInt(conf.get(LensConfConstants.MAIL_SMTP_TIMEOUT,
-        LensConfConstants.MAIL_DEFAULT_SMTP_TIMEOUT));
+      LensConfConstants.MAIL_DEFAULT_SMTP_TIMEOUT));
     mailSmtpConnectionTimeout = Integer.parseInt(conf.get(LensConfConstants.MAIL_SMTP_CONNECTIONTIMEOUT,
-        LensConfConstants.MAIL_DEFAULT_SMTP_CONNECTIONTIMEOUT));
+      LensConfConstants.MAIL_DEFAULT_SMTP_CONNECTIONTIMEOUT));
 
   }
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.lens.server.api.events.AsyncEventListener#process(org.apache.lens.server.api.events.LensEvent)
    */
   @Override
@@ -103,12 +108,12 @@ public class QueryEndNotifier extends AsyncEventListener<QueryEnded> {
     QueryContext queryContext = queryService.getQueryContext(event.getQueryHandle());
     if (queryContext == null) {
       LOG.warn("Could not find the context for " + event.getQueryHandle() + " for event:" + event.getCurrentValue()
-          + ". No email generated");
+        + ". No email generated");
       return;
     }
 
     boolean whetherMailNotify = Boolean.parseBoolean(queryContext.getConf().get(LensConfConstants.QUERY_MAIL_NOTIFY,
-        LensConfConstants.WHETHER_MAIL_NOTIFY_DEFAULT));
+      LensConfConstants.WHETHER_MAIL_NOTIFY_DEFAULT));
 
     if (!whetherMailNotify) {
       return;
@@ -117,24 +122,23 @@ public class QueryEndNotifier extends AsyncEventListener<QueryEnded> {
     String queryName = queryContext.getQueryName();
     queryName = queryName == null ? "" : queryName;
     String mailSubject = "Query " + queryName + " " + queryContext.getStatus().getStatus() + ": "
-        + event.getQueryHandle();
+      + event.getQueryHandle();
 
     String mailMessage = createMailMessage(queryContext);
 
     String to = queryContext.getSubmittedUser() + "@" + queryService.getServerDomain();
 
     String cc = queryContext.getConf().get(LensConfConstants.QUERY_RESULT_EMAIL_CC,
-        LensConfConstants.QUERY_RESULT_DEFAULT_EMAIL_CC);
+      LensConfConstants.QUERY_RESULT_DEFAULT_EMAIL_CC);
 
     LOG.info("Sending completion email for query handle: " + event.getQueryHandle());
-    sendMail(host, port, from, to, cc, mailSubject, mailMessage, mailSmtpTimeout, mailSmtpConnectionTimeout);
+    sendMail(host, port, new Email(from, to, cc, mailSubject, mailMessage), mailSmtpTimeout, mailSmtpConnectionTimeout);
   }
 
   /**
    * Creates the mail message.
    *
-   * @param queryContext
-   *          the query context
+   * @param queryContext the query context
    * @return the string
    */
   private String createMailMessage(QueryContext queryContext) {
@@ -158,31 +162,25 @@ public class QueryEndNotifier extends AsyncEventListener<QueryEnded> {
     }
     return msgBuilder.toString();
   }
-
+  @Data
+  public static class Email {
+    private final String from;
+    private final String to;
+    private final String cc;
+    private final String subject;
+    private final String message;
+  }
   /**
    * Send mail.
    *
-   * @param host
-   *          the host
-   * @param port
-   *          the port
-   * @param from
-   *          the from
-   * @param to
-   *          the to
-   * @param cc
-   *          the cc
-   * @param subject
-   *          the subject
-   * @param mailMessage
-   *          the mail message
-   * @param mailSmtpTimeout
-   *          the mail smtp timeout
-   * @param mailSmtpConnectionTimeout
-   *          the mail smtp connection timeout
+   * @param host                      the host
+   * @param port                      the port
+   * @param email                     the email
+   * @param mailSmtpTimeout           the mail smtp timeout
+   * @param mailSmtpConnectionTimeout the mail smtp connection timeout
    */
-  public static void sendMail(String host, String port, String from, String to, String cc, String subject,
-      String mailMessage, int mailSmtpTimeout, int mailSmtpConnectionTimeout) {
+  public static void sendMail(String host, String port,
+    Email email, int mailSmtpTimeout, int mailSmtpConnectionTimeout) {
     Properties props = System.getProperties();
     props.put("mail.smtp.host", host);
     props.put("mail.smtp.port", port);
@@ -191,20 +189,20 @@ public class QueryEndNotifier extends AsyncEventListener<QueryEnded> {
     Session session = Session.getDefaultInstance(props, null);
     try {
       MimeMessage message = new MimeMessage(session);
-      message.setFrom(new InternetAddress(from));
-      for(String recipient: to.trim().split("\\s*,\\s*")) {
+      message.setFrom(new InternetAddress(email.getFrom()));
+      for (String recipient : email.getTo().trim().split("\\s*,\\s*")) {
         message.addRecipients(Message.RecipientType.TO, InternetAddress.parse(recipient));
       }
-      if (cc != null && cc.length() > 0) {
-        for(String recipient: cc.trim().split("\\s*,\\s*")) {
+      if (email.getCc() != null && email.getCc().length() > 0) {
+        for (String recipient : email.getCc().trim().split("\\s*,\\s*")) {
           message.addRecipients(Message.RecipientType.CC, InternetAddress.parse(recipient));
         }
       }
-      message.setSubject(subject);
+      message.setSubject(email.getSubject());
       message.setSentDate(new Date());
 
       MimeBodyPart messagePart = new MimeBodyPart();
-      messagePart.setText(mailMessage);
+      messagePart.setText(email.getMessage());
       Multipart multipart = new MimeMultipart();
 
       multipart.addBodyPart(messagePart);

http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a18896b4/lens-server/src/main/java/org/apache/lens/server/query/QueryExecutionServiceImpl.java
----------------------------------------------------------------------
diff --git a/lens-server/src/main/java/org/apache/lens/server/query/QueryExecutionServiceImpl.java b/lens-server/src/main/java/org/apache/lens/server/query/QueryExecutionServiceImpl.java
index fa8e1eb..ca22b04 100644
--- a/lens-server/src/main/java/org/apache/lens/server/query/QueryExecutionServiceImpl.java
+++ b/lens-server/src/main/java/org/apache/lens/server/query/QueryExecutionServiceImpl.java
@@ -18,21 +18,11 @@
  */
 package org.apache.lens.server.query;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
+import java.io.*;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.DelayQueue;
-import java.util.concurrent.Delayed;
-import java.util.concurrent.PriorityBlockingQueue;
-import java.util.concurrent.TimeUnit;
+import java.util.concurrent.*;
 
 import javax.ws.rs.BadRequestException;
 import javax.ws.rs.NotFoundException;
@@ -40,31 +30,10 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.StreamingOutput;
 
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FSDataInputStream;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.hive.conf.HiveConf;
-import org.apache.hive.service.cli.CLIService;
-
-import org.apache.hive.service.cli.ColumnDescriptor;
-import org.apache.hive.service.cli.TypeDescriptor;
 import org.apache.lens.api.LensConf;
 import org.apache.lens.api.LensException;
 import org.apache.lens.api.LensSessionHandle;
-import org.apache.lens.api.query.LensPreparedQuery;
-import org.apache.lens.api.query.LensQuery;
-import org.apache.lens.api.query.QueryHandle;
-import org.apache.lens.api.query.QueryHandleWithResultSet;
-import org.apache.lens.api.query.QueryPlan;
-import org.apache.lens.api.query.QueryPrepareHandle;
-import org.apache.lens.api.query.QueryResult;
-import org.apache.lens.api.query.QueryResultSetMetadata;
-import org.apache.lens.api.query.QueryStatus;
-import org.apache.lens.api.query.SubmitOp;
+import org.apache.lens.api.query.*;
 import org.apache.lens.api.query.QueryStatus.Status;
 import org.apache.lens.driver.cube.RewriteUtil;
 import org.apache.lens.driver.hive.HiveDriver;
@@ -79,12 +48,23 @@ import org.apache.lens.server.api.query.*;
 import org.apache.lens.server.session.LensSessionImpl;
 import org.apache.lens.server.stats.StatisticsService;
 import org.apache.lens.server.util.UtilityMethods;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FSDataInputStream;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hive.service.cli.CLIService;
+import org.apache.hive.service.cli.ColumnDescriptor;
+import org.apache.hive.service.cli.TypeDescriptor;
+
 import org.codehaus.jackson.*;
 import org.codehaus.jackson.map.*;
 import org.codehaus.jackson.map.module.SimpleModule;
 
-import com.google.common.collect.Lists;
-
 /**
  * The Class QueryExecutionServiceImpl.
  */
@@ -131,9 +111,9 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
   public static final String NAME = "query";
 
   /**
-   * The Constant mapper.
+   * The Constant MAPPER.
    */
-  private static final ObjectMapper mapper = new ObjectMapper();
+  private static final ObjectMapper MAPPER = new ObjectMapper();
 
   /**
    * The accepted queries.
@@ -158,7 +138,8 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
   /**
    * The prepared queries.
    */
-  private Map<QueryPrepareHandle, PreparedQueryContext> preparedQueries = new HashMap<QueryPrepareHandle, PreparedQueryContext>();
+  private Map<QueryPrepareHandle, PreparedQueryContext> preparedQueries
+    = new HashMap<QueryPrepareHandle, PreparedQueryContext>();
 
   /**
    * The all queries.
@@ -275,7 +256,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
     // Add result formatter
     getEventService().addListenerForType(new ResultFormatter(this), QueryExecuted.class);
     getEventService().addListenerForType(new QueryExecutionStatisticsGenerator(this, getEventService()),
-                                         QueryEnded.class);
+      QueryEnded.class);
     getEventService().addListenerForType(new QueryEndNotifier(this, getCliService().getHiveConf()), QueryEnded.class);
     LOG.info("Registered query result formatter");
   }
@@ -372,7 +353,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.lens.server.api.events.LensEventListener#onEvent(org.apache.lens.server.api.events.LensEvent)
      */
     @Override
@@ -409,7 +390,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see java.lang.Comparable#compareTo(java.lang.Object)
      */
     @Override
@@ -419,7 +400,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see java.util.concurrent.Delayed#getDelay(java.util.concurrent.TimeUnit)
      */
     @Override
@@ -459,7 +440,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see java.lang.Runnable#run()
      */
     @Override
@@ -527,7 +508,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see java.lang.Runnable#run()
      */
     @Override
@@ -544,12 +525,10 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
             LOG.info("Polling status for " + ctx.getQueryHandle());
             try {
               // session is not required to update status of the query
-              // acquire(ctx.getLensSessionIdentifier());
+              // don't need to wrap this with acquire/release
               updateStatus(ctx.getQueryHandle());
             } catch (LensException e) {
               LOG.error("Error updating status ", e);
-            } finally {
-              // release(ctx.getLensSessionIdentifier());
             }
           }
           Thread.sleep(pollInterval);
@@ -583,7 +562,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
   private void setLaunchedStatus(QueryContext ctx) throws LensException {
     QueryStatus before = ctx.getStatus();
     ctx.setStatus(new QueryStatus(ctx.getStatus().getProgress(), QueryStatus.Status.LAUNCHED, "launched on the driver",
-                                  false, null, null));
+      false, null, null));
     launchedQueries.add(ctx);
     ctx.setLaunchTime(System.currentTimeMillis());
     fireStatusChangeEvent(ctx, ctx.getStatus(), before);
@@ -674,7 +653,8 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
    * @param currState the curr state
    * @return the status change
    */
-  private static StatusChange newStatusChangeEvent(QueryContext ctx, QueryStatus.Status prevState, QueryStatus.Status currState) {
+  private static StatusChange newStatusChangeEvent(QueryContext ctx,
+    QueryStatus.Status prevState, QueryStatus.Status currState) {
     QueryHandle query = ctx.getQueryHandle();
     switch (currState) {
     case CANCELED:
@@ -690,7 +670,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
       return new QueryQueued(ctx.getSubmissionTime(), prevState, currState, query, ctx.getSubmittedUser());
     case RUNNING:
       return new QueryRunning(System.currentTimeMillis() - ctx.getDriverStatus().getDriverStartTime(), prevState,
-                              currState, query);
+        currState, query);
     case EXECUTED:
       return new QueryExecuted(ctx.getDriverStatus().getDriverFinishTime(), prevState, currState, query);
     case SUCCESSFUL:
@@ -737,7 +717,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see java.lang.Runnable#run()
      */
     @Override
@@ -762,7 +742,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
                 int rows = set.size();
                 finishedQuery.setMetadataClass(metadata.getClass().getName());
                 finishedQuery.setResult(outputPath);
-                finishedQuery.setMetadata(mapper.writeValueAsString(metadata));
+                finishedQuery.setMetadata(MAPPER.writeValueAsString(metadata));
                 finishedQuery.setRows(rows);
               }
             }
@@ -789,7 +769,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
             resultSets.remove(finished.getCtx().getQueryHandle());
           }
           fireStatusChangeEvent(finished.getCtx(),
-                                new QueryStatus(1f, Status.CLOSED, "Query purged", false, null, null), finished.getCtx().getStatus());
+            new QueryStatus(1f, Status.CLOSED, "Query purged", false, null, null), finished.getCtx().getStatus());
           LOG.info("Query purged: " + finished.getCtx().getQueryHandle());
         } catch (LensException e) {
           incrCounter(QUERY_PURGER_COUNTER);
@@ -810,7 +790,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see java.lang.Runnable#run()
      */
     @Override
@@ -838,7 +818,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.hive.service.CompositeService#init(org.apache.hadoop.hive.conf.HiveConf)
    */
   public synchronized void init(HiveConf hiveConf) {
@@ -851,7 +831,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
       throw new IllegalStateException("Could not load drivers");
     }
     maxFinishedQueries = conf.getInt(LensConfConstants.MAX_NUMBER_OF_FINISHED_QUERY,
-                                     LensConfConstants.DEFAULT_FINISHED_QUERIES);
+      LensConfConstants.DEFAULT_FINISHED_QUERIES);
     initalizeFinishedQueryStore(conf);
     LOG.info("Query execution service initialized");
   }
@@ -873,7 +853,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
     module.addSerializer(ColumnDescriptor.class, new JsonSerializer<ColumnDescriptor>() {
       @Override
       public void serialize(ColumnDescriptor columnDescriptor, JsonGenerator jsonGenerator,
-                            SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
+        SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
         jsonGenerator.writeStartObject();
         jsonGenerator.writeStringField("name", columnDescriptor.getName());
         jsonGenerator.writeStringField("comment", columnDescriptor.getComment());
@@ -890,15 +870,15 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
         JsonNode node = oc.readTree(jsonParser);
         org.apache.hive.service.cli.Type t = org.apache.hive.service.cli.Type.getType(node.get("type").asText());
         return new ColumnDescriptor(node.get("name").asText(), node.get("comment").asText(), new TypeDescriptor(t),
-                                    node.get("position").asInt());
+          node.get("position").asInt());
       }
     });
-    mapper.registerModule(module);
+    MAPPER.registerModule(module);
   }
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.lens.server.LensService#prepareStopping()
    */
   public void prepareStopping() {
@@ -911,7 +891,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.hive.service.CompositeService#stop()
    */
   public synchronized void stop() {
@@ -929,7 +909,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.hive.service.CompositeService#start()
    */
   public synchronized void start() {
@@ -943,13 +923,13 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
           } else {
             ctx.setConf(getLensConf(ctx.getLensConf()));
           }
-          for(LensDriver driver : drivers.values()) {
-            if(ctx.getDriverContext() != null) {
+          for (LensDriver driver : drivers.values()) {
+            if (ctx.getDriverContext() != null) {
               ctx.getDriverContext().setDriverConf(driver, ctx.getConf());
             }
           }
         } catch (LensException e) {
-          LOG.error("Could not set query conf " , e);
+          LOG.error("Could not set query conf ", e);
         }
       }
     }
@@ -1012,8 +992,8 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
       }
       try {
         Class<LensResultSetMetadata> mdKlass = (Class<LensResultSetMetadata>) Class.forName(query.getMetadataClass());
-        return new LensPersistentResult(mapper.readValue(query.getMetadata(), mdKlass), query.getResult(),
-                                        query.getRows());
+        return new LensPersistentResult(MAPPER.readValue(query.getMetadata(), mdKlass), query.getResult(),
+          query.getRows());
       } catch (Exception e) {
         throw new LensException(e);
       }
@@ -1041,12 +1021,13 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
         if (resultSet == null) {
           if (ctx.isPersistent() && ctx.getQueryOutputFormatter() != null) {
             resultSets
-              .put(queryHandle, new LensPersistentResult(ctx.getQueryOutputFormatter().getMetadata(), ctx
-                .getQueryOutputFormatter().getFinalOutputPath().toString(), ctx.getQueryOutputFormatter()
-                                                           .getNumRows()));
+              .put(queryHandle,
+                new LensPersistentResult(
+                  ctx.getQueryOutputFormatter().getMetadata(),
+                  ctx.getQueryOutputFormatter().getFinalOutputPath(),
+                  ctx.getQueryOutputFormatter().getNumRows()));
           } else if (allQueries.get(queryHandle).isResultAvailableInDriver()) {
-            resultSet = allQueries.get(queryHandle).getSelectedDriver().fetchResultSet(allQueries
-                                                                                         .get(queryHandle));
+            resultSet = allQueries.get(queryHandle).getSelectedDriver().fetchResultSet(allQueries.get(queryHandle));
             resultSets.put(queryHandle, resultSet);
           } else {
             throw new NotFoundException("Result set not available for query:" + queryHandle);
@@ -1065,13 +1046,12 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
    * @throws LensException the lens exception
    */
   LensResultSet getDriverResultset(QueryHandle queryHandle) throws LensException {
-    return allQueries.get(queryHandle).getSelectedDriver().fetchResultSet(allQueries.get
-      (queryHandle));
+    return allQueries.get(queryHandle).getSelectedDriver().fetchResultSet(allQueries.get(queryHandle));
   }
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.lens.server.api.query.QueryExecutionService#prepare(org.apache.lens.api.LensSessionHandle,
    * java.lang.String, org.apache.lens.api.LensConf, java.lang.String)
    */
@@ -1100,11 +1080,11 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
    * @throws LensException the lens exception
    */
   private PreparedQueryContext prepareQuery(LensSessionHandle sessionHandle, String query, LensConf lensConf,
-                                            SubmitOp op) throws LensException {
+    SubmitOp op) throws LensException {
     Configuration conf = getLensConf(sessionHandle, lensConf);
     accept(query, conf, op);
     PreparedQueryContext prepared = new PreparedQueryContext(query, getSession(sessionHandle).getLoggedInUser(), conf,
-                                                             lensConf, drivers.values());
+      lensConf, drivers.values());
     rewriteAndSelect(prepared);
     preparedQueries.put(prepared.getPrepareHandle(), prepared);
     preparedQueryQueue.add(prepared);
@@ -1114,7 +1094,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see
    * org.apache.lens.server.api.query.QueryExecutionService#explainAndPrepare(org.apache.lens.api.LensSessionHandle,
    * java.lang.String, org.apache.lens.api.LensConf, java.lang.String)
@@ -1148,14 +1128,14 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see
    * org.apache.lens.server.api.query.QueryExecutionService#executePrepareAsync(org.apache.lens.api.LensSessionHandle,
    * org.apache.lens.api.query.QueryPrepareHandle, org.apache.lens.api.LensConf, java.lang.String)
    */
   @Override
   public QueryHandle executePrepareAsync(LensSessionHandle sessionHandle, QueryPrepareHandle prepareHandle,
-                                         LensConf conf, String queryName) throws LensException {
+    LensConf conf, String queryName) throws LensException {
     try {
       LOG.info("ExecutePrepareAsync: " + sessionHandle.toString() + " query:" + prepareHandle.getPrepareHandleId());
       acquire(sessionHandle);
@@ -1177,16 +1157,16 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.lens.server.api.query.QueryExecutionService#executePrepare(org.apache.lens.api.LensSessionHandle,
    * org.apache.lens.api.query.QueryPrepareHandle, long, org.apache.lens.api.LensConf, java.lang.String)
    */
   @Override
   public QueryHandleWithResultSet executePrepare(LensSessionHandle sessionHandle, QueryPrepareHandle prepareHandle,
-                                                 long timeoutMillis, LensConf conf, String queryName) throws LensException {
+    long timeoutMillis, LensConf conf, String queryName) throws LensException {
     try {
       LOG.info("ExecutePrepare: " + sessionHandle.toString() + " query:" + prepareHandle.getPrepareHandleId()
-                 + " timeout:" + timeoutMillis);
+        + " timeout:" + timeoutMillis);
       acquire(sessionHandle);
       PreparedQueryContext pctx = getPreparedQueryContext(sessionHandle, prepareHandle);
       Configuration qconf = getLensConf(sessionHandle, conf);
@@ -1205,7 +1185,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.lens.server.api.query.QueryExecutionService#executeAsync(org.apache.lens.api.LensSessionHandle,
    * java.lang.String, org.apache.lens.api.LensConf, java.lang.String)
    */
@@ -1278,7 +1258,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.lens.server.api.query.QueryExecutionService#updateQueryConf(org.apache.lens.api.LensSessionHandle,
    * org.apache.lens.api.query.QueryHandle, org.apache.lens.api.LensConf)
    */
@@ -1303,7 +1283,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.lens.server.api.query.QueryExecutionService#updateQueryConf(org.apache.lens.api.LensSessionHandle,
    * org.apache.lens.api.query.QueryPrepareHandle, org.apache.lens.api.LensConf)
    */
@@ -1359,7 +1339,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.lens.server.api.query.QueryExecutionService#getQuery(org.apache.lens.api.LensSessionHandle,
    * org.apache.lens.api.query.QueryHandle)
    */
@@ -1376,7 +1356,8 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
    * @return the prepared query context
    * @throws LensException the lens exception
    */
-  private PreparedQueryContext getPreparedQueryContext(LensSessionHandle sessionHandle, QueryPrepareHandle prepareHandle)
+  private PreparedQueryContext getPreparedQueryContext(LensSessionHandle sessionHandle,
+    QueryPrepareHandle prepareHandle)
     throws LensException {
     try {
       acquire(sessionHandle);
@@ -1392,7 +1373,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.lens.server.api.query.QueryExecutionService#getPreparedQuery(org.apache.lens.api.LensSessionHandle,
    * org.apache.lens.api.query.QueryPrepareHandle)
    */
@@ -1404,13 +1385,13 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.lens.server.api.query.QueryExecutionService#execute(org.apache.lens.api.LensSessionHandle,
    * java.lang.String, long, org.apache.lens.api.LensConf, java.lang.String)
    */
   @Override
   public QueryHandleWithResultSet execute(LensSessionHandle sessionHandle, String query, long timeoutMillis,
-                                          LensConf conf, String queryName) throws LensException {
+    LensConf conf, String queryName) throws LensException {
     try {
       LOG.info("Blocking execute " + sessionHandle.toString() + " query: " + query + " timeout: " + timeoutMillis);
       acquire(sessionHandle);
@@ -1435,7 +1416,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
    * @throws LensException the lens exception
    */
   private QueryHandleWithResultSet executeTimeoutInternal(LensSessionHandle sessionHandle, QueryContext ctx,
-                                                          long timeoutMillis, Configuration conf) throws LensException {
+    long timeoutMillis, Configuration conf) throws LensException {
     QueryHandle handle = executeAsyncInternal(sessionHandle, ctx);
     QueryHandleWithResultSet result = new QueryHandleWithResultSet(handle);
     // getQueryContext calls updateStatus, which fires query events if there's a change in status
@@ -1447,10 +1428,8 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
       }
     }
     QueryCompletionListener listener = new QueryCompletionListenerImpl(handle);
-    getQueryContext(sessionHandle, handle).getSelectedDriver().registerForCompletionNotification
-      (handle,
-       timeoutMillis,
-       listener);
+    getQueryContext(sessionHandle, handle).getSelectedDriver()
+      .registerForCompletionNotification(handle, timeoutMillis, listener);
     try {
       synchronized (listener) {
         listener.wait(timeoutMillis);
@@ -1491,7 +1470,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see
      * org.apache.lens.server.api.driver.QueryCompletionListener#onCompletion(org.apache.lens.api.query.QueryHandle)
      */
@@ -1506,7 +1485,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.lens.server.api.driver.QueryCompletionListener#onError(org.apache.lens.api.query.QueryHandle,
      * java.lang.String)
      */
@@ -1522,7 +1501,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see
    * org.apache.lens.server.api.query.QueryExecutionService#getResultSetMetadata(org.apache.lens.api.LensSessionHandle,
    * org.apache.lens.api.query.QueryHandle)
@@ -1538,7 +1517,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
         return resultSet.getMetadata().toQueryResultSetMetadata();
       } else {
         throw new NotFoundException("Resultset metadata not found for query: (" + sessionHandle + ", " + queryHandle
-                                      + ")");
+          + ")");
       }
     } finally {
       release(sessionHandle);
@@ -1547,13 +1526,13 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.lens.server.api.query.QueryExecutionService#fetchResultSet(org.apache.lens.api.LensSessionHandle,
    * org.apache.lens.api.query.QueryHandle, long, int)
    */
   @Override
   public QueryResult fetchResultSet(LensSessionHandle sessionHandle, QueryHandle queryHandle, long startIndex,
-                                    int fetchSize) throws LensException {
+    int fetchSize) throws LensException {
     try {
       LOG.info("FetchResultSet:" + sessionHandle.toString() + " query:" + queryHandle);
       acquire(sessionHandle);
@@ -1565,7 +1544,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.lens.server.api.query.QueryExecutionService#closeResultSet(org.apache.lens.api.LensSessionHandle,
    * org.apache.lens.api.query.QueryHandle)
    */
@@ -1584,7 +1563,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.lens.server.api.query.QueryExecutionService#cancelQuery(org.apache.lens.api.LensSessionHandle,
    * org.apache.lens.api.query.QueryHandle)
    */
@@ -1616,13 +1595,13 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.lens.server.api.query.QueryExecutionService#getAllQueries(org.apache.lens.api.LensSessionHandle,
    * java.lang.String, java.lang.String, java.lang.String, long, long)
    */
   @Override
   public List<QueryHandle> getAllQueries(LensSessionHandle sessionHandle, String state, String userName,
-                                         String queryName, long fromDate, long toDate) throws LensException {
+    String queryName, long fromDate, long toDate) throws LensException {
     validateTimeRange(fromDate, toDate);
     userName = UtilityMethods.removeDomain(userName);
     try {
@@ -1661,7 +1640,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
           userName = null;
         }
         List<QueryHandle> persistedQueries = lensServerDao.findFinishedQueries(state, userName, queryName, fromDate,
-                                                                               toDate);
+          toDate);
         if (persistedQueries != null && !persistedQueries.isEmpty()) {
           LOG.info("Adding persisted queries " + persistedQueries.size());
           all.addAll(persistedQueries);
@@ -1676,14 +1655,14 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see
    * org.apache.lens.server.api.query.QueryExecutionService#getAllPreparedQueries(org.apache.lens.api.LensSessionHandle,
    * java.lang.String, java.lang.String, long, long)
    */
   @Override
   public List<QueryPrepareHandle> getAllPreparedQueries(LensSessionHandle sessionHandle, String user, String queryName,
-                                                        long fromDate, long toDate) throws LensException {
+    long fromDate, long toDate) throws LensException {
     validateTimeRange(fromDate, toDate);
     user = UtilityMethods.removeDomain(user);
     try {
@@ -1734,7 +1713,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.lens.server.api.query.QueryExecutionService#destroyPrepared(org.apache.lens.api.LensSessionHandle,
    * org.apache.lens.api.query.QueryPrepareHandle)
    */
@@ -1765,7 +1744,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.lens.server.api.query.QueryExecutionService#explain(org.apache.lens.api.LensSessionHandle,
    * java.lang.String, org.apache.lens.api.LensConf)
    */
@@ -1776,7 +1755,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
       acquire(sessionHandle);
       Configuration qconf = getLensConf(sessionHandle, lensConf);
       ExplainQueryContext explainQueryContext = new ExplainQueryContext(query,
-          getSession(sessionHandle).getLoggedInUser(), lensConf, qconf, drivers.values());
+        getSession(sessionHandle).getLoggedInUser(), lensConf, qconf, drivers.values());
 
       accept(query, qconf, SubmitOp.EXPLAIN);
       explainQueryContext.setDriverQueriesAndPlans(RewriteUtil.rewriteQuery(explainQueryContext));
@@ -1784,7 +1763,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
       explainQueryContext.setSelectedDriver(driverSelector.select(explainQueryContext, qconf));
       return explainQueryContext.getSelectedDriverQueryPlan().toQueryPlan();
     } catch (LensException e) {
-      LOG.error("Error during explain :" , e);
+      LOG.error("Error during explain :", e);
       QueryPlan plan;
       if (e.getCause() != null && e.getCause().getMessage() != null) {
         plan = new QueryPlan(true, e.getCause().getMessage());
@@ -1801,7 +1780,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.lens.server.LensService#addResource(org.apache.lens.api.LensSessionHandle, java.lang.String,
    * java.lang.String)
    */
@@ -1831,18 +1810,18 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
    * @throws LensException
    */
   private QueryContext createResourceQuery(String command, LensSessionHandle sessionHandle, LensDriver driver)
-      throws LensException {
+    throws LensException {
     LensConf qconf = new LensConf();
     qconf.addProperty(LensConfConstants.QUERY_PERSISTENT_RESULT_INDRIVER, "false");
     QueryContext addQuery = QueryContext.createContextWithSingleDriver(command,
-        getSession(sessionHandle).getLoggedInUser(), qconf, getLensConf(
-              sessionHandle, qconf), driver, sessionHandle.getPublicId().toString());
+      getSession(sessionHandle).getLoggedInUser(), qconf, getLensConf(
+        sessionHandle, qconf), driver, sessionHandle.getPublicId().toString());
     return addQuery;
   }
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.lens.server.LensService#deleteResource(org.apache.lens.api.LensSessionHandle, java.lang.String,
    * java.lang.String)
    */
@@ -1862,7 +1841,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.lens.server.LensService#readExternal(java.io.ObjectInput)
    */
   @Override
@@ -1901,7 +1880,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
         //Create DriverSelectorQueryContext by passing all the drivers and the user query
         //Driver conf gets reset in start
         DriverSelectorQueryContext driverCtx = new DriverSelectorQueryContext(ctx.getUserQuery(), new Configuration(),
-                                                                              drivers.values());
+          drivers.values());
         ctx.setDriverContext(driverCtx);
         boolean driverAvailable = in.readBoolean();
         // set the selected driver if available, if not available for the cases of queued queries,
@@ -1939,7 +1918,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.lens.server.LensService#writeExternal(java.io.ObjectOutput)
    */
   @Override
@@ -1986,7 +1965,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.lens.server.api.query.QueryExecutionService#getHttpResultSet(org.apache.lens.api.LensSessionHandle,
    * org.apache.lens.api.query.QueryHandle)
    */
@@ -2009,7 +1988,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
       if (resultFSReadUrl != null) {
         try {
           URI resultReadPath = new URI(resultFSReadUrl + resultPath.toUri().getPath() + "?op=OPEN&user.name="
-                                         + getSession(sessionHandle).getClusterUser());
+            + getSession(sessionHandle).getClusterUser());
           return Response.seeOther(resultReadPath)
             .header("content-disposition", "attachment; filename = " + resultPath.getName())
             .type(MediaType.APPLICATION_OCTET_STREAM).build();
@@ -2056,7 +2035,7 @@ public class QueryExecutionServiceImpl extends LensService implements QueryExecu
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.lens.server.LensService#closeSession(org.apache.lens.api.LensSessionHandle)
    */
   public void closeSession(LensSessionHandle sessionHandle) throws LensException {

http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a18896b4/lens-server/src/main/java/org/apache/lens/server/query/QueryExecutionStatisticsGenerator.java
----------------------------------------------------------------------
diff --git a/lens-server/src/main/java/org/apache/lens/server/query/QueryExecutionStatisticsGenerator.java b/lens-server/src/main/java/org/apache/lens/server/query/QueryExecutionStatisticsGenerator.java
index 2ec2ba7..86719b7 100644
--- a/lens-server/src/main/java/org/apache/lens/server/query/QueryExecutionStatisticsGenerator.java
+++ b/lens-server/src/main/java/org/apache/lens/server/query/QueryExecutionStatisticsGenerator.java
@@ -27,6 +27,7 @@ import org.apache.lens.server.api.query.QueryContext;
 import org.apache.lens.server.api.query.QueryEnded;
 import org.apache.lens.server.stats.event.query.QueryDriverStatistics;
 import org.apache.lens.server.stats.event.query.QueryExecutionStatistics;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -47,10 +48,8 @@ public class QueryExecutionStatisticsGenerator extends AsyncEventListener<QueryE
   /**
    * Instantiates a new query execution statistics generator.
    *
-   * @param queryService
-   *          the query service
-   * @param eventService
-   *          the event service
+   * @param queryService the query service
+   * @param eventService the event service
    */
   public QueryExecutionStatisticsGenerator(QueryExecutionServiceImpl queryService, LensEventService eventService) {
     this.queryService = queryService;
@@ -59,7 +58,7 @@ public class QueryExecutionStatisticsGenerator extends AsyncEventListener<QueryE
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.lens.server.api.events.AsyncEventListener#process(org.apache.lens.server.api.events.LensEvent)
    */
   @Override
@@ -72,7 +71,7 @@ public class QueryExecutionStatisticsGenerator extends AsyncEventListener<QueryE
     QueryContext ctx = queryService.getQueryContext(handle);
     if (ctx == null) {
       LOG.warn("Could not find the context for " + handle + " for event:" + ended.getCurrentValue()
-          + ". No stat generated");
+        + ". No stat generated");
       return;
     }
     event.setEndTime(ctx.getEndTime());


Mime
View raw message