org.apache.catalina.Context.unbind()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(136)

本文整理了Java中org.apache.catalina.Context.unbind()方法的一些代码示例,展示了Context.unbind()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Context.unbind()方法的具体详情如下:
包路径:org.apache.catalina.Context
类名称:Context
方法名:unbind

Context.unbind介绍

暂无

代码示例

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

private void unbind(Context context) {
    if (clBindRequired) {
      context.unbind(Globals.IS_SECURITY_ENABLED, MY_CLASSLOADER);
    }
  }
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

private void unbind(Context context) {
    if (clBindRequired) {
      context.unbind(Globals.IS_SECURITY_ENABLED, MY_CLASSLOADER);
    }
  }
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

@Override
  public void run() {
    ClassLoader oldCL = context.bind(Globals.IS_SECURITY_ENABLED, null);
    try {
      wrapped.run();
    } finally {
      context.unbind(Globals.IS_SECURITY_ENABLED, oldCL);
    }
    // Since this runnable is not executing as a result of a socket
    // event, we need to ensure that any registered dispatches are
    // executed.
    coyoteRequest.action(ActionCode.DISPATCH_EXECUTE, null);
  }
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

@Override
  public void run() {
    ClassLoader oldCL = context.bind(Globals.IS_SECURITY_ENABLED, null);
    try {
      wrapped.run();
    } finally {
      context.unbind(Globals.IS_SECURITY_ENABLED, oldCL);
    }
    // Since this runnable is not executing as a result of a socket
    // event, we need to ensure that any registered dispatches are
    // executed.
    coyoteRequest.action(ActionCode.DISPATCH_EXECUTE, null);
  }
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

@Override
public void fireOnComplete() {
  List<AsyncListenerWrapper> listenersCopy = new ArrayList<>();
  listenersCopy.addAll(listeners);
  ClassLoader oldCL = context.bind(Globals.IS_SECURITY_ENABLED, null);
  try {
    for (AsyncListenerWrapper listener : listenersCopy) {
      try {
        listener.fireOnComplete(event);
      } catch (Throwable t) {
        ExceptionUtils.handleThrowable(t);
        log.warn("onComplete() failed for listener of type [" +
            listener.getClass().getName() + "]", t);
      }
    }
  } finally {
    context.fireRequestDestroyEvent(request.getRequest());
    clearServletRequestResponse();
    context.unbind(Globals.IS_SECURITY_ENABLED, oldCL);
  }
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

public boolean timeout() {
  AtomicBoolean result = new AtomicBoolean();
  request.getCoyoteRequest().action(ActionCode.ASYNC_TIMEOUT, result);
  // Avoids NPEs during shutdown. A call to recycle will null this field.
  Context context = this.context;
  if (result.get()) {
    ClassLoader oldCL = context.bind(false, null);
    try {
      List<AsyncListenerWrapper> listenersCopy = new ArrayList<>();
      listenersCopy.addAll(listeners);
      for (AsyncListenerWrapper listener : listenersCopy) {
        try {
          listener.fireOnTimeout(event);
        } catch (Throwable t) {
          ExceptionUtils.handleThrowable(t);
          log.warn("onTimeout() failed for listener of type [" +
              listener.getClass().getName() + "]", t);
        }
      }
      request.getCoyoteRequest().action(
          ActionCode.ASYNC_IS_TIMINGOUT, result);
    } finally {
      context.unbind(false, oldCL);
    }
  }
  return !result.get();
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

public boolean timeout() {
  AtomicBoolean result = new AtomicBoolean();
  request.getCoyoteRequest().action(ActionCode.ASYNC_TIMEOUT, result);
  // Avoids NPEs during shutdown. A call to recycle will null this field.
  Context context = this.context;
  if (result.get()) {
    ClassLoader oldCL = context.bind(false, null);
    try {
      List<AsyncListenerWrapper> listenersCopy = new ArrayList<>();
      listenersCopy.addAll(listeners);
      for (AsyncListenerWrapper listener : listenersCopy) {
        try {
          listener.fireOnTimeout(event);
        } catch (Throwable t) {
          ExceptionUtils.handleThrowable(t);
          log.warn(sm.getString("asyncContextImpl.onTimeoutError",
              listener.getClass().getName()), t);
        }
      }
      request.getCoyoteRequest().action(
          ActionCode.ASYNC_IS_TIMINGOUT, result);
    } finally {
      context.unbind(false, oldCL);
    }
  }
  return !result.get();
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

@Override
public void fireOnComplete() {
  List<AsyncListenerWrapper> listenersCopy = new ArrayList<>();
  listenersCopy.addAll(listeners);
  ClassLoader oldCL = context.bind(Globals.IS_SECURITY_ENABLED, null);
  try {
    for (AsyncListenerWrapper listener : listenersCopy) {
      try {
        listener.fireOnComplete(event);
      } catch (Throwable t) {
        ExceptionUtils.handleThrowable(t);
        log.warn(sm.getString("asyncContextImpl.onCompleteError",
            listener.getClass().getName()), t);
      }
    }
  } finally {
    context.fireRequestDestroyEvent(request.getRequest());
    clearServletRequestResponse();
    context.unbind(Globals.IS_SECURITY_ENABLED, oldCL);
  }
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

} finally {
  if (localDataSource) {
    context.unbind(Globals.IS_SECURITY_ENABLED, oldThreadContextCL);

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

} finally {
  if (localDataSource) {
    context.unbind(Globals.IS_SECURITY_ENABLED, oldThreadContextCL);

代码示例来源:origin: pivotalsoftware/session-managers

} finally {
  closeQuietly(in, bytes);
  context.unbind(Globals.IS_SECURITY_ENABLED, oldThreadContextCL);

代码示例来源:origin: com.gopivotal.manager/common

} finally {
  closeQuietly(in, bytes);
  context.unbind(Globals.IS_SECURITY_ENABLED, oldThreadContextCL);

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

context.unbind(Globals.IS_SECURITY_ENABLED, oldThreadContextCL);

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

context.unbind(Globals.IS_SECURITY_ENABLED, oldThreadContextCL);

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

close(dbConnection);
} finally {
  context.unbind(Globals.IS_SECURITY_ENABLED, oldThreadContextCL);
  release(_conn);

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

close(dbConnection);
} finally {
  context.unbind(Globals.IS_SECURITY_ENABLED, oldThreadContextCL);
  release(_conn);

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

protected void processChildren(Container container) {
    ClassLoader originalClassLoader = null;
    try {
      if (container instanceof Context) {
        Loader loader = ((Context) container).getLoader();
        // Loader will be null for FailedContext instances
        if (loader == null) {
          return;
        }
        // Ensure background processing for Contexts and Wrappers
        // is performed under the web app's class loader
        originalClassLoader = ((Context) container).bind(false, null);
      }
      container.backgroundProcess();
      Container[] children = container.findChildren();
      for (int i = 0; i < children.length; i++) {
        if (children[i].getBackgroundProcessorDelay() <= 0) {
          processChildren(children[i]);
        }
      }
    } catch (Throwable t) {
      ExceptionUtils.handleThrowable(t);
      log.error("Exception invoking periodic operation: ", t);
    } finally {
      if (container instanceof Context) {
        ((Context) container).unbind(false, originalClassLoader);
      }
    }
  }
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

protected void processChildren(Container container) {
    ClassLoader originalClassLoader = null;
    try {
      if (container instanceof Context) {
        Loader loader = ((Context) container).getLoader();
        // Loader will be null for FailedContext instances
        if (loader == null) {
          return;
        }
        // Ensure background processing for Contexts and Wrappers
        // is performed under the web app's class loader
        originalClassLoader = ((Context) container).bind(false, null);
      }
      container.backgroundProcess();
      Container[] children = container.findChildren();
      for (int i = 0; i < children.length; i++) {
        if (children[i].getBackgroundProcessorDelay() <= 0) {
          processChildren(children[i]);
        }
      }
    } catch (Throwable t) {
      ExceptionUtils.handleThrowable(t);
      log.error(sm.getString("containerBase.backgroundProcess.error"), t);
    } finally {
      if (container instanceof Context) {
        ((Context) container).unbind(false, originalClassLoader);
      }
    }
  }
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

context.unbind(Globals.IS_SECURITY_ENABLED, MY_CLASSLOADER);

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

context.unbind(Globals.IS_SECURITY_ENABLED, MY_CLASSLOADER);

相关文章

微信公众号

最新文章

更多

Context类方法