Package org.h2.engine
Class Engine
java.lang.Object
org.h2.engine.Engine
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 Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Map
<String, Engine.DatabaseHolder> private static boolean
private static long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
checkClustering
(ConnectionInfo ci, Database database) (package private) static void
Called after a database has been closed, to remove the object from the list of open databases.static SessionLocal
Open a database connection with the given connection information.private static SessionLocal
private static SessionLocal
openSession
(ConnectionInfo ci, boolean ifExists, boolean forbidCreation, String cipher) private static void
throwNotFound
(boolean ifExists, boolean forbidCreation, String name) private static void
validateUserAndPassword
(boolean correct) This method is called after validating user name and password.
-
Field Details
-
DATABASES
-
WRONG_PASSWORD_DELAY
private static volatile long WRONG_PASSWORD_DELAY -
JMX
private static boolean JMX
-
-
Constructor Details
-
Engine
private Engine()
-
-
Method Details
-
openSession
private static SessionLocal openSession(ConnectionInfo ci, boolean ifExists, boolean forbidCreation, String cipher) -
throwNotFound
-
createSession
Open a database connection with the given connection information.- Parameters:
ci
- the connection information- Returns:
- the session
-
openSession
-
checkClustering
-
close
Called after a database has been closed, to remove the object from the list of open databases.- Parameters:
name
- the database name
-
validateUserAndPassword
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
- if the user name or the password was correct- Throws:
DbException
- the exception 'wrong user or password'
-