Top Description Inners Fields Constructors Methods
org.h2.engine

public final Class Engine

extends Object
Class Inheritance
Imports
java.util.HashMap, .Map, .Objects, org.h2.api.ErrorCode, org.h2.command.CommandInterface, org.h2.command.dml.SetTypes, org.h2.message.DbException, .Trace, org.h2.security.auth.AuthenticationException, .AuthenticationInfo, .Authenticator, org.h2.store.fs.FileUtils, org.h2.util.DateTimeUtils, .MathUtils, .ParserUtil, .StringUtils, .ThreadDeadlockDetector, .TimeZoneProvider, .Utils

The engine contains a map of all open databases. It is also responsible for opening and creating new databases. This is a singleton class.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static final Map<String, Engine.DatabaseHolder>
private static boolean
private static volatile long

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static void
pack-priv static void
close(String
the database name
name
)

Called after a database has been closed, to remove the object from the list of open databases.

public static SessionLocal

Returns:

the session
createSession
(ConnectionInfo
the connection information
ci
)

Open a database connection with the given connection information.

private static SessionLocal
openSession(ConnectionInfo ci, boolean ifExists, boolean forbidCreation, String cipher)

private static SessionLocal
private static void
throwNotFound(boolean ifExists, boolean forbidCreation, String name)

private static void
validateUserAndPassword(boolean
if the user name or the password was correct
correct
)

This method is called after validating user name and password.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DATABASESback to summary
private static final Map<String, Engine.DatabaseHolder> DATABASES
JMXback to summary
private static boolean JMX
WRONG_PASSWORD_DELAYback to summary
private static volatile long WRONG_PASSWORD_DELAY

Constructor Detail

Engineback to summary
private Engine()

Method Detail

checkClusteringback to summary
private static void checkClustering(ConnectionInfo ci, Database database)
closeback to summary
pack-priv static void close(String name)

Called after a database has been closed, to remove the object from the list of open databases.

Parameters
name:String

the database name

createSessionback to summary
public static SessionLocal createSession(ConnectionInfo ci)

Open a database connection with the given connection information.

Parameters
ci:ConnectionInfo

the connection information

Returns:SessionLocal

the session

openSessionback to summary
private static SessionLocal openSession(ConnectionInfo ci, boolean ifExists, boolean forbidCreation, String cipher)
openSessionback to summary
private static SessionLocal openSession(ConnectionInfo ci)
throwNotFoundback to summary
private static void throwNotFound(boolean ifExists, boolean forbidCreation, String name)
validateUserAndPasswordback to summary
private static void validateUserAndPassword(boolean correct)

This method is called after validating user name and password. If user name and password were correct, the sleep time is reset, otherwise this method waits some time (to make brute force / rainbow table attacks harder) and then throws a 'wrong user or password' exception. The delay is a bit randomized to protect against timing attacks. Also the delay doubles after each unsuccessful logins, to make brute force attacks harder. There is only one exception message both for wrong user and for wrong password, to make it harder to get the list of user names. This method must only be called from one place, so it is not possible from the stack trace to see if the user name was wrong or the password.

Parameters
correct:boolean

if the user name or the password was correct

Exceptions
DbException:
the exception 'wrong user or password'
org.h2.engine back to summary

private final Class Engine.DatabaseHolder

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv volatile Database

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

databaseback to summary
pack-priv volatile Database database

Constructor Detail

DatabaseHolderback to summary
pack-priv DatabaseHolder()