public static interface Session.Builder
Session
builder. A Session
is initially in the
Session.Lifecycle.NEW
lifecycle state. It transitions to the
Session.Lifecycle.OPEN
lifecycle state when fully initialized or
to Session.Lifecycle.CLOSED
if initialization fails.Modifier and Type | Method | Description |
---|---|---|
Session |
build() |
Return a
Session with the attributes specified. |
Session.Builder |
property(SessionProperty p,
java.lang.Object v) |
Specify a property and its value for the built
Session . |
Session.Builder property(SessionProperty p, java.lang.Object v)
Session
.p
- SessionProperty
to set. Not null
.v
- value for the propertySession.Builder
java.lang.IllegalArgumentException
- if p.validate(v)
does not return
true, if this method has already been called with the property
p
, or the implementation does not support the SessionProperty
.Session build()
Session
with the attributes specified. Note that the
Session
may not be attached to a server. Call one of the
Session.attach()
convenience methods to attach the Session
to
a server. The lifecycle of the new Session
is
Session.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 new Session
when this method is called so limiting the
number of Session
s is not required to limit the use of
scarce resources. It may be appropriate to limit the number of
Session
s for other reasons, but that is implementation dependent.Session
java.lang.IllegalStateException
- if this method has already been called or
if the implementation cannot create a Session with the specified
SessionProperty
s.java.lang.IllegalStateException
- if the DataSource
that created this
Session.Builder
is closedSqlException
- if creating a Session
would exceed some
limitReport a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2017, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.
DRAFT JDBC 4.4 EA5