-
- Enclosing interface:
- Session
public static interface Session.Builder
ASession
builder. ASession
is initially in theSession.Lifecycle.NEW
lifecycle state. It transitions toSession.Lifecycle.CLOSED
if initialization fails.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Session
build()
Return aSession
with the attributes specified.Session.Builder
property(SessionProperty p, java.lang.Object v)
Specify a property and its value for the builtSession
.
-
-
-
Method Detail
-
property
Session.Builder property(SessionProperty p, java.lang.Object v)
Specify a property and its value for the builtSession
.- Parameters:
p
-SessionProperty
to set. Notnull
.v
- value for the property. If v isCloneable
it is cloned otherwise it is retained.- Returns:
- this
Session.Builder
- Throws:
java.lang.IllegalArgumentException
- ifp.validate(v)
does not return true, if this method has already been called with the propertyp
, or the implementation does not support theSessionProperty
.
-
build
Session build()
Return aSession
with the attributes specified. Note that theSession
may not be attached to a server. Call one of theSession.attach()
convenience methods to attach theSession
to a server. The lifecycle of the newSession
isSession.Lifecycle.NEW
. This method cannot block. If the DataSource is unable to support a new Session when this method is called, this method throws SqlException. Note that the implementation does not have to allocate scarce resources to the newSession
when this method is called so limiting the number ofSession
s is not required to limit the use of scarce resources. It may be appropriate to limit the number ofSession
s for other reasons, but that is implementation dependent.- Returns:
- a
Session
- Throws:
java.lang.IllegalStateException
- if this method has already been called or if the implementation cannot create a Session with the specifiedSessionProperty
s.java.lang.IllegalStateException
- if theDataSource
that created thisSession.Builder
is closedSqlException
- if creating aSession
would exceed some limit
-
-