- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.sun.grizzly.util.WorkerThread.getAttachment()
方法的一些代码示例,展示了WorkerThread.getAttachment()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WorkerThread.getAttachment()
方法的具体详情如下:
包路径:com.sun.grizzly.util.WorkerThread
类名称:WorkerThread
方法名:getAttachment
[英]Get the current set of attributes (state) associated with this instance. Unlike detach(), this method doesn't clear the WorkerThread attributes.
[中]获取与此实例关联的当前属性集(状态)。与detach()不同,此方法不清除WorkerThread属性。
代码示例来源:origin: com.sun.grizzly/grizzly-http
private static ThreadAttachment obtainThreadAttachment() {
final Thread currentThread = Thread.currentThread();
if (currentThread instanceof WorkerThread) {
return ((WorkerThread) currentThread).getAttachment();
}
return new KeepAliveThreadAttachment();
}
代码示例来源:origin: org.glassfish.external/grizzly-module
private void saveParser(SelectionKey key, ProtocolParser parser) {
WorkerThread workerThread = (WorkerThread) Thread.currentThread();
// Detach the current Thread data.
ThreadAttachment threadAttachment = workerThread.getAttachment();
threadAttachment.setAttribute(ProtocolParser.PARSER, parser);
// Attach it to the SelectionKey so the it can be resumed latter.
key.attach(threadAttachment);
}
代码示例来源:origin: com.sun.grizzly/grizzly-utils
private static ThreadAttachment obtainThreadAttachment() {
final Thread currentThread = Thread.currentThread();
if (currentThread instanceof WorkerThread) {
return ((WorkerThread) currentThread).getAttachment();
}
return new ThreadAttachment();
}
代码示例来源:origin: com.sun.grizzly/grizzly-utils
private static void notifyRemotelyClosed(SelectionKey key) {
if (Thread.currentThread() instanceof WorkerThread) {
ConnectionCloseHandlerNotifier notifier =
(ConnectionCloseHandlerNotifier) ((WorkerThread) Thread.currentThread()).getAttachment().getAttribute("ConnectionCloseHandlerNotifier");
if (notifier != null) {
notifier.notifyRemotlyClose(key);
}
}
}
代码示例来源:origin: com.sun.grizzly/grizzly-http
private KeepAliveThreadAttachment getKeepAliveAttachment() {
final Thread t = Thread.currentThread();
if (t instanceof WorkerThread) {
final WorkerThread workerThread = (WorkerThread) t;
final KeepAliveThreadAttachment threadAttachment =
(KeepAliveThreadAttachment) workerThread.getAttachment();
key.attach(threadAttachment);
return threadAttachment;
}
final Object attachment = key.attachment();
if (attachment != null) {
return (KeepAliveThreadAttachment) attachment;
}
final KeepAliveThreadAttachment threadAttachment = new KeepAliveThreadAttachment();
threadAttachment.associate();
key.attach(threadAttachment);
return threadAttachment;
}
代码示例来源:origin: com.sun.grizzly/grizzly-http-utils
ConnectionCloseHandler cch = (ConnectionCloseHandler)
((WorkerThread)Thread.currentThread())
.getAttachment().getAttribute("ConnectionCloseHandler");
if (cch != null){
cch.remotlyClosed(key);
代码示例来源:origin: com.sun.grizzly/grizzly-http-utils
ConnectionCloseHandler cch = (ConnectionCloseHandler)
((WorkerThread)Thread.currentThread())
.getAttachment().getAttribute("ConnectionCloseHandler");
if (cch != null){
cch.remotlyClosed(key);
代码示例来源:origin: com.sun.grizzly/grizzly-http-utils
ConnectionCloseHandler cch = (ConnectionCloseHandler)
((WorkerThread)Thread.currentThread())
.getAttachment().getAttribute("ConnectionCloseHandler");
if (cch != null){
cch.remotlyClosed(key);
代码示例来源:origin: com.sun.grizzly/grizzly-utils
ConnectionCloseHandlerNotifier notifier = (ConnectionCloseHandlerNotifier)
((WorkerThread)Thread.currentThread())
.getAttachment().getAttribute("ConnectionCloseHandlerNotifier");
if (notifier != null){
notifier.notifyRemotlyClose(key);
代码示例来源:origin: org.glassfish.external/grizzly-module
private void saveSecuredBufferRemainders(SelectionKey selectionKey) {
ThreadAttachment attachment =
(ThreadAttachment) selectionKey.attachment();
WorkerThread workerThread = (WorkerThread) Thread.currentThread();
if (attachment == null || workerThread.getAttachment() != attachment) {
Controller.logger().log(Level.FINE,
"SelectionKey ThreadAttachment is NULL or doesn't " +
"correspond to the current thread, when saving buffers");
return;
}
ByteBuffer inputBB = workerThread.getInputBB();
if (inputBB != null && inputBB.hasRemaining()) {
workerThread.updateAttachment(attachment.getMode() | Mode.INPUT_BB);
} else {
workerThread.updateAttachment(attachment.getMode() &
(Integer.MAX_VALUE ^ Mode.INPUT_BB));
}
ByteBuffer outputBB = workerThread.getOutputBB();
if (outputBB != null && outputBB.hasRemaining()) {
workerThread.updateAttachment(attachment.getMode() | Mode.OUTPUT_BB);
} else {
workerThread.updateAttachment(attachment.getMode() &
(Integer.MAX_VALUE ^ Mode.OUTPUT_BB));
}
}
代码示例来源:origin: org.glassfish.external/grizzly-module
ctx.getSelectionKey().attach(null);
} else {
wt.getAttachment().setTimeout(null);
代码示例来源:origin: org.glassfish.external/grizzly-module
kh.setKey(key);
WorkerThread workerThread = (WorkerThread) Thread.currentThread();
ThreadAttachment attachment = workerThread.getAttachment();
attachment.setMode(Mode.STORE_ALL);
kh.setThreadAttachment(workerThread.detach());
Maven: org.glassfish.grizzly grizzly-websockets 2.3.1
启动 GlassFish 4.1.1 服务器(Grizzly Framework 2.3.23)时,显示以下警告消息:无法初始化实例。类=接口(interface) org.glassfish.gri
下面是启动 Grizzly Http Server 的代码。如果我按任何键,服务器就会停止。有什么办法让它活着。 Jetty 有 join() 方法,不会退出主程序。灰熊中是否也有类似的东西。 pub
我已经搜索了很多,但仍然不明白使用 Grizzly 是否意味着我可以免受这些攻击,或者我应该付出更多努力? 目前,我在程序中所做的唯一一件事就是通过以下代码将资源类(由 @Path 注释 - 我正在使
我正在使用 Jersey Grizzly,并且想要对 Grizzly 实现基本身份验证。我按如下方式创建 grizzly 服务器: ResourceConfig rc = new PackagesRe
有没有办法绑定(bind)grizzly对我的 Java 应用程序是动态的/透明的(可能通过使用 spring)?或者是 Web 容器的 IO 处理部分(例如 Glassfish)? 最佳答案 您的意
我有这个服务器设置和路由代码。 package net.randohinn.neo; import java.io.IOException; import java.text.SimpleDateFo
我已将此示例实现到我的应用程序中: https-clientserver-grizzly 这是来自该链接的 Server.java: public class Server { private
我已经使用 maven 设置了一个独立的 grizzly/jersey 服务器并引用了以下依赖项 org.glassfish.grizzly grizzly-http-server 2.
我正在尝试使用 grizzly 2.3 Web 服务器将 MyHttpHandler 映射到自定义 url,如下所示(应该是 RESTfull url,如 /entity/42/attribute):
我创建了一个 grizzly Web 服务器,从 tomcat 运行我的 Jersey 应用程序,以加快测试速度。 我是一个 grizzly 初学者,但是通过网络我将一些代码行放在一起,以便在不到一个
目前在我的应用程序中,如果我转到 http://localhost:8181/index.htm 它工作得很好,如果我转到 http://localhost:8181 我收到 404 错误。如何让 G
我创建了一个返回 JSON 的 Grizzly 服务器。效果很好: final ResourceConfig resourceConfig = new ResourceConfig().pac
如何关闭 Grizzly 的日志记录? 我想关闭以下日志记录: Okt 18, 2018 8:42:24 AM org.glassfish.grizzly.http.server.NetworkLis
我正在使用带有嵌入式版本的 Grizzly 的 Jersey,我只想在本地主机上绑定(bind)/监听。我正在通过创建调用使用 GrizzlyWebContainerFactory 创建 Thread
我写了下面的测试代码: @Test public void testLeakWithGrizzly() throws Throwable { ExecutorService executor
如何设置或增加连接限制或最大值。我创建的 grizzly HttpServer 中工作线程的池大小: HttpServer server = HttpServer.createSimpleServer
我正在使用 Grizzly HttpServer,它注册了两个 HttpHandler 实例: 在 /api/* 下有一个 Jersey REST 风格的应用程序,提供产品的 API,并且 在 /*
我有一个在嵌入式 Grizzly 上运行的 Jersey 应用程序,其初始化如下: HttpServer httpServer = GrizzlyServerFactory.createHttpSer
本文整理了Java中org.glassfish.grizzly.websockets.WebSocketEngine类的一些代码示例,展示了WebSocketEngine类的具体用法。这些代码示例主要
我是一名优秀的程序员,十分优秀!