001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.test.threading.ejb;
023:
024: import java.rmi.*;
025: import javax.ejb.*;
026:
027: /**
028: * <description>
029: *
030: * @see <related>
031: * @author <a href="mailto:marc@jboss.org">Marc Fleury</a>
032: * @version $Revision: 57211 $
033: *
034: * Revisions:
035: *
036: * 20010625 marc fleury: Initial version
037: */
038: public class EJBThreadsBean implements EntityBean {
039: org.apache.log4j.Category log = org.apache.log4j.Category
040: .getInstance(getClass());
041:
042: // Constants -----------------------------------------------------
043:
044: // Attributes ----------------------------------------------------
045: public String id;
046:
047: // Static --------------------------------------------------------
048:
049: // Constructors --------------------------------------------------
050:
051: // Public --------------------------------------------------------
052:
053: public String ejbCreate(String id) throws RemoteException,
054: CreateException {
055: log.debug("create" + Thread.currentThread() + " id: " + id);
056: this .id = id;
057:
058: return id;
059: }
060:
061: public void ejbPostCreate(String id) {
062: }
063:
064: public void ejbRemove() throws RemoveException {
065: log.debug("remove" + Thread.currentThread());
066: }
067:
068: public void ejbActivate() throws RemoteException {
069: }
070:
071: public void ejbPassivate() throws RemoteException {
072: }
073:
074: public void ejbLoad() throws RemoteException {
075: }
076:
077: public void ejbStore() throws RemoteException {
078: }
079:
080: public void setEntityContext(EntityContext context)
081: throws RemoteException {
082: }
083:
084: public void unsetEntityContext() throws RemoteException {
085: }
086:
087: public void test() {
088:
089: log.debug("test" + Thread.currentThread());
090:
091: }
092:
093: public void testBusinessException() throws RemoteException {
094: log.debug("testBusinessExcetiopn" + Thread.currentThread());
095: throw new RemoteException("TestBusinessException");
096: };
097:
098: public void testRuntimeException() throws RemoteException {
099: log.debug("testRuntimeException" + Thread.currentThread());
100: throw new NullPointerException();
101: }
102:
103: public void testTimeOut() throws RemoteException {
104: log.debug("testTimeout" + Thread.currentThread());
105: synchronized (this ) {
106: try {
107: wait(5000);
108: } catch (InterruptedException e) {
109:
110: }
111: }
112: }
113:
114: public void testNonTransactional() throws RemoteException {
115: log.debug("testNonTransactional" + Thread.currentThread());
116: }
117: }
|