-1

I have found that to this method passed

  PrivilegedExceptionAction

This object has method run(). Does it mean that will be created separate thread for executing? Please part of code that create this thread if yes. I didn't find it.

Mooseman
  • 18,763
  • 14
  • 70
  • 93
user710818
  • 23,228
  • 58
  • 149
  • 207

2 Answers2

1

I think maybe this is your answer from SCJP Book:

The overloaded run(String s) method will be ignored by the Thread class unless you call it yourself. The Thread class expects a run() method with no arguments, and it will execute this method for you in a separate call stack after the thread has been started. With a run(String s) method, the Thread class won't call the method for you, and even if you call the method directly yourself, execution won't happen in a new thread of execution with a separate call stack. It will just happen in the same call stack as the code that you made the call from, just like any other normal method call.

0

No, Subject.doAs runs code in the same thread, just with given subject.

Honza
  • 974
  • 10
  • 18