Package EDU.oswego.cs.dl.util.concurrent

Examples of EDU.oswego.cs.dl.util.concurrent.Slot


/*    */
/*    */   public FIFOSlot()
/*    */   {
/*    */     try
/*    */     {
/* 12 */       this.slot_ = new Slot(FIFOSemaphore.class);
/*    */     }
/*    */     catch (Exception ex) {
/* 15 */       ex.printStackTrace();
/* 16 */       throw new Error("Cannot make Slot?");
/*    */     }
View Full Code Here


        // Test disconnect. This will be fatal for most channels, but reliable
        // channels
        // should be able to recover from it. In any case transportConnected
        // should be false
        // immediately after the disconnect
        final Slot disconnectEvent = new Slot();
        sender.addTransportStatusEventListener(new TransportStatusEventListener() {
                public void statusChanged(TransportStatusEvent e) {
                    if( e.getChannelStatus() == TransportStatusEvent.DISCONNECTED ) {
                        try {
                            disconnectEvent.offer(e, 1000);
                        } catch (InterruptedException e1) {
                        }
                    }
                }
            });
        sender.forceDisconnect();

        assertNotNull("Should have received state change notification", disconnectEvent.poll(1000*30));
        assertFalse("Should be disconnected", sender.isTransportConnected());
        //there could ber exceptions thrown - which are valid for a force disconnect
        //so clear them so tearDown() will pass
        exceptions.clear();
    }
View Full Code Here

// Test disconnect. This will be fatal for most channels, but reliable
// channels
// should be able to recover from it. In any case transportConnected
// should be false
// immediately after the disconnect
        final Slot disconnectEvent = new Slot();
        sender.addTransportStatusEventListener(new TransportStatusEventListener() {
            public void statusChanged(TransportStatusEvent e) {
                if (e.getChannelStatus() == TransportStatusEvent.DISCONNECTED) {
                    try {
                        disconnectEvent.offer(e, 1000);
                    }
                    catch (InterruptedException e1) {
                    }
                }
            }
        });
        sender.forceDisconnect();

        assertNotNull("Should have received state change notification", disconnectEvent.poll(1000 * 30));
        assertFalse("Should be disconnected", sender.isTransportConnected());
//there could ber exceptions thrown - which are valid for a force disconnect
//so clear them so tearDown() will pass
        exceptions.clear();
    }
View Full Code Here

TOP

Related Classes of EDU.oswego.cs.dl.util.concurrent.Slot

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.