You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by jv...@apache.org on 2009/10/20 18:01:04 UTC

svn commit: r827715 - /mina/branches/3.0/core/src/main/java/org/apache/mina/impl/AbstractIoSession.java

Author: jvermillard
Date: Tue Oct 20 16:01:04 2009
New Revision: 827715

URL: http://svn.apache.org/viewvc?rev=827715&view=rev
Log:
more AbstractIoSession, to be continued

Modified:
    mina/branches/3.0/core/src/main/java/org/apache/mina/impl/AbstractIoSession.java

Modified: mina/branches/3.0/core/src/main/java/org/apache/mina/impl/AbstractIoSession.java
URL: http://svn.apache.org/viewvc/mina/branches/3.0/core/src/main/java/org/apache/mina/impl/AbstractIoSession.java?rev=827715&r1=827714&r2=827715&view=diff
==============================================================================
--- mina/branches/3.0/core/src/main/java/org/apache/mina/impl/AbstractIoSession.java (original)
+++ mina/branches/3.0/core/src/main/java/org/apache/mina/impl/AbstractIoSession.java Tue Oct 20 16:01:04 2009
@@ -40,12 +40,23 @@
     
     private long id;
     
+    private long creationTime;
+    
+    
+    private long readBytes;
+    private long writtenBytes;
+
+    // variable for idle checking
+    private long lastReadTime;
+    private long lastWriteTime;
+    
     /**
      * Create an {@link IoSession} with a unique identifier ({@link IoSession#getId()})
      */
     public AbstractIoSession() {
         // generated a unique id
         id = NEXT_ID.getAndIncrement();
+        creationTime = System.currentTimeMillis();
         LOG.debug("Created new session with id : {}",id);
     }
     
@@ -54,4 +65,34 @@
         return id;
     }
     
-} 
+    @Override
+    public long getCreationTime() {
+        return creationTime;
+    }
+    
+    @Override
+    public long getReadBytes() {
+        return readBytes;
+    }
+    
+    @Override
+    public long getWrittenBytes() {
+        return writtenBytes;
+    }
+    
+    @Override
+    public long getLastReadTime() {
+        return lastReadTime;
+    }
+    
+    @Override
+    public long getLastWriteTime() {
+        return lastWriteTime;
+    }
+    
+    @Override
+    public final long getLastIoTime() {
+        return Math.max(lastReadTime, lastWriteTime);
+    }
+    
+}



Re: svn commit: r827715 - /mina/branches/3.0/core/src/main/java/org/apache/mina/impl/AbstractIoSession.java

Posted by Ashish <pa...@gmail.com>.
>> Julien,
>>
>> Do we need *impl* as package name? Coz anyways we are not going to
>> stuff everything here.
>> Can we retain the implementations in their respective packages like
>> Sessions stuff in *session* package?
>>
>> wdyt?
>>
> Well it's much easier for OSGi bundelization, you just export the main
> packages and not the impl ones.
>
 Ok. I am not very familiar with OSGi :-(


-- 
thanks
ashish

Re: svn commit: r827715 - /mina/branches/3.0/core/src/main/java/org/apache/mina/impl/AbstractIoSession.java

Posted by Julien Vermillard <jv...@archean.fr>.
Thanks Fernando,
I totally forgot that some client bundle will use it as base for adding
transports.
We need to reorganize in that way. 
Julien

 Le Wed, 21 Oct 2009 08:24:34 -0700,
Fernando Padilla <fe...@alum.mit.edu> a écrit :

> Normally through OSGi you choose what packages to expose to the rest
> of the world and which ones to keep private.  So normally you expose
> the Service-Apis but keep their implementations private.
> 
> But actually, Mina is not a stand alone service per-se, since 
> AbstractIoSession is also a building block, that someone else will
> want to use to make their own IoSession right?  So Mina is both a
> Service-Api (interfaces), plus a collection of building blocks
> (exported packages) which are all going to be exposed through OSGi
> (if that is your goal).
> 
> So you're going to be exporting all of these classes anyhow.. no real 
> need to create sub packages.  Unless you do have a few classes you
> know you want to keep private.. but probably not.
> 
> 
> On 10/20/09 11:57 PM, Julien Vermillard wrote:
> > Le Wed, 21 Oct 2009 10:30:16 +0530,
> > Ashish<pa...@gmail.com>  a écrit :
> >
> >    
> >>> URL: http://svn.apache.org/viewvc?rev=827715&view=rev
> >>> Log:
> >>> more AbstractIoSession, to be continued
> >>>
> >>> Modified:
> >>>     mina/branches/3.0/core/src/main/java/org/apache/mina/impl/AbstractIoSession.java
> >>>
> >>>        
> >> Julien,
> >>
> >> Do we need *impl* as package name? Coz anyways we are not going to
> >> stuff everything here.
> >> Can we retain the implementations in their respective packages like
> >> Sessions stuff in *session* package?
> >>
> >> wdyt?
> >>
> >>      
> > Well it's much easier for OSGi bundelization, you just export the
> > main packages and not the impl ones.
> >
> > Julien
> >    

Re: svn commit: r827715 - /mina/branches/3.0/core/src/main/java/org/apache/mina/impl/AbstractIoSession.java

Posted by Fernando Padilla <fe...@alum.mit.edu>.
Normally through OSGi you choose what packages to expose to the rest of 
the world and which ones to keep private.  So normally you expose the 
Service-Apis but keep their implementations private.

But actually, Mina is not a stand alone service per-se, since 
AbstractIoSession is also a building block, that someone else will want 
to use to make their own IoSession right?  So Mina is both a Service-Api 
(interfaces), plus a collection of building blocks (exported packages) 
which are all going to be exposed through OSGi (if that is your goal).

So you're going to be exporting all of these classes anyhow.. no real 
need to create sub packages.  Unless you do have a few classes you know 
you want to keep private.. but probably not.


On 10/20/09 11:57 PM, Julien Vermillard wrote:
> Le Wed, 21 Oct 2009 10:30:16 +0530,
> Ashish<pa...@gmail.com>  a écrit :
>
>    
>>> URL: http://svn.apache.org/viewvc?rev=827715&view=rev
>>> Log:
>>> more AbstractIoSession, to be continued
>>>
>>> Modified:
>>>     mina/branches/3.0/core/src/main/java/org/apache/mina/impl/AbstractIoSession.java
>>>
>>>        
>> Julien,
>>
>> Do we need *impl* as package name? Coz anyways we are not going to
>> stuff everything here.
>> Can we retain the implementations in their respective packages like
>> Sessions stuff in *session* package?
>>
>> wdyt?
>>
>>      
> Well it's much easier for OSGi bundelization, you just export the main
> packages and not the impl ones.
>
> Julien
>    

Re: svn commit: r827715 - /mina/branches/3.0/core/src/main/java/org/apache/mina/impl/AbstractIoSession.java

Posted by Julien Vermillard <jv...@archean.fr>.
Le Wed, 21 Oct 2009 10:30:16 +0530,
Ashish <pa...@gmail.com> a écrit :

> > URL: http://svn.apache.org/viewvc?rev=827715&view=rev
> > Log:
> > more AbstractIoSession, to be continued
> >
> > Modified:
> >    mina/branches/3.0/core/src/main/java/org/apache/mina/impl/AbstractIoSession.java
> >
> 
> Julien,
> 
> Do we need *impl* as package name? Coz anyways we are not going to
> stuff everything here.
> Can we retain the implementations in their respective packages like
> Sessions stuff in *session* package?
> 
> wdyt?
> 
Well it's much easier for OSGi bundelization, you just export the main
packages and not the impl ones.

Julien

Re: svn commit: r827715 - /mina/branches/3.0/core/src/main/java/org/apache/mina/impl/AbstractIoSession.java

Posted by Ashish <pa...@gmail.com>.
> URL: http://svn.apache.org/viewvc?rev=827715&view=rev
> Log:
> more AbstractIoSession, to be continued
>
> Modified:
>    mina/branches/3.0/core/src/main/java/org/apache/mina/impl/AbstractIoSession.java
>

Julien,

Do we need *impl* as package name? Coz anyways we are not going to
stuff everything here.
Can we retain the implementations in their respective packages like
Sessions stuff in *session* package?

wdyt?

-- 
thanks
ashish