Source:
<code>protected void handleDriverSessionStart(DriverEvent event) { DriverSessionStarted sessionStarted = (DriverSessionStarted) event; if (!(event.getDriver() instanceof HiveDriver)) { return; } HiveDriver hiveDriver = (HiveDriver) event.getDriver(); String grillSession = sessionStarted.getGrillSessionID(); GrillSessionHandle sessionHandle = getSessionHandle(grillSession); try { GrillSessionImpl session = getSession(sessionHandle); acquire(sessionHandle); List<GrillSessionImpl.ResourceEntry> resources = session.getGrillSessionPersistInfo().getResources(); if (resources != null && !resources.isEmpty()) { for (GrillSessionImpl.ResourceEntry resource : resources) { LOG.info("Restoring resource " + resource + " for session " + grillSession); try { <START> String command = "add " + resource.getType().toLowerCase() + " " + resource.getLocation(); <END> GrillConf conf = new GrillConf(); conf.addProperty(GrillConfConstants.QUERY_PERSISTENT_RESULT_INDRIVER, "false"); QueryContext addQuery = new QueryContext(command, getSession(sessionHandle).getUserName(), getGrillConf(sessionHandle, conf)); addQuery.setGrillSessionIdentifier(sessionHandle.getPublicId().toString()); hiveDriver.execute(addQuery); resource.restoredResource(); LOG.info("Restored resource " + resource + " for session " + grillSession); } catch (Exception exc) { LOG.error("Unable to add resource " + resource + " for session " + grillSession, exc); } } } else { LOG.info("No resources to restore for session " + grillSession); } } catch (GrillException e) { LOG.warn("Grill session went away! " + grillSession + " driver session: " + ((DriverSessionStarted) event).getDriverSessionID(), e); } finally { try { release(sessionHandle); } catch (GrillException e) { LOG.error("Error releasing session " + sessionHandle, e); } } }</code><technical_language>QueryExecutionServiceImpl addResource method already. call directly</technical_language>

Target:
protected void handleDriverSessionStart(DriverEvent event) { DriverSessionStarted sessionStarted = (DriverSessionStarted) event; if (!(event.getDriver() instanceof HiveDriver)) { return; } HiveDriver hiveDriver = (HiveDriver) event.getDriver(); String grillSession = sessionStarted.getGrillSessionID(); GrillSessionHandle sessionHandle = getSessionHandle(grillSession); try { GrillSessionImpl session = getSession(sessionHandle); acquire(sessionHandle); List<GrillSessionImpl.ResourceEntry> resources = session.getGrillSessionPersistInfo().getResources(); if (resources != null && !resources.isEmpty()) { for (GrillSessionImpl.ResourceEntry resource : resources) { LOG.info("Restoring resource " + resource + " for session " + grillSession); try { hiveDriver.execute(createAddResourceQuery(sessionHandle, resource.getType(), resource.getLocation())); resource.restoredResource(); LOG.info("Restored resource " + resource + " for session " + grillSession); } catch (Exception exc) { LOG.error("Unable to add resource " + resource + " for session " + grillSession, exc); } } } else { LOG.info("No resources to restore for session " + grillSession); } } catch (GrillException e) { LOG.warn("Grill session went away! " + grillSession + " driver session: " + ((DriverSessionStarted) event).getDriverSessionID(), e); } finally { try { release(sessionHandle); } catch (GrillException e) { LOG.error("Error releasing session " + sessionHandle, e); } } }