|
IBM WebSphere Application ServerTM Release 8 |
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Interface Summary | |
---|---|
Alarm | An object implementing this interface is returned when an alarm is created. |
AlarmListener | This interface is implemented by a Java object that will receive alarm notifications. |
AlarmManager | This manages a set of logical alarms. |
AlarmManagerEvents | These are events which can be thrown by an Alarm/AlarmManager. |
AsynchScope | An asynch bean is a scoping mechanism. |
AsynchScopeEvents | These are events which can be generated by an AsynchScope. |
AsynchScopeManager | This interface is used for object which manage a set of child asynch beans. |
EventSource | Runtime objects implement this when they are an event source Java objects can be registered with an EventSource. |
EventSourceEvents | This defines some generic events which can be thrown by all event sources. |
SubsystemMonitor | This represents a subsystem monitor. |
SubsystemMonitorEvents | These are the events which can be fired by a SubsystemMonitor. |
SubsystemMonitorManager | This manages a set of subsystem monitors. |
Work | This is implemented by applications when they want to run code blocks asynchronously. |
WorkEvent | This is sent to a WorkListener as the Work is processed by a WorkManager. |
WorkEvents | This interface defines the events which are published to an EventSource when a Work is executed and possibly fails. |
WorkItem | This is returned once a Work is accepted for dispatcher. |
WorkListener | This is a callback interface called to report on the dispatching of a Work. |
WorkManager | The WorkManager is the abstraction for dispatching and monitoring asynchronous work and is a factory for asynchronous beans. |
WorkManagerEvents | These are system events which can be thrown by a WorkManager. |
WorkWithExecutionContext | This is returned to wrap an application supplied Work implementation with a J2EE context. |
Exception Summary | |
---|---|
SerialDeserialException | This can be thrown when a WorkWithExecutionContext is serialized or deserialized. |
WorkCompletedException | This exception indicates that a Work started but completed with an exception. |
WorkContextException | This exception is thrown when there is a problem with the J2EE context associated with a Work. |
WorkException | This is the base class for all Work related exceptions. |
WorkRejectedException | This is thrown then the work cannot be started. |
Provides for the full support of application controlled threading, asynchronous callbacks and scoped alarms and subsystem monitors.
If the method throws an exception then any local transactions are rolled back. If the method then returns normally, any incomplete local transactions are completed. If the method starts its own global transaction and the async method didn't commit this global transaction then the global transaction is rolled back when the method returns.
How-ever, when the object is a simple Java object then it is allowed to lookup the java:comp name space like it's creator would. This allows it to lookup connection factories and EJBs in the normal J2EE way. The environment properties of the creating component are also available. The java:comp name space is actually identical to the one available to the creating component. All connection factories use the same resource sharing scope as the creating component also. The only exception to this rule is that 'java:comp/UserTransaction' is only available to the async bean when the J2EE component that created it was a servlet. It is not visible when the owner was an EJB even if it was using bean managed transactions.
class GoodAsyncBean { DataSource ds; public GoodAsyncBean() throws NamingException { // ok to cache a connection factory or datasource as class instance // data. InitialContext ic = new InitialContext(); // we're assuming the creating J2EE component has this resource reference // defined in it's descriptor. ds = (DataSource)ic.lookup("java:comp/env/jdbc/myDataSource"); } // Now when the asynch method is called, get a connection, use it and then // close it. void anEventListener() { Connection c = null; try { c = ds.getConnection(); // use the connection now... } finally { if(c != null) c.close(); } } }
class BadAsyncBean { DataSource ds; // don't do this, you can't cache connections across asynch method calls. Connection c; public BadAsyncBean() throws NamingException { // ok to cache a connection factory or datasource as class instance // data. InitialContext ic = new InitialContext(); ds = (DataSource)ic.lookup("java:comp/env/jdbc/myDataSource"); // here, you broke the rules... c = ds.getConnection(); } // Now when the asynch method is called, illegally use the cached connection // and you'll likely see a bunch of J2C related exceptions at runtime. // close it. void someAsynchMethod() { // use the connection now... } }
Question | Answer for Java beans | Answer for EJB |
---|---|---|
Transactions | If created by a servlet then java:comp/UserTransaction is available. If created by an EJB then only TX_NOT_SUPPORTED is allowed and a 'buddy' EJB must be used for full global transaction support. | The support is what is specified by the descriptor for the EJB and the J2EE specification. |
Security | The credentials on the thread that created the async bean are used when the bean is invoked. | The credentials on the thread that created the async bean are used, however, the descriptor for the bean can override this with the run as role attribute. |
Application Profiles | The profiles active for the creating component are used. | The profiles active for the creating component are used but they may be augmented by specifying additional ones on the target EJB method. |
Java:comp | The Java:comp of the component that created the async bean are always available to the async bean. | The java:comp of the creating component is ignored. The java:comp of the async EJB is always used. |
Method | Description |
---|---|
Work.startWork | Start an async bean on another thread. |
AlarmManager.create | Run the async bean when the alarm expires. |
EventSource.addListener | Run the async bean when a matching event is published on the EventSource. |
|
IBM WebSphere Application ServerTM Release 8 |
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |