Wednesday, February 18, 2009
Happiness
Gone are the days of fun and friends
Gone are the days of movies n laughter
Gone are the days of easy life and dreamy times
There came days of wait for love
Then came days of mails n calls
Heart was full of excitement and fulfillment
A vision of castle in the sky
There began the hallucination of a happy ever after life
Little did I know that it is all the launch of a new beginning
A start of the odds n rules of expectations
Changes began ...slow n steady
The veracity of existence began to haunt
Everything turned new, everything seemed different
This was not in my dreams
This was not in my trance
But, this was the journey I started
I had no right to whine, no way to turn back
Ought to face it, have got to face reality
Came the Roads of adjustments and compromise
Living for the loved one was the norm
Expectations grew in the back of the heart
But the fear of hurting stopped the act
Mails reduced, calls vanished
It was taken for granted that everything was alright
No time to discuss, no time to talk
All that I hear is “I am tired”
A new life took birth from within
A little one was growing in the womb
Out came the life’s angel
With it came another responsibility another role to play
Juggling between acts and dealing with sleepless nights
Reacting to new changes was not a piece of cake
Grueling the work life balance
And fulfilling the little one’s demands
Was the new priority at hand
I look around to find nothing is for ME
Working hard to survive, but wondering whom am I satisfying?
Forgot to dream, forgot to desire
Forgot that I am an individual too
Where do I go, what do I do
Confused with everything that life has brought in its way
Throw the expectations throw the yearning
Throw everything in its way
Be patient, be caring, and be loving
That is what the conscious seems to repeat
What for, what do I get for being all that?
Then came a voice of solitude
Then came the imagination of loneliness
After all, what is life without the loved ones?
It is so true that Love is LIFE
The thought that there is someone who loves u more than the world around
Makes every hardship so trivial
The smile of my love
The care from my love
The acceptance of my extremities by my love
Makes me think again, that life is indeed not bad
The mischief of my little one
The laughter of my baby,
Quench all the sadness away
Her first smile
Her first tooth
Her first step
Can anything else replace this sense of ecstasy?
Realizations walked in
Thinking all over again
After all, Happiness is in the mind,
Sow it and be sure to reap the fruits of joy
Life is Beautiful
Life is exhilarating
It is all in the eyes of the beholder
Find a way 2 be HAPPY!
Friday, November 23, 2007
Difference between Stateless and Stateful Session Bean
Skip navigation.
GoogleURL();
This script outputs the google search URL required for search on edocs documentation.
Downloads Product Documentation Support
dev2dev Home Dev Centers CodeShare Community Newsgroups
GoogleSearchCollection();
This script outputs the google search parameters required for search on edocs documentation.
eDocs Home > BEA WebLogic Server 8.1 Documentation > Programming WebLogic Enterprise JavaBeans > Session EJBs
Programming WebLogic Enterprise JavaBeans
Session EJBs
This section describes how session beans work within the EJB container, and provides design and development guidelines that are specific to session beans. For a description of the overall bean development process, see Implementing Enterprise Java Beans.
It is assumed that the reader is familiar with Java programming and session bean features and capabilities. For an introduction to session bean features and how they are typically used in applications, see Session EJBs Implement Business Logic and Session Bean Features.
The following sections describe the session bean life-cycle, design considerations, and instructions for key implementation tasks.
Comparing Stateless and Stateful Session Beans
Pooling for Stateless Session EJBs
Caching and Passivating Stateful Session EJBs
Design Decisions for Session Beans
Implementing Session Beans
Comparing Stateless and Stateful Session Beans
This section looks at the key differences between stateless and stateful session beans.
Table 5-1 Comparing Stateless and Stateful Session Beans
Stateless Session Beans
Stateful Sessions Beans
Are pooled in memory, to save the overhead of creating a bean every time one is needed. WebLogic Server uses a bean instance when needed and puts it back in the pool when the work is complete.
Stateless sessions beans provide faster performance than stateful beans.
Each client creates a new instance of a bean, and eventually removes it. Instances may be passivated to disk if the cache fills up.
An application issues an ejbRemove() to remove the bean from the cache.
Stateful sessions beans do not perform as well as stateless sessions beans.
Have no identity and no client association; they are anonymous.
Are bound to particular client instances.Each bean has an implicit identity. Each time a client interacts with a stateful session bean during a session, it is the same object.
Do not persist. The bean has no state between calls.
Persist. A stateful session bean's state is preserved for the duration of a session.
See Choosing Between Stateless and Stateful Beans for a discussion of when to use which type of session bean.
Pooling for Stateless Session EJBs
By default, no stateless session EJB instances exist in WebLogic Server at startup time. As individual beans are invoked, WebLogic Server initializes new instances of the EJB.
However, in a production environment, WebLogic Server can provide improved performance and throughput for stateless session EJBs by maintaining a free pool of unbound stateless session EJBs—instances that are not currently processing a method call. If an unbound instance is available to serve a request, response time improves, because the request does not have to wait for an instance to be created. The free pool improves performance by reusing objects and skipping container callbacks when it can.
Upon startup, WebLogic Server automatically creates and populates the free pool with the quantity of instances you specify in the bean's initial-beans-in-free-pool deployment element in the weblogic-ejb-jar.xml file. By default, initial-beans-in-free-pool is set to 0.
The following figure illustrates the WebLogic Server free pool, and the processes by which stateless EJBs enter and leave the pool. Dotted lines indicate the "state" of the EJB from the perspective of WebLogic Server.
Figure 5-1 WebLogic Server Free Pool Showing Stateless Session EJB Life Cycle
If you configure a pool, WebLogic Server will service method calls with an EJB instance from the free pool, if one is available. The EJB remains active for the duration of the client's method call. After the method completes, the EJB instance is returned to the free pool. Because WebLogic Server unbinds stateless session beans from clients after each method call, the actual bean class instance that a client uses may be different from invocation to invocation.
If all instances of an EJB class are active and max-beans-in-free-pool has been reached, new clients requesting the EJB class will be blocked until an active EJB completes a method call. If the transaction times out (or, for non-transactional calls, if five minutes elapse), WebLogic Server throws a RemoteException for a remote client or an EJBException for a local client.
Note: The maximum size of the free pool is limited by the value of the max-beans-in-free-pool element, available memory, or the number of execute threads.
When an application requests a bean instance from the free pool, there are three possible outcomes:
An instance is available in the pool. WebLogic Server makes that instance available and your application proceeds with processing.
No instance is available in the pool, but the number of instances in use is less then max-beans-in-free-pool. WebLogic Server allocates a new bean instance and gives it to you.
No instances are available in the pool and the number of instances in use is already max-beans-in-free-pool. You application must wait until either your transaction times out or a bean instance that already exists in the pool becomes available.
Caching and Passivating Stateful Session EJBs
WebLogic Server uses a cache of bean instances to improve the performance of stateful session EJBs. The cache stores active EJB instances in memory so that they are immediately available for client requests. The cache contains EJBs that are currently in use by a client and instances that were recently in use. Stateful session beans in cache are bound to a particular client.
The following figure illustrates the WebLogic Server cache, and the processes by which stateful EJBs enter and leave the cache.
Figure 5-2 Stateful Session EJB Life Cycle
Stateful Session EJB Creation
No stateful session EJB instances exist in WebLogic Server at startup. Before a client begins accessing a stateful session bean, it creates a new bean instance to use during its session with the bean. When the session is over the instance is destroyed. While the session is in progress, the instance is cached in memory.
Stateful Session EJB Passivation
Passivation is the process by which WebLogic Server removes an EJB instance from cache while preserving its state on disk. While passivated, EJBs are not in memory and are not immediately available for client requests, as they are when in the cache.
The EJB developer must ensure that a call to the ejbPassivate() method leaves a stateful session bean in a condition such that WebLogic Server can serialize its data and passivate the instance. During passivation, WebLogic Server attempts to serialize any fields that are not declared transient. This means that you must ensure that all non-transient fields represent serializable objects, such as the bean's remote or home interface. EJB 2.1 specifies the field types that are allowed.
Controlling Passivation
The rules that govern the passivation of stateful session beans vary, based on the value of the beans cache-type element, which can be:
LRU—least recently used, or eager passivation.
NRU—not recently used, or as lazy passivation
The idle-timeout-seconds and max-beans-in-cache elements also affect passivation and removal behaviors, based on the value of cache-type.
Eager Passivation (LRU)
When you configure eager passivation for a stateful session bean by setting cache-type to LRU, the container passivates instances to disk:
As soon as an instance has been inactive for idle-timeout-seconds, regardless of the value of max-beans-in-cache.
When max-beans-in-cache is reached, even though idle-timeout-seconds has not expired.
The container removes a passivated instance from disk after it has been inactive for idle-timeout-seconds after passivation. This is referred to as a lazy remove.
Lazy Passivation (NRU)
When lazy passivation is configured by setting cache-type to NRU, the container avoids passivating beans, because of the associated systems overhead—pressure on the cache is the only event that causes passivation or eager removal of beans.
The container:
Removes a bean instance from cache when idle-timeout-seconds expires, and does not passivate it to disk. This is referred to as a eager remove. An eager remove ensures that an inactive instance does not consume memory or disk resources.
Passivates instances to disk when max-beans-in-cache is reached, even though idle-timeout-seconds has not expired.
Managing EJB Cache Size
For a discussion of managing cache size to optimize performance in a production environment see Setting EJB Cache Size in WebLogic Server Performance and Tuning.
Specifying the Persistent Store Directory for Passivated Beans
When a stateful session bean is passivated, its state is stored in a file system directory. Each server instance has its own directory for storing the state of passivated stateful session beans, known as the persistent store directory. The persistent store directory contains one subdirectory for each passivated bean.
The persistent store directory is created by default in the server instance directory, for example:
D:\releases\610\bea\user_domains\mydomain\myserver\pstore\
The path to the persistence store is:
RootDirectory\ServerName\persistent-store-dir
where:
RootDirectory—the directory where WebLogic Server runs, for example:
D:\releases\810\bea\user_domains\mydomain
RootDirectory can be specified at server startup with the -Dweblogic.RootDirectory property.
ServerName—the name of the server instance.
persistent-store-dir—the value of the of the persistent-store-dir element in the stanza of weblogic-ejb-jar.xml. If no value is specified for , the directory is named pstore by default.
The persistent store directory contains a subdirectory, named with a hash code, for each passivated bean. For example, the subdirectory for a passivated bean in the example above might be:
D:\releases\810\bea\user_domains\mydomain\myserver\pstore\14t89gex0m2fr
Configuring Concurrent Access to Stateful Session Beans
In accordance with the EJB 2.0 specification, simultaneous access to a stateful session EJB results in a RemoteException. This access restriction on stateful session EJBs applies whether the EJB client is remote or internal to WebLogic Server. To override this restriction and configure a stateful session bean to allow concurrent calls, set the allow-concurrent-calls deployment element.
If multiple servlet classes access a stateful session EJB, each servlet thread (rather than each instance of the servlet class) must have its own session EJB instance. To prevent concurrent access, a JSP/servlet can use a stateful session bean in request scope.
Design Decisions for Session Beans
This section discusses some design decisions relevant to session beans.
Choosing Between Stateless and Stateful Beans
Stateless session beans are a good choice if your application does not need to maintain state for a particular client between business method calls. WebLogic Server is multi-threaded, servicing multiple clients simultaneously. With stateless session beans, the EJB container is free to use any available, pooled bean instance to service a client request, rather than reserving an instance for each client for the duration of a session. This results in greater resource utilization, scalability and throughput.
Stateless session beans are preferred for their light-weight implementation. They are a good choice if your application's beans perform autonomous, distinct tasks without bean-to-bean interaction.
Stateful session beans are a good choice if you need to preserve the bean's state for the duration of the session.
For examples of applications of stateless and stateful session beans, see Stateless Session Beans and Stateful Session Beans.
Choosing the Optimal Free Pool Setting for Stateless Session Beans
When you choose values for initial-beans-in-free-pool and max-beans-in-free-pool you must weigh memory consumption against slowing down your application. If the number of stateless session bean instances is too high, the free pool contains inactive instances that consume memory. If the number is too low, a client may not obtain an instance when it needs it. This leads to client threads blocking until an instance frees up, slowing down the application.
Usually max-beans-in-free-pool should be equal to the number of worker threads in the server instance, so that when a thread tries to do work an instance is available.
Implementing Session Beans
Implementing Enterprise Java Beans, takes you through session bean implementation step-by-step. This section explains the details of configuring WebLogic-Server specific session bean behavior by setting bean-specific deployment descriptor elements.
WebLogic-Specific Configurable Behaviors for Session Beans
Table 5-2 summarizes the deployment descriptor elements you set to configure the behavior of a stateless session bean and how the bean behaves if you do not configure the element. All of the elements listed are sub-elements of the stateless-session-descriptor element in weblogic-ejb-jar.xml.
Table 5-3 summarizes the deployment descriptor elements you set to configure the behavior of a stateful session bean and how the bean behaves if you do not configure the element. All of the elements listed are sub-elements of the stateful-session-descriptor element in weblogic-ejb-jar.xml.
Table 5-2 WebLogic-Specific Features for Stateless Session EJBs
To control
Set the following weblogic-ejb-jar.xml element(s)
Default behavior
The number of inactive instances of a stateless session bean that exist in WebLogic Server when it is started.
See Pooling for Stateless Session EJBs.
initial-beans-in-free-pool
WebLogic Server creates 0 beans in the free pool.
The maximum size of the free pool of inactive stateless session beans.
max-beans-in-free-pool
WebLogic Server limits the maximum number of beans in the free pool to 1000.
How WebLogic Server replicates stateless session EJB instances in a cluster.
See Reliability and Availability Features.
stateless-clustering
home-is-clusterable
home-load-algorithm
home-call-router-class-name
stateless-bean-is-clusterable
stateless-bean-load-algorithm
stateless-bean-call-router-class-name
stateless-bean-methods-are-idempotent
The EJB can be deployed to multiple servers in a cluster.
Table 5-3 WebLogic-Specific Features for Stateful Session EJBs
Behavior
weblogic-ejb-jar.xml element
Default
Whether multiple clients can simultaneously access a bean without triggering a Remote Exception.
See Configuring Concurrent Access to Stateful Session Beans.
allow-concurrent-calls
False—The server throws a RemoteException when a stateful session bean instance is currently handling a method call and another (concurrent) method call arrives on the server.
Whether the EJB container can remove a stateful session bean within a transaction context without provoking an error.
allow-remove-during-transaction
False—The server throws an exception when a stateful session bean is removed within a transaction context.
The number of stateful been instances that can exist in cache.
max-beans-in-cache
1000
The period of inactivity before a stateful session bean instance remains in cache (given that max-beans-in-cache has not been reached), and after passivation, remains on disk.
idle-timeout-seconds
600 seconds
The rules for removing a stateful session bean instance from the cache.
cache-type
NRU (not recently used)—For a description of this behavior, see Lazy Passivation (NRU).
Where WebLogic Server stores the state of passivated stateful session bean instances.
persistent-store-dir
To support method failover, specify the idempotent methods for a clustered EJB. An idempotent method can be repeated with no negative side-effects.
idempotent-methods
None
Custom class to be used for routing home method calls.
home-call-router-class-name
None
Indicates if the bean home can be clustered.
home-is-clusterable
True
Algorithm to use for load-balancing among replicas of the bean home.
home-load-algorithm
Algorithm specified by the property weblogic.cluster.defaultLoadAlgorithm
Indicates the replication used for stateful session beans in a cluster: in-memory or none.
replication-type
None
Contact BEA Feedback Privacy
Copyright();
© 2007 BEA Systems © BEA Systems
This code is building Meta information to pass to the webTrends server for reporting.
-->Courtesy:http://java.sun.com/developer/onlineTraining/EJBIntro/EJBIntro.html
GoogleURL();
This script outputs the google search URL required for search on edocs documentation.
Downloads Product Documentation Support
dev2dev Home Dev Centers CodeShare Community Newsgroups
GoogleSearchCollection();
This script outputs the google search parameters required for search on edocs documentation.
eDocs Home > BEA WebLogic Server 8.1 Documentation > Programming WebLogic Enterprise JavaBeans > Session EJBs
Programming WebLogic Enterprise JavaBeans
Session EJBs
This section describes how session beans work within the EJB container, and provides design and development guidelines that are specific to session beans. For a description of the overall bean development process, see Implementing Enterprise Java Beans.
It is assumed that the reader is familiar with Java programming and session bean features and capabilities. For an introduction to session bean features and how they are typically used in applications, see Session EJBs Implement Business Logic and Session Bean Features.
The following sections describe the session bean life-cycle, design considerations, and instructions for key implementation tasks.
Comparing Stateless and Stateful Session Beans
Pooling for Stateless Session EJBs
Caching and Passivating Stateful Session EJBs
Design Decisions for Session Beans
Implementing Session Beans
Comparing Stateless and Stateful Session Beans
This section looks at the key differences between stateless and stateful session beans.
Table 5-1 Comparing Stateless and Stateful Session Beans
Stateless Session Beans
Stateful Sessions Beans
Are pooled in memory, to save the overhead of creating a bean every time one is needed. WebLogic Server uses a bean instance when needed and puts it back in the pool when the work is complete.
Stateless sessions beans provide faster performance than stateful beans.
Each client creates a new instance of a bean, and eventually removes it. Instances may be passivated to disk if the cache fills up.
An application issues an ejbRemove() to remove the bean from the cache.
Stateful sessions beans do not perform as well as stateless sessions beans.
Have no identity and no client association; they are anonymous.
Are bound to particular client instances.Each bean has an implicit identity. Each time a client interacts with a stateful session bean during a session, it is the same object.
Do not persist. The bean has no state between calls.
Persist. A stateful session bean's state is preserved for the duration of a session.
See Choosing Between Stateless and Stateful Beans for a discussion of when to use which type of session bean.
Pooling for Stateless Session EJBs
By default, no stateless session EJB instances exist in WebLogic Server at startup time. As individual beans are invoked, WebLogic Server initializes new instances of the EJB.
However, in a production environment, WebLogic Server can provide improved performance and throughput for stateless session EJBs by maintaining a free pool of unbound stateless session EJBs—instances that are not currently processing a method call. If an unbound instance is available to serve a request, response time improves, because the request does not have to wait for an instance to be created. The free pool improves performance by reusing objects and skipping container callbacks when it can.
Upon startup, WebLogic Server automatically creates and populates the free pool with the quantity of instances you specify in the bean's initial-beans-in-free-pool deployment element in the weblogic-ejb-jar.xml file. By default, initial-beans-in-free-pool is set to 0.
The following figure illustrates the WebLogic Server free pool, and the processes by which stateless EJBs enter and leave the pool. Dotted lines indicate the "state" of the EJB from the perspective of WebLogic Server.
Figure 5-1 WebLogic Server Free Pool Showing Stateless Session EJB Life Cycle
If you configure a pool, WebLogic Server will service method calls with an EJB instance from the free pool, if one is available. The EJB remains active for the duration of the client's method call. After the method completes, the EJB instance is returned to the free pool. Because WebLogic Server unbinds stateless session beans from clients after each method call, the actual bean class instance that a client uses may be different from invocation to invocation.
If all instances of an EJB class are active and max-beans-in-free-pool has been reached, new clients requesting the EJB class will be blocked until an active EJB completes a method call. If the transaction times out (or, for non-transactional calls, if five minutes elapse), WebLogic Server throws a RemoteException for a remote client or an EJBException for a local client.
Note: The maximum size of the free pool is limited by the value of the max-beans-in-free-pool element, available memory, or the number of execute threads.
When an application requests a bean instance from the free pool, there are three possible outcomes:
An instance is available in the pool. WebLogic Server makes that instance available and your application proceeds with processing.
No instance is available in the pool, but the number of instances in use is less then max-beans-in-free-pool. WebLogic Server allocates a new bean instance and gives it to you.
No instances are available in the pool and the number of instances in use is already max-beans-in-free-pool. You application must wait until either your transaction times out or a bean instance that already exists in the pool becomes available.
Caching and Passivating Stateful Session EJBs
WebLogic Server uses a cache of bean instances to improve the performance of stateful session EJBs. The cache stores active EJB instances in memory so that they are immediately available for client requests. The cache contains EJBs that are currently in use by a client and instances that were recently in use. Stateful session beans in cache are bound to a particular client.
The following figure illustrates the WebLogic Server cache, and the processes by which stateful EJBs enter and leave the cache.
Figure 5-2 Stateful Session EJB Life Cycle
Stateful Session EJB Creation
No stateful session EJB instances exist in WebLogic Server at startup. Before a client begins accessing a stateful session bean, it creates a new bean instance to use during its session with the bean. When the session is over the instance is destroyed. While the session is in progress, the instance is cached in memory.
Stateful Session EJB Passivation
Passivation is the process by which WebLogic Server removes an EJB instance from cache while preserving its state on disk. While passivated, EJBs are not in memory and are not immediately available for client requests, as they are when in the cache.
The EJB developer must ensure that a call to the ejbPassivate() method leaves a stateful session bean in a condition such that WebLogic Server can serialize its data and passivate the instance. During passivation, WebLogic Server attempts to serialize any fields that are not declared transient. This means that you must ensure that all non-transient fields represent serializable objects, such as the bean's remote or home interface. EJB 2.1 specifies the field types that are allowed.
Controlling Passivation
The rules that govern the passivation of stateful session beans vary, based on the value of the beans cache-type element, which can be:
LRU—least recently used, or eager passivation.
NRU—not recently used, or as lazy passivation
The idle-timeout-seconds and max-beans-in-cache elements also affect passivation and removal behaviors, based on the value of cache-type.
Eager Passivation (LRU)
When you configure eager passivation for a stateful session bean by setting cache-type to LRU, the container passivates instances to disk:
As soon as an instance has been inactive for idle-timeout-seconds, regardless of the value of max-beans-in-cache.
When max-beans-in-cache is reached, even though idle-timeout-seconds has not expired.
The container removes a passivated instance from disk after it has been inactive for idle-timeout-seconds after passivation. This is referred to as a lazy remove.
Lazy Passivation (NRU)
When lazy passivation is configured by setting cache-type to NRU, the container avoids passivating beans, because of the associated systems overhead—pressure on the cache is the only event that causes passivation or eager removal of beans.
The container:
Removes a bean instance from cache when idle-timeout-seconds expires, and does not passivate it to disk. This is referred to as a eager remove. An eager remove ensures that an inactive instance does not consume memory or disk resources.
Passivates instances to disk when max-beans-in-cache is reached, even though idle-timeout-seconds has not expired.
Managing EJB Cache Size
For a discussion of managing cache size to optimize performance in a production environment see Setting EJB Cache Size in WebLogic Server Performance and Tuning.
Specifying the Persistent Store Directory for Passivated Beans
When a stateful session bean is passivated, its state is stored in a file system directory. Each server instance has its own directory for storing the state of passivated stateful session beans, known as the persistent store directory. The persistent store directory contains one subdirectory for each passivated bean.
The persistent store directory is created by default in the server instance directory, for example:
D:\releases\610\bea\user_domains\mydomain\myserver\pstore\
The path to the persistence store is:
RootDirectory\ServerName\persistent-store-dir
where:
RootDirectory—the directory where WebLogic Server runs, for example:
D:\releases\810\bea\user_domains\mydomain
RootDirectory can be specified at server startup with the -Dweblogic.RootDirectory property.
ServerName—the name of the server instance.
persistent-store-dir—the value of the of the persistent-store-dir element in the
The persistent store directory contains a subdirectory, named with a hash code, for each passivated bean. For example, the subdirectory for a passivated bean in the example above might be:
D:\releases\810\bea\user_domains\mydomain\myserver\pstore\14t89gex0m2fr
Configuring Concurrent Access to Stateful Session Beans
In accordance with the EJB 2.0 specification, simultaneous access to a stateful session EJB results in a RemoteException. This access restriction on stateful session EJBs applies whether the EJB client is remote or internal to WebLogic Server. To override this restriction and configure a stateful session bean to allow concurrent calls, set the allow-concurrent-calls deployment element.
If multiple servlet classes access a stateful session EJB, each servlet thread (rather than each instance of the servlet class) must have its own session EJB instance. To prevent concurrent access, a JSP/servlet can use a stateful session bean in request scope.
Design Decisions for Session Beans
This section discusses some design decisions relevant to session beans.
Choosing Between Stateless and Stateful Beans
Stateless session beans are a good choice if your application does not need to maintain state for a particular client between business method calls. WebLogic Server is multi-threaded, servicing multiple clients simultaneously. With stateless session beans, the EJB container is free to use any available, pooled bean instance to service a client request, rather than reserving an instance for each client for the duration of a session. This results in greater resource utilization, scalability and throughput.
Stateless session beans are preferred for their light-weight implementation. They are a good choice if your application's beans perform autonomous, distinct tasks without bean-to-bean interaction.
Stateful session beans are a good choice if you need to preserve the bean's state for the duration of the session.
For examples of applications of stateless and stateful session beans, see Stateless Session Beans and Stateful Session Beans.
Choosing the Optimal Free Pool Setting for Stateless Session Beans
When you choose values for initial-beans-in-free-pool and max-beans-in-free-pool you must weigh memory consumption against slowing down your application. If the number of stateless session bean instances is too high, the free pool contains inactive instances that consume memory. If the number is too low, a client may not obtain an instance when it needs it. This leads to client threads blocking until an instance frees up, slowing down the application.
Usually max-beans-in-free-pool should be equal to the number of worker threads in the server instance, so that when a thread tries to do work an instance is available.
Implementing Session Beans
Implementing Enterprise Java Beans, takes you through session bean implementation step-by-step. This section explains the details of configuring WebLogic-Server specific session bean behavior by setting bean-specific deployment descriptor elements.
WebLogic-Specific Configurable Behaviors for Session Beans
Table 5-2 summarizes the deployment descriptor elements you set to configure the behavior of a stateless session bean and how the bean behaves if you do not configure the element. All of the elements listed are sub-elements of the stateless-session-descriptor element in weblogic-ejb-jar.xml.
Table 5-3 summarizes the deployment descriptor elements you set to configure the behavior of a stateful session bean and how the bean behaves if you do not configure the element. All of the elements listed are sub-elements of the stateful-session-descriptor element in weblogic-ejb-jar.xml.
Table 5-2 WebLogic-Specific Features for Stateless Session EJBs
To control
Set the following weblogic-ejb-jar.xml element(s)
Default behavior
The number of inactive instances of a stateless session bean that exist in WebLogic Server when it is started.
See Pooling for Stateless Session EJBs.
initial-beans-in-free-pool
WebLogic Server creates 0 beans in the free pool.
The maximum size of the free pool of inactive stateless session beans.
max-beans-in-free-pool
WebLogic Server limits the maximum number of beans in the free pool to 1000.
How WebLogic Server replicates stateless session EJB instances in a cluster.
See Reliability and Availability Features.
stateless-clustering
home-is-clusterable
home-load-algorithm
home-call-router-class-name
stateless-bean-is-clusterable
stateless-bean-load-algorithm
stateless-bean-call-router-class-name
stateless-bean-methods-are-idempotent
The EJB can be deployed to multiple servers in a cluster.
Table 5-3 WebLogic-Specific Features for Stateful Session EJBs
Behavior
weblogic-ejb-jar.xml element
Default
Whether multiple clients can simultaneously access a bean without triggering a Remote Exception.
See Configuring Concurrent Access to Stateful Session Beans.
allow-concurrent-calls
False—The server throws a RemoteException when a stateful session bean instance is currently handling a method call and another (concurrent) method call arrives on the server.
Whether the EJB container can remove a stateful session bean within a transaction context without provoking an error.
allow-remove-during-transaction
False—The server throws an exception when a stateful session bean is removed within a transaction context.
The number of stateful been instances that can exist in cache.
max-beans-in-cache
1000
The period of inactivity before a stateful session bean instance remains in cache (given that max-beans-in-cache has not been reached), and after passivation, remains on disk.
idle-timeout-seconds
600 seconds
The rules for removing a stateful session bean instance from the cache.
cache-type
NRU (not recently used)—For a description of this behavior, see Lazy Passivation (NRU).
Where WebLogic Server stores the state of passivated stateful session bean instances.
persistent-store-dir
To support method failover, specify the idempotent methods for a clustered EJB. An idempotent method can be repeated with no negative side-effects.
idempotent-methods
None
Custom class to be used for routing home method calls.
home-call-router-class-name
None
Indicates if the bean home can be clustered.
home-is-clusterable
True
Algorithm to use for load-balancing among replicas of the bean home.
home-load-algorithm
Algorithm specified by the property weblogic.cluster.defaultLoadAlgorithm
Indicates the replication used for stateful session beans in a cluster: in-memory or none.
replication-type
None
Contact BEA Feedback Privacy
Copyright();
© 2007 BEA Systems © BEA Systems
This code is building Meta information to pass to the webTrends server for reporting.
-->Courtesy:http://java.sun.com/developer/onlineTraining/EJBIntro/EJBIntro.html
Wednesday, November 14, 2007
Difference between Session and Entity bean
Session beans and entity beans compared
Table 1 is a summary of the differences between entity and session beans.
Table 1. Comparison of session and entity beans
Session bean
Entity bean
Represents a single conversation with a client.
Typically, encapsulates an action or actions to be taken on business data.
Typically, encapsulates persistent business data—for example, a row in a database.
Is relatively short-lived.
Is relatively long-lived.
Is created and used by a single client.
May be shared by multiple clients.
Has no primary key.
Has a primary key, which enables an instance to be found and shared by more than one client.
Typically, persists only for the life of the conversation with the client. (However, may choose to save information.)
Persists beyond the life of a client instance. Persistence can be container-managed or bean-managed.
Is not recoverable—if the EJB server fails, it may be destroyed.
Is recoverable—it survives failures of the EJB server.
May be stateful (that is, have a client-specific state) or stateless (have no non-transient state).
Is typically stateful.
May or may not be transactional. If transactional, can manage its own OTS transactions, or use container-managed transactions.
A stateful session bean that manages its own transactions can begin an OTS transaction in one method and commit or roll it back in a subsequent method.
A stateless session bean that manages its own transactions and begins an OTS transaction must commit (or roll back) the transaction in the same method in which it was started.
The state of a transactional, stateful session bean is not automatically rolled back on transaction rollback. In some cases, the bean can use session synchronization to react to syncpoint.
May or may not be transactional. Must use the container-managed transaction model.
If transactional, its state is automatically rolled back on transaction rollback.
Is not re-entrant.
May be re-entrant.
Courtesy:http://publib.boulder.ibm.com/infocenter/cicsts/v3r1/index.jsp?topic=/com.ibm.cics.ts31.doc/dfhpj/topics/dfhpji2.htm
Table 1 is a summary of the differences between entity and session beans.
Table 1. Comparison of session and entity beans
Session bean
Entity bean
Represents a single conversation with a client.
Typically, encapsulates an action or actions to be taken on business data.
Typically, encapsulates persistent business data—for example, a row in a database.
Is relatively short-lived.
Is relatively long-lived.
Is created and used by a single client.
May be shared by multiple clients.
Has no primary key.
Has a primary key, which enables an instance to be found and shared by more than one client.
Typically, persists only for the life of the conversation with the client. (However, may choose to save information.)
Persists beyond the life of a client instance. Persistence can be container-managed or bean-managed.
Is not recoverable—if the EJB server fails, it may be destroyed.
Is recoverable—it survives failures of the EJB server.
May be stateful (that is, have a client-specific state) or stateless (have no non-transient state).
Is typically stateful.
May or may not be transactional. If transactional, can manage its own OTS transactions, or use container-managed transactions.
A stateful session bean that manages its own transactions can begin an OTS transaction in one method and commit or roll it back in a subsequent method.
A stateless session bean that manages its own transactions and begins an OTS transaction must commit (or roll back) the transaction in the same method in which it was started.
The state of a transactional, stateful session bean is not automatically rolled back on transaction rollback. In some cases, the bean can use session synchronization to react to syncpoint.
May or may not be transactional. Must use the container-managed transaction model.
If transactional, its state is automatically rolled back on transaction rollback.
Is not re-entrant.
May be re-entrant.
Courtesy:http://publib.boulder.ibm.com/infocenter/cicsts/v3r1/index.jsp?topic=/com.ibm.cics.ts31.doc/dfhpj/topics/dfhpji2.htm
Tuesday, October 16, 2007
What is Sooji(Semolina) made of?
Semolina is coarsely ground grain, usually wheat, with particles mostly between 0.25 and 0.75 millimetres in diameter.
In Northern India, it is known as Suji; in southern India, rava. In much of North Africa and the Middle-East, it is made into the staple couscous or kuskus.
In South India, semolina is used to make such delicacies as rava dosa and upma. A popular dessert in Greece ("Halvas"), Cyprus ("Halouvas"), Turkey ("Helva"), Iran ("Halva"), and India and Pakistan ("Halwa") is sometimes made with semolina scorched with sugar, butter, milk and pine nuts.
It can be used as an alternative to corn meal to 'flour' the underside of fresh pizza dough to prevent it from sticking to the peel.
In bread making, a small proportion of semolina added to the usual mix of flour produces a tasty crust.
Courtesy:http://en.wikipedia.org/wiki/Sooji
In Northern India, it is known as Suji; in southern India, rava. In much of North Africa and the Middle-East, it is made into the staple couscous or kuskus.
In South India, semolina is used to make such delicacies as rava dosa and upma. A popular dessert in Greece ("Halvas"), Cyprus ("Halouvas"), Turkey ("Helva"), Iran ("Halva"), and India and Pakistan ("Halwa") is sometimes made with semolina scorched with sugar, butter, milk and pine nuts.
It can be used as an alternative to corn meal to 'flour' the underside of fresh pizza dough to prevent it from sticking to the peel.
In bread making, a small proportion of semolina added to the usual mix of flour produces a tasty crust.
Courtesy:http://en.wikipedia.org/wiki/Sooji
What is Maida made of?
In India, super refined wheat flour is called maida. This flour is used to make a wide variety of food items like puri, chappathi, parotta, etc. Maida is sometimes referred to as "All purpose flour".
Maida is made up of wheat flour it has no fibe and is made by fine grinding
Maida is made up of wheat flour it has no fibe and is made by fine grinding
Friday, October 12, 2007
What is Ghee???
Ghee (Hindi घी, Urdu گھی, Punjabi ਘੋ, Kashmiri ग्याव/گیاو - from Sanskrit ghṛtə घृत "sprinkled"; also known in Arabic as سمن, samneh, meaning "ghee" or "fat") is a class of clarified butter
Preparation of Ghee
Milk is curdled. The curd is then manually churned until it precipitates butter and leaves behind some whey. The butter is then heated on a low flame until a layer of white froth covers the surface. This state indicates the end of process and the liquid obtained on filtering the suspension is pure ghee.
Light: That rich, creamy look. You would imagine ghee is a heavy fat. It's not. What is ghee, you may ask. Dehydrated milk-butter without its solids. To make ghee, technologists heat milk butter on a slow fire. All the water slowly evaporates. What's left of the butter is a clear golden liquid, with the solids settled at the bottom. The liquid is ghee. Bonus: ghee is so flavorful that just a teaspoon will do more than four tablespoons of any other cooking oil. Luscious: Brush a layer on corn-on-the-cob or drop a dollop into hot lentils. Pour into the hollow of a freshly baked potato or saute with salmon. Stir-fry, bake, saute or spread--any which way you use it, ghee will find flavour with you. What’s more, it won’t smoke or burn during cooking. Lasting: Keep ghee and butter at room temperature. Butter will eventually turn rancid; ghee will not. It's the moisture in butter that promotes decay. Virtually moisture-free, ghee has no such problem. It will retain its original freshness and flavour for months, even without refrigeration. Energising: Some foods dissolve in water, and some in fat. Ghee in your diet will carry fat-soluble foods quickly and easily inside cells. Such foods will reach where they are supposed to reach, to work the way they are supposed to work. Sometimes, it's just packaging that makes the difference. An Anti-oxidant: Ghee has beta-carotene and vitamin E, both known anti-oxidants that counter the effects of free radicals. Science has been able to establish that free radicals cause nearly 90 percent of all degenerative diseases. Ghee in your diet, then, could give Father Time a run for his money. A Sharpener: The goodness of ghee not only powers your cells, but also penetrates the corners of your mind. Result?quicker leaning, better recall, wiser decisions. Cow ghee in particular is supposed to be extremely good for your brain. A Healer: Ghee repairs the mucus lining of the stomach and evens out the acid balance in there. An ancient Indian fable says King Akbar the Great once challenged a citizen to eat and digest limestone. The man accepted—and won. His secret? Just before he had the limsetone, he downed a huge bowlful of ghee to arm his stomach against the assault. So stir-fry the garlic in a teaspoon of ghee, and drizzle over piping hot bread. It’s aromatherapy of the most intoxicating kind. Then feel the flavour do ghee-licious things to your taste-buds. Indulge.
Preparation of Ghee
Milk is curdled. The curd is then manually churned until it precipitates butter and leaves behind some whey. The butter is then heated on a low flame until a layer of white froth covers the surface. This state indicates the end of process and the liquid obtained on filtering the suspension is pure ghee.
Light: That rich, creamy look. You would imagine ghee is a heavy fat. It's not. What is ghee, you may ask. Dehydrated milk-butter without its solids. To make ghee, technologists heat milk butter on a slow fire. All the water slowly evaporates. What's left of the butter is a clear golden liquid, with the solids settled at the bottom. The liquid is ghee. Bonus: ghee is so flavorful that just a teaspoon will do more than four tablespoons of any other cooking oil. Luscious: Brush a layer on corn-on-the-cob or drop a dollop into hot lentils. Pour into the hollow of a freshly baked potato or saute with salmon. Stir-fry, bake, saute or spread--any which way you use it, ghee will find flavour with you. What’s more, it won’t smoke or burn during cooking. Lasting: Keep ghee and butter at room temperature. Butter will eventually turn rancid; ghee will not. It's the moisture in butter that promotes decay. Virtually moisture-free, ghee has no such problem. It will retain its original freshness and flavour for months, even without refrigeration. Energising: Some foods dissolve in water, and some in fat. Ghee in your diet will carry fat-soluble foods quickly and easily inside cells. Such foods will reach where they are supposed to reach, to work the way they are supposed to work. Sometimes, it's just packaging that makes the difference. An Anti-oxidant: Ghee has beta-carotene and vitamin E, both known anti-oxidants that counter the effects of free radicals. Science has been able to establish that free radicals cause nearly 90 percent of all degenerative diseases. Ghee in your diet, then, could give Father Time a run for his money. A Sharpener: The goodness of ghee not only powers your cells, but also penetrates the corners of your mind. Result?quicker leaning, better recall, wiser decisions. Cow ghee in particular is supposed to be extremely good for your brain. A Healer: Ghee repairs the mucus lining of the stomach and evens out the acid balance in there. An ancient Indian fable says King Akbar the Great once challenged a citizen to eat and digest limestone. The man accepted—and won. His secret? Just before he had the limsetone, he downed a huge bowlful of ghee to arm his stomach against the assault. So stir-fry the garlic in a teaspoon of ghee, and drizzle over piping hot bread. It’s aromatherapy of the most intoxicating kind. Then feel the flavour do ghee-licious things to your taste-buds. Indulge.
Wednesday, October 10, 2007
how to live long beautiful healthy life
Courtesy</">http://www.healthy-india.org>
How does one eat healthy in everyday life?
HEALTHY EATING HABITS : A WAY OF LIFE!
How does one translate the above advice to everyday life?
How does one eat healthy in everyday life?
HEALTHY EATING HABITS : A WAY OF LIFE!
- Have a variety of fresh fruits and vegetables every day. A minimum quantity of 450-500 grams of fresh fruits and vegetables is advisable.Locally grown, locally available fruits and vegetables like berries are equally if not more beneficial as compared to the expensive fruits and vegetables.
- Consume variety, Wherever possible and available consume a variety of fruits and vegetables everyday. Different ones offer different benefits- Different vegetables and fruits can be either greens, yellows, orange and red, white or purple in colour etc. Motivate young children and adults alike to eat plenty of fresh fruits and vegetables to prevent a host of diseases.
- Consume whole grains instead of polished grains.
- Eat un-husked pulses rather than husked pulses
- Restrict the intake of saturated fats and all other fats which are solid at room temperature
- Avoid vanaspati as it contains hydrogenated trans fatty acids
- Moderate the intake of canned food, preserved food, fast food as these are high on salt and also contain preservatives which can be harmful in the long run.
- Small quantity of nuts especially groundnuts, peanuts and almonds are healthy and should be eaten. Groundnuts, almonds, peanuts and fruit seed which are unsalted and unfried can be included as a snack instead of the other regular snacks consumed.
- Common sources of Vanaspati are biscuits, mithais from halwais, cakes etc. In addition, many halwais use it for their namkeens. These should be eaten in moderation.
Persons with sedentary lifestyle, or those with desk jobs or those with urban lifestyles should try and consume not more than 500-550gms of visible fat per month: Fat is all combined- oil (any type), ghee, butter. - Try and roast in the sigri, oven, and barbecue instead of frying.
- Even if you have to fry, deep-frying on high heat is better than shallow frying, in slow heat.
- Be careful during the 'chonken (baghar) of sabjis'- use a small spoon to put the cooking medium/oil rather than pouring it from the container. This would control the intake of oil.
- Cook sabjis in slow flame with little bit of water rather than using more cooking medium- so that it doesn't stick to the kadhai. Non-stick utensils can be used to cook in "zero oil".
- Non-stick utensils can be used especially for dosas, chillas, patties, tikkis.
- If you are eating out, then, skim the gravy, sabjis, dals, soups.
- When eating South Indian food, have the idlis rather than the vadas/ dosas- some people make the dosas / chillas without oil on request.
- If you are travelling and purees( fried ) have to be eaten, then press them in between a paper napkin. Even other fried stuffs should be first put on the paper napkin to absorb the excess oil before serving/eating.
- Cheese and cheese-spreads, dressings like mayonnaise contain high amounts of fat and should be avoided or eaten in very small quantities only, occasionally.
- Instead of cheese, try strained curds (tied in a cloth for 3-4 hours). Add salt, pepper and flavours of your choice like mustard and garlic, to substitute for butter/cheese on rotis, bread, and as a dressings.
How does one translate the above advice to everyday life?
- Instead of fried snacks, have a fruit instead. Another option is raw sprouts. Snacks like sevais with vegetables, poha with vegetables, bread in toaster/equity, stuffed with vegetables or puffed rice (mudi/wheat) with freshly cut vegetables, sprouts with vegetables, idlis, roasted gram(chana) are other options.A handful of unsalted nuts can also be eaten as a snack.
- Even though cottage cheese / paneer has a lower fat content than cheese, it still has fat and should be eaten in moderation.
Skim your milk overnight in the refrigerator and then use it. Toned milk is preferred to full cream milk. - Don't eat egg yolk more than twice a week.
- Eat 'chilke vali dal' (unhusked pulses) instead of 'dhuli dal' (husked dal) - this not only has a positive influence on cholesterol but also on diabetes and also positively affects health and prevents cancer, heart attacks and strokes and helps maintain a lower body weight.
Home ground atta is the best to eat in everyday life! - Don't remove the 'choker' from the 'atta'. It is an important source of fibre. Besides, the choker also contains important vitamins and attenuates the rise of blood glucose levels in patients who have diabetes or even have a tendency for diabetes (family history of diabetes). Daliya or porridge is a much better breakfast than bread.
- Partially polished rice is better than fully polished rice.
- Try out jaggery or khajoor instead of sugar; or try honey instead of jam and sugar.
- Avoid refined maida / suji, (breads, biscuits, mathris, naans, kulchas, bhaturas etc) and go for whole wheat atta instead.
- Fresh steamed idlis (although made of rice) are more healthy than bread .Even freshly boiled rice is healthier than maida bread.
Subscribe to:
Posts (Atom)