KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > threading > ejb > EJBThreadsBean


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.test.threading.ejb;
23
24 import java.rmi.*;
25 import javax.ejb.*;
26
27 /**
28 * <description>
29 *
30 * @see <related>
31 * @author <a HREF="mailto:marc@jboss.org">Marc Fleury</a>
32 * @version $Revision: 58115 $
33 *
34 * Revisions:
35 *
36 * 20010625 marc fleury: Initial version
37 */

38 public class EJBThreadsBean implements EntityBean
39 {
40    org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(getClass());
41    
42    // Constants -----------------------------------------------------
43

44    // Attributes ----------------------------------------------------
45
public String JavaDoc id;
46    // Static --------------------------------------------------------
47

48   // Constructors --------------------------------------------------
49

50   // Public --------------------------------------------------------
51

52     
53    public String JavaDoc ejbCreate(String JavaDoc id)
54       throws RemoteException, CreateException {
55       log.debug("create"+Thread.currentThread()+" id: "+id);
56       this.id = id;
57         
58       return id;
59    }
60     
61    public void ejbPostCreate(String JavaDoc id) {}
62    public void ejbRemove() throws RemoveException {log.debug("remove"+Thread.currentThread());}
63    public void ejbActivate() throws RemoteException {}
64    public void ejbPassivate() throws RemoteException {}
65    public void ejbLoad() throws RemoteException {}
66    public void ejbStore() throws RemoteException {}
67     
68    public void setEntityContext(EntityContext context) throws RemoteException {}
69    public void unsetEntityContext() throws RemoteException{}
70     
71    public void test() {
72         
73       log.debug("test"+Thread.currentThread());
74             
75    }
76     
77    public void testBusinessException()
78       throws RemoteException
79    {
80       log.debug("testBusinessExcetiopn"+Thread.currentThread());
81       throw new RemoteException("TestBusinessException");
82    };
83     
84    public void testRuntimeException()
85       throws RemoteException
86    {
87       log.debug("testRuntimeException"+Thread.currentThread());
88       throw new NullPointerException JavaDoc();
89    }
90    public void testTimeOut()
91       throws RemoteException
92    {
93       log.debug("testTimeout"+Thread.currentThread());
94       synchronized (this)
95       {
96          try {
97             wait(5000);
98          }
99          catch (InterruptedException JavaDoc e) {
100                 
101          }
102       }
103    }
104    public void testNonTransactional() throws RemoteException
105    {
106       log.debug("testNonTransactional"+Thread.currentThread());
107    }
108 }
109
Popular Tags