Changeset 41c38e6


Ignore:
Timestamp:
Oct 11, 2008 1:23:55 PM (12 years ago)
Author:
sponge <sponge@…>
Branches:
master
Children:
87a992b
Parents:
ca5c15d
Message:

Added JDK5 lint fixes
Streaming lib javadocs

Location:
apps/streaming/java/src/net/i2p/client/streaming
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • apps/streaming/java/src/net/i2p/client/streaming/Connection.java

    rca5c15d r41c38e6  
    575575   
    576576    private boolean _remotePeerSet = false;
    577     /** who are we talking with */
     577    /** who are we talking with
     578     * @return peer Destination
     579     */
    578580    public Destination getRemotePeer() { return _remotePeer; }
    579581    public void setRemotePeer(Destination peer) {
     
    584586   
    585587    private boolean _sendStreamIdSet = false;
    586     /** what stream do we send data to the peer on? */
     588    /** what stream do we send data to the peer on?
     589     * @return non-global stream sending ID
     590     */
    587591    public long getSendStreamId() { return _sendStreamId; }
    588592    public void setSendStreamId(long id) {
     
    593597   
    594598    private boolean _receiveStreamIdSet = false;
    595     /** stream the peer sends data to us on. (may be null) */
     599    /** The stream ID of a peer connection that sends data to us. (may be null)
     600     * @return receive stream ID, or null if there isn't one
     601     */
    596602    public long getReceiveStreamId() { return _receiveStreamId; }
    597603    public void setReceiveStreamId(long id) {
     
    602608    }
    603609   
    604     /** when did we last send anything to the peer? */
     610    /** When did we last send anything to the peer?
     611     * @return Last time we sent data
     612     */
    605613    public long getLastSendTime() { return _lastSendTime; }
     614    /** Set the time we sent data.
     615     * @param when The time we sent data
     616     */
    606617    public void setLastSendTime(long when) { _lastSendTime = when; }
    607618   
    608     /** what was the last packet Id sent to the peer? */
     619    /** What was the last packet Id sent to the peer?
     620     * @return The last sent packet ID
     621     */
    609622    public long getLastSendId() { return _lastSendId; }
     623    /** Set the packet Id that was sent to a peer.
     624     * @param id The packet ID
     625     */
    610626    public void setLastSendId(long id) { _lastSendId = id; }
    611627   
     628    /**
     629     * Retrieve the current ConnectionOptions.
     630     * @return the current ConnectionOptions
     631     */
    612632    public ConnectionOptions getOptions() { return _options; }
     633    /**
     634     * Set the ConnectionOptions.
     635     * @param opts ConnectionOptions
     636     */
    613637    public void setOptions(ConnectionOptions opts) { _options = opts; }
    614638       
     
    642666     * never.  This should be set when we want to send on timeout, for
    643667     * instance, or want to delay an ACK.
     668     * @return the next time the scheduler will want to send a packet, or -1 if never.
    644669     */
    645670    public long getNextSendTime() { return _nextSendTime; }
     
    666691    }
    667692   
    668     /** how many packets have we sent and the other side has ACKed? */
     693    /** how many packets have we sent and the other side has ACKed?
     694     * @return Count of how many packets ACKed.
     695     */
    669696    public long getAckedPackets() { return _ackedPackets; }
    670697    public long getCreatedOn() { return _createdOn; }
     
    682709    public void incrementUnackedPacketsReceived() { _unackedPacketsReceived++; }
    683710    public int getUnackedPacketsReceived() { return _unackedPacketsReceived; }
    684     /** how many packets have we sent but not yet received an ACK for? */
     711    /** how many packets have we sent but not yet received an ACK for?
     712     * @return Count of packets in-flight.
     713     */
    685714    public int getUnackedPacketsSent() {
    686715        synchronized (_outboundPackets) {
     
    858887    }
    859888   
    860     /** stream that the local peer receives data on */
     889    /** stream that the local peer receives data on
     890     * @return the inbound message stream
     891     */
    861892    public MessageInputStream getInputStream() { return _inputStream; }
    862     /** stream that the local peer sends data to the remote peer on */
     893    /** stream that the local peer sends data to the remote peer on
     894     * @return the outbound message stream
     895     */
    863896    public MessageOutputStream getOutputStream() { return _outputStream; }
    864897   
     898        @Override
    865899    public String toString() {
    866900        StringBuffer buf = new StringBuffer(128);
     
    928962     */
    929963    class ConEvent implements SimpleTimer.TimedEvent {
    930         private Exception _addedBy;
     964        private Exception _addedBy; // unused?
    931965        public ConEvent() {
    932966            //_addedBy = new Exception("added by");
  • apps/streaming/java/src/net/i2p/client/streaming/ConnectionManager.java

    rca5c15d r41c38e6  
    105105    /**
    106106     * Get the socket accept() timeout.
    107      * @return
     107     * @return accept timeout in ms.
    108108     */
    109109    public long MgetSoTimeout() {
     
    122122     * Create a new connection based on the SYN packet we received.
    123123     *
     124     * @param synPacket SYN packet to process
    124125     * @return created Connection with the packet's data already delivered to
    125126     *         it, or null if the syn's streamId was already taken
     
    191192     * connection delay, otherwise it returns immediately.
    192193     *
    193      * @return new connection, or null if we have exceeded our limit
     194     * @param peer Destination to contact
     195     * @param opts Connection's options
     196     * @return new connection, or null if we have exceeded our limit
    194197     */
    195198    public Connection connect(Destination peer, ConnectionOptions opts) {
     
    294297     * Drop the (already closed) connection on the floor.
    295298     *
     299     * @param con Connection to drop.
    296300     */
    297301    public void removeConnection(Connection con) {
     
    320324    }
    321325   
    322     /** return a set of Connection objects */
     326    /** return a set of Connection objects
     327     * @return set of Connection objects
     328     */
    323329    public Set listConnections() {
    324330        synchronized (_connectionLock) {
  • apps/streaming/java/src/net/i2p/client/streaming/ConnectionOptions.java

    rca5c15d r41c38e6  
    9595    }
    9696   
     97        @Override
    9798    protected void init(Properties opts) {
    9899        super.init(opts);
     
    119120    }
    120121   
     122        @Override
    121123    public void setProperties(Properties opts) {
    122124        super.setProperties(opts);
     
    165167     * or that many milliseconds pass.
    166168     *
     169     * @return how long to wait before actually attempting to connect
    167170     */
    168171    public int getConnectDelay() { return _connectDelay; }
     
    174177     * only?
    175178     *
     179     * @return if we want signatures on all packets.
    176180     */
    177181    public boolean getRequireFullySigned() { return _fullySigned; }
     
    181185     * How many messages will we send before waiting for an ACK?
    182186     *
     187     * @return Maximum amount of messages that can be in-flight
    183188     */
    184189    public int getWindowSize() { return _windowSize; }
     
    196201    }
    197202   
    198     /** after how many consecutive messages should we ack? */
     203    /** after how many consecutive messages should we ack?
     204     * @return receive window size.
     205     */
    199206    public int getReceiveWindow() { return _receiveWindow; }
    200207    public void setReceiveWindow(int numMsgs) { _receiveWindow = numMsgs; }
     
    202209    /**
    203210     * What to set the round trip time estimate to (in milliseconds)
     211     * @return round trip time estimate in ms
    204212     */
    205213    public int getRTT() { return _rtt; }
     
    230238     * 3 consecutive rtt decreases, we are trending downwards (-1), else we're stable.
    231239     *
     240     * @return positive/flat/negative trend in round trip time
    232241     */
    233242    public int getRTTTrend() {
     
    256265    }
    257266   
    258     /** How long after sending a packet will we wait before resending? */
     267    /** How long after sending a packet will we wait before resending?
     268     * @return delay for a retransmission in ms
     269     */
    259270    public int getResendDelay() { return _resendDelay; }
    260271    public void setResendDelay(int ms) { _resendDelay = ms; }
     
    266277     * we have received so far.
    267278     *
     279     * @return ACK delay in ms
    268280     */
    269281    public int getSendAckDelay() { return _sendAckDelay; }
    270282    public void setSendAckDelay(int delayMs) { _sendAckDelay = delayMs; }
    271283   
    272     /** What is the largest message we want to send or receive? */
     284    /** What is the largest message we want to send or receive?
     285     * @return Maximum message size (MTU/MRU)
     286     */
    273287    public int getMaxMessageSize() { return _maxMessageSize; }
    274288    public void setMaxMessageSize(int bytes) { _maxMessageSize = bytes; }
     
    278292     * connection in either direction
    279293     *
     294     * @return how long to wait before any data is transferred in either direction in ms
    280295     */
    281296    public int getChoke() { return _choke; }
     
    284299    /**
    285300     * What profile do we want to use for this connection?
    286      *
     301     * TODO: Only bulk is supported so far.
     302     * @return the profile of the connection.
    287303     */
    288304    public int getProfile() { return _profile; }
     
    296312     * How many times will we try to send a message before giving up?
    297313     *
     314     * @return Maximum retrys before failing a sent message.
    298315     */
    299316    public int getMaxResends() { return _maxResends; }
     
    303320     * What period of inactivity qualifies as "too long"?
    304321     *
     322     * @return period of inactivity qualifies as "too long"
    305323     */
    306324    public int getInactivityTimeout() { return _inactivityTimeout; }
     
    323341     * how much data are we willing to accept in our buffer?
    324342     *
     343     * @return size of the buffer used to accept data
    325344     */
    326345    public int getInboundBufferSize() { return _inboundBufferSize; }
     
    332351     * while in I2P, window sizes are in messages, so setting factor=maxMessageSize
    333352     * mimics TCP, but using a smaller factor helps grow a little more rapidly.
     353     * @return window size to grow by to attempt to avoid congestion.
    334354     */
    335355    public int getCongestionAvoidanceGrowthRateFactor() { return _congestionAvoidanceGrowthRateFactor; }
     
    341361     * while in I2P, window sizes are in messages, so setting factor=maxMessageSize
    342362     * mimics TCP, but using a smaller factor helps grow a little more rapidly.
     363     * @return slow start window size to grow by to attempt to avoid sending many small packets.
    343364     */
    344365    public int getSlowStartGrowthRateFactor() { return _slowStartGrowthRateFactor; }
    345366    public void setSlowStartGrowthRateFactor(int factor) { _slowStartGrowthRateFactor = factor; }
    346367   
     368        @Override
    347369    public String toString() {
    348370        StringBuffer buf = new StringBuffer(128);
  • apps/streaming/java/src/net/i2p/client/streaming/I2PServerSocketFull.java

    rca5c15d r41c38e6  
    1717    /**
    1818     *
    19      * @return
     19     * @return I2PSocket
    2020     * @throws net.i2p.I2PException
    2121     * @throws SocketTimeoutException
  • apps/streaming/java/src/net/i2p/client/streaming/I2PSocketFull.java

    rca5c15d r41c38e6  
    120120            c.disconnectComplete();
    121121    }
     122        @Override
    122123    public String toString() {
    123124        Connection c = _connection;
  • apps/streaming/java/src/net/i2p/client/streaming/I2PSocketManagerFull.java

    rca5c15d r41c38e6  
    113113    /**
    114114     *
    115      * @return
     115     * @return connected I2PSocket
    116116     * @throws net.i2p.I2PException
    117117     * @throws java.net.SocketTimeoutException
     
    142142     * @param peer
    143143     * @param timeoutMs
    144      * @return
     144     * @return true on success, false on failure
    145145     */
    146146    public boolean ping(Destination peer, long timeoutMs) {
     
    247247     * Retrieve a set of currently connected I2PSockets, either initiated locally or remotely.
    248248     *
     249     * @return set of currently connected I2PSockets
    249250     */
    250251    public Set listSockets() {
  • apps/streaming/java/src/net/i2p/client/streaming/MessageHandler.java

    rca5c15d r41c38e6  
    7171     * Notify the client that the session has been terminated
    7272     *
     73     * @param session that has been terminated
    7374     */
    7475    public void disconnected(I2PSession session) {
     
    9192     * Notify the client that some error occurred
    9293     *
     94     * @param session of the client
     95     * @param message to send to the client about the error
     96     * @param error the actual error
    9397     */
    9498    public void errorOccurred(I2PSession session, String message, Throwable error) {
  • apps/streaming/java/src/net/i2p/client/streaming/MessageInputStream.java

    rca5c15d r41c38e6  
    7474    }
    7575   
    76     /** What is the highest block ID we've completely received through? */
     76    /** What is the highest block ID we've completely received through?
     77     * @return highest data block ID completely received
     78     */
    7779    public long getHighestReadyBockId() {
    7880        // not synchronized as it doesnt hurt to read a too-low value
     
    9092     * ID.  This may return null if there are no such IDs.
    9193     *
     94     * @return array of message ID holes, or null if none
    9295     */
    9396    public long[] getNacks() {
     
    129132     * ready block ID, or null if there aren't any.
    130133     *
     134     * @return block IDs greater than the highest ready block ID, or null if there aren't any.
    131135     */
    132136    public long[] getOutOfOrderBlocks() {
     
    147151    }
    148152   
    149     /** how many blocks have we received that we still have holes before? */
     153    /** how many blocks have we received that we still have holes before?
     154     * @return Count of blocks received that still have holes
     155     */
    150156    public int getOutOfOrderBlockCount() {
    151157        synchronized (_dataLock) {
     
    157163     * how long a read() call should block (if less than 0, block indefinitely,
    158164     * but if it is 0, do not block at all)
     165     * @return how long read calls should block, 0 or less indefinitely block
    159166     */
    160167    public int getReadTimeout() { return _readTimeout; }
     
    204211     * previously pending messages to the ready queue if it fills the gap, etc).
    205212     *
     213     * @param messageId ID of the message
     214     * @param payload message payload
    206215     * @return true if this is a new packet, false if it is a dup
    207216     */
     
    261270    }
    262271   
     272        @Override
    263273    public int read(byte target[]) throws IOException {
    264274        return read(target, 0, target.length);
    265275    }
    266276   
     277        @Override
    267278    public int read(byte target[], int offset, int length) throws IOException {
    268279        if (_locallyClosed) throw new IOException("Already locally closed");
     
    361372    }
    362373   
     374        @Override
    363375    public int available() throws IOException {
    364376        if (_locallyClosed) throw new IOException("Already closed, you wanker");
     
    384396     * buffer)?
    385397     *
     398     * @return Count of bytes waiting to be read
    386399     */
    387400    public int getTotalQueuedSize() {
     
    419432    }
    420433   
     434        @Override
    421435    public void close() {
    422436        synchronized (_dataLock) {
  • apps/streaming/java/src/net/i2p/client/streaming/MessageOutputStream.java

    rca5c15d r41c38e6  
    7878    public void setBufferSize(int size) { _nextBufferSize = size; }
    7979   
     80        @Override
    8081    public void write(byte b[]) throws IOException {
    8182        write(b, 0, b.length);
    8283    }
    8384   
     85        @Override
    8486    public void write(byte b[], int off, int len) throws IOException {
    8587        if (_closed) throw new IOException("Already closed");
     
    160162        if (periods > 0) {
    161163            // first term decays on slow transmission
    162             _sendBps = (int)(((float)0.9f*((float)_sendBps/(float)periods)) + ((float)0.1f*((float)_sendPeriodBytes/(float)periods)));
     164            _sendBps = (int)((0.9f*((float)_sendBps/(float)periods)) + (0.1f*((float)_sendPeriodBytes/(float)periods)));
    163165            _sendPeriodBytes = len;
    164166            _sendPeriodBeginTime = now;
     
    256258     *
    257259     * @throws IOException if the write fails
    258      * @throws InterruptedIOException if the write times out
    259260     */
     261        @Override
    260262    public void flush() throws IOException {
     263     /* @throws InterruptedIOException if the write times out
     264      * Documented here, but doesn't belong in the javadoc.
     265      */
    261266        long begin = _context.clock().now();
    262267        WriteStatus ws = null;
  • apps/streaming/java/src/net/i2p/client/streaming/Packet.java

    rca5c15d r41c38e6  
    150150   
    151151    private boolean _sendStreamIdSet = false;
    152     /** what stream do we send data to the peer on? */
     152    /** what stream do we send data to the peer on?
     153     * @return stream ID we use to send data
     154     */
    153155    public long getSendStreamId() { return _sendStreamId; }
    154156    public void setSendStreamId(long id) {
     
    163165     * stream the replies should be sent on.  this should be 0 if the
    164166     * connection is still being built.
     167     * @return stream ID we use to get data, zero if the connection is still being built.
    165168     */
    166169    public long getReceiveStreamId() { return _receiveStreamId; }
     
    172175    }
    173176   
    174     /** 0-indexed sequence number for this Packet in the sendStream */
     177    /** 0-indexed sequence number for this Packet in the sendStream
     178     * @return 0-indexed sequence number for current Packet in current sendStream
     179     */
    175180    public long getSequenceNum() { return _sequenceNum; }
    176181    public void setSequenceNum(long num) { _sequenceNum = num; }
     
    182187     * if FLAG_NO_ACK is set.
    183188     *
     189     * @return The highest packet sequence number received on receiveStreamId
    184190     */
    185191    public long getAckThrough() {
     
    199205     * have not been received.  this may be null.
    200206     *
     207     * @return List of packet sequence numbers not ACKed, or null if there are none.
    201208     */
    202209    public long[] getNacks() { return _nacks; }
     
    208215     * value is seconds since the packet was created.
    209216     *
     217     * @return Delay before resending a packet in seconds.
    210218     */
    211219    public int getResendDelay() { return _resendDelay; }
     
    214222    public static final int MAX_PAYLOAD_SIZE = 32*1024;
    215223   
    216     /** get the actual payload of the message.  may be null */
     224    /** get the actual payload of the message.  may be null
     225     * @return the payload of the message, null if none.
     226     */
    217227    public ByteArray getPayload() { return _payload; }
    218228    public void setPayload(ByteArray payload) {
     
    233243    }
    234244
    235     /** is a particular flag set on this packet? */
     245    /** is a particular flag set on this packet?
     246     * @param flag bitmask of any flag(s)
     247     * @return true if set, false if not.
     248     */
    236249    public boolean isFlagSet(int flag) { return 0 != (_flags & flag); }
    237250    public void setFlag(int flag) { _flags |= flag; }
     
    244257    public void setFlags(int flags) { _flags = flags; }
    245258
    246     /** the signature on the packet (only included if the flag for it is set) */
     259    /** the signature on the packet (only included if the flag for it is set)
     260     * @return signature on the packet if the flag for signatures is set
     261     */
    247262    public Signature getOptionalSignature() { return _optionSignature; }
    248263    public void setOptionalSignature(Signature sig) {
     
    251266    }
    252267
    253     /** the sender of the packet (only included if the flag for it is set) */
     268    /** the sender of the packet (only included if the flag for it is set)
     269     * @return the sending Destination
     270     */
    254271    public Destination getOptionalFrom() { return _optionFrom; }
    255272    public void setOptionalFrom(Destination from) {
     
    263280     * to wait before sending any more data (only valid if the flag for it is
    264281     * set)
     282     * @return How long the sender wants the recipient to wait before sending any more data in ms.
    265283     */
    266284    public int getOptionalDelay() { return _optionDelay; }
     
    277295     * What is the largest payload the sender of this packet wants to receive?
    278296     *
     297     * @return Maximum payload size sender can receive (MRU)
    279298     */
    280299    public int getOptionalMaxSize() { return _optionMaxSize; }
     
    288307     * the number of bytes written.
    289308     *
     309     * @param buffer bytes to write to a destination
     310     * @param offset starting point in the buffer to send
     311     * @return Count actually written
    290312     * @throws IllegalStateException if there is data missing or otherwise b0rked
    291313     */
     
    371393    /**
    372394     * how large would this packet be if we wrote it
     395     * @return How large the current packet would be
     396     * @throws IllegalStateException
    373397     */
    374398    public int writtenSize() throws IllegalStateException {
     
    498522     * Determine whether the signature on the data is valid. 
    499523     *
    500      * @return true if the signature exists and validates against the data,
     524     * @param ctx Application context
     525     * @param from the Destination the data came from
     526     * @param buffer data to validate with signature
     527     * @return true if the signature exists and validates against the data,
    501528     *         false otherwise.
    502529     */
     
    531558     * the number of bytes written.
    532559     *
     560     * @param buffer data to be written
     561     * @param offset starting point in the buffer
     562     * @param ctx Application Context
     563     * @param key signing key
     564     * @return Count of bytes written
    533565     * @throws IllegalStateException if there is data missing or otherwise b0rked
    534566     */
     
    561593    }
    562594   
     595        @Override
    563596    public String toString() {
    564597        StringBuffer str = formatAsString();
  • apps/streaming/java/src/net/i2p/client/streaming/PacketLocal.java

    rca5c15d r41c38e6  
    108108    public SimpleTimer.TimedEvent getResendEvent() { return _resendEvent; }
    109109   
    110     /** how long after packet creation was it acked? */
     110    /** how long after packet creation was it acked?
     111     * @return how long after packet creation the packet was ACKed in ms
     112     */
    111113    public int getAckTime() {
    112114        if (_ackOn <= 0)
     
    131133    public void setResendPacketEvent(SimpleTimer.TimedEvent evt) { _resendEvent = evt; }
    132134   
     135        @Override
    133136    public StringBuffer formatAsString() {
    134137        StringBuffer buf = super.formatAsString();
Note: See TracChangeset for help on using the changeset viewer.