You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Oleg Kalnichevski (JIRA)" <ji...@apache.org> on 2007/02/11 15:57:05 UTC

[jira] Created: (HTTPCORE-43) Implement support for FileChannel#transferFrom and FileChannel#transferTo

Implement support for FileChannel#transferFrom and FileChannel#transferTo
-------------------------------------------------------------------------

                 Key: HTTPCORE-43
                 URL: https://issues.apache.org/jira/browse/HTTPCORE-43
             Project: HttpComponents Core
          Issue Type: Improvement
            Reporter: Oleg Kalnichevski
             Fix For: 4.0-alpha5


Implement optional support for FileChannel#transferFrom and FileChannel#transferTo operations. Direct coping from and to FileChannel is believed to result in a significant performance improvement for file bound operations 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Commented: (HTTPCORE-43) Implement support for FileChannel#transferFrom and FileChannel#transferTo

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12488959 ] 

Oleg Kalnichevski commented on HTTPCORE-43:
-------------------------------------------

Andrea,
I personally think FileChannel#transfer* methods simply cannot be used efficiently with chunk coding. This is the reason why I suggested FileContentEncoder and FileContentDecoder interfaces should be optional extensions of the base interfaces, which only Identity and ContentLength  encoders / decoders were meant to implement. I see no real benefit in Chunk encoder / decoder implementing the FileChannel interfaces at all.

Oleg

> Implement support for FileChannel#transferFrom and FileChannel#transferTo
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-43
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-43
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>            Reporter: Oleg Kalnichevski
>             Fix For: 4.0-alpha5
>
>
> Implement optional support for FileChannel#transferFrom and FileChannel#transferTo operations. Direct coping from and to FileChannel is believed to result in a significant performance improvement for file bound operations 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Commented: (HTTPCORE-43) Implement support for FileChannel#transferFrom and FileChannel#transferTo

Posted by "Steffen Pingel (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12490185 ] 

Steffen Pingel commented on HTTPCORE-43:
----------------------------------------

I have similar requirements performance requirements and would like to avoid buffering in NHttpServiceHandler but write directly to the channel (at least when LengthDelimitedEncoder is used). I am suggesting a new interface for entities that are tailored for NIO (so far I have only implemented this for writing):

public interface HttpNIOEntity extends HttpEntity {

    void produceContent(ContentEncoder encoder) throws IOException;

}

My custom service handler invokes entity.produceContent() in outputReady() in case of HttpNIOEntity objects and uses buffering for other entities. This also opens the possibility for IO control in entities. I am asynchronously reading chunks of a file to avoid blocking the NIO thread and use the content encoder to suspend output if reading from disk is slower than the writing network:

public interface ContentEncoder extends IOControl {
...
}


> Implement support for FileChannel#transferFrom and FileChannel#transferTo
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-43
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-43
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>            Reporter: Oleg Kalnichevski
>             Fix For: 4.0-alpha5
>
>
> Implement optional support for FileChannel#transferFrom and FileChannel#transferTo operations. Direct coping from and to FileChannel is believed to result in a significant performance improvement for file bound operations 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Commented: (HTTPCORE-43) Implement support for FileChannel#transferFrom and FileChannel#transferTo

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12487890 ] 

Oleg Kalnichevski commented on HTTPCORE-43:
-------------------------------------------

Andrea,
I think this functionality will have plugged in at a lower level. My plan was to add method that take FileChannel as an input parameter to the ContentDecoder and ContentEncoder interfaces:

http://jakarta.apache.org/httpcomponents/httpcore/jakarta-httpcore-nio/xref/org/apache/http/nio/ContentDecoder.html
http://jakarta.apache.org/httpcomponents/httpcore/jakarta-httpcore-nio/xref/org/apache/http/nio/ContentEncoder.html

Content codecs always keep a reference to the underlying I/O session and therefore are able to interact directly with the channel associated with that session.

Hope this helps

Oleg
  

> Implement support for FileChannel#transferFrom and FileChannel#transferTo
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-43
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-43
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>            Reporter: Oleg Kalnichevski
>             Fix For: 4.0-alpha5
>
>
> Implement optional support for FileChannel#transferFrom and FileChannel#transferTo operations. Direct coping from and to FileChannel is believed to result in a significant performance improvement for file bound operations 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Commented: (HTTPCORE-43) Implement support for FileChannel#transferFrom and FileChannel#transferTo

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12487724 ] 

Oleg Kalnichevski commented on HTTPCORE-43:
-------------------------------------------

Andrea,
I am not sure I understand the question. What do you mean by FileElement?

Oleg

> Implement support for FileChannel#transferFrom and FileChannel#transferTo
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-43
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-43
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>            Reporter: Oleg Kalnichevski
>             Fix For: 4.0-alpha5
>
>
> Implement optional support for FileChannel#transferFrom and FileChannel#transferTo operations. Direct coping from and to FileChannel is believed to result in a significant performance improvement for file bound operations 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Updated: (HTTPCORE-43) Implement support for FileChannel#transferFrom and FileChannel#transferTo

Posted by "Andrea Selva (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-43?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrea Selva updated HTTPCORE-43:
---------------------------------

    Attachment: transfer.patch

Thank's, here is the patch done for the submodule httpcore, i'm familiar with svn but never used to do a patch, so thanks for the help!!
Andrea

> Implement support for FileChannel#transferFrom and FileChannel#transferTo
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-43
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-43
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>            Reporter: Oleg Kalnichevski
>             Fix For: 4.0-alpha5
>
>         Attachments: transfer.patch, transfersImprove.tar.bz2
>
>
> Implement optional support for FileChannel#transferFrom and FileChannel#transferTo operations. Direct coping from and to FileChannel is believed to result in a significant performance improvement for file bound operations 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Commented: (HTTPCORE-43) Implement support for FileChannel#transferFrom and FileChannel#transferTo

Posted by "Andrea Selva (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12487812 ] 

Andrea Selva commented on HTTPCORE-43:
--------------------------------------

Sorry, my mind was thinking FileEntity and i' ve written FileElement. I've seen that in the http core, the IO for file is handled by the FileEntity class, if i not mistake, and tghis class gives one method for read from an InputStream and another to write to an OutputStream. Could you explain in more deep where and how insert the transferTo/From operation, please?


> Implement support for FileChannel#transferFrom and FileChannel#transferTo
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-43
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-43
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>            Reporter: Oleg Kalnichevski
>             Fix For: 4.0-alpha5
>
>
> Implement optional support for FileChannel#transferFrom and FileChannel#transferTo operations. Direct coping from and to FileChannel is believed to result in a significant performance improvement for file bound operations 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Commented: (HTTPCORE-43) Implement support for FileChannel#transferFrom and FileChannel#transferTo

Posted by "Andrea Selva (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12488174 ] 

Andrea Selva commented on HTTPCORE-43:
--------------------------------------

Yes i've understood, but adding a method only to pass a reference of FileChannel impose to rewrite part of the subclasses of AbstractContentDecoder/Encoder to effectively use the transfer functions. So you intend to modify the read functions to check if the ReadableByteChannel passed in isa FileChannel instance and if so, use the transferFrom to get the data? If this is the way you intend, i could try to do a simple poc implementation for the LengthDelimitedDecoder

> Implement support for FileChannel#transferFrom and FileChannel#transferTo
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-43
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-43
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>            Reporter: Oleg Kalnichevski
>             Fix For: 4.0-alpha5
>
>
> Implement optional support for FileChannel#transferFrom and FileChannel#transferTo operations. Direct coping from and to FileChannel is believed to result in a significant performance improvement for file bound operations 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Commented: (HTTPCORE-43) Implement support for FileChannel#transferFrom and FileChannel#transferTo

Posted by "Ortwin Glück (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12472111 ] 

Ortwin Glück commented on HTTPCORE-43:
--------------------------------------

Yep, and if you are going to use Channel.newChannel make sure to workaround this bug:
http://www.odi.ch/weblog/posting.php?posting=371

> Implement support for FileChannel#transferFrom and FileChannel#transferTo
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-43
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-43
>             Project: HttpComponents Core
>          Issue Type: Improvement
>            Reporter: Oleg Kalnichevski
>             Fix For: 4.0-alpha5
>
>
> Implement optional support for FileChannel#transferFrom and FileChannel#transferTo operations. Direct coping from and to FileChannel is believed to result in a significant performance improvement for file bound operations 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Updated: (HTTPCORE-43) Implement support for FileChannel#transferFrom and FileChannel#transferTo

Posted by "Andrea Selva (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-43?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrea Selva updated HTTPCORE-43:
---------------------------------

    Attachment: transfersImprove.tar.bz2

Hi, i've writed some code that i hope could be usefull. 
Let me know if it is what you have thinked.
Thanks
 Andrea

> Implement support for FileChannel#transferFrom and FileChannel#transferTo
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-43
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-43
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>            Reporter: Oleg Kalnichevski
>             Fix For: 4.0-alpha5
>
>         Attachments: transfersImprove.tar.bz2
>
>
> Implement optional support for FileChannel#transferFrom and FileChannel#transferTo operations. Direct coping from and to FileChannel is believed to result in a significant performance improvement for file bound operations 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Commented: (HTTPCORE-43) Implement support for FileChannel#transferFrom and FileChannel#transferTo

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12490755 ] 

Oleg Kalnichevski commented on HTTPCORE-43:
-------------------------------------------

Andrea,

Many thanks for this contribution. It would be much easier for me to review and commit the patch if it was submitted in the unified diff (diff -u) format. Please give me a few days to review the code

Oleg

> Implement support for FileChannel#transferFrom and FileChannel#transferTo
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-43
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-43
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>            Reporter: Oleg Kalnichevski
>             Fix For: 4.0-alpha5
>
>         Attachments: transfersImprove.tar.bz2
>
>
> Implement optional support for FileChannel#transferFrom and FileChannel#transferTo operations. Direct coping from and to FileChannel is believed to result in a significant performance improvement for file bound operations 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Commented: (HTTPCORE-43) Implement support for FileChannel#transferFrom and FileChannel#transferTo

Posted by "Andrea Selva (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12487715 ] 

Andrea Selva commented on HTTPCORE-43:
--------------------------------------

You intend to create an extension of FileElement?

> Implement support for FileChannel#transferFrom and FileChannel#transferTo
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-43
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-43
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>            Reporter: Oleg Kalnichevski
>             Fix For: 4.0-alpha5
>
>
> Implement optional support for FileChannel#transferFrom and FileChannel#transferTo operations. Direct coping from and to FileChannel is believed to result in a significant performance improvement for file bound operations 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Commented: (HTTPCORE-43) Implement support for FileChannel#transferFrom and FileChannel#transferTo

Posted by "Andrea Selva (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12488927 ] 

Andrea Selva commented on HTTPCORE-43:
--------------------------------------

Thanks, it help me to modify the LenghtDelimitedEncoder,now i'm tring to do the same thing on the ChunkEncoder, but i've noted that this works on a buffer and the previous on a channel. I think that if you want to use the transfer* methods of FileChannel, it use should be extended in the flush method of SessionOutputBuffer, but it seems to create an break in the design..i think.
Thanks for the attention
 Andrea

> Implement support for FileChannel#transferFrom and FileChannel#transferTo
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-43
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-43
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>            Reporter: Oleg Kalnichevski
>             Fix For: 4.0-alpha5
>
>
> Implement optional support for FileChannel#transferFrom and FileChannel#transferTo operations. Direct coping from and to FileChannel is believed to result in a significant performance improvement for file bound operations 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Resolved: (HTTPCORE-43) Implement support for FileChannel#transferFrom and FileChannel#transferTo

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-43?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCORE-43.
---------------------------------------

    Resolution: Fixed

Andrea,

The patch looks pretty good as far as I can tell. I checked it in with just some minor changes to the javadocs. Thank you so much for this contribution to the project.

Oleg

> Implement support for FileChannel#transferFrom and FileChannel#transferTo
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-43
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-43
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>            Reporter: Oleg Kalnichevski
>             Fix For: 4.0-alpha5
>
>         Attachments: transfer.patch, transfersImprove.tar.bz2
>
>
> Implement optional support for FileChannel#transferFrom and FileChannel#transferTo operations. Direct coping from and to FileChannel is believed to result in a significant performance improvement for file bound operations 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Commented: (HTTPCORE-43) Implement support for FileChannel#transferFrom and FileChannel#transferTo

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12490921 ] 

Oleg Kalnichevski commented on HTTPCORE-43:
-------------------------------------------

Andrea, 

If you are familiar with SVN command line interface, command 'svn diff > my.patch' should produce a patch in the unified diff format. Just make sure to add all local files to the repository control by calling 'svn add'

Oleg

> Implement support for FileChannel#transferFrom and FileChannel#transferTo
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-43
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-43
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>            Reporter: Oleg Kalnichevski
>             Fix For: 4.0-alpha5
>
>         Attachments: transfersImprove.tar.bz2
>
>
> Implement optional support for FileChannel#transferFrom and FileChannel#transferTo operations. Direct coping from and to FileChannel is believed to result in a significant performance improvement for file bound operations 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Commented: (HTTPCORE-43) Implement support for FileChannel#transferFrom and FileChannel#transferTo

Posted by "Andrea Selva (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12490838 ] 

Andrea Selva commented on HTTPCORE-43:
--------------------------------------

I'll do it in next days...once ready i'll post it

> Implement support for FileChannel#transferFrom and FileChannel#transferTo
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-43
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-43
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>            Reporter: Oleg Kalnichevski
>             Fix For: 4.0-alpha5
>
>         Attachments: transfersImprove.tar.bz2
>
>
> Implement optional support for FileChannel#transferFrom and FileChannel#transferTo operations. Direct coping from and to FileChannel is believed to result in a significant performance improvement for file bound operations 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Commented: (HTTPCORE-43) Implement support for FileChannel#transferFrom and FileChannel#transferTo

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12490257 ] 

Oleg Kalnichevski commented on HTTPCORE-43:
-------------------------------------------

Hi Steffen,

I like the idea. I probably would rather not have ContentEncoder extend IOControl, though. This should also do the job, shouldn't it? 

public interface HttpNIOEntity extends HttpEntity {

    void produceContent(ContentEncoder encoder, IOControl ioControl) throws IOException;

} 

Let us give Andrea some more time to come up with a patch for FileContentEncoders. Then we could look into adding support for NIO entities. You may want to open a separate Jira issue for that.

Oleg

> Implement support for FileChannel#transferFrom and FileChannel#transferTo
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-43
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-43
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>            Reporter: Oleg Kalnichevski
>             Fix For: 4.0-alpha5
>
>
> Implement optional support for FileChannel#transferFrom and FileChannel#transferTo operations. Direct coping from and to FileChannel is believed to result in a significant performance improvement for file bound operations 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Commented: (HTTPCORE-43) Implement support for FileChannel#transferFrom and FileChannel#transferTo

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12488183 ] 

Oleg Kalnichevski commented on HTTPCORE-43:
-------------------------------------------

Hi Andrea,

My very _preliminary_ plan was to provide a set of extended interfaces, which codecs capable of making an effective use of FileChannel (such as content length delimited and identity) may opt to implement in addition to base interfaces. Something along these lines

public interface FileContentDecoder extends ContentDecoder {

    long read(FileChannel channel, long position, long count) throws IOException;
    
}

public interface FileContentEncoder extends ContentEncoder {

    long write(FileChannel channel, long position, long count) throws IOException;

}

public class IdentityEncoder extends AbstractContentEncoder implements FileContentEncoder {
    
    private final WritableByteChannel channel;
   
...
 
    public IdentityEncoder(final WritableByteChannel channel) {
        super();
        if (channel == null) {
            throw new IllegalArgumentException("Channel may not be null");
        }
        this.channel = channel;
    }

    public long write(final FileChannel filechannel, long position, long count) throws IOException {
        if (channel == null) {
            return 0;
        }
        assertNotCompleted();
        return filechannel.transferTo(position, count, this.channel);
    }

...
    
}


If you were willing to take the first stab at it, it would be terrific.

Oleg


> Implement support for FileChannel#transferFrom and FileChannel#transferTo
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-43
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-43
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>            Reporter: Oleg Kalnichevski
>             Fix For: 4.0-alpha5
>
>
> Implement optional support for FileChannel#transferFrom and FileChannel#transferTo operations. Direct coping from and to FileChannel is believed to result in a significant performance improvement for file bound operations 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org