Examples of Isolate


Examples of com.sun.cldc.isolate.Isolate

    /**
     * Tests send() followed by a receive().
     */
    void testSendReceive() throws IOException {
        String sendstr = "foo";
        Isolate i = Isolate.currentIsolate();
        Link link = Link.newLink(i, i);
        Sender sender = new Sender(link,
            LinkMessage.newStringMessage(sendstr));

        assertFalse("sender should be blocked", sender.done);
View Full Code Here

Examples of com.sun.cldc.isolate.Isolate

    /**
     * Tests that close() will unblock a thread blocked in receive().
     */
    void testReceiveClose() throws IOException {
        Isolate i = Isolate.currentIsolate();
        Link link = Link.newLink(i, i);
        Receiver receiver = new Receiver(link);

        assertFalse("receiver should be blocked", receiver.done);
        assertNull("receiver should have no exceptions", receiver.exception);
View Full Code Here

Examples of com.sun.cldc.isolate.Isolate

    /**
     * Tests that close() will unblock a thread blocked in send().
     */
    void testSendClose() throws IOException {
        Isolate i = Isolate.currentIsolate();
        Link link = Link.newLink(i, i);
        Sender sender = new Sender(link,
            LinkMessage.newStringMessage("foobar"));

        assertFalse("sender should be blocked", sender.done);
View Full Code Here

Examples of com.sun.cldc.isolate.Isolate

    /**
     * Tests that the native rendezvous point structure is getting cleaned up
     * properly by the finalizer.
     */
    void testCleanup() {
        Isolate i = Isolate.currentIsolate();
        Link link = Link.newLink(i, i);
        int rp = link.hashCode();

        assertEquals("refcount must be 1", 1, Utils.getRefCount(link));

View Full Code Here

Examples of com.sun.cldc.isolate.Isolate

    /**
     * Tests link creation with isolates in different states.
     */
    void testIsolateStates() throws IOException, IsolateStartupException {
        boolean thrown;
        Isolate us = Isolate.currentIsolate();
        Isolate them = new Isolate("com.sun.midp.links.Empty", null);

        thrown = false;
        try {
            Link link = Link.newLink(us, them);
        } catch (IllegalStateException ise) {
            thrown = true;
        }
        assertTrue("started,new should throw ISE", thrown);

        thrown = false;
        try {
            Link link = Link.newLink(them, us);
        } catch (IllegalStateException ise) {
            thrown = true;
        }
        assertTrue("new,started should throw ISE", thrown);

        them.start();

        thrown = false;
        try {
            Link link = Link.newLink(us, them);
        } catch (IllegalStateException ise) {
            thrown = true;
        }
        assertFalse("started,started should not throw ISE", thrown);

        thrown = false;
        try {
            Link link = Link.newLink(them, us);
        } catch (IllegalStateException ise) {
            thrown = true;
        }
        assertFalse("started,started should not throw ISE", thrown);

        them.exit(0);
        them.waitForExit();

        thrown = false;
        try {
            Link link = Link.newLink(us, them);
        } catch (IllegalStateException ise) {
View Full Code Here

Examples of com.sun.cldc.isolate.Isolate

    /**
     * Tests receiver and sender isolate access for a link.
     */
    void testAccess() throws IOException, IsolateStartupException {
        Isolate i1 = Isolate.currentIsolate();
        Isolate i2 = new Isolate("com.sun.midp.links.Empty", null);
        i2.start();
        Link link1 = Link.newLink(i1, i2);
        Link link2 = Link.newLink(i2, i1);
        boolean thrown;

        thrown = false;
        try {
            LinkMessage lm = link1.receive();
        } catch (IllegalArgumentException iae) {
            thrown = true;
        }
        assertTrue("receive should catch IAE", thrown);

        thrown = false;
        try {
            link2.send(LinkMessage.newStringMessage("hello"));
        } catch (IllegalArgumentException iae) {
            thrown = true;
        }
        assertTrue("send should catch IAE", thrown);

        i2.exit(0);
    }
View Full Code Here

Examples of com.sun.cldc.isolate.Isolate

     * ensures that each time exactly one thread is unblocked and has received
     * the message just sent. Finally, after sending enough messages, ensures
     * that all threads have been accounted for.
     */
    void testReceivers() throws IOException {
        Isolate is = Isolate.currentIsolate();
        Link link = Link.newLink(is, is);
        Receiver ra[] = new LoggingReceiver[NUM_THREADS];

        doneset = new Hashtable(NUM_THREADS);
        messages = new Hashtable(NUM_THREADS);
View Full Code Here

Examples of com.sun.cldc.isolate.Isolate

     * ensures that each time exactly one thread is unblocked and had sent the
     * message just received. Finally, after receiving enough messages,
     * ensures that all threads have been accounted for.
     */
    void testSenders() throws IOException {
        Isolate is = Isolate.currentIsolate();
        Link link = Link.newLink(is, is);
        LoggingSender sa[] = new LoggingSender[NUM_THREADS];

        for (int i = 0; i < NUM_THREADS; i++) {
            String s = Integer.toString(rand.nextInt());
View Full Code Here

Examples of com.sun.cldc.isolate.Isolate

    /**
     * Tests passing null for arguments.
     */
    void testNulls() {
        boolean thrown;
        Isolate is = Isolate.currentIsolate();
        Link[] la = new Link[3];
        la[0] = Link.newLink(is, is);
        la[1] = Link.newLink(is, is);
        la[2] = Link.newLink(is, is);

View Full Code Here

Examples of com.sun.cldc.isolate.Isolate

    /**
     * Tests zero-length setting and getting operations.
     */
    void testZero() {
        Link[] la;
        Isolate is = Isolate.currentIsolate();

        LinkPortal.setLinks(is, new Link[0]);
        la = LinkPortal.getLinks();
        assertNotNull("shouldn't be null", la);
        assertEquals("length zero", 0, la.length);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.