what you can do with createDynamicProxy.
Where you did fail is to make the environment of the birthplace available to the component. Like i already did point out has a lot of open question, in my opinion it makes sense to make the application context available (when it still exists), where i have given you a easy workaround
index.cfm
jRunnable = createDynamicProxy( new Runnable(), [ 'java.lang.Runnable' ] );
t = createObject( 'java', 'java.lang.Thread' ).init( jRunnable );
t.start();
Runnable.cfc
component accessors="true" {
public function init() {
variables.ac=getPageContext().getApplicationContext();
}
function run() {
getPageContext().setApplicationContext(variables.ac);
systemOutput( 'Thread has run.',1,1);
systemOutput( getApplicationMetadata(),1,1);
systemOutput( url ,1,1);
}
}
but making the user enviroment data available (session,client scope) is much more in question, in theory that Proxy class can be executed long after the users session did end.
Also the context (stacktrace) not necessary is still available.
So again, you need to be more clear what you are expecting what is not working ATM.
Like i also set we can simplify all of the by providing a function createRunnable
.