IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  FilecreateTempFile behaving differently in webMethods

    Posted Fri December 16, 2005 10:26 AM

    I am creating temporary files using following Java code.

    File tmp = File.createTempFile(“ORD” , “.tmp”, new File(“/home/adubey”));

    When I put this code in a Java file, compile and run it, then its generating temporary files with name “ORD#####.tmp”, where “#####” is a randomly generated number.

    However, if I am creating a Java Service in webMethods and using same java code for temporary file generation, then the value of “#####” is always sequential. After every execution the “#####” value is getting an increment of one.

    Are there any properties or settings available in webMethods which is a reason for this sequential temporary file generation, and where is this sequence number being persisted?

    Thanks
    Amrendra


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 2.  RE: FilecreateTempFile behaving differently in webMethods

    Posted Sat December 17, 2005 02:09 AM

    webMethods is a company, not a product. A point that I will keep hammering until everyone gets it :slight_smile:

    Which product are you talking about? I assume Integration Server.

    Just a guess here, but because pre-Java 2 didn’t have createTempFile there were some implementations out there that provided similar functionality. You might be picking up a different File class than expected in IS. You might try specifying the fully-qualified class name of java.io.File to see if that makes a difference.


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 3.  RE: FilecreateTempFile behaving differently in webMethods

    Posted Mon December 19, 2005 04:27 AM

    I have created a java service in webMethods Developer, which is generating sequential temp file names.
    But the same code written as Java class outside webMethods Developer is generating random file names.

    I tried specifying fully qualified class name (both the places, java file and java service) of java.io.File, but no change in output.

    The Java version and vendor of my IS is:
    Java Version: 1.4.2_01 (48.0)
    Java Vendor: Sun Microsystems Inc.

    This behaviour is strange…

    Thanks
    Amrendra


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 4.  RE: FilecreateTempFile behaving differently in webMethods

    Posted Mon December 19, 2005 07:49 PM

    Try creating several temp files within a single run of the stand-alone version. You’ll see the same sequential behavior.

    The reason for this is the use of a random number generator to get the initial value. Each time the JVM is started, a new number is used. After the first one is used, subsequent calls to createTempFile simply increment the number until it finds one that is not used by an existing file (see the source of java.io.File for confirmation).


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 5.  RE: FilecreateTempFile behaving differently in webMethods

    Posted Tue December 20, 2005 05:40 AM

    Thanks a lot Rob. It was a very clear explanation. However it has raised couple of more questions in my mind.

    I tried executing the same java service of webMethods Integration Server from different usernames and from different machines but it was giving the same sequential output. I tried reloading the package as well but result was same. However I am getting a new number if I restart the IS. I would be grateful if I get some comments on my questions:

    1. Does webMethods Integration Server initialize the JVM only once in its life cycle?

    2. What mechanism webMethods Integration Server is following in order to initialize and execute a Java service?

    3. Why webMethods Integration Server is not initializing the JVM on every execution of a Java Service, is there any specific reason for this?

    Thanks
    Amrendra


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 6.  RE: FilecreateTempFile behaving differently in webMethods

    Posted Tue December 20, 2005 04:39 PM
    1. The IS runs within a JVM. There is only one JVM and it runs IS, not the other way around. When you shut down IS, it does some clean up and then the JVM stops.

    2. How it manages things specifically I do not know, but an IS Java service is simply a static method within a class. Without getting into too much detail, when a Java service is to be invoked, IS simply calls the method within the appropriate class.

    3. Because there is only one JVM running, and IS is running within it. IS is a Java application.


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 7.  RE: FilecreateTempFile behaving differently in webMethods

    Posted Wed December 21, 2005 04:11 AM

    Rob,

    Thank you very much for your comments.

    Regards
    Amrendra


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services