Creates the session with the options set by this builder.

@return a completion stage that completes with the session when it is fully initialized.
968903
@NonNull
  public CompletionStage<SessionT> buildAsync() {
    CompletionStage<CqlSession> buildStage = buildDefaultSessionAsync();
    CompletionStage<SessionT> wrapStage = buildStage.thenApply(this::wrap);
    // thenApply does not propagate cancellation (!)
    CompletableFutures.propagateCancellation(wrapStage, buildStage);
    return wrapStage;
  }
1329709
public ExecutionResult withComplete() {
    return this.complete ? this : new ExecutionResult(result, failure, nonResult, waitNanos, true, success, successAll);
  }
702666
public CompletionStage<ResponseBuilder> createResource(final ResponseBuilder builder) {
        LOGGER.debug("Creating resource as {}", getIdentifier());

        final TrellisDataset mutable = TrellisDataset.createDataset();
        final TrellisDataset immutable = TrellisDataset.createDataset();

        return handleResourceCreation(mutable, immutable, builder)
            .whenComplete((a, b) -> mutable.close())
            .whenComplete((a, b) -> immutable.close());
    }
566312
private Completable initFromBeginningToInfinity() {
    return Completable.create(new Completable.OnSubscribe() {
      @Override
      public void call(CompletableSubscriber subscriber) {
        LOGGER.info("Initializing state from beginning to no end.");

        try {
          sessionState().setToBeginningWithNoEnd(numPartitions());
          subscriber.onCompleted();
        } catch (Exception ex) {
          LOGGER.warn("Failed to initialize state from beginning to no end.", ex);
          subscriber.onError(ex);
        }
      }
    });
  }
406447
@Memoized
  Session session() {
    Session result = sessionFactory().create(this);
    provisioned = true;
    return result;
  }
1193715
public function complete()
    {
        $site = SiteConfig::current_site_config();

        $id = $this->request->param('ID');

        if ($id == "error") {
            $return = $this->error_data();
        } else {
            $return = $this->success_data();
        }
            
        $this->customise($return);
        
        // Extend our completion process, to allow for custom completion
        // templates
        $this->extend("onBeforeComplete");

        // Clear our session data
        if (isset($_SESSION)) {
            ShoppingCart::get()->clear();
            unset($_SESSION['Checkout.PostageID']);
            unset($_SESSION['Checkout.PaymentMethod']);
        }

        return $this->renderWith(array(
            "Payment_complete_" . $this->payment_handler,
            "Payment_complete",
            "Checkout",
            "Page"
        ));
    }
507988
private HttpSession2 buildSession(boolean create) {
        if (create) {
            session = buildSession(sessionManager.getSessionIdGenerator().generate(request), true);
            log.debug("Build new session[{}].", session.getId());
            return session;
        } else {
            return null;
        }
    }
929674
public CompletableFuture<Void> closeSession(SessionId sessionId, boolean delete) {
    RaftSessionState state = sessions.get(sessionId.id());
    if (state == null) {
      return Futures.exceptionalFuture(new RaftException.UnknownSession("Unknown session: " + sessionId));
    }

    log.debug("Closing session {}", sessionId);
    CloseSessionRequest request = CloseSessionRequest.builder()
        .withSession(sessionId.id())
        .withDelete(delete)
        .build();

    CompletableFuture<Void> future = new CompletableFuture<>();
    connection.closeSession(request).whenComplete((response, error) -> {
      sessions.remove(sessionId.id());
      if (error == null) {
        if (response.status() == RaftResponse.Status.OK) {
          future.complete(null);
        } else {
          future.completeExceptionally(response.error().createException());
        }
      } else {
        future.completeExceptionally(error);
      }
    });
    return future;
  }
27227
public final String create() throws UnableToCompleteException {
    final SourceWriter sourceWriter = getSourceWriter(logger, context);
    if (sourceWriter != null) {
      writeClassBody(sourceWriter);
      sourceWriter.commit(logger);
    }
    return getQualifiedName();
  }
118550
public void complete(Session session) {
        try {
            session.complete();
            sessionCache.put(session.getId(), session);
        } catch (Exception e) {
            log.warn("Session failed to complete", e);
        }
    }
1363867
private CompletionStage<Void> emitMembershipUpdateEvent() {
        final IRI membershipResource = parent.getMembershipResource().map(MutatingLdpHandler::removeHashFragment)
            .orElse(null);
        if (membershipResource != null) {
            return allOf(getServices().getResourceService().touch(membershipResource).toCompletableFuture(),
                getServices().getResourceService().get(membershipResource).thenAccept(res -> {
                    if (res.getIdentifier() != null) {
                        getServices().getEventService().emit(new SimpleEvent(getUrl(res.getIdentifier()),
                                    getSession().getAgent(), asList(PROV.Activity, AS.Update),
                                    asList(res.getInteractionModel())));
                    }
                }).toCompletableFuture());
        }
        return completedFuture(null);
    }
925858
public Session getSession() throws ControlException {
        if (_session == null) {
            try {
                switch (getDestinationType()) {
                    case Auto:
                        determineDestination();
                        return getSession();
                    case Topic:
                        createTopicSession();
                        break;
                    case Queue:
                        createQueueSession();
                        break;
                }
            }
            catch (JMSException e) {
                throw new ControlException("Failure to get JMS connection or session", e);
            }
        }
        return _session;
    }
1364861
public InitMethodType<SessionBeanType<T>> getOrCreateInitMethod()
   {
      List<Node> nodeList = childNode.get("init-method");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new InitMethodTypeImpl<SessionBeanType<T>>(this, "init-method", childNode, nodeList.get(0));
      }
      return createInitMethod();
   }
612909
public CompletionHandler createAsyncHandler() {
        return Utility.createAsyncHandler((v, a) -> {
            finish(v);
        }, (t, a) -> {
            context.getLogger().log(Level.WARNING, "Servlet occur, force to close channel. request = " + request + ", result is CompletionHandler", (Throwable) t);
            finish(500, null);
        });
    }
794663
private void complete() {
        if (upToDate) {
            // No rules were added since last time.
            return;
        }

        // Make sure either no final rules or a pair of AnnualTimeZoneRules
        // are available.
        if (finalRules != null && finalRules[1] == null) {
            throw new IllegalStateException("Incomplete final rules");
        }

        // Create a TimezoneTransition and add to the list
        if (historicRules != null || finalRules != null) {
            TimeZoneRule curRule = initialRule;
            long lastTransitionTime = Grego.MIN_MILLIS;

            // Build the transition array which represents historical time zone
            // transitions.
            if (historicRules != null) {
                BitSet done = new BitSet(historicRules.size()); // for skipping rules already processed

                while (true) {
                    int curStdOffset = curRule.getRawOffset();
                    int curDstSavings = curRule.getDSTSavings();
                    long nextTransitionTime = Grego.MAX_MILLIS;
                    TimeZoneRule nextRule = null;
                    Date d;
                    long tt;

                    for (int i = 0; i < historicRules.size(); i++) {
                        if (done.get(i)) {
                            continue;
                        }
                        TimeZoneRule r = historicRules.get(i);
                        d = r.getNextStart(lastTransitionTime, curStdOffset, curDstSavings, false);
                        if (d == null) {
                            // No more transitions from this rule - skip this rule next time
                            done.set(i);
                        } else {
                            if (r == curRule ||
                                    (r.getName().equals(curRule.getName())
                                            && r.getRawOffset() == curRule.getRawOffset()
                                            && r.getDSTSavings() == curRule.getDSTSavings())) {
                                continue;
                            }
                            tt = d.getTime();
                            if (tt < nextTransitionTime) {
                                nextTransitionTime = tt;
                                nextRule = r;
                            }
                        }
                    }

                    if (nextRule ==  null) {
                        // Check if all historic rules are done
                        boolean bDoneAll = true;
                        for (int j = 0; j < historicRules.size(); j++) {
                            if (!done.get(j)) {
                                bDoneAll = false;
                                break;
                            }
                        }
                        if (bDoneAll) {
                            break;
                        }
                    }

                    if (finalRules != null) {
                        // Check if one of final rules has earlier transition date
                        for (int i = 0; i < 2 /* finalRules.length */; i++) {
                            if (finalRules[i] == curRule) {
                                continue;
                            }
                            d = finalRules[i].getNextStart(lastTransitionTime, curStdOffset, curDstSavings, false);
                            if (d != null) {
                                tt = d.getTime();
                                if (tt < nextTransitionTime) {
                                    nextTransitionTime = tt;
                                    nextRule = finalRules[i];
                                }
                            }
                        }
                    }

                    if (nextRule == null) {
                        // Nothing more
                        break;
                    }

                    if (historicTransitions == null) {
                        historicTransitions = new ArrayList<TimeZoneTransition>();
                    }
                    historicTransitions.add(new TimeZoneTransition(nextTransitionTime, curRule, nextRule));
                    lastTransitionTime = nextTransitionTime;
                    curRule = nextRule;
                }
            }
            if (finalRules != null) {
                if (historicTransitions == null) {
                    historicTransitions = new ArrayList<TimeZoneTransition>();
                }
                // Append the first transition for each
                Date d0 = finalRules[0].getNextStart(lastTransitionTime, curRule.getRawOffset(), curRule.getDSTSavings(), false);
                Date d1 = finalRules[1].getNextStart(lastTransitionTime, curRule.getRawOffset(), curRule.getDSTSavings(), false);
                if (d1.after(d0)) {
                    historicTransitions.add(new TimeZoneTransition(d0.getTime(), curRule, finalRules[0]));
                    d1 = finalRules[1].getNextStart(d0.getTime(), finalRules[0].getRawOffset(), finalRules[0].getDSTSavings(), false);
                    historicTransitions.add(new TimeZoneTransition(d1.getTime(), finalRules[0], finalRules[1]));
                } else {
                    historicTransitions.add(new TimeZoneTransition(d1.getTime(), curRule, finalRules[1]));
                    d0 = finalRules[0].getNextStart(d1.getTime(), finalRules[1].getRawOffset(), finalRules[1].getDSTSavings(), false);
                    historicTransitions.add(new TimeZoneTransition(d0.getTime(), finalRules[1], finalRules[0]));
                }
            }
        }
        upToDate = true;
    }
1164571
public SessionConfigType<WebAppType<T>> getOrCreateSessionConfig()
   {
      List<Node> nodeList = childNode.get("session-config");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new SessionConfigTypeImpl<WebAppType<T>>(this, "session-config", childNode, nodeList.get(0));
      }
      return createSessionConfig();
   }
1146638
public alluxio.grpc.CompleteFilePOptionsOrBuilder getOptionsOrBuilder() {
    return options_ == null ? alluxio.grpc.CompleteFilePOptions.getDefaultInstance() : options_;
  }