homeservicesportfoliocontactwebsite design tutorials
 

 

 
 

To the index

ColdFusion MX

  • Do we still need to use cflock in ColdFusion MX?
  • Why is CFMX so slow the first time a page is run?
  • What happened to the old tags in CFMX?
  • Beginner

    Do we still need to use cflock in ColdFusion MX?

    CFMX does not require locking the way CF5 did. In CFMX, if you don't lock shared scope access update, the server will not crash.

    All you have to worry about in CFMX is race conditions; where two threads of code might access or update the same variable at the same time and cause a conflict. To avoid that, use a named lock (not a scoped lock).

    Read Sean Corfield's blog for more information on locking in CFMX.

    to question

    Why is CFMX so slow the first time a page is run?

    That's the way it is and always is going to be with Java. You'll just have to get used to it.

    What you're running into is what's called the JIT - the Just-In-Time compiler. In say a C++ or Visual Basic or even Fortran or Cobol you compile the source code into machine language specific for a certain platform once, and then never bother with it again (upgrades not with-standing.)

    Java's different. Since it's supposed to run on any platform it's not compiled til it's first called. Thats' what that 20 second delay is -- your java source code is being *compiled* for the platform it's currently running on. After that's done once it'll run more or less at the same speed as say the original C++ version of CF. But anytime you make a change to any .CFM you're going to take a hit as the CF is converted into java and the Java's compiled.

    While you're developing you're just going to have to learn to live with this, Sorry. But it's not so much of a problem on a production machine fortunately.

    to question

    Advanced

    What happened to the old tags in CFMX?

    A few of the tags that used to be 'native' tags are now just cfm templates in the cfusionMX\wwwroot\cftags directory. If you have a cfoutput wrapped around any of those you will run into the same problem.

    As a side note, you can create your own 'native' cf tags by dropping cf templates into that directory.

    For example, if you created a file called directorysearch.cfm and put it in there, you could use <cfdirectorysearch> as a tag call.

    to question