如何修改WebLogic 中关于ThreadLocal的属性值EagerThreadLocalCleanup

EagerThreadLocalCleanup

Specifies whether to clean up all ThreadLocals storage from self-tuning thread pool threads after they have finished processing each work request. By default, the self-tuning thread pool only cleans up ThreadLocal storage in its threads after an application is undeployed to avoid ClassLoader memory leak.

Available Since

Release 12.2.1.0.0

Privileges

Read/Write

Type

boolean

eagerThreadLocalCleanup属性指定在它们完成处理每个工作请求之后是否从自调整线程池中清除所有ThreadLocal存储。

默认情况下,该eagerThreadLocalCleanup属性设置为false,其中自调整线程池仅在线程返回备用池时以及取消部署应用程序后才清理ThreadLocal存储。

将eagerThreadLocalCleanup属性设置为true可以确保在为新请求运行工作时,所有线程池线程都没有先前请求的剩余ThreadLocal值。但是,开销是由于在每个工作请求之后清理ThreadLocal存储,然后为每个新请求重新建立ThreadLocal值而产生的。由于某些应用程序会在ThreadLocal存储中缓存创建对象的开销很大,因此在每个请求之后清理ThreadLocal值可能会对这些应用程序的性能产生负面影响。

具体修改步骤:

[weblogic@goya ~]$ cd Oracle/Middleware/Oracle_Home/oracle_common/common/bin/

[weblogic@goya bin]$ ./wlst.sh

wls:/offline> connect('weblogic','weblogic123')

Connecting to t3://localhost:7001 with userid weblogic ...

Successfully connected to Admin Server "AdminServer" that belongs to domain "base_domain".

Warning: An insecure protocol was used to connect to the server.

To ensure on-the-wire security, the SSL port or Admin port should be used instead.

wls:/base_domain/serverConfig/> find('threadlocal')

Finding "threadlocal" in all registered MBean instances ...

/Servers/AdminServer                           EagerThreadLocalCleanup                            false

/Servers/Server1                               EagerThreadLocalCleanup                            false

/Servers/Server2                               EagerThreadLocalCleanup                            false

wls:/base_domain/serverConfig/> edit()

Location changed to edit tree.   

This is a writable tree with DomainMBean as the root.    

To make changes you will need to start an edit session via startEdit().

For more help, use help('edit').

wls:/base_domain/edit/> startEdit()

Starting an edit session ...

Started edit session, be sure to save and activate your changes once you are done.

wls:/base_domain/edit/ !> cd('/Servers/AdminServer')

wls:/base_domain/edit/Servers/AdminServer !> cmo.setEagerThreadLocalCleanup(true)

wls:/base_domain/edit/Servers/AdminServer !> save()

Saving all your changes ...

Saved all your changes successfully.

wls:/base_domain/edit/Servers/AdminServer !> validate()

Validating changes ...

Validated the changes successfully

wls:/base_domain/edit/Servers/AdminServer !> showChanges()

All changes that are made but not yet activated are:

MBean Changed : com.bea:Name=AdminServer,Type=Server

Operation Invoked : modify

Attribute Modified : EagerThreadLocalCleanup

Attributes Old Value : false

Attributes New Value : true

Server Restart Required : true

wls:/base_domain/edit/Servers/AdminServer !> activate()

Activating all your changes, this may take a while ...

The edit lock associated with this edit session is released once the activation is completed.

The following non-dynamic attribute(s) have been changed on MBeans

that require server re-start:

MBean Changed : com.bea:Name=AdminServer,Type=Server

Attributes changed : EagerThreadLocalCleanup

Activation completed

wls:/base_domain/edit/Servers/AdminServer> ls()

dr--   COM

......

-r--   DynamicallyCreated                           false

-rw-   EagerThreadLocalCleanup                      true

-rw-   ExternalDNSName                              null

-rw-   ExtraEjbcOptions                             null

-rw-   ExtraRmicOptions                             null

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yangkei

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值