Implementing SingleThradModel interface and synchronizing service

Hi all,
I came across the one question.
What is difference between the implementing SingleThradModel interface and synchronizing service method in the Servlet?
Which one is the better one? and why?
It seems to be same for me... but still confused?
Please explain me.
Thanks,
Rahul

No one is better. Just write threadsafe code. E.g. do not declare instance variables which are to be used per request. Just keep in mind that only one instance of the Servlet will be created which lives as long as the webapplication runs and that it will be reused among all requests. Keep request scoped variables inside the method block and you're safe.

Similar Messages

  • Difference between Asynchronous and synchronous service (BPMN Process).

    When we create new BPM process jdeveloper gives 4 options including Asy and synchronous service.
    i want to know how they differ logically because both templates look same!!!!

    In an Async process the start node is exposed as 'one way', so if you see the wsdl for this (port type section) , you will see only inputs and not outputs. This means the  caller doesn't wait for the process to end. In a Sync process, the web service interface to the start node is 'two way', request/response....so you will see both and input and output in the port type section. the caller will wait for the response from the process.

  • Implements an interface and "return"

    I was implement an interface about Element, I had declear all of the methods of ELement and its superclass Node. Then it ask for return statement for everymethod.
    actually, I only need some of the method, so what can I return for the empty method body. and for the methods I wanted, even I dont have any further programming for those methods, like "boolean hasAttrubute(String value), it still remian as an empty methods, what can I return for those?

    Like I said before if some of the methods do not apply
    in the subclass, you still have to provide meaningful
    implementations for them. The proper thing to do is to
    throw an UnsupportedOperationException.If this is an implementation of the DOM Element, doing that will get you nowhere fast.

  • Payload from Two diff Outbound interfaces and Business Service

    Hi All:
    I created a scenario....where messge is coming from two diff outbound message interface..and have only one inbound inteface...
    Message_One is coming from one OA interface.
    Message_Two is coming from other OA interface.
    I am using only one Inbound interface...
    Message Mapping
    Source Message:
    MessageOne
    MessageTwo
    Target Message:
    Message.
    Now for this I cretaed one IP
    <b>Fork</b> (two receive steps..for message one and mesage two)
    <b>Transformation</b> (Interface Mapping between (Message one, Message Two) and Message
    <b>Send.</b>
    Here is the source from the Test Tab of the IR tool.
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
       <ns0:Message1>
          <ns1:MT_Message_One xmlns:ns1="http://t-systems.com/XI/Demo/BPM">
             <CutomerName>Gillette</CutomerName>
             <CutomerID>AA123</CutomerID>
             <ProductName>PN</ProductName>
             <ProductID>1234</ProductID>
          </ns1:MT_Message_One>
       </ns0:Message1>
       <ns0:Message2>
          <ns1:MT_Message_Two xmlns:ns1="http://t-systems.com/XI/Demo/BPM">
             <ProductCost/>
             <ProductManufaturingDate/>
             <ProductExpDate/>
             <ProductID/>
          </ns1:MT_Message_Two>
       </ns0:Message2>
    </ns0:Messages>
    Now below information is coming from first File
           <CutomerName>Gillette</CutomerName>
             <CutomerID>AA123</CutomerID>
             <ProductName>PN</ProductName>
             <ProductID>1234</ProductID>
    This infromation is coming from second file
             <ProductCost/>
             <ProductManufaturingDate/>
             <ProductExpDate/>
             <ProductID/>
    Question how my input message looks for both??
    I am using HTTP client to send the two diff message from two diff Business Service to same BPM.
    Is it like
    <b> <ns1:MT_Message_One xmlns:ns1="http://t-systems.com/XI/Demo/BPM">
             <CutomerName>Gillette</CutomerName>
             <CutomerID>AA123</CutomerID>
             <ProductName>PN</ProductName>
             <ProductID>1234</ProductID>
          </ns1:MT_Message_One></b>
    <b>      <ns1:MT_Message_Two xmlns:ns1="http://t-systems.com/XI/Demo/BPM">
             <ProductCost/>
             <ProductManufaturingDate/>
             <ProductExpDate/>
             <ProductID/>
          </ns1:MT_Message_Two>
       </ns0:Message2></b>
    Thanks & Regards,
    Farooq Farooqui

    Yes now I achived it...
    It like the same as I mentioned
    <ns1:MT_Message_One xmlns:ns1="http://t-systems.com/XI/Demo/BPM">
    <CutomerName>Gillette</CutomerName>
    <CutomerID>AA123</CutomerID>
    <ProductName>PN</ProductName>
    <ProductID>1234</ProductID>
    </ns1:MT_Message_One>
    <ns1:MT_Message_Two xmlns:ns1="http://t-systems.com/XI/Demo/BPM">
    <ProductCost/>
    <ProductManufaturingDate/>
    <ProductExpDate/>
    <ProductID/>
    </ns1:MT_Message_Two>
    </ns0:Message2>

  • How to find out in program which all classes have implemented an interface

    Hello,
    I have created an interface and few classes are implementing the interface.
    I want to know in a program which all class have implemented the interface.
    Is it possible to find it out and how?
    Regards,
    Bikash.

    Hi Bikash,
    Read the Database view VSEOIMPLEM with where condition REFCLSNAME = Interface Name and version = 1.
    This would give you all the classes which have implemented the interface and are active...
    If you want to look at the values that the field version can have then see Type Group SEOC ans search for version....
    Hope this help...
    Regards,
    Sitakant

  • Interfaces and methods with complex object

    In all the examples I have, the methods of an interface use only basic java datatypes (int, Character, ..)
    I want to pass a Vector that represents a list of objects from one of my own classes to an interface method.
    class Myclass ...
    private String p1;
    private int p2;
    myInterfaceMethod(..., Vector list, ...)
    // list is a vector of Myclass objects
    How do I know about Myclass when implementing the interface and how do I access p1 and p2 ?

    You can use any kind of "complex" object in your interface methods, all of them are objects at last.
    The other question seems to be a misunderstanding of interface implementation. When u "implement" an interface in a class, all that JVM does is to check that you actualy have one method (with code inside its body) for each method you defined previously in the interface.
    Think of an interface as a contract signed by a class. It's forced to implement each method definied in you interface. So, as the method is defined inside the class, you can access any data member of the class without doing anything "special". Do u catch it?

  • Implementing Basecommand interface

    hi all,
    i have created a GUI using swing which i want to evoke as a button in ARC map ,but for that i have to implement basecommand interface and use my code there , but iam not getting it how to do that so can any one give me a code snippet or a description soas to how that can be achieved...
    thanks in advance

    Sorry, but there is no BaseCommand interface in the API.
    And what don't you know? What a baseCommand is supposed to do? Neither do I, but if it exists somewhere, it's likely to have a documentation that tells you. Or don't you kno who wto implement interfaces? Then read the tutorial.

  • Must implement specifik interface

    Hi,
    Im creating a game to force myshelf to code a game-engine, just for fun. In this game I have superclass for a basic unit. This class gets subclassed down to game-units. I have different type of game units, some more advanced than others (my game idea is like a manager game where choose between units similar to warcraft 3 units).
    To help the game-engine separate between the different type of units and the methods that can be used on them, I want to use differtent interface for the advanced units. This could be the start of the Wizard-class:
    public class Wizards extends BasicUnit implements SpellCaster {
    // method and variables that are specific for a wizard and dont excist in BasicUnit
    }Question is: How can I force a method in the game-enginge class to look if a used unit implements a certain interface, in this case the SpellCaster-interface?
    I know it should be possible, like the Comparable Interface. But how do i do it?
    If its a dumb question a link to the specifik documents would do, I read it myshelf. But of course I would be happy if someone have the kindness to write an example. Again, this aint homework, just a fun x-mas project for me.

    Ani_Skywalker wrote:
    Hi again Jverd,
    I google [visitor pattern|http://en.wikipedia.org/wiki/Visitor_pattern] and through that I also find [virtual function|http://en.wikipedia.org/wiki/Virtual_functions] . I can see how its usefull in this issue.
    Thought my main concern for the moment is about [composition over inheritance|http://blogs.msdn.com/steverowe/archive/2008/04/28/prefer-composition-over-inheritance.aspxI]. This is not what we learned in school when I took my first and second java courses. But I think the composition over inheritance strategy seems very sensible.
    jverd wrote:
    I don't really know your whole picture, but one option is to define a type that has those particular operations in common, and pass that type around when that's what you need. The subclasses could inherit from a base class that provides those, or implement an interface, and then add their own methods.But this is exactly what my class BasicUnit does. Maybe my english is bad and I misslead you, or maybe I should pick a better name for that class, like Unit. But what it does is to hold methods that every unit in the game use. Subclasses that need more methods adds that. The way you wrote your example is kind of how I've done it, as it seems to me. Could you tell me were you think I do wrong?It may have just been a misunderstanding on my part, as I don't know you and I don't know your requirements or the details of how you're implementing them.
    Or it may be that you're kind of close to doing it correctly, but not quite. The situation I described as a good approach can look a lot like the not-so-good way I thought you were doing it. I'm kind of sleep-deprived right now, so I don't have the energy or brainpower to go into any more detail at the moment.
    Good luck though. I expect somebody will continue helping you if you keep working at it.

  • Interfaces and final variables

    So I understand that I am not supposed to put my final variables or constants into an interface, but then where?
    I have 2 classes that implement an interface, and they both allow listerners to be added to them, through that interface. They both fire property events on the listener with the same property. Currently I just put the property id constants into one class and reference it from the other. But it appears to me the best place for the definition of these common properties is in the interface!?

    So If you read over all the postings, you'll know exactly why they say, never to create classes for the purpose of grouping constants, it is confusing.
    More explicitly, it is lazy. The reason you are grouping the constants has nothing to do with the relationship between the constants and their use within the program, you are grouping them because you are tired of typing a long declaration everytime you want to use them within the program. So, the overall design of your program is being warped by design decisions that are based on laziness.
    The reason people put them in interfaces, "public interface Globals...", is so that importing that namespace through inheritance doesn't suck up that "valuable" superclass (which I will have to remember to rant about on some other thread). It is probably the case that the most efficient way to do this is to use static getters: getPI(), getOrigin(), getNewYears(), whatever. You will see an awful lot of constants that have been replaced over the years with getters. As the code matures, it isn't peculiar to see the flexibility of the programme being reduced or impeded by the constraints and constants implicit in the codesbase.
    Andrew

  • How an array implements an interface?

    Section 5.5 of JLS (dealing with casting conversions) explains something like this:
    When an interface type S is cast to an array type T,
    "then T must implement S, or a compile-time error occurs. "
    I could not understand how an array can be made to implement an interface.
    I guessed it means that the component type of array implements the interface, and prepared the following test code. It doesn't compile.
    interface S{  }
    class C implements S{ }
    class Test {
    public static void main(String[] args) {
         C[] ac = new C[100];
         S s = new C();
         C[] ac1 = (C[])s; //doesn't compile
         System.out.println(ac1.length);
    Would someone open my eyes? Thank you

    dmbdmb Your correction compiled my code. But I was not looking for that, because the corrected code casts an array type to array type. Anyway, thanks.
    jverdYou are the man. Now I got it. Thank you.
    I think I will have to remember your simplified rule (Then S must be Serializable or Cloneable) rather than the JLS' rule. With your rule, I can write a test code like this, which compiles, and which shows that an interface type can be cast to array type.
    import java.awt.Point;
    import java.io.Serializable;
    class Test {
            public static void main(String[] args) {
               Point[] pa = new Point[100]; //any array of reference type
               Serializable s = new String("test");
               Point[] pa1 = (Point[])s; //compiles, though invalid at runtime
    }

  • Synchronous interface without Service Interface and Mapping

    Hi all,
    Short and simple question: Is it possible to set up a synchronous interface without using Service Interfaces and (Operation and Message) Mapping?
    In my case I would like to create an interface with a SOAP and File adapter.
    Cheers,
    Mac

    Hi Mac,
    >>Short and simple question: Is it possible to set up a synchronous interface without using Service Interfaces and (Operation and Message) Mapping?
    Yes possible provided you have both Sync adapter as sender and receiver. For eg: Soap sender --> PI --> HTTP adapter
    >>In my case I would like to create an interface with a SOAP and File adapter.
    Sync scenario using File adapter as receiver is not possible. Because File adapter works asynchronously.
    Regards
    Suraj

  • How to implement XI interfaces in online and offline modes?

    Hi Everybody,
    Can you please tell me how to implement XI interfaces in online and offline modes?
    thanks a lot,
    Ramya Shenoy.

    Hi,
    Are you looking for Push and Pull mechanism of PI?
    When the adapters like SOAP, HTTP, IDOC, etc. send the data to PI , it is nothing but a push mechanism, and hence the communication is synchronous by default.
    But adapters like JDBC, File, etc. they fetch the data from Source Applications, so it is a kind of Pull mechanism for PI, and
    by default communication is asynchrnous.
    Pls elaborate exactly what are you looking for?
    Regards,
    Supriya.

  • Synchronous Service Interfaces

    Dear All,
    I am getting a some strange issue when transported the Synchronous Service Interface from Dev to Quality system ,the interface automatically has changed to Asynchronous Service interface.
    I saw some issue on Production system also when transported.
    Can you please give me some hints on this?
    Thank you very much.
    Best Regards,
    Sateesh

    Hi Sateesh,
    I can say activated object cache may be having asynchronous interface. When you transported that object might have transported to Qal and Prod.
    Lets see other experts comments who has faced this kind problem.
    Regards,
    Krupa

  • How can my web service class implement an interface

    I am not able to write :
    webserviceclass implements interface
    I am using servicegen script to convert java file to the web service.But then also,if i add
    javaClassComponents="javaclass1,interface1"
    It is saying interface1 does not have any no arg constructor,so can't used in the web service.
    kindly tell how can i code my web service to implement an interface.

    This forum focuses on end-user support. You can find more web development help on the [http://forums.mozillazine.org/viewforum.php?f=25 mozillaZine Web Development board]. Separate forum, separate registration. Please note the tips in the Sticky Post at the top of the forum before posting.
    That said... Firefox honors the setting autocomplete="off" in the form tag. When this attribute is set, users should not be prompted to save the username/password, and it should not be filled automatically. (Is this what wasn't working??)
    https://developer.mozilla.org/en/How_to_Turn_Off_Form_Autocompletion
    Knowledgeable users can bypass this setting by running a script to strip this attribute. I doubt that very many users would do that, but if people have to log in very frequently, it is more likely to happen. Users also may use add-ons that manage passwords, and those add-ons might not honor the autcomplete="off" setting. I haven't used any such add-ons, so I don't know the situation there.
    I'm sure this isn't completely satisfactory but hopefully it helps to some extent.

  • Concrete classes implement abstract class and implements the interface

    I have one query..
    In java collection framework, concrete classes extend the abstract classes and implement the interface. What is the reason behind extending the class and implementing the interface when the abstract class actually claims to implement that interface?
    For example :
    Class Vector extends AbstractList and implements List ,....
    But the abstract class AbstractList implements List.. So the class Vector need not explicitly implement interface List.
    So, what is the reason behind this explicit definition...?
    If anybody knows please let me know..
    Thanx
    Rajendra.

    Why do you post this question again? You already asked this once in another thread and it has been extensively debated in that thread: http://forum.java.sun.com/thread.jsp?forum=31&thread=347682

Maybe you are looking for