You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shiro.apache.org by fp...@apache.org on 2020/07/02 06:18:36 UTC
[shiro-site] branch master updated: Fix Subject.associateWith()
examples
This is an automated email from the ASF dual-hosted git repository.
fpapon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shiro-site.git
The following commit(s) were added to refs/heads/master by this push:
new a21895e Fix Subject.associateWith() examples
new 39ad934 Merge pull request #62 from mpfz0r/patch-1
a21895e is described below
commit a21895ed044be98c6421f4573f1890554d1e1186
Author: Marco Pfatschbacher <ma...@graylog.com>
AuthorDate: Wed Jul 1 19:23:05 2020 +0200
Fix Subject.associateWith() examples
---
subject.md.vtl | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/subject.md.vtl b/subject.md.vtl
index 6a03ceb..3bbbdc0 100644
--- a/subject.md.vtl
+++ b/subject.md.vtl
@@ -301,7 +301,7 @@ Subject subject = new Subject.Builder()...
Callable work = //build/acquire a Callable instance.
//associate the work with the built subject so SecurityUtils.getSubject() calls works properly:
work = subject.associateWith(work);
-ExecutorService executorService = new java.util.concurrent.Executors.newCachedThreadPool();
+ExecutorService executor = java.util.concurrent.Executors.newCachedThreadPool();
//execute the work on a different thread as the built Subject:
executor.execute(work);
```
@@ -313,8 +313,9 @@ Subject subject = new Subject.Builder()...
Runnable work = //build/acquire a Runnable instance.
//associate the work with the built subject so SecurityUtils.getSubject() calls works properly:
work = subject.associateWith(work);
-Executor executor = new java.util.concurrent.Executors.newCachedThreadPool();
-//execute the work on a different thread as the built Subject: executor.execute(work);
+ExecutorService executor = java.util.concurrent.Executors.newCachedThreadPool();
+//execute the work on a different thread as the built Subject:
+executor.execute(work);
```
#tip('Automatic Cleanup', 'The <code>associateWith</code>* methods perform necessary thread cleanup automatically to ensure threads remain clean in a pooled environment.')