Examples of BlockingInputStream


Examples of org.exist.storage.io.BlockingInputStream

     */
    public XmlrpcInputStream(XmldbURL xmldbURL) {
       
        logger.debug("Initializing ResourceInputStream");
       
        bis = new BlockingInputStream();
        bos = bis.getOutputStream();
       
        rt = new XmlrpcDownloadThread(xmldbURL , bos);
       
        rt.start();
View Full Code Here

Examples of org.exist.storage.io.BlockingInputStream

     */
    public XmlrpcOutputStream(XmldbURL xmldbURL) {
       
        logger.debug("Initializing XmlrpcOutputStream");
       
        bis = new BlockingInputStream();
        bos = bis.getOutputStream();
       
        rt = new XmlrpcUploadThread(xmldbURL, bis);
        rt.start();
       
View Full Code Here

Examples of org.exist.storage.io.BlockingInputStream

   
    /** Creates a new instance of NodeInputStream */
    public NodeInputStream(Serializer serializer, NodeValue node) {
        logger.debug("Initializing NodeInputStream");
       
        bis = new BlockingInputStream();
        bos = bis.getOutputStream();
       
        rt = new NodeSerializerThread(serializer, node , bos);
       
        rt.start();
View Full Code Here

Examples of org.exist.storage.io.BlockingInputStream

     */
    public EmbeddedOutputStream(XmldbURL xmldbURL) {
       
        logger.debug("Initializing EmbeddedUploadThread");
       
        bis = new BlockingInputStream();
        bos = bis.getOutputStream();
       
        rt = new EmbeddedUploadThread(xmldbURL, bis);
        rt.start();
       
View Full Code Here

Examples of org.jgroups.util.BlockingInputStream

        getStateFromApplication(requester, bos, false);
    }

    protected Tuple<InputStream,Object> createStreamToProvider(final Address provider, final StateHeader hdr) {
        Util.close(input_stream);
        input_stream=new BlockingInputStream(buffer_size);
        return new Tuple<InputStream,Object>(input_stream, null);
    }
View Full Code Here

Examples of org.jgroups.util.BlockingInputStream

    }

   
    protected void createStreamToProvider(final Address provider, final StateHeader hdr) {
        Util.close(input_stream);
        input_stream=new BlockingInputStream(buffer_size);

        // use another thread to read state because the state requester has to receive state chunks from the state provider
        Thread t=getThreadFactory().newThread(new Runnable() {
            public void run() {
                setStateInApplication(provider, input_stream, hdr.getDigest());
View Full Code Here

Examples of org.jgroups.util.BlockingInputStream

@Test(groups=Global.FUNCTIONAL,sequential=false)
public class BlockingInputStreamTest {

   
    public void testCreation() throws IOException {
        BlockingInputStream in=new BlockingInputStream(2000);
        System.out.println("in = " + in);
        assert in.available() == 0 && in.capacity() == 2000;

        in.write(new byte[]{'b', 'e', 'l', 'a'});
        System.out.println("in = " + in);
        assert in.available() == 4 && in.capacity() == 2000;
    }
View Full Code Here

Examples of org.jgroups.util.BlockingInputStream

        assert in.available() == 4 && in.capacity() == 2000;
    }


    public void testRead() throws IOException {
        final BlockingInputStream in=new BlockingInputStream(100);
        byte[] input={'B', 'e', 'l', 'a'};
        in.write(input);
        in.close();

        assert in.available() == 4;
        for(int i=0; i < input.length; i++) {
            int b=in.read();
            assert b == input[i];
        }
        int b=in.read();
        assert b == -1;
    }
View Full Code Here

Examples of org.jgroups.util.BlockingInputStream

        assert b == -1;
    }


    public void testBlockingReadAndClose() throws IOException {
        final BlockingInputStream in=new BlockingInputStream(100);
        final CountDownLatch latch=new CountDownLatch(1);
        byte[] buf=new byte[100];
       
        new Closer(latch, in, 1000L).start(); // closes input stream after 1 sec
        latch.countDown();
        int num=in.read(buf, 0, buf.length);
        assert num == -1 : " expected -1 (EOF) but got " + num;
    }
View Full Code Here

Examples of org.jgroups.util.BlockingInputStream

        assert num == -1 : " expected -1 (EOF) but got " + num;
    }

   
    public void testBlockingWriteAndClose() throws IOException {
        final BlockingInputStream in=new BlockingInputStream(3);
        final CountDownLatch latch=new CountDownLatch(1);
        byte[] buf={'B', 'e', 'l', 'a'};

        new Closer(latch, in, 1000L).start(); // closes input stream after 1 sec
        latch.countDown();
        in.write(buf, 0, buf.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.