Interface Session.Builder

    • Method Detail

      • property

        Session.Builder property​(SessionProperty p,
                                 java.lang.Object v)
        Specify a property and its value for the built Session.
        Parameters:
        p - SessionProperty to set. Not null.
        v - value for the property. If v is Cloneable it is cloned otherwise it is retained.
        Returns:
        this Session.Builder
        Throws:
        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.
      • build

        Session build()
        Return a 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 Sessions is not required to limit the use of scarce resources. It may be appropriate to limit the number of Sessions 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 specified SessionPropertys.
        java.lang.IllegalStateException - if the DataSource that created this Session.Builder is closed
        SqlException - if creating a Session would exceed some limit