Code Comments
Programming Forum and web based access to our favorite programming groups.From my understanding, each enterpirse bean has a single threaded container manage it. If two clients request the same enterprise bean at the same time, then one of them will wait or fail since a single threaded container can only handle one request at a time. Is this true? If not, how can we control the multithreading of container? Thanks, Jing
Post Follow-up to this messagein my option, synchronized thread safe is controlled by container,programmer need not care it,which may be the reason why EJB is so welcome. also container controls the bean's instance,maybe the container will create another instance to handle the client's request 在 Wed, 03 Mar 2004 02:48:03 GMT 时, "dolphinn" <jxu2@chat.carleton.ca> 写了 : -- >From my understanding, each enterpirse bean has a single threaded container >manage it. If two clients request the same enterprise bean at >the same time, then one of them will wait or fail since a single threaded >container can only handle one request at a time. Is this true? >If not, how can we control the multithreading of container? > >Thanks, >Jing >
Post Follow-up to this messageBut what I am doing is tring to evaluate the performance of J2EE applications. I wish to simulate the application including platform infrastructure, so I can learn what factors have impacts on the performance of softwares based on EJB platform against traditional java applications. In the book Mastering Enterprise Java Bean 2nd edition by Ed Roman, it talks about the relationship between Home Objects, EJB Objects, and Bean Instances. It says some containers have 1:N relationship between Home Ojbects and Bean instances and 1:N relationship between EJB Objects and Bean instances. In which case, there is only one Home Object and EJB Object istance for a bean, and the home object and the EJB object are multithreaded. I amhere. Isn't that one instance is one thread? How can one instance of a class be multithreaded? "Yan Lijun" <gumpagain@163.com> wrote in message news:k7ri40h1ts31q4fd9fakljih0qreifo056@ news.yaako.com... > in my option, > synchronized thread safe is controlled by container,programmer need not care > it,which may be the reason why EJB is so welcome. > also container controls the bean's instance,maybe the container will create > another instance to handle the client's request > > > 在 Wed, 03 Mar 2004 02:48:03 GMT 时, "dolphinn" <jxu2@chat.carleton.ca> 写 了: > -- > container >
Post Follow-up to this messagedolphinn wrote: > But what I am doing is tring to evaluate the performance of J2EE > applications. I wish to simulate the application including platform > infrastructure, so I can learn what factors have impacts on the > performance of softwares based on EJB platform against traditional > java applications. > > In the book Mastering Enterprise Java Bean 2nd edition by Ed Roman, > it talks about the relationship between Home Objects, EJB Objects, > and Bean Instances. It says some containers have 1:N relationship > between Home Ojbects and Bean instances and 1:N relationship between > EJB Objects and Bean instances. In which case, there is only one > Home Object and EJB Object istance for a bean, and the home object > and the EJB object are multithreaded. > I amhere. Isn't that one instance is one thread? How can > one instance of a class be multithreaded? You should read that as "is being accessed/used by several threads at the same time", hence multithreaded. -- Kind regards, Christophe Vanfleteren
Post Follow-up to this messageThanks for answering. My question now seems to become a fundamental one. What is the definition of instance and thread in EJB? Before, I thought that if a class is runable, each instance of this class is a thread. One instance is equevalent to one thread. But now seems a class can have multiple instances, and each instance are multithreaded. Then what is the identifier an instance, and what is the identifier of a thread? Thanks a lot, J Xu > You should read that as "is being accessed/used by several threads at the > same time", hence multithreaded. > > -- > Kind regards, > Christophe Vanfleteren
Post Follow-up to this messagedolphinn wrote: > Thanks for answering. My question now seems to become a fundamental one. > What is the definition of instance and thread in EJB? > Before, I thought that if a class is runable, each instance of this class is > a thread. > One instance is equevalent to one thread. > But now seems a class can have multiple instances, and each instance are > multithreaded. > Then what is the identifier an instance, and what is the identifier of a > thread? Objects and threads are almost orthogonal concepts. Objects (a.k.a. class instances) are characterized by their state and behaviors. Threads are independant sequences of execution, which exercise objects' behaviors and modify of their state. The number of threads of execution to which an object is exposed is not generally a characteristic of that object -- it is a characteristic of the program using that object. This all gets a bit muddied in Java because of the java.lang.Thread class. It helps to understand that a Thread object does not fully encapsulate a thread -- it is more of a control panel for one. The actual thread is a VM-level / OS-level native entity. Any live object is uniquely identified by the VM that contains it and its reference in that VM. Any Java thread is identified by the VM to which it belongs and the java.lang.Thread instance associated with it. A thread is not inherently restricted with regard to which objects it may examine or modify. Going back to your earlier questions, I think you have chosen too complicated a problem. "Evaluat[ing] the performance of J2EE applications" simply has too many variables: the computing platform and its configuration, the specific J2EE implementation and its configuration, the particular application(s) and application configuration(s). Don't forget to choose which aspects of J2EE you want to evaluate (before you say "all", go read the hundreds, if not thousands, of pages of the various J2EE specifications). If you build a native model then how closely do you intend to model the J2EE app? If you plan a very accurate model then you are probably going to have to build your own J2EE implementation, or an equivalent. If a less accurate model then what do you realistically expect to learn from it? Finally, you need to very clearly understand the technologies involved to have any hope of producing any a valid evaluation of them. Your questions in this newsgroup thread make it clear that you do not have a good grasp of threading, and that is a very fundamental aspect of what you want to test. Moreover, it is unlikely that you will gain the necessary depth of understanding from Usenet. Given the breadth of the problem you are trying to tackle, you are not going to be able to learn enough fast enough to produce any valid answers before the problem ceases to be relevant. I recommend that you narrow the scope. John Bollinger jobollin@indiana.edu
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.