Interface | Description |
---|---|
Alarm | Deprecated
Interfaces for alarms and alarm management are replaced by
ManagedScheduledExecutorService and related interfaces. |
AlarmListener | Deprecated
Interfaces for alarms and alarm management are replaced by
ManagedScheduledExecutorService and related interfaces. |
AlarmManager | Deprecated
Interfaces for alarms and alarm management are replaced by
ManagedScheduledExecutorService and related interfaces. |
AlarmManagerEvents | Deprecated
Interfaces for alarms and alarm management are replaced by
ManagedScheduledExecutorService and related interfaces. |
AsynchScope | Deprecated |
AsynchScopeEvents | Deprecated |
AsynchScopeManager | Deprecated |
EventSource | Deprecated
Event triggers and listeners are replaced by
ContextService and related interfaces. |
EventSourceEvents | Deprecated
Event triggers and listeners are replaced by
ContextService and related interfaces. |
SubsystemMonitor | Deprecated |
SubsystemMonitorEvents | Deprecated |
SubsystemMonitorManager | Deprecated |
Work | Deprecated
Interfaces for work and work management are replaced by
ManagedExecutorService and related interfaces. |
WorkEvent | Deprecated
Interfaces for work and work management are replaced by
ManagedExecutorService and related interfaces. |
WorkEvents | Deprecated
Interfaces for work and work management are replaced by
ManagedExecutorService and related interfaces. |
WorkItem | Deprecated
Interfaces for work and work management are replaced by
ManagedExecutorService and related interfaces. |
WorkListener | Deprecated
Interfaces for work and work management are replaced by
ManagedExecutorService and related interfaces. |
WorkManager | Deprecated
Interfaces for work and work management are replaced by
ManagedExecutorService and related interfaces. |
WorkManagerEvents | Deprecated
Interfaces for work and work management are replaced by
ManagedExecutorService and related interfaces. |
WorkWithExecutionContext | Deprecated
Interfaces relating to the capture of work with execution context are replaced by
ContextService and related interfaces. |
Exception | Description |
---|---|
SerialDeserialException | Deprecated
Interfaces relating to the capture of work with execution context are replaced by
ContextService and related interfaces. |
WorkCompletedException | Deprecated
Interfaces for work and work management are replaced by
ManagedExecutorService and related interfaces. |
WorkContextException | Deprecated
Interfaces for work and work management are replaced by
ManagedExecutorService and related interfaces. |
WorkException | Deprecated
Interfaces for work and work management are replaced by
ManagedExecutorService and related interfaces. |
WorkRejectedException | Deprecated
Interfaces for work and work management are replaced by
ManagedExecutorService and related interfaces. |
Deprecated. Asynchronous Beans is replaced by Concurrency Utilities for Java EE.
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. |