Skip to main content

[JAVA2D] thread priority exception

2 replies [Last post]
Anonymous

ok, I have a regular applet embedded into a html file..I run that file
throught he appletviewer with the command: "appletviewer applet.html"

everything works fine except for when I terminate the program I get an
exception about the thread:
"java.security.AccessControlException: access denied
(java.lang.RuntimePermissionmodifyThread)"

I get this because in my run() method I have the following
line: "Thread.currentThread().setPriority(Thread.MAX_PRIORITY);"

I do have a line where I set the MIN_PRIORITY flag too, but I don't get an
exception for that one...

what could be wrong??

Thanx

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
hockey_dave
Offline
Joined: 2006-02-17

I'm getting the same error occassionally when I try to set my applet's thread name in my applet's init() method.

private String threadName=null;

threadName="george";
Thread.currentThread.setName(threadName);

java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThread)

at java.security.AccessControlContext.checkPermission(Unknown Source)

at java.security.AccessController.checkPermission(Unknown Source)

at java.lang.SecurityManager.checkPermission(Unknown Source)

at sun.applet.AppletSecurity.checkAccess(Unknown Source)

at java.lang.Thread.checkAccess(Unknown Source)

at java.lang.Thread.setName(Unknown Source)

at com.unicast.adcontroller.players.PlayingAdTracker.a(Unknown Source)

at com.unicast.adcontroller.players.PlayingAdTracker.init(Unknown Source)

at sun.applet.AppletPanel.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

Keith Lea

Applets can't set thread priority without being signed with a security
policy that allows it.

-Keith

Flavius Alecu wrote:
> ok, I have a regular applet embedded into a html file..I run that file
> throught he appletviewer with the command: "appletviewer applet.html"
>
> everything works fine except for when I terminate the program I get an
> exception about the thread:
> "java.security.AccessControlException: access denied
> (java.lang.RuntimePermissionmodifyThread)"
>
> I get this because in my run() method I have the following
> line: "Thread.currentThread().setPriority(Thread.MAX_PRIORITY);"
>
> I do have a line where I set the MIN_PRIORITY flag too, but I don't get an
> exception for that one...
>
> what could be wrong??
>
> Thanx
>
> ===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the body
> of the message "signoff JAVA2D-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".