title: Java Reflection permission error
body: <p>I'm trying to load a class via an URLClassLoader (well, it neither works with an normal class loader) and want them to not have any permission.</p>
  
  <p>Therefore, i created my own security manager, which genereates a key on startup, which can only by requested once (in main thread). 
  The security manager has 2 lists, the applicationThread, which will be granted any right and the temporaryList, which will be granted one right just once (it's about the reflection).</p>
  
  <p>As it is very hard to descripe, i decided to upload the whole thing: <em>look at the link below</em></p>
  
  <p>Ok, coming back: I created a WatchDog thread, which checks if the thread doesn't take too much time.</p>
  
  <p>When i now start to instance two classes from an URLClassLoader, I call exactly 30 methods without getting any errors, but on the 31st call, it tries to check Permissions for the following  but this is just happaning after the 30th call.</p>
  
  <pre>
  java.lang.RuntimePermission accessClassInPackage.sun.reflect),
  </pre>
  
  <p>Does anyone know what's going on there?</p>
  
  <p>edit:
  I had time to strip down the example. 
  <a href="http://myxcode.at/securitymanager.zip" rel="nofollow">http://myxcode.at/securitymanager.zip</a>
  I found out, that the SecurityManager is not asked synchronous. Just run this small piece of code and have a look at the red lines.</p>
  
  <p>If the red lines come in the very first line, just run the program again, you will find out that it seems a little bit uncontrolled. </p>
  
  <p>The problem more or less is, that i need the security manager to be synchronized.
  Here is my output for those who cannot face the error(bug?)
  <a href="http://pastebin.com/E9yLRLif" rel="nofollow">http://pastebin.com/E9yLRLif</a></p>
  
  <p>edit2: maybe its about the console? maybe the console is too slow?</p>