Home Comments

New streaming API comments

annekatannekat Member Christophe AvareOrganization: Thales Research & TechnologyProject: none at the moment ✭✭
1/ How to reset an Out/InputStream ?
There is a promising method BasicStream.reset() that allow stream recycling, but no clear equivalent in the user defined interfaces.
What is the behavior of the stream created by Ice.Util.createXXXStream(..) after a call to finish? Can it be reused for a new message?

2/ Useless code?
The BasicOutputStream is written as:
public class BasicOutputStream extends BasicStream
{
    public
    BasicOutputStream(Instance instance, Ice.OutputStream out)
    {
        super(instance);
        _out = out;
    }

    public Ice.OutputStream _out;
}
The _out argument is not used, and the only code that creates BasicOutputStream is in the OutputStreamI implementation:
public class OutputStreamI implements OutputStream
{
    public
    OutputStreamI(Communicator communicator)
    {
        _communicator = communicator;
        _os = new IceInternal.BasicOutputStream(Util.getInstance(communicator), this);
    }
The second (this) argument is used nowhere and adds no functionality.
Rewritting it as:
public class OutputStreamI implements OutputStream
{
    public
    OutputStreamI(Communicator communicator)
    {
        _communicator = communicator;
        _os = new IceInternal.BasicStream(Util.getInstance(communicator));
    }
have the same effect.
The BasicOutputStream class can be entirely removed without breaking any client.

Comments

  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    annekat wrote:
    1/ How to reset an Out/InputStream ?
    There is a promising method BasicStream.reset() that allow stream recycling, but no clear equivalent in the user defined interfaces.
    What is the behavior of the stream created by Ice.Util.createXXXStream(..) after a call to finish? Can it be reused for a new message?
    No, a stream cannot be reused.
    The BasicOutputStream class can be entirely removed without breaking any client.
    The BasicOutputStream class is not for use by Ice applications, as indicated by the fact that it is in the IceInternal package. This class is definitely necessary, but the reason is complex.

    - Mark
  • annekatannekat Member Christophe AvareOrganization: Thales Research & TechnologyProject: none at the moment ✭✭
    mes wrote:
    This class is definitely necessary, but the reason is complex.
    I really am interested in to discover the rational behind this design.
    Can you provide some background?

    And you can add this question to the shoplist:

    Why the BasicStream is a kind of input/output mixin class?
    (Usually, input and output related funtionnalities are provided by separate interfaces, eventually collapsed into one "full duplex" at some time in the stream type hierarchy.)

    Thanks
  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    annekat wrote:
    I really am interested in to discover the rational behind this design.
    Can you provide some background?
    As you've seen, the default implementation of the stream API delegates to the BasicStream class. To allow the stream implementations to handle object marshaling, we needed a way to pass state (namely, the stream object) through the object marshaling methods such as __write(IceInternal.BasicStream). By creating a simple subclass of BasicStream, we can attach state to the BasicStream instance and retrieve it later (see the implementation of Ice.ObjectWriter, for example).
    Why the BasicStream is a kind of input/output mixin class?
    I'll let Marc answer that.

    - Mark
  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    BasicStream is both an input and output stream because this simplifies Ice internals. Other than that I cannot provide more information, as discussing Ice internal design details (BasicStream is an internal class, i.e., the Ice application developer must not use it) is out of the scope of the support we can give here on this message board.
  • annekatannekat Member Christophe AvareOrganization: Thales Research & TechnologyProject: none at the moment ✭✭
    marc wrote:
    discussing Ice internal design details ... is out of the scope of the support we can give here on this message board.
    Take no offense, please!
    This is not a support request (thus i use this 'comments' newsgroup), just user feedback.
    The streaming API is new, its documentation minimalistic and of great interest for us. It just appears that its structure is slightly different of what we are accustomed to see in other streaming libraries, and we are looking for the best way to adapt ourselves.

    I understand you provide the best support for your product and you need to get time to develop it and make some business with it.

    Regards.
Sign In or Register to comment.