Hi, I'm getting some strange behaviour with the DBC annotations. Things seems to behave differently when being called from different threads. I've adjusted the DbcTest class to illustrate what I mean by calling a dbc annotated method from within run() which is called by the ScheduledThreadPoolExecutor. It seems to get stuck calling the dbc annotated method and will not get to the System.out.println("end run()"); line.
regards James | /* | * JBoss, Home of Professional Open Source | * Copyright 2005, JBoss Inc., and individual contributors as indicated | * by the @authors tag. See the copyright.txt in the distribution for a | * full listing of individual contributors. | * | * This 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.1 of | * the License, or (at your option) any later version. | * | * This software 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 software; if not, write to the Free | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | */ | package test.dbc; | | import java.util.concurrent.ScheduledThreadPoolExecutor; | import java.util.concurrent.TimeUnit; | | import test.dbc.java.Sorter; | import test.dbc.office.Computer; | import test.dbc.office.Developer; | import test.dbc.office.OfficeManager; | import test.dbc.stack.Stack; | import test.dbc.stack.StackImpl; | | /** | * | * @author <a href="mailto:[EMAIL PROTECTED]">Kabir Khan</a> | * @version $Revision$ | */ | public class DbcTest { | | OfficeManager officeManagerProperty; //Used within run | | public DbcTest(String name) { | | } | | public static void main(String[] args) { | try { | new DbcTest("officetest").testOffice(); | } catch (Exception e) { | e.printStackTrace(); | } | } | | | public void testOffice() throws Exception { | System.out.println("****************** TEST OFFICE ******************"); | OfficeManager officeManager = new OfficeManager(); | | Computer compA = officeManager.createComputer("comp A"); | //officeManager.createComputer("comp B"); | Developer kabir = officeManager.createDeveloper("Kabir"); | | officeManager.assignComputer(compA, kabir); | | Developer bill = officeManager.createDeveloper("Bill"); | | Computer compB = officeManager.createComputer("comp B"); | officeManager.assignComputer(compB, bill); | | officeManagerProperty = officeManager; | ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1); | | executor.schedule( new Runnable(){ | public void run(){ | System.out.println("in run()"); | officeManagerProperty.createComputer("fromrunnable"); | System.out.println("end run()"); | } | } , 5, TimeUnit.SECONDS); | | | /* | try { | officeManager.createDeveloper(null); | if (true) | throw new Exception("Did not validate developer null name"); | } catch (RuntimeException e) { | } | */ | } | | | public void testStack() throws Exception { | System.out.println("****************** TEST STACK ******************"); | Stack s = new StackImpl(); | s.push("one"); | s.push("two"); | s.pop(); | | s.push("two"); | s.push("three"); | s.pop(); | s.pop(); | s.pop(); | try { | s.pop(); | throw new Exception("Did not validate empty stack before pop"); | } catch (RuntimeException e) { | System.out.println(e.getMessage()); | } | } | | public void testJavaExpression() throws Exception { | System.out.println("****************** TEST SORTER ******************"); | | int[] unsorted = new int[] { 4, 1, 5, 3 }; | Sorter.sort(unsorted); | | try { | Sorter.brokenSort(unsorted); | throw new Exception("Did not validate list was not sorted"); | } catch (RuntimeException e) { | System.out.println(e.getMessage()); | } | } | | } View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3951153#3951153 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3951153 _______________________________________________ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user