Package org.jacorb.notification

Examples of org.jacorb.notification.AnyMessage


     * enqueue a message into the queue which then should be returned to the first thread.
     * wrong synchronization led to a deadlock.
     */
    public void testDeadlock() throws Exception
    {
        final AnyMessage mesg = new AnyMessage();

        final AtomicBoolean received = new AtomicBoolean(false);
        final AtomicBoolean delivered = new AtomicBoolean(false);
        final CountDownLatch threadsDone = new CountDownLatch(1);
        final CountDownLatch getPutOrder = new CountDownLatch(1);
        final AtomicReference getException = new AtomicReference(null);
        final AtomicReference putException = new AtomicReference(null);

        final CyclicBarrier barrier = new CyclicBarrier(2, new Runnable()
        {
            public void run()
            {
                threadsDone.countDown();
            }
        });

        Runnable getCommand = new Runnable()
        {
            public void run()
            {
                try
                {
                    synchronized (lock_)
                    {
                        getPutOrder.countDown();
                        objectUnderTest_.getMessageBlocking();
                    }

                    received.set(true);
                } catch (Exception e)
                {
                    getException.set(e);
                }
                finally
                {
                    try
                    {
                        barrier.await();
                    } catch (InterruptedException e)
                    {
                        // ignored
                    } catch (BrokenBarrierException e)
                    {
                        // should not happen
                        e.printStackTrace();
                    }
                }
            }
        };

        Runnable putCommand = new Runnable()
        {
            public void run()
            {
                try
                {
                    getPutOrder.await();

                    objectUnderTest_.enqeue(mesg.getHandle());

                    delivered.set(true);
                } catch (Exception e)
                {
                    putException.set(e);
View Full Code Here


        super(name, setup);
    }

    public void setUpTest() throws Exception
    {
        objectUnderTest_ = new AnyMessage();
    }
View Full Code Here

            // received a StructuredEvent wrapped inside an Any
            // see Spec. 2-11
            return newMessage(StructuredEventHelper.extract(any), consumer);
        }

        AnyMessage _mesg = newAnyMessage(any);

        _mesg.initReceiveTimestamp();

        _mesg.setFilterStage(consumer.getFirstStage());

        return _mesg.getHandle();
    }
View Full Code Here

        if (StructuredEventHelper.type().equals(any.type()))
        {
            return newMessage(StructuredEventHelper.extract(any));
        }

        AnyMessage _mesg = newAnyMessage(any);

        return _mesg.getHandle();
    }
View Full Code Here

        return _mesg.getHandle();
    }

    private AnyMessage newAnyMessage(Any any)
    {
        AnyMessage _mesg = (AnyMessage) anyMessagePool_.lendObject();

        _mesg.setAny(any);

        return _mesg;
    }
View Full Code Here

            // received a StructuredEvent wrapped inside an Any
            // see Spec. 2-11
            return newMessage(StructuredEventHelper.extract(any), consumer);
        }

        AnyMessage _mesg = newAnyMessage(any);

        _mesg.initReceiveTimestamp();

        _mesg.setFilterStage(consumer.getFirstStage());

        return _mesg.getHandle();
    }
View Full Code Here

        if (StructuredEventHelper.type().equals(any.type()))
        {
            return newMessage(StructuredEventHelper.extract(any));
        }

        AnyMessage _mesg = newAnyMessage(any);

        return _mesg.getHandle();
    }
View Full Code Here

        return _mesg.getHandle();
    }

    private AnyMessage newAnyMessage(Any any)
    {
        AnyMessage _mesg = (AnyMessage) anyMessagePool_.lendObject();

        _mesg.setAny(any);

        return _mesg;
    }
View Full Code Here

            // received a StructuredEvent wrapped inside an Any
            // see Spec. 2-11
            return newMessage(StructuredEventHelper.extract(any), consumer);
        }

        AnyMessage _mesg = newAnyMessage(any);

        _mesg.initReceiveTimestamp();

        _mesg.setFilterStage(consumer.getFirstStage());

        return _mesg.getHandle();
    }
View Full Code Here

        if (StructuredEventHelper.type().equals(any.type()))
        {
            return newMessage(StructuredEventHelper.extract(any));
        }

        AnyMessage _mesg = newAnyMessage(any);

        return _mesg.getHandle();
    }
View Full Code Here

TOP

Related Classes of org.jacorb.notification.AnyMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.