Skip to content

JavaLoader.create Creation of Multiple Instances (initUseJavaProxyCFC) #10

@de-robat

Description

@de-robat

I found the behaviour of the JavaLoader a bit missleading whenever coldfusion ist setted to "Disable access to internal ColdFusion Java components" via the CF-Administrator. In those cases the JavaLoader switches the underlying loading procedures to use a different JavaProxy Implementation in the "initUseJavaProxyCFC" function beeing written in JavaLoader.cfc . The weird thing here is that by using the Proxy from coldfusion "coldfusion.runtime.java.JavaProxy" the init() function calls to java proxys work differently than the once beeing issued over JavaProxy.cfc Component.

Usually a call of init() on an JavaProxy leads to the invocation of a constructur and thus result in the return of a new instance. However when the JavaProxy.cfc component is used subsequent init calls lead to the return of one and the same Instance all over again.
This is due to:

//make sure we only ever have one instance
if(_hasClassInstance())
{
    return _getClassInstance();
}

The bad thing about that is that you can't rely on the functionality and always have to code for the case where no new Instances are created. Is there a reason why the JavaProxy Component is behaving differently and if yes than please indicate that in the "hint" attribute of the:

<cffunction 
    name="init" 
    hint="create an instance of this object"
    access="public" 
    returntype="any" 
    output="false" >

description.
Besides that flaw wich cost me quite some time today i love the JavaLoader! Its really great and much appreciated. Thank you very much.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions