User: pra
Date: 01/03/06 23:54:57
Added: src/main/org/jboss/test/mdb/bean ExQueueBean.java
Log:
Added transaction test bean
Revision Changes Path
1.1 jbosstest/src/main/org/jboss/test/mdb/bean/ExQueueBean.java
Index: ExQueueBean.java
===================================================================
/*
* Copyright (c) 2000 Peter Antman DN <[EMAIL PROTECTED]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.jboss.test.mdb.bean;
import javax.ejb.MessageDrivenBean;
import javax.ejb.MessageDrivenContext;
import javax.ejb.EJBException;
import javax.jms.MessageListener;
import javax.jms.Message;
/**
* MessageBeanImpl.java
*
*
* Created: Sat Nov 25 18:07:50 2000
*
* @author
* @version
*/
public class ExQueueBean implements MessageDrivenBean, MessageListener{
private MessageDrivenContext ctx = null;
static int throwex = 1;
public ExQueueBean() {
}
public void setMessageDrivenContext(MessageDrivenContext ctx)
throws EJBException {
this.ctx = ctx;
}
public void ejbCreate() {}
public void ejbRemove() {ctx=null;}
public void onMessage(Message message) {
/*
if (message.toString().equals("TextMessage@Queue Message queue/ex nr 1") ||
message.toString().equals("TextMessage@Queue Message queue/ex nr 3"))
{
*/
throwex++;
if (throwex%2==0) {
System.err.println("DEBUG: ExQueueBean throwing EJBException for message"
+ message.toString() );
System.err.println("throwex " + throwex);
throw new EJBException();
}
System.err.println("DEBUG: ExQueueBean got message " + message.toString() );
}
} // MessageBeanImpl