MCPcopy Index your code
hub / github.com/apache/tomcat / load

Method load

java/org/apache/catalina/session/DataSourceStore.java:403–438  ·  view source on GitHub ↗
(String id)

Source from the content-addressed store, hash-verified

401 }
402
403 @Override
404 public Session load(String id) throws ClassNotFoundException, IOException {
405 org.apache.catalina.Context context = getManager().getContext();
406 Log contextLog = context.getLogger();
407 String loadSql = "SELECT " + sessionIdCol + ", " + sessionDataCol + " FROM " + sessionTable + " WHERE " +
408 sessionIdCol + " = ? AND " + sessionAppCol + " = ?";
409
410 Session session = withRetry((ConnectionOperation<StandardSession,ClassNotFoundException>) conn -> {
411 ClassLoader oldThreadContextCL = context.bind(null);
412
413 try (PreparedStatement preparedLoadSql = conn.prepareStatement(loadSql)) {
414 preparedLoadSql.setString(1, id);
415 preparedLoadSql.setString(2, getName());
416 try (ResultSet rst = preparedLoadSql.executeQuery()) {
417 if (rst.next()) {
418 try (ObjectInputStream ois = getObjectInputStream(rst.getBinaryStream(2))) {
419 if (contextLog.isTraceEnabled()) {
420 contextLog.trace(sm.getString("dataSourceStore.loading", id, sessionTable));
421 }
422
423 StandardSession _session = (StandardSession) manager.createEmptySession();
424 _session.readObjectData(ois);
425 _session.setManager(manager);
426 return _session;
427 }
428 } else if (context.getLogger().isDebugEnabled()) {
429 contextLog.debug(sm.getString("dataSourceStore.noObject", id));
430 }
431 return null;
432 }
433 } finally {
434 context.unbind(oldThreadContextCL);
435 }
436 });
437 return session;
438 }
439
440 @Override
441 public void remove(String id) throws IOException {

Callers

nothing calls this directly

Calls 15

withRetryMethod · 0.95
getNameMethod · 0.95
isTraceEnabledMethod · 0.95
traceMethod · 0.95
readObjectDataMethod · 0.95
setManagerMethod · 0.95
debugMethod · 0.95
getObjectInputStreamMethod · 0.80
getContextMethod · 0.65
getManagerMethod · 0.65
getLoggerMethod · 0.65
bindMethod · 0.65

Tested by

no test coverage detected