Tabnine Logo
RequestScope.setCurrent
Code IndexAdd Tabnine to your IDE (free)

How to use
setCurrent
method
in
org.glassfish.jersey.process.internal.RequestScope

Best Java code snippets using org.glassfish.jersey.process.internal.RequestScope.setCurrent (Showing top 18 results out of 315)

origin: hstaudacher/osgi-jax-rs-connector

/**
 * Runs the {@link Callable task} in the request scope initialized from the
 * {@link RequestScope.Instance scope instance}. The {@link RequestScope.Instance
 * scope instance} is NOT released by the method (this must be done explicitly). The
 * current thread might be already in any request scope and in that case the scope
 * will be changed to the scope defined by the {@link RequestScope.Instance scope
 * instance}. At the end of the method the request scope is returned to its original
 * state.
 *
 * @param scopeInstance The request scope instance from which the request scope will
 *                      be initialized.
 * @param task          Task to be executed.
 * @param <T>           {@code task} result type.
 * @return result returned by the {@code task}.
 * @throws Exception Exception thrown by the {@code task}.
 */
public <T> T runInScope(Instance scopeInstance, Callable<T> task) throws Exception {
  final Instance oldInstance = retrieveCurrent();
  try {
    setCurrent(scopeInstance.getReference());
    return Errors.process(task);
  } finally {
    scopeInstance.release();
    resumeCurrent(oldInstance);
  }
}
origin: com.eclipsesource.jaxrs/jersey-all

/**
 * Runs the {@link Runnable task} in the request scope initialized from the
 * {@link RequestScope.Instance scope instance}. The {@link RequestScope.Instance
 * scope instance} is NOT released by the method (this must be done explicitly). The
 * current thread might be already in any request scope and in that case the scope
 * will be changed to the scope defined by the {@link RequestScope.Instance scope
 * instance}. At the end of the method the request scope is returned to its original
 * state.
 *
 * @param scopeInstance The request scope instance from which the request scope will
 *                      be initialized.
 * @param task          Task to be executed.
 */
public void runInScope(Instance scopeInstance, Runnable task) {
  final Instance oldInstance = retrieveCurrent();
  try {
    setCurrent(scopeInstance.getReference());
    Errors.process(task);
  } finally {
    scopeInstance.release();
    resumeCurrent(oldInstance);
  }
}
origin: hstaudacher/osgi-jax-rs-connector

/**
 * Runs the {@link Runnable task} in the request scope initialized from the
 * {@link RequestScope.Instance scope instance}. The {@link RequestScope.Instance
 * scope instance} is NOT released by the method (this must be done explicitly). The
 * current thread might be already in any request scope and in that case the scope
 * will be changed to the scope defined by the {@link RequestScope.Instance scope
 * instance}. At the end of the method the request scope is returned to its original
 * state.
 *
 * @param scopeInstance The request scope instance from which the request scope will
 *                      be initialized.
 * @param task          Task to be executed.
 */
public void runInScope(Instance scopeInstance, Runnable task) {
  final Instance oldInstance = retrieveCurrent();
  try {
    setCurrent(scopeInstance.getReference());
    Errors.process(task);
  } finally {
    scopeInstance.release();
    resumeCurrent(oldInstance);
  }
}
origin: hstaudacher/osgi-jax-rs-connector

/**
 * Runs the {@link Runnable task} in the request scope initialized from the
 * {@link RequestScope.Instance scope instance}. The {@link RequestScope.Instance
 * scope instance} is NOT released by the method (this must be done explicitly). The
 * current thread might be already in any request scope and in that case the scope
 * will be changed to the scope defined by the {@link RequestScope.Instance scope
 * instance}. At the end of the method the request scope is returned to its original
 * state.
 *
 * @param scopeInstance The request scope instance from which the request scope will
 *                      be initialized.
 * @param task          Task to be executed.
 */
public void runInScope(Instance scopeInstance, Runnable task) {
  final Instance oldInstance = retrieveCurrent();
  try {
    setCurrent(scopeInstance.getReference());
    Errors.process(task);
  } finally {
    scopeInstance.release();
    resumeCurrent(oldInstance);
  }
}
origin: com.eclipsesource.jaxrs/jersey-all

/**
 * Runs the {@link Callable task} in the request scope initialized from the
 * {@link RequestScope.Instance scope instance}. The {@link RequestScope.Instance
 * scope instance} is NOT released by the method (this must be done explicitly). The
 * current thread might be already in any request scope and in that case the scope
 * will be changed to the scope defined by the {@link RequestScope.Instance scope
 * instance}. At the end of the method the request scope is returned to its original
 * state.
 *
 * @param scopeInstance The request scope instance from which the request scope will
 *                      be initialized.
 * @param task          Task to be executed.
 * @param <T>           {@code task} result type.
 * @return result returned by the {@code task}.
 * @throws Exception Exception thrown by the {@code task}.
 */
public <T> T runInScope(Instance scopeInstance, Callable<T> task) throws Exception {
  final Instance oldInstance = retrieveCurrent();
  try {
    setCurrent(scopeInstance.getReference());
    return Errors.process(task);
  } finally {
    scopeInstance.release();
    resumeCurrent(oldInstance);
  }
}
origin: hstaudacher/osgi-jax-rs-connector

/**
 * Runs the {@link org.glassfish.jersey.internal.util.Producer task} in the request scope initialized
 * from the {@link RequestScope.Instance scope instance}.
 * The {@link RequestScope.Instance scope instance} is NOT released by the method (this
 * must be done explicitly). The current thread might be already in any request scope
 * and in that case the scope will be changed to the scope defined by the
 * {@link RequestScope.Instance scope instance}. At the end of the method the request
 * scope is returned to its original state.
 *
 * @param scopeInstance The request scope instance from which the request scope will
 *                      be initialized.
 * @param task          Task to be executed.
 * @param <T>           {@code task} result type.
 * @return result returned by the {@code task}
 */
public <T> T runInScope(Instance scopeInstance, Producer<T> task) {
  final Instance oldInstance = retrieveCurrent();
  try {
    setCurrent(scopeInstance.getReference());
    return Errors.process(task);
  } finally {
    scopeInstance.release();
    resumeCurrent(oldInstance);
  }
}
origin: hstaudacher/osgi-jax-rs-connector

/**
 * Runs the {@link Callable task} in the request scope initialized from the
 * {@link RequestScope.Instance scope instance}. The {@link RequestScope.Instance
 * scope instance} is NOT released by the method (this must be done explicitly). The
 * current thread might be already in any request scope and in that case the scope
 * will be changed to the scope defined by the {@link RequestScope.Instance scope
 * instance}. At the end of the method the request scope is returned to its original
 * state.
 *
 * @param scopeInstance The request scope instance from which the request scope will
 *                      be initialized.
 * @param task          Task to be executed.
 * @param <T>           {@code task} result type.
 * @return result returned by the {@code task}.
 * @throws Exception Exception thrown by the {@code task}.
 */
public <T> T runInScope(Instance scopeInstance, Callable<T> task) throws Exception {
  final Instance oldInstance = retrieveCurrent();
  try {
    setCurrent(scopeInstance.getReference());
    return Errors.process(task);
  } finally {
    scopeInstance.release();
    resumeCurrent(oldInstance);
  }
}
origin: com.eclipsesource.jaxrs/jersey-all

/**
 * Runs the {@link org.glassfish.jersey.internal.util.Producer task} in the request scope initialized
 * from the {@link RequestScope.Instance scope instance}.
 * The {@link RequestScope.Instance scope instance} is NOT released by the method (this
 * must be done explicitly). The current thread might be already in any request scope
 * and in that case the scope will be changed to the scope defined by the
 * {@link RequestScope.Instance scope instance}. At the end of the method the request
 * scope is returned to its original state.
 *
 * @param scopeInstance The request scope instance from which the request scope will
 *                      be initialized.
 * @param task          Task to be executed.
 * @param <T>           {@code task} result type.
 * @return result returned by the {@code task}
 */
public <T> T runInScope(Instance scopeInstance, Producer<T> task) {
  final Instance oldInstance = retrieveCurrent();
  try {
    setCurrent(scopeInstance.getReference());
    return Errors.process(task);
  } finally {
    scopeInstance.release();
    resumeCurrent(oldInstance);
  }
}
origin: hstaudacher/osgi-jax-rs-connector

/**
 * Runs the {@link org.glassfish.jersey.internal.util.Producer task} in the request scope initialized
 * from the {@link RequestScope.Instance scope instance}.
 * The {@link RequestScope.Instance scope instance} is NOT released by the method (this
 * must be done explicitly). The current thread might be already in any request scope
 * and in that case the scope will be changed to the scope defined by the
 * {@link RequestScope.Instance scope instance}. At the end of the method the request
 * scope is returned to its original state.
 *
 * @param scopeInstance The request scope instance from which the request scope will
 *                      be initialized.
 * @param task          Task to be executed.
 * @param <T>           {@code task} result type.
 * @return result returned by the {@code task}
 */
public <T> T runInScope(Instance scopeInstance, Producer<T> task) {
  final Instance oldInstance = retrieveCurrent();
  try {
    setCurrent(scopeInstance.getReference());
    return Errors.process(task);
  } finally {
    scopeInstance.release();
    resumeCurrent(oldInstance);
  }
}
origin: com.eclipsesource.jaxrs/jersey-all

/**
 * Runs the {@link Runnable task} in the new request scope. The current thread might
 * be already in any request scope and in that case the scope will be changed to the
 * scope defined by the {@link RequestScope.Instance scope instance}. At the end of
 * the method the request scope is returned to its original state. The newly created
 * {@link RequestScope.Instance scope instance} will be implicitly released at the end
 * of the method call except the task will call
 * {@link RequestScope#suspendCurrent}.
 *
 * @param task Task to be executed.
 */
public void runInScope(Runnable task) {
  final Instance oldInstance = retrieveCurrent();
  final Instance instance = createInstance();
  try {
    setCurrent(instance);
    Errors.process(task);
  } finally {
    instance.release();
    resumeCurrent(oldInstance);
  }
}
origin: com.eclipsesource.jaxrs/jersey-all

/**
 * Runs the {@link Callable task} in the new request scope. The current thread might
 * be already in any request scope and in that case the scope will be changed to the
 * scope defined by the {@link RequestScope.Instance scope instance}. At the end of
 * the method the request scope is returned to its original state. The newly created
 * {@link RequestScope.Instance scope instance} will be implicitly released at the end
 * of the method call except the task will call
 * {@link RequestScope#suspendCurrent}.
 *
 * @param task Task to be executed.
 * @param <T>  {@code task} result type.
 * @return result returned by the {@code task}.
 * @throws Exception Exception thrown by the {@code task}.
 */
public <T> T runInScope(Callable<T> task) throws Exception {
  final Instance oldInstance = retrieveCurrent();
  final Instance instance = createInstance();
  try {
    setCurrent(instance);
    return Errors.process(task);
  } finally {
    instance.release();
    resumeCurrent(oldInstance);
  }
}
origin: hstaudacher/osgi-jax-rs-connector

/**
 * Runs the {@link Runnable task} in the new request scope. The current thread might
 * be already in any request scope and in that case the scope will be changed to the
 * scope defined by the {@link RequestScope.Instance scope instance}. At the end of
 * the method the request scope is returned to its original state. The newly created
 * {@link RequestScope.Instance scope instance} will be implicitly released at the end
 * of the method call except the task will call
 * {@link RequestScope#suspendCurrent}.
 *
 * @param task Task to be executed.
 */
public void runInScope(Runnable task) {
  final Instance oldInstance = retrieveCurrent();
  final Instance instance = createInstance();
  try {
    setCurrent(instance);
    Errors.process(task);
  } finally {
    instance.release();
    resumeCurrent(oldInstance);
  }
}
origin: hstaudacher/osgi-jax-rs-connector

/**
 * Runs the {@link Runnable task} in the new request scope. The current thread might
 * be already in any request scope and in that case the scope will be changed to the
 * scope defined by the {@link RequestScope.Instance scope instance}. At the end of
 * the method the request scope is returned to its original state. The newly created
 * {@link RequestScope.Instance scope instance} will be implicitly released at the end
 * of the method call except the task will call
 * {@link RequestScope#suspendCurrent}.
 *
 * @param task Task to be executed.
 */
public void runInScope(Runnable task) {
  final Instance oldInstance = retrieveCurrent();
  final Instance instance = createInstance();
  try {
    setCurrent(instance);
    Errors.process(task);
  } finally {
    instance.release();
    resumeCurrent(oldInstance);
  }
}
origin: hstaudacher/osgi-jax-rs-connector

/**
 * Runs the {@link Callable task} in the new request scope. The current thread might
 * be already in any request scope and in that case the scope will be changed to the
 * scope defined by the {@link RequestScope.Instance scope instance}. At the end of
 * the method the request scope is returned to its original state. The newly created
 * {@link RequestScope.Instance scope instance} will be implicitly released at the end
 * of the method call except the task will call
 * {@link RequestScope#suspendCurrent}.
 *
 * @param task Task to be executed.
 * @param <T>  {@code task} result type.
 * @return result returned by the {@code task}.
 * @throws Exception Exception thrown by the {@code task}.
 */
public <T> T runInScope(Callable<T> task) throws Exception {
  final Instance oldInstance = retrieveCurrent();
  final Instance instance = createInstance();
  try {
    setCurrent(instance);
    return Errors.process(task);
  } finally {
    instance.release();
    resumeCurrent(oldInstance);
  }
}
origin: com.eclipsesource.jaxrs/jersey-all

/**
 * Runs the {@link org.glassfish.jersey.internal.util.Producer task} in the new request scope. The
 * current thread might be already in any request scope and in that case the scope
 * will be changed to the scope defined by the {@link RequestScope.Instance scope
 * instance}. At the end of the method the request scope is returned to its original
 * state. The newly created {@link RequestScope.Instance scope instance} will be
 * implicitly released at the end of the method call except the task will call
 * {@link RequestScope#suspendCurrent}.
 *
 * @param task Task to be executed.
 * @param <T>  {@code task} result type.
 * @return result returned by the {@code task}.
 */
public <T> T runInScope(Producer<T> task) {
  final Instance oldInstance = retrieveCurrent();
  final Instance instance = createInstance();
  try {
    setCurrent(instance);
    return Errors.process(task);
  } finally {
    instance.release();
    resumeCurrent(oldInstance);
  }
}
origin: hstaudacher/osgi-jax-rs-connector

/**
 * Runs the {@link org.glassfish.jersey.internal.util.Producer task} in the new request scope. The
 * current thread might be already in any request scope and in that case the scope
 * will be changed to the scope defined by the {@link RequestScope.Instance scope
 * instance}. At the end of the method the request scope is returned to its original
 * state. The newly created {@link RequestScope.Instance scope instance} will be
 * implicitly released at the end of the method call except the task will call
 * {@link RequestScope#suspendCurrent}.
 *
 * @param task Task to be executed.
 * @param <T>  {@code task} result type.
 * @return result returned by the {@code task}.
 */
public <T> T runInScope(Producer<T> task) {
  final Instance oldInstance = retrieveCurrent();
  final Instance instance = createInstance();
  try {
    setCurrent(instance);
    return Errors.process(task);
  } finally {
    instance.release();
    resumeCurrent(oldInstance);
  }
}
origin: hstaudacher/osgi-jax-rs-connector

/**
 * Runs the {@link org.glassfish.jersey.internal.util.Producer task} in the new request scope. The
 * current thread might be already in any request scope and in that case the scope
 * will be changed to the scope defined by the {@link RequestScope.Instance scope
 * instance}. At the end of the method the request scope is returned to its original
 * state. The newly created {@link RequestScope.Instance scope instance} will be
 * implicitly released at the end of the method call except the task will call
 * {@link RequestScope#suspendCurrent}.
 *
 * @param task Task to be executed.
 * @param <T>  {@code task} result type.
 * @return result returned by the {@code task}.
 */
public <T> T runInScope(Producer<T> task) {
  final Instance oldInstance = retrieveCurrent();
  final Instance instance = createInstance();
  try {
    setCurrent(instance);
    return Errors.process(task);
  } finally {
    instance.release();
    resumeCurrent(oldInstance);
  }
}
origin: hstaudacher/osgi-jax-rs-connector

/**
 * Runs the {@link Callable task} in the new request scope. The current thread might
 * be already in any request scope and in that case the scope will be changed to the
 * scope defined by the {@link RequestScope.Instance scope instance}. At the end of
 * the method the request scope is returned to its original state. The newly created
 * {@link RequestScope.Instance scope instance} will be implicitly released at the end
 * of the method call except the task will call
 * {@link RequestScope#suspendCurrent}.
 *
 * @param task Task to be executed.
 * @param <T>  {@code task} result type.
 * @return result returned by the {@code task}.
 * @throws Exception Exception thrown by the {@code task}.
 */
public <T> T runInScope(Callable<T> task) throws Exception {
  final Instance oldInstance = retrieveCurrent();
  final Instance instance = createInstance();
  try {
    setCurrent(instance);
    return Errors.process(task);
  } finally {
    instance.release();
    resumeCurrent(oldInstance);
  }
}
org.glassfish.jersey.process.internalRequestScopesetCurrent

Popular methods of RequestScope

  • current
  • referenceCurrent
    Get a new reference for to currently running request scope instance. This call prevents automatic Re
  • runInScope
    Runs the org.glassfish.jersey.internal.util.Producer in the request scope initialized from the Reque
  • retrieveCurrent
  • <init>
  • activate
    Stores the provided RequestContext to thread-local variable belonging to current request scope.
  • createContext
    Creates a new instance of the RequestContext. This instance can be then used to run task in the requ
  • release
    Releases the provided RequestContext to thread-local variable belonging to current request scope.
  • resume
    Resumes the provided RequestContext to thread-local variable belonging to current request scope.
  • createInstance
    Creates a new instance of the RequestScope.Instance. This instance can be then used to run task in t
  • isActive
  • resumeCurrent
  • isActive,
  • resumeCurrent,
  • shutdown,
  • suspend

Popular in Java

  • Running tasks concurrently on multiple threads
  • onRequestPermissionsResult (Fragment)
  • getContentResolver (Context)
  • setScale (BigDecimal)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now