Re: about the implementation of SimpleIoProcessorPool

2009-12-01 Thread Eero Nevalainen
Emmanuel Lecharny wrote:
>>> The test is just a safety belt. It does not harm... We should
>>> probably refactor this code to be a bit moe accurate though ...
>>
>> assert?
> 
> Yuck :/
> 
> So C-ished..
> 
> better have better code !

Wait... what?

I thought the whole point of assertions is to provide these "no harm
safety belt checks", with the side effect that they can be disabled if
there are concerns of efficiency.

-- 
Eero Nevalainen




Re: about the implementation of SimpleIoProcessorPool

2009-11-30 Thread Eero Nevalainen
Emmanuel Lecharny wrote:
> On Mon, Nov 30, 2009 at 11:30 AM, Peng Lee  wrote:
>>  In my opinion,the line 176 [if (processorConstructor == null) ]
>> is redundant, because if processorConstructor is null, a
>> NullPointerException should be trowed previously. So, I think we
>> should remove the redundant code here.
>>  Of course, maybe there are any other things that i haven't knew
>> about, and who knows?
> 
> 
> The test is just a safety belt. It does not harm... We should probably
> refactor this code to be a bit moe accurate though ...

assert?

-- 
Eero Nevalainen



Re: [GSoC] Protocol performance testing framework

2009-04-01 Thread Eero Nevalainen

Alex Karasulu wrote:

Hi all,

Please excuse the cross post but this proposal for a Google Summer of Code
project applies as much to Apache MINA as it does to Apache Directory.  The
idea is very simple, you have the following components:

  (1) A MINA protocol server that is being tested.
  (2) A MINA IoFilter for statistics collection for use in any MINA protocol
server.  This filter may collect information from the system, the JVM and
from MINA itself.  It can sample this information and push this information
into the statistics collector (#4 below).  It will probably expose some out
of band socket for communcation and control.
  (3) A load injecting agent which can accept PDU's or a sequence of PDU's
to inject into the MINA protocol server.  Several of these may be
instantiated on different hosts to generate load on the server.  The PDU's
are prepared and supplied in advance before begining a test from the agent
control UI (#4).  These agents have a socket channel for command and control
from the Agent Control UI.  They will all be started together to start
generating load against the server.  PDU's are supplied to keep these agents
ignorant about the protocol being used.  This way the control UI can be used
to prepare PDU's in advance.
  (4) Agent control UI and statistics collator.  This is the command center
that communicates with the agents to tell them what PDUs to send to which
endpoints and at what frequence if things cycle.  This agent also gathers
statistics from all the agents to get client latency information as well as
to generate overall throughput statistics from the time collated data
obtained from all the load inject agents/clients.  It also controls the
sampling rate of the IoFilter injected into the server and collects data
from it to correlate memory usage, CPU, server side latencies and other
factors effecting server performance.


Is there some specific reason for not using the Grinder?
http://grinder.sourceforge.net/index.html

I used it a couple of years ago and was pleased with it. The only thing 
we needed to add before getting to actual testing was some shell scripts 
to start the agents over SSH.


--
Eero Nevalainen



Re: Codec Factories

2009-03-30 Thread Eero Nevalainen

Ashish wrote:

the codec factory expose two methods :
  public ProtocolEncoder getEncoder( IoSession session )
  public ProtocolDecoder getDecoder( IoSession session )

Usually, when designing a new codec, those methods returns a new instance of
the decoder/encoder for each sessions, as these instances are stored into
the user's session. In many cases (ie, when the encoding/decoding is
stateless), this is useless. We should instead create unique instances of
those encoder/decoder, and store the instance into the session. Even if the
codec is stateful, the current codec state should not be handled within the
codec, but in a separate context object.




I'm not saying that the current implementation is wrong, but I think we
should stress out this in the codec documentation, in order to let the
protocol developers to know about it.


The codec's that I have written so far are stateless. They operate on
the byte[] and if the message
is complete, transforms it. My experience is more with decoder's though.
I think this though came across my mind while browsing some decoder,
don't recall which. factory was creating a new Decoder instance each
time (probably it was one of ApacheDS decoder - DNS, NTP or ??)

Documenting it shall help, as developer's can decide whether they need
instance per session or one instance for application.

- ashish



Isn't the factory just supposed to return the same codec each time in 
this case?


-Eero


Re: [jira] Commented: (DIRMINA-654) Google Protocol Buffers Codec

2009-01-09 Thread Eero Nevalainen

Tomasz Blachowicz wrote:

On Wed, Jan 7, 2009 at 10:50 PM, Shawn Pearce  wrote:

Applications that add two numbers together and return the result are fairly
common for an RPC sort of example.  The body of the implementation is
trivial, its the RPC framing that is interesting to show.

What about just a simple add server?

 message AddRequest { required int32 a = 1; optional int32 b = 2; }
 message AddResult{ required int32 r = 1; }

?


This is good idea I guess, I can provide the implementation for such a add
server. Do you guys have any other ideas?


How about a stack calculator? You could demonstrate the extendability 
quite compactly with it:


First you have two messages defined
- a number
- the addition operator (+)

Then you can add a multiplication operator (*)

If I've understood protocol buffers correctly, an old client using just 
the addition should be able to operate just fine, even though a new 
message has been added to the protocol.


--

Eero



Re: How to check UDP message header length?

2009-01-09 Thread Eero Nevalainen

Steve Ulrich wrote:

hezjing [mailto:hezj...@gmail.com] wrote:

CumulativeProtocolDecoder is the choice since the header's size fixed,
and
there is a payload length information (correct?).


The CumulativeProtocolDecoder is always a good idea. ;-)


Isn't it really needed just for TCP?


The question is, how do we know the header is ready to be parsed?


"if (buffer.remaining() >= 6)" should work for you


You don't get partial UDP datagrams, so this won't happen due to 
network. It's good to check though, in case the sender is doing 
something wrong.



btw: Please use the user ML as you are having problems using mina for your 
development.
This ml is intended for discussions for further development of mina itself.


Yes, shutting up...

--

Eero


Re: [Votes] MINA 2.0-RC1

2008-11-18 Thread Eero Nevalainen

Emmanuel Lecharny wrote:
[] Continue to add new features to MINA 2.0 milestones until we reach a 
stable point

[] Freeze the code, move to MINA 2.0-RC1
[] I abstain


Non-binding
[x] Freeze the code, move to MINA 2.0-RC1

Get 2.0 out, let users migrate, drop 1.0 and 1.1.

--
Eero Nevalainen


Re: svn commit: r682480 - in /mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client: auth/ codec/ util/

2008-08-05 Thread Eero Nevalainen

Alex Karasulu wrote:

On Tue, Aug 5, 2008 at 3:39 AM, Eero Nevalainen <[EMAIL PROTECTED]

wrote:



Emmanuel's optimization is interesting, but it removes the possibility of
activating debugging at runtime. It's not needed often but when it's needed
you'll certainly want to have it.



Hey I never tried activating debugging at runtime.  How's this done?


With Log4j the default is to configure logging with a 
configureAndWatch(...) method. It starts a thread which periodically 
checks if the config file has changed.


The other approach I tried was explicitly refreshing logging with a JMX 
bean. Got it working, but it would still need work to be what I want.
(Motivation was that explicit refresh allows the program to complain if 
the config file has syntax errors. However, IIRC Log4j didn't expose 
those errors :( )


-Eero


My 2cts ...

- Eero


Julien Vermillard wrote:


Hi,
interesting solution Emm, but you got an idea of the speedup ?
Because it's really not helping readability of code :)

Perhaps we can do that on critical parts of code.

Sangjin : does some of you recent change in 1.0 branches need to be
ported to trunk ? If so I'll try to take a look.

Julien

On Tue, 05 Aug 2008 09:10:32 +0200
Emmanuel Lecharny <[EMAIL PROTECTED]> wrote:

 Sangjin Lee wrote:

Thanks for pointing that out.  It was a mechanical
search-and-replace.  I also wasn't familiar with the capability of
SLF4J in terms of evaluating args.  I'll look at them again, and
remove isXXXEnabled() calls.


You can keep the isXXXEnabled. It should not make a big difference.
But Julien is right, when using the {} to pass arguments to the
XXX.log( message, arg1...) the cost is almost the same than simply
doing a ifXXXEnabled() {...}.

The ultimate optimization, considering that the logs will become
static, would be to add a static with an evaluation of the log state :

   private static final Logger LOG = LoggerFactory.getLogger( .class );

   /**
* Speedup for logs
*/
   private static final boolean IS_DEBUG = LOG.isDebugEnabled();
...
   if ( IS_DEBUG ) {
   LOG.debug( blah );
   }

Doing so will allow the JVM to simply remove the test, as if DEBUG is not
true, and as it's static, the optimizer will consider that the
inner code will never be executed.

It might worth the extra effort for DEBUG, certainly not for warnings
or errors.

My 2cts ...

 Regards,

Sangjin


On Mon, Aug 4, 2008 at 11:23 PM, Julien Vermillard
<[EMAIL PROTECTED]>wrote:




Why using isTraceEnabled here ?
there is no concatenation and even if there was, we could use {}
in slf4j call.
if (LOG.isTraceEnabled()) {
   LOG.trace("enter
BasicScheme.authenticate(UsernamePasswordCredentials, String)");
}

Julien

2008/8/4  <[EMAIL PROTECTED]>:



Author: sjlee
Date: Mon Aug  4 12:46:17 2008
New Revision: 682480

URL: http://svn.apache.org/viewvc?rev=682480&view=rev
Log:
ASYNCWEB-24

Wrapped debug() and trace() calls with isDebugEnabled() and



isTraceEnabled() calls.  Also prefer StringBuilder over
StringBuffer.


Modified:




 
mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/auth/AuthScope.java

  
mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/auth/AuthState.java

  
mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/auth/BasicScheme.java

  
mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/auth/DigestScheme.java

  
mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/auth/NTCredentials.java

  
mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/auth/NTLMScheme.java

  
mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/auth/UsernamePasswordCredentials.java

  
mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/codec/HttpDecoder.java

  
mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/util/EncodingUtil.java

  
mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/util/ParameterFormatter.java



Modified:



mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/auth/AuthScope.java



URL:



http://svn.apache.org/viewvc/mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/auth/AuthScope.java?rev=682480&r1=682479&r2=682480&view=diff

 ==



---



mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/auth/AuthScope.java
(original)



+++



mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/auth/AuthScope.java
Mon Aug  4 12:46:17 2008



@@ -265,7 +265,7 @@
* @see java.lang.Object#toString()
*/
   public String toString() {
-StringBuffer buffer = new StringBuffer();
+StringBuilder buffer = new StringBuilder();
   if

Re: svn commit: r682480 - in /mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client: auth/ codec/ util/

2008-08-05 Thread Eero Nevalainen
Emmanuel's optimization is interesting, but it removes the possibility 
of activating debugging at runtime. It's not needed often but when it's 
needed you'll certainly want to have it.


My 2cts ...

- Eero

Julien Vermillard wrote:

Hi,
interesting solution Emm, but you got an idea of the speedup ?
Because it's really not helping readability of code :)

Perhaps we can do that on critical parts of code.

Sangjin : does some of you recent change in 1.0 branches need to be
ported to trunk ? If so I'll try to take a look.

Julien

On Tue, 05 Aug 2008 09:10:32 +0200
Emmanuel Lecharny <[EMAIL PROTECTED]> wrote:


Sangjin Lee wrote:

Thanks for pointing that out.  It was a mechanical
search-and-replace.  I also wasn't familiar with the capability of
SLF4J in terms of evaluating args.  I'll look at them again, and
remove isXXXEnabled() calls. 

You can keep the isXXXEnabled. It should not make a big difference.
But Julien is right, when using the {} to pass arguments to the
XXX.log( message, arg1...) the cost is almost the same than simply
doing a ifXXXEnabled() {...}.

The ultimate optimization, considering that the logs will become
static, would be to add a static with an evaluation of the log state :

private static final Logger LOG = LoggerFactory.getLogger( class>.class );


/**
 * Speedup for logs
 */
private static final boolean IS_DEBUG = LOG.isDebugEnabled();
...
if ( IS_DEBUG ) {
LOG.debug( blah );
}

Doing so will allow the JVM to simply remove the test, as if DEBUG is 
not true, and as it's static, the optimizer will consider that the

inner code will never be executed.

It might worth the extra effort for DEBUG, certainly not for warnings
or errors.

My 2cts ...


Regards,
Sangjin


On Mon, Aug 4, 2008 at 11:23 PM, Julien Vermillard
<[EMAIL PROTECTED]>wrote:

  

Why using isTraceEnabled here ?
there is no concatenation and even if there was, we could use {}
in slf4j call.
if (LOG.isTraceEnabled()) {
LOG.trace("enter
BasicScheme.authenticate(UsernamePasswordCredentials, String)");
}

Julien

2008/8/4  <[EMAIL PROTECTED]>:


Author: sjlee
Date: Mon Aug  4 12:46:17 2008
New Revision: 682480

URL: http://svn.apache.org/viewvc?rev=682480&view=rev
Log:
ASYNCWEB-24

Wrapped debug() and trace() calls with isDebugEnabled() and
  

isTraceEnabled() calls.  Also prefer StringBuilder over
StringBuffer. 

Modified:

  

 
mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/auth/AuthScope.java

 mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/auth/AuthState.java

 mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/auth/BasicScheme.java

 mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/auth/DigestScheme.java

 mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/auth/NTCredentials.java

 mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/auth/NTLMScheme.java

 mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/auth/UsernamePasswordCredentials.java

 mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/codec/HttpDecoder.java

 mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/util/EncodingUtil.java

 mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/util/ParameterFormatter.java


Modified:
  

mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/auth/AuthScope.java


URL:
  

http://svn.apache.org/viewvc/mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/auth/AuthScope.java?rev=682480&r1=682479&r2=682480&view=diff

==


---
  

mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/auth/AuthScope.java
(original)


+++
  

mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/auth/AuthScope.java
Mon Aug  4 12:46:17 2008


@@ -265,7 +265,7 @@
 * @see java.lang.Object#toString()
 */
public String toString() {
-StringBuffer buffer = new StringBuffer();
+StringBuilder buffer = new StringBuilder();
if (this.scheme != null) {
buffer.append(this.scheme.toUpperCase());
buffer.append(' ');

Modified:
  

mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/auth/AuthState.java


URL:
  

http://svn.apache.org/viewvc/mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/auth/AuthState.java?rev=682480&r1=682479&r2=682480&view=diff

==


---
  

mina/asyncweb/branches/1.0/client/src/main/java/org/apache/asyncweb/client/auth/AuthState.java
(original)


+++
  

mina/asyncweb/branches/1.0/client/src/

Re: AW: Java Threads are my problem.

2008-06-24 Thread Eero Nevalainen

Simon Funnell wrote:

Thanks for the replies.

I will give you an example of what (I believe, trying to find out if I 
am wrong) happens with MINA. MINA has an IoFilterChain where you can 
plug in a ThreadPool ExecutorFilter.


I am basing this understanding on my interpretation of the Java Language 
specification so when I say thread memory and shared memory I think I am 
talking about RAM allocated for different purposes.


Could you cite the exact source on which you base this interpretation. A 
short google on: java "thread memory" yielded me these two articles

http://www.developer.com/java/article.php/951051
http://www.javaperformancetuning.com/news/qotm030.shtml
I think the interpretation in both of these is that the "thread memory" 
is the copies in the CPU cache and registries. The CPU will make these 
copies when accessing the data even when it is in "shared memory"


Am I correct in thinking that on a request data is read from a socket to 
the IO processor thread memory, then copied to shared memory, then again 
to ExecutorFilter thread before being operated on?


I think this is the case. Note however that the ExecutorFilter is by no 
means mandatory. I am using MINA without the ExecutorFilter to avoid one 
layer of context switch / copying.


If this is the case I am assuming that when the ExecutorFilter thread 
finishes its operations the data is copied back to shared memory and 
then again to the IO processor thread memory for writing a response.


I think so, yes. I think MINA puts all outgoing writes in queue. I 
didn't check how the queues are drained, but the queuing is pretty much 
mandatory anyway if multiple threads can write to an IoSession. Maybe 
some MINA guru can tell how this works exactly?


Is it right that this a problem partially solved with In-VM pipe? In 
this case it would I am assuming it would be socket data to written to 
pipe (in IO processor thread) and then read or copied straight to 
ExecutorFilter thread (or something along those lines).


I hope this is clearer, using MINA would save me a lot of time, I could 
use this saved time to contribute to furthering the goals of the 
project. Also, because I am not in a rush, that time is available 
immediately.


Regards,

Simon

Eero Nevalainen wrote:

Hello!

I haven't dug deep enough to say anything authoritative, but I think 
you've the got the thread memory and shared memory sort of backwards.
To my understanding, "shared memory" generally means that the data is 
in the Main memory (RAM) of the computer

(see http://en.wikipedia.org/wiki/Memory_(computers) )
where it can be accessed by every CPU. In contrast, "thread working 
memory" does not need to accessible by other CPUs, so the java runtime 
will make every effort to perform "thread working memory" instructions 
in the CPU registries and cache.

(see http://en.wikipedia.org/wiki/Processor_register )

Copying between the CPU local memory and main memory is still 
unavoidable if the data is too big to fit to what the CPU has. If you 
still want to build something on top of java threads then I suggest 
you read on user threads or "fibers".


-Eero Nevalainen

Steve Ulrich wrote:

Hi!

I don't think mina-list is the right list for this.

Some thoughts, anyway:
"shared memory" between threads should be synchronized somehow 
(doesn't mean it has to be in a synchronized block), so it's a big 
performance killer to synchronize all variables. If you need 
synchronized variables read the documentation for the "volatile" flag 
and the API for the atomic- and concurrency-packages will be usefull 
as well.
If you implement your own "thread model" in a single thread, your 
application won't scale very well to multi processor systems. A 
simple form of this "thread model" is the Executor created by 
"Executors.newSingleThreadExecutor()". But it's poison for 
scalability!!!


My opinion: using some volatile flags, Locks and concurrency 
collections at the right positions will surely do the trick and lead 
to a better scalability. Even a little oversynchronisation will be 
better than a "single thread thread model" ;-)


regards

Steve


Simon Funnell [mailto:[EMAIL PROTECTED] wrote:

Dear List,

This is not exactly Mina specific, its more general, but its close to
the problem Mina surrounds. I have been working on an approach to
concurrency and I have come to the point where the Java Thread model is
causing me problems. I would like to create my own threading model that
does away with shared memory and thread memory, so there is just shared
memory. My original idea was to use a single thread and implement my
own
threads within that thread. The difficulty with this is that there is
still copying from shared memory to thread working memory (as I
understand it). I would like to cut out this shared memory to thread
memory and back to shared memory copying. Is this possible?

Thanks for any replies.

Regards,

Simon











Re: AW: Java Threads are my problem.

2008-06-23 Thread Eero Nevalainen

Hello!

I haven't dug deep enough to say anything authoritative, but I think 
you've the got the thread memory and shared memory sort of backwards.
To my understanding, "shared memory" generally means that the data is in 
the Main memory (RAM) of the computer

(see http://en.wikipedia.org/wiki/Memory_(computers) )
where it can be accessed by every CPU. In contrast, "thread working 
memory" does not need to accessible by other CPUs, so the java runtime 
will make every effort to perform "thread working memory" instructions 
in the CPU registries and cache.

(see http://en.wikipedia.org/wiki/Processor_register )

Copying between the CPU local memory and main memory is still 
unavoidable if the data is too big to fit to what the CPU has. If you 
still want to build something on top of java threads then I suggest you 
read on user threads or "fibers".


-Eero Nevalainen

Steve Ulrich wrote:

Hi!

I don't think mina-list is the right list for this.

Some thoughts, anyway:
"shared memory" between threads should be synchronized somehow (doesn't mean it has to be 
in a synchronized block), so it's a big performance killer to synchronize all variables. If you 
need synchronized variables read the documentation for the "volatile" flag and the API 
for the atomic- and concurrency-packages will be usefull as well.
If you implement your own "thread model" in a single thread, your application won't scale very well 
to multi processor systems. A simple form of this "thread model" is the Executor created by 
"Executors.newSingleThreadExecutor()". But it's poison for scalability!!!

My opinion: using some volatile flags, Locks and concurrency collections at the right 
positions will surely do the trick and lead to a better scalability. Even a little 
oversynchronisation will be better than a "single thread thread model" ;-)

regards

Steve


Simon Funnell [mailto:[EMAIL PROTECTED] wrote:

Dear List,

This is not exactly Mina specific, its more general, but its close to
the problem Mina surrounds. I have been working on an approach to
concurrency and I have come to the point where the Java Thread model is
causing me problems. I would like to create my own threading model that
does away with shared memory and thread memory, so there is just shared
memory. My original idea was to use a single thread and implement my
own
threads within that thread. The difficulty with this is that there is
still copying from shared memory to thread working memory (as I
understand it). I would like to cut out this shared memory to thread
memory and back to shared memory copying. Is this possible?

Thanks for any replies.

Regards,

Simon






Re: Migration from mina 1.1.X to 2.0.X

2008-06-03 Thread Eero Nevalainen

Sergey Mamitko wrote:

Hello

I have a lot of code which uses mina 1.1.X.
JDK: java 1.5+
OS:  Windows, Unix

And now it was decided to create additional feature - implementation of serial 
communication.
According to your tutorials it is possible to create serial communication using 
mina 2.0
I downloaded appropriate version of mina and tried to apply to existing code 
but failed.
New version has different API. Correct?
If yes, what is there easy way to migrate from mina 1.1.X to 2.0.X


Most probably you should take a look at this
http://mina.apache.org/changes-between-2x-and-1x.html

Do note that the API may still change and seems likely to do so.

And second question: is this true that latest stable release Apache MINA 2.0.0-M1 (Java 5+) doesn't contain serial communication functionality. 
Because I found it only under SNV repository.


See this:
http://www.nabble.com/Serial-Transport-reintegration-in-TRUNK-or-not-td17357082.html#a17357082

-Eero Nevalainen


Re: Feed back appreciated - Quick preview of buffer rewrite

2008-05-21 Thread Eero Nevalainen

Emmanuel Lecharny wrote:

이희승 (Trustin Lee) wrote:
On Wed, 21 May 2008 10:08:27 +0900, Emmanuel Lecharny 
<[EMAIL PROTECTED]> wrote:
Another things would also be to get a byte[] getBytes( in length ) 
method returning as much bytes as possible, up to a length. If the 
number of available bytes is below the length, the returned byte 
array will only contains the available bytes, and it will be up to 
the decoder to deal with it. The idea is to avoid calling the 
element() method for every single byte we want.


It sounds similar to ByteBufferQueue.pollSlice(int length), but 
pollSlice() returns null when there's not enough data.  
Would be better to returns what has already been read. Sometime, you are 
just proxying the data, and you want to send it to the next consumer as 
soon as you get some. Otherwise, the queue will buffer potentially 
gigantic data in memory. (This is something we experimented with 
JpegPhoto data in Ldap, this is the reason I mention it).


S.. Let's suppose I was writing a kind of proxy that receives 
messages and relays parts of those messages to several clients.


I'd get the relayable part of the message with a slice() operation.
My decoder would then make a message object with the ByteBufferQueue and 
send it for further processing.


For the clients my encoder would first write some header stuff with the 
offerXX() methods.
Then I think I'd need a method that offers a ByteBufferQueue (or 
Iterable).



I think that the above use case works fine when using heap buffers, as 
when there are no more references to the message object the sliced 
buffers should be freed as well. But would I need to do something extra

to make it work with direct buffers?

-Eero Nevalainen





Re: IoSession.write() without WriteFuture

2008-05-19 Thread Eero Nevalainen

Julien Vermillard wrote:

On Tue, 6 May 2008 14:27:06 +0300
"Cem Uzunlar" <[EMAIL PROTECTED]> wrote:


Yes, it would definitely be a very good option.

2008/5/6 "이희승 (Trustin Lee) <[EMAIL PROTECTED]>:


Hi,

There's an obvious situation that a user doesn't want WriteFuture at
all.  In such a case, we could save pretty much amount of memory per
each write request by not creating WriteFuture.

Not sure if this will interfere with existing IoFilters though.
--
Trustin Lee - Principal Software Engineer, JBoss, Red Hat
--
what we call human nature is actually human habit
--
http://gleamynode.net/




So we can introduce
void write(..);
and
WriteFuture writeWithFuture(..);


or
WriteFuture write(..);
and
void writeAndForget(..);

Depends on which is the default (I don't know so don't ask)

-Eero Nevalainen



Re: MINA NioDatagramAcceptor reading one UDP packet at a time

2008-03-06 Thread Eero Nevalainen

Mark Webb wrote:

If I want to have a program that received UDP packets.  Do I need to
write a protocol filter in order to make sure my
IoHandler.messageReceived() method only gets one packet at a time?

Thanks



I took a look at it and my guess would be that only packet at a time is 
read. The relevant code seems to be

DatagramConnectorDelegate.readSession( DatagramSessionImpl session )

and the API description of

DatagramChannel.read( ByteBuffer dst )

-Eero


Re: Finishing directory reorganization

2008-02-26 Thread Eero Nevalainen

이희승 (Trustin Lee) wrote:

2008-02-26 (화), 15:32 +0100, Emmanuel Lecharny 쓰시길:

??? (Trustin Lee) wrote:

Hi,

As we already moved AsyncWeb to /repos/asf/mina/asyncweb, I think it
also makes sense to move

* /repos/asf/mina/(trunk|branches|tags|all) to /repos/asf/mina/mina
* /repos/asf/mina/sandbox/ftpserver to /repos/asf/mina/ftpserver

WDYT?  mina/mina sounds somewhat funny but I can't think of any better
name for now. :)
  

+1.

/repos/asf/mina/core ?


Then we have repos/asf/mina/core/trunk/core :D



Ok... how about mina/kernel for the "main" MINA? It dodges the double 
name issue somewhat.
(of course we can argue whether mina/core/trunk/kernel is a better order 
than mina/kernel/trunk/core) :)


mina/main would of course have been a good solution if it didn't suck so 
much. Almost certain to mistype and misread :P


-Eero


Re: [AsyncWeb] Ideas for client

2008-02-12 Thread Eero Nevalainen
Btw, what was the status of DNS resolution in MINA? I remember that at 
some point DNS resolving used the blocking java API calls. I could 
imagine that an asynchronous HTTP-client would have to perform a lot of 
DNS queries(or not, depending on use). Could this become a pithole?


-Eero

Rick McGuire wrote:
The one feature I like about the AHC client that appears to be missing 
here is the higher-level abstraction of an HTTP request.  The one 
drawback of doing everything with URLs is the requirement that the user 
of the client needs to be responsible for encoding all of the parameter 
information in the URL.  In the AHC approach, a request is configured as 
an operation to a particular address and additional specifics of the 
operation are attached to the request (parameters, credentials needed 
for authentication, proxy configuration etc.).  The AHC client then uses 
that information to handle the URL encoding, authentication challenges, 
proxy connection, etc.  There are times where a straighforward "fetch me 
this URL mode" is sufficient.  There are other situations where that 
becomes awkward to use.


Rick

Mike Heath wrote:

I posted some use cases here:
http://cwiki.apache.org/confluence/display/AWEB/ClientUseCases  They
still need some refinement to properly convey what I want but they're a
decent start.

I've also posted a hypothetical AsyncWeb Client API at
http://swamp.homelinux.net/mina/asyncweb/client/api/ with the intent to
further promote discussion and foster more innovative ideas.  I would
love to here some feedback on this API.  What do you like, dislike, not
understand?  Where do you see room for improvement?  The API is really
rough in places but for the most part it conveys the ideas I've had over
the past week or so.  Any suggestions for name changes to classes and/or
methods are welcome.

-Mike

  






[jira] Commented: (DIRMINA-527) should be able to set connect timeout in milliseconds

2008-02-08 Thread Eero Nevalainen (JIRA)

[ 
https://issues.apache.org/jira/browse/DIRMINA-527?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12566948#action_12566948
 ] 

Eero Nevalainen commented on DIRMINA-527:
-

The ruling seems to be "no API changes whatsoever in 1.1.x". See 
https://issues.apache.org/jira/browse/DIRMINA-397?focusedCommentId=12517492#action_12517492
 for a precedent :)

> should be able to set connect timeout in milliseconds
> -
>
> Key: DIRMINA-527
> URL: https://issues.apache.org/jira/browse/DIRMINA-527
> Project: MINA
>  Issue Type: Improvement
>  Components: Core
>Affects Versions: 1.0.8, 1.1.5, 2.0.0-M1
>Reporter: Sangjin Lee
> Attachments: DIRMINA-527.patch
>
>
> Currently, IoConnector allows setting connect timeouts only in seconds.  The 
> minimum value of allowed connect timeout is 1 second.  There are cases where 
> one needs to have a shorter connect timeout than 1 second and will finer 
> granularity than seconds.
> I suggest introducing the ability to set connect timeout in milliseconds and 
> deprecating the getter/setter in seconds in favor of the ms getter/setter.
> See the discussion thread at 
> http://www.nabble.com/connect-timeout-to15281787s16868.html.

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



Re: Status of dependency on LGPL'd library (Was: Re: [Legal] Why is this LGPL notice file in our SVN?)

2008-01-24 Thread Eero Nevalainen

Sam Ruby wrote:

On Jan 24, 2008 4:30 AM, Trustin Lee <[EMAIL PROTECTED]> wrote:

Oops, forgot to reply to 'all'.

On Jan 24, 2008 6:29 PM, Trustin Lee <[EMAIL PROTECTED]> wrote:

Hi,

Thanks everyone for the detailed interpretation.  If Henry understood
our policy correctly, does it mean that it's OK if the build of the
submodule that depends on RXTX doesn't occur automatically but with
some interactive precedure with proper notice?

Thanks,
Trustin


That would not be OK if RXTX were under the GPL, for example.  The
current draft makes no distinction between LGPL and GPL.  I've heard
statements that LGPL (as of version 2) is OK for C and C-like
programming languages, but not for direct references from languages
like Java, but indirect references through standard interfaces (such
as JDBC) are OK.  So far, none of that is reflected in the current
draft, nor would it apply to usage of RXTX by MINA.

I've also heard a statement the the FSF has somehow clarified this for
Java, but can not find any evidence that backs this up.  Can anybody
provide a link?


This one, maybe? 
http://www.fsf.org/licensing/licenses/lgpl-java.html/view?searchterm=LGPL%20java


-Eero


Re: How can i improve the total numbers of session which server will handle connects from client

2008-01-08 Thread Eero Nevalainen

Hi,

Apparently deng was suffering from the same problem I had earlier(he 
contacted me directly). The problem was that the OS was limiting 
outbound connections on the client side. This was fixed by editing 
/etc/security/limits.conf and allowing a larger max number of open files.


-Eero

Steve Johns wrote:

Did you get your problem fixed?

On Dec 22, 2007 12:36 AM, Steve Johns <[EMAIL PROTECTED]> wrote:


Try your own client with Sumup server and see if it works. If NOT,
something wrong with your client. If YES, try to find out what happens in
ExceptionCaught().Good luck!


On Dec 21, 2007 11:22 AM, chinadeng <[EMAIL PROTECTED]> wrote:


the  problem is still in ,plz,give some advices?

Qi wrote:

Hi,

For those clients failed establish a connection, do they report any

errors

such as connection timeout, etc?
I've run a simple experiment that tries to establish 300 connections

to

the example sumupserver running on another machine in the local

network,

and I found no problem. However, my client code is in Java, so it is
different from your situation.

And could you also remove the threadmodel settings and set it to be
Thread.manual, then increase the receiver buffer size in
SocketAcceptorConfig.getSessionConfig().setReceiveBufferSize(), just

for a

experiment?

Cheers,
Qi




--
View this message in context:
http://www.nabble.com/How-can-i-improve-the-total-numbers-of-session-which-server-will--handle-connects-from-client-tp14429723s16868p14449668.html
 Sent from the Apache MINA Support Forum mailing list archive at
Nabble.com .








Re: Re : Mina and isa proxy

2008-01-08 Thread Eero Nevalainen

Francesca Milan wrote:

Edouard De Oliveira ha scritto:
It seems that there's a Socket.getChannel() method. see 
http://java.sun.com/j2se/1.5.0/docs/api/java/net/Socket.html
 
Regards,

-Edouard De Oliveira-
http://tedorg.free.fr/en/main.php

- Message d'origine 
De : Francesca Milan <[EMAIL PROTECTED]>
À : dev@mina.apache.org
Envoyé le : Mardi, 8 Janvier 2008, 11h42mn 15s
Objet : Mina and isa proxy

Hi!

I'm trying to extend mina to enable connections through proxy server.
Apache commons.httpclient (ProxyClient class) allow the proxy
 connection but it return me a Socket object.
The problem is that mina SocketConnector works with SocketChannel. Is 
there someone that know if is possibile to obtain a socketChannel from

 a socket object?

Thanks
Francesca

...sorry for my terrible english :-/





  
_ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers 
Yahoo! Mail http://mail.yahoo.fr
  
..but it returns null because I'haven't create the socket with this 
procedure:


   SocketChannel sc = SocketChannel.open(new InetSocketAddress(...));
   Socket socket = sc.socket();


"It is not possible to create a channel for an arbitrary, pre-existing 
socket, nor is it possible to specify the SocketImpl object to be used 
by a socket associated with a socket channel"


http://java.sun.com/j2se/1.5.0/docs/api/java/nio/channels/SocketChannel.html

Same in 1.6, java unfortunately seems to lacks this possibility.

-Eero



Re: Many sockets over single socket

2008-01-03 Thread Eero Nevalainen

Trustin Lee wrote:

On Dec 11, 2007 11:51 AM, oscarcs <[EMAIL PROTECTED]> wrote:

I must develop a system made of nodes in a tree layout. Each node (computer)
has many children and only one father.

Each node sends TCP messages (using a propietary protocol) to the father, an
the father itself must send the messages to the grandfather and so on.

I have been using MINA to solve many of the communications concerns, but now
i have some doubts.

My questions are:

1. Is there a way to simulate at the lowest posible level, many sockets over
a single socket?. I mean, using a single socket to send to the grandfather
all the messages comming from the children, so i can reuse the procotol
logic in all the levels.


Yes.  MINA is all about an abstract API, so you can implement a
meta-transport that does what you want.


2. If not, another aproach would be replicate all the child socktets in all
the levels, so at the upper level i will end with a single machine with too
many sockets. How much is the overhead (in reources or CPU) of using
multiple sockets vs. single socket?. Is there any limit?


I'd suggest you open as many sockets as the number of cores of your
machine at least, and each socket could host multiple sockets.  If you
can implement a virtual socket, then it shouldn't be that difficult to
implement.

It would be really a great addition to MiNA project if such a facility
is provided out of the box.


Hmm, this sounds very much like SCTP or like BEEP channels. beep4j 
builds on MINA so it might have something similar already implemented.


-Eero


Re: MINA based test tool

2008-01-03 Thread Eero Nevalainen

Hello Mark!

I've used The Grinder http://grinder.sourceforge.net/ , mainly because 
it seemed to have less "overhead" than JMeter for testing. I noticed 
that quite a bit of the effort needed on a benchmarking tool is related 
to distributing and initialising the test clients. You might want to try 
this part on existing tools before writing your own, unless you're 
content on having a single machine testing tool.


Additionally, we already used MINA in our grinder tests by distributing 
the MINA jar with the test files.


-Eero

Mark wrote:

I am sure there are other tools that perform load testing/benchmarking, but
they are not based on MINA :)

My intent is to tightly couple MINA and use it as the foundation for the
testing.  The idea is that if people have a system they want to test, they
can either use an existing handler or write their own and let the
acceptors/connectors do all the work.  So leverage this testing tool off of
MINA's flexibility.  I was just curious as to the pitfalls that I might run
in to or if anyone has thought about writing such a system before.

As always, thanks Trustin !!
--Mark

On Dec 13, 2007 6:44 AM, Trustin Lee <[EMAIL PROTECTED]> wrote:


Hi Mark,

On Dec 13, 2007 1:54 PM, Mark <[EMAIL PROTECTED]> wrote:

I have been toying with the idea of writing a test tool based on MINA.

 This

tool will be similar to what jmeter offers.  I have used jmeter for

numerous

programs over the years and was never really happy with how it worked if

you

need to test a protocol that jmeter does not support 'out of the box'.

 I am

curious as to what the MINA community thinks about such a program.

Do you mean a benchmark software that uses a MINA codec?  It sounds
like a good idea, but we will also need to think about distributed
load generation and many more advanced features that existing testing
frameworks provide.  Considering that, I'd personally prefer to
provide some kind of plugin, extension or module for a known
performance testing framework.

I know JMeter doesn't satisfy your needs but there might be some other
performance testing framework that will fit best (even if it's not
ideal best).

However, on the other hand, if you have some good idea about
performance testing framework which tightly integrates MINA, I'd like
to see you go ahead and how it will look like.  Please feel free to do
what you want to do.  It will be an exciting project anyway, because
we might be able to provide some features of the advanced testing
framework while improving MINA to support you to implement such
features.

Cheers,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6









Re: transferring files with Mina

2007-11-22 Thread Eero Nevalainen

This discussion brought to mind an earlier one about sending large files
http://www.nabble.com/Question-for-transfering-large-file-tf4222408s16868.html#a12011448

What about the option of calculating the MD5 locally and then sending 
the file and the checksum after that?


-Eero Nevalainen

[EMAIL PROTECTED] wrote:

Hi Trustin,
(sorry for so much mails ;-)
Bloking IO could be problematic so I will probably work on the second
option (in fact my initial thoughts).
My initial work was based on serialization but I fell like it could
be no as efficient as needed, so I need to rethink about it and write
a protocol from scratch which will include a MD5 check on each packet
(security and check of file transport is the key of this project).
Thank a lot
Frederic


Selon Trustin Lee <[EMAIL PROTECTED]>:


On Nov 22, 2007 3:51 AM, Frédéric Brégier <[EMAIL PROTECTED]> wrote:

Hi all,
I feel that the question I post inside my long previous mail should
be on a separate one, so here it is again. Sorry for the double post !

Just a question perhaps stupid :
I have the idea to perhaps use StreamWriteFilter or StreamIoHandler to

transfer some files

but with a protocol exchange before and after the file transfer (to verify

the access, the rules,

to make some pre or post operations, probably making an MD5 check of the

transfered file...).

I have look at the mailing list but I didn't find a good example of what

could be the best

but also I didn't understand how to "get" the file on the other side.
That is to say : I saw some code to send file (using StreamWF) but no on

receiving this file?

I'm surely missing something, obviously...

For now.. you can:

1) Use StreamIoHandler, which is not recommended because it makes MINA
work like a blocking I/O server.  However, it's fine as long as you
limit the usage of the StreamIoHandler.
2) Create a chunk message so your decoder generate multiple chunks
with begin and end mark.

Please let me know if you have any better idea to deal with big files. :)

Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6








[jira] Closed: (DIRMINA-372) Generics support for IoHandler

2007-11-21 Thread Eero Nevalainen (JIRA)

 [ 
https://issues.apache.org/jira/browse/DIRMINA-372?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eero Nevalainen closed DIRMINA-372.
---


Yeah, DemuxingIoHandler does the trick. Closing the issue.

> Generics support for IoHandler
> --
>
> Key: DIRMINA-372
> URL: https://issues.apache.org/jira/browse/DIRMINA-372
> Project: MINA
>  Issue Type: Improvement
>    Reporter: Eero Nevalainen
>Assignee: Trustin Lee
>Priority: Minor
> Fix For: 2.0.0-M1
>
>
> It would be nice to have generics support for IoHandler so that 
> messageReceived and messageSent would be called with the appropriate generic 
> types.

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



Re: [poll] New name for WrappingFilter

2007-11-07 Thread Eero Nevalainen

I think it'd be nicer to have something that ends with IoFilter.
So one more shot at naming the bugger:

EventCombiningIoFilter

-Eero

Mike Heath wrote:

+1 CommonIoEventFilter

It seams like there may be a better name for this but
CommonIoEventFilter would be fine.

-Mike

Maarten Bosteels wrote:

It's hard to come up with a good name for this beast, I'd welcome all new
suggestions :-)
For now, this is my vote:

+1 CommonIoEventFilter

Maarten

On 11/6/07, Trustin Lee <[EMAIL PROTECTED]> wrote:

Hi folks,

WrappingFilter is a new utility abstract IoFilter for those who want
to filter all events in a single filter method:


http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/util/WrappingFilter.java?view=markup

One known usage is here:


http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/logging/MdcInjectionFilter.java?view=markup

However, WrappingFilter doesn't represent what it does exactly, so we
need a new name.  So far, the following names were suggested:

* GenericIoFilter
* SameActionForEveryIoEventTypeFilter
* CommonIoEventFilter
* SingletonActionIoFilter
* MuxingIoFilter - (see http://en.wikipedia.org/wiki/Multiplexing)
* CrossCuttingIoFilter - (see
http://en.wikipedia.org/wiki/Cross-cutting_concern)

Please feel free to add your suggestion or to cast a vote.  I'd like
to see some consensus anyway.

Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6







Re: Renaming WrappingFilter

2007-10-24 Thread Eero Nevalainen

SingletonActionIoFilter?

-Eero Nevalainen

Jeroen Brattinga wrote:

How about CommonIoEventFilter?


Jeroen Brattinga

On Tue, 2007-10-23 at 22:14 +0200, Maarten Bosteels wrote:

What about SameActionForEveryIoEventTypeFilter ?

Ok, a bit long and it doesn't sound very cool but it more or less expresses
what it does.

On 9/29/07, Trustin Lee <[EMAIL PROTECTED]> wrote:

Hi,

WrappingFilter is an abstract IoFilter that helps users to build an
IoFilter that filters all events in one method.  It is useful when you
need to build a filter that performs common action for a certain set
of events.  Good example of the usage is MdcInjectionFilter currently.
LoggingFilter also could be a good example once converted.

However, I think its name, WrappingFilter, doesn't express what it
does correctly.  What would be the best name for this abstract filter?
The following is what I thought so far:

* GenericIoFilter


yes, why not, at least it's better than WrappingFilter

Maarten

Hmm.. that's all so far.  Any idea? :D

Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6







Re: MINA TCP/IP server clustering

2007-10-12 Thread Eero Nevalainen

Kumaran Arul wrote:
Hi 



Has anyone got any experience with clustering MINA servers at a JVM
level? 


How can we replicate IoSessions? Would Terracotta be a good choice?

Any lead or tips will be greatly appreciated?


A google with the keywords " load balancing terracotta " confirmed my 
earlier understanding

http://www.terracotta.org/confluence/display/wiki/Load+Balancers

That is, Terracotta shares all data between the machines so it therefore 
doesn't do load balancing.


Of course if you are looking for something else than load balancing, 
Terracotta might do what you want. It all depends on what you want to 
achieve with the clustering.


-Eero


WSDL on MINA?

2007-10-10 Thread Eero Nevalainen

Hi,

Has someone implemented WSDL (Web Services Description Language) on top 
of MINA?


-Eero Nevalainen


Re: [VOTE] Import KeepAlive functionality contribution under MINA PMC

2007-09-27 Thread Eero Nevalainen
+1 import. The code is actually a bit ugly to use, since I have to store 
and retrieve the IoSession specific values as session attributes and the 
sessionCreated is called elsewhere... In MINA 2.0 this function can be 
properly implemented as an IoFilter, since 2.0 allows to have 
ProtocolCodecFilters earlier in the chain. But import first, refactor 
later..


-Eero

Julien Vermillard wrote:

+1 import, the code is looking nice, and it's a very common need.
Julien

On Thu, 27 Sep 2007 07:24:45 +0900
"Trustin Lee" <[EMAIL PROTECTED]> wrote:


Hi again.

There's an important contribution from Eero Nevalainen that will help
users to implement sending a protocol-specific keep-alive message
periodically:

https://issues.apache.org/jira/browse/DIRMINA-354

It's just a few classes, so I thought we could just import the code,
but procedure is procedure. :)

Software grant has been received long time ago, and also again, it was
not processed on time due to my laziness.  There's no reason not to
import these classes IMO; it's just a few classes that makes people's
life a lot easier.

Once vote passes, I will start the paperwork and all the required
procedure.

[ ]: +1, import
[ ] 0, abstain
[ ]: -1, don't import

Cheers,
Trustin






Re: Bad performance while opening/closing connections frequently.

2007-08-30 Thread Eero Nevalainen

Hmm. Any suggestions as how to diagnose/verify this?

-Eero

Maarten Bosteels wrote:

Could also be your OS that refuses connections because of high load (have
seen this on my centOS box)

Maarten

On 8/30/07, peter royal <[EMAIL PROTECTED]> wrote:

On Aug 30, 2007, at 3:09 AM, Eero Nevalainen wrote:

I have a related problem. We have just started load testing one of
our simple servers. Nothing fancy, no tuning done as of yet, using
MINA 1.1.0.

When our load testing script generates incoming connections
rapidly, our server starts refusing connections after 400
connections. When it's done at a slower pace we start to get
refused connections after 800 established ones. I have one
suspicion, but I'd like to confirm if someone can tell me directly
what's causing this behaviour?

Are you running out of ephemeral ports? Use netstat to see if you
have connections hanging around in CLOSE_WAIT or such.

-pete


--
[EMAIL PROTECTED] - http://fotap.org/~osi











Re: Bad performance while opening/closing connections frequently.

2007-08-30 Thread Eero Nevalainen

peter royal wrote:

On Jul 5, 2007, at 2:05 AM, gh_aiyz wrote:
I'm developing a server based on mina 1.03 ..  but now the 
performance is very bad while opening/closing connections frequently. 
My server is designed for web page-view statistic, so it must support 
frequent connection opening/closing,  and a throughput of 1 times 
/ second is expected.


Did I do anything wrong?? or is it a problem of mina? I need your help...


Alas, MINA does not perform the best when you do frequent setup/teardown 
of connections, due to the latency it involves on the MINA side in the 
context switch between the acceptor thread and the processing threads. 
We'd like to address this for 2.0, but don't have any code written on it 
yet. If you want to help, that'd be great! :)


I have a related problem. We have just started load testing one of our 
simple servers. Nothing fancy, no tuning done as of yet, using MINA 1.1.0.


When our load testing script generates incoming connections rapidly, our 
server starts refusing connections after 400 connections. When it's done 
at a slower pace we start to get refused connections after 800 
established ones. I have one suspicion, but I'd like to confirm if 
someone can tell me directly what's causing this behaviour?


- Eero Nevalainen


Re: ProtocolCodecFilter (UTF-8 text line codec factory) is causing issues with UDP

2007-08-12 Thread Eero Nevalainen
What are you using to generate your messages? What do you use as your 
line delimiter?


-Eero Nevalainen

satish viswanatham wrote:

Hi,

When I create the UDP acceptor with the following config -

cfg.getFilterChain().addLast("codec", new ProtocolCodecFilter(new
TextLineCodecFactory(Charset.forName("UTF-8";


My IoHandlerAdaptor's messageReceived is never called:

   public void messageReceived(IoSession session, Object orig) throws
Exception;

I do see the following line, which tells me that MINA has received the
message, but not calling the IoHandlerAdaptor.

2007-08-11 01:40:33,477 [AnonymousIoService-1] INFO
com.jasperwireless.networktester.UdpServerHandler [null] - [/127.0.0.1:2291]
RECEIVED: HeapBuffer[pos=0 lim=500 cap=500: 00 .]

Is this a known issue? Is there a work around?  It is easy to reproduce. I
tried both on MINA 1.1.0 and MINA 1.1.1. Please let me know, if I should be
trying any work around or fix my code.

Thanks for your help.

Satish





[jira] Closed: (DIRMINA-397) Add convenience constructor for specifying linedelimiter in TextLineCodecFactory

2007-08-03 Thread Eero Nevalainen (JIRA)

 [ 
https://issues.apache.org/jira/browse/DIRMINA-397?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eero Nevalainen closed DIRMINA-397.
---


Ok then. Re-closing the issue.

> Add convenience constructor for specifying linedelimiter in 
> TextLineCodecFactory
> 
>
> Key: DIRMINA-397
> URL: https://issues.apache.org/jira/browse/DIRMINA-397
> Project: MINA
>  Issue Type: Improvement
>  Components: Filter
>    Reporter: Eero Nevalainen
>Assignee: Mark Webb
>Priority: Minor
> Fix For: 2.0.0-M1
>
>
> Change the following
> public TextLineCodecFactory( Charset charset )
> {
> encoder = new TextLineEncoder( charset, LineDelimiter.UNIX );
> decoder = new TextLineDecoder( charset, LineDelimiter.AUTO );
> }
> to
> public TextLineCodecFactory( Charset charset )
> {
> this( charset, LineDelimiter.UNIX, LineDelimiter.AUTO );
> }
> public TextLineCodecFactory( Charset charset, LineDelimiter 
> encodingDelimiter, LineDelimiter decodingDelimiter )
> {
> encoder = new TextLineEncoder( charset, encodingDelimiter );
> decoder = new TextLineDecoder( charset, decodingDelimiter );
> }

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



[jira] Reopened: (DIRMINA-397) Add convenience constructor for specifying linedelimiter in TextLineCodecFactory

2007-08-03 Thread Eero Nevalainen (JIRA)

 [ 
https://issues.apache.org/jira/browse/DIRMINA-397?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eero Nevalainen reopened DIRMINA-397:
-


Can we get this to the 1.1 and 1.0 branches as well?

> Add convenience constructor for specifying linedelimiter in 
> TextLineCodecFactory
> 
>
> Key: DIRMINA-397
> URL: https://issues.apache.org/jira/browse/DIRMINA-397
> Project: MINA
>  Issue Type: Improvement
>  Components: Filter
>    Reporter: Eero Nevalainen
>Assignee: Mark Webb
>Priority: Minor
> Fix For: 2.0.0-M1
>
>
> Change the following
> public TextLineCodecFactory( Charset charset )
> {
> encoder = new TextLineEncoder( charset, LineDelimiter.UNIX );
> decoder = new TextLineDecoder( charset, LineDelimiter.AUTO );
> }
> to
> public TextLineCodecFactory( Charset charset )
> {
> this( charset, LineDelimiter.UNIX, LineDelimiter.AUTO );
> }
> public TextLineCodecFactory( Charset charset, LineDelimiter 
> encodingDelimiter, LineDelimiter decodingDelimiter )
> {
> encoder = new TextLineEncoder( charset, encodingDelimiter );
> decoder = new TextLineDecoder( charset, decodingDelimiter );
> }

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



Re: Resources to learn how to use Mina

2007-07-19 Thread Eero Nevalainen

I had the same problem when I first discovered MINA :)
I found the code examples to be a good place to start learning. The 
reverser and netcat examples are perhaps(?) the simplest.


-Eero

Simon Aquilina wrote:

Thanks Mark,

I did come across that page but went to Developers Guide instead of the 
User Guides. I will follow up those tutorials and try to get some 
knowledge on Mina :)


Thanks and Regards,
Sim085


From: "Mark Webb" <[EMAIL PROTECTED]>
Reply-To: dev@mina.apache.org
To: dev@mina.apache.org
Subject: Re: Resources to learn how to use Mina
Date: Wed, 18 Jul 2007 15:53:57 -0400

You are at the right place!  Here is a link to some documentation:
http://mina.apache.org/documentation.html
Tutorials can be found here:
http://mina.apache.org/documentation.html#Documentation-Tutorials

If you have any problems or questions please feel free to ask them on 
this

list.

On 7/18/07, Simon Aquilina <[EMAIL PROTECTED]> wrote:


Hi,

I just came across Mina a few days ago while asking on another forum on
whether a framework similar to this existed. To say the least Mina 
really
impressed me, however so far I have been finding it a little 
difficult to
find guides detailing how to install Mina and build applications on 
top of
it! Therefore I have subscribed to this mailing list to see if anyone 
can

point me to any particular location(s).

I am sorry if this is the wrong place to ask this question, or it is too
much of asking. However I tried searching documentation material from 
the

http://mina.apache.org but so far did not have any luck.

I am no Java expert, but would not mind contributing (even 
documentations)
once I have learnt what Mina really is and how to use it. I feel 
there is

much to learn, but hopefully with a little help I will succeed :)

Thanks and Regards,
Sim085

_
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/





--
..Cheers
Mark


_
FREE pop-up blocking with the new MSN Toolbar - get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/






[jira] Closed: (DIRMINA-396) Add Convenience constructor for specifying linedelimiter in TextLineCodecFactory

2007-07-09 Thread Eero Nevalainen (JIRA)

 [ 
https://issues.apache.org/jira/browse/DIRMINA-396?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eero Nevalainen closed DIRMINA-396.
---

Resolution: Duplicate

My off finger hit the enter key :P. See 
https://issues.apache.org/jira/browse/DIRMINA-397

> Add Convenience constructor for specifying linedelimiter in 
> TextLineCodecFactory
> 
>
> Key: DIRMINA-396
> URL: https://issues.apache.org/jira/browse/DIRMINA-396
> Project: MINA
>  Issue Type: Improvement
>  Components: Filter
>    Reporter: Eero Nevalainen
>Priority: Minor
>


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



Re: Windows Telnet and GPRS clients

2007-07-09 Thread Eero Nevalainen
You can tell TextLineEncoder and TextLineDecoder to use any 
LineDelimiter you need. TextLineCodecFactory just wraps these two up and 
implements the ProtocolCodecFactory interface.

(just two methods, getEncoder() and getDecoder())

-Eero Nevalainen

Ahmed Al-Obaidy wrote:

So what you are suggesting...

can I tell TextLineCodecFactory to use different LineDelimiter?? or should I 
write new codec from scratch??

Eero Nevalainen <[EMAIL PROTECTED]> wrote: 


Ahmed Al-Obaidy wrote:

Even more, when tracking devices connect the server... the messages appear
in the Log.. but the IoHandlerAdapter never catch the messages events...
the output look like this

Tracking Gateway server started.
57453 [SocketAcceptorIoProcessor-0.0] INFO ConnHandler -
[/213.139.63.254:3599] CREATED
57469 [AnonymousIoService-1] INFO ConnHandler - [/213.139.63.254:3599]
OPENED
58859 [AnonymousIoService-2] INFO ConnHandler - [/213.139.63.254:3599]
RECEIVED: HeapBuffer[pos=0 lim=102 cap=8192: 33 35 33 35 37 39 30 31 34 38
34 32 33 36 39 2C 30 35 2A 38 32 37 2C 30 30 30 2C 50 54 33 33 2C 56 2C 30
30 30 30 2E 30 30 30 30 2C 4E 2C 30 30 30 30 30 2E 30 30 30 30 2C 45 2C 30
30 30 2E 30 2C 30 30 30 2E 30 2C 30 30 2E 30 2C 30 30 3A 30 30 3A 31 37 20
30 36 2D 30 31 2D 38 30 2C 32 2E 32 31 2C 39 39 0D]
78672 [AnonymousIoService-3] INFO ConnHandler - [/213.139.63.254:3599]
RECEIVED: HeapBuffer[pos=0 lim=102 cap=8192: 33 35 33 35 37 39 30 31 34 38
34 32 33 36 39 2C 30 35 2A 38 32 37 2C 30 30 30 2C 50 54 33 33 2C 56 2C 30
30 30 30 2E 30 30 30 30 2C 4E 2C 30 30 30 30 30 2E 30 30 30 30 2C 45 2C 30
30 30 2E 30 2C 30 30 30 2E 30 2C 30 30 2E 30 2C 30 30 3A 30 30 3A 34 39 20
30 36 2D 30 31 2D 38 30 2C 32 2E 32 31 2C 39 39 0D]


Well the hexdump only shows the 'carriage return' character at the 
end(CR 0x0D) so my guess is the textlinedecoder is still waiting for the 
'line feed' character (LF 0x0A).


-Eero Nevalainen


   
-

Choose the right car based on your needs.  Check out Yahoo! Autos new Car 
Finder tool.




[jira] Commented: (DIRMINA-397) Add convenience constructor for specifying linedelimiter in TextLineCodecFactory

2007-07-09 Thread Eero Nevalainen (JIRA)

[ 
https://issues.apache.org/jira/browse/DIRMINA-397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12511103
 ] 

Eero Nevalainen commented on DIRMINA-397:
-

It seems I'm not the only one who needs to set the delimiters manually. 
Although TextLineEncoder and Decoder can be used directly to the same effect 
this change would make my code a little bit prettier.

> Add convenience constructor for specifying linedelimiter in 
> TextLineCodecFactory
> 
>
> Key: DIRMINA-397
> URL: https://issues.apache.org/jira/browse/DIRMINA-397
> Project: MINA
>  Issue Type: Improvement
>  Components: Filter
>    Reporter: Eero Nevalainen
>Priority: Minor
>
> Change the following
> public TextLineCodecFactory( Charset charset )
> {
> encoder = new TextLineEncoder( charset, LineDelimiter.UNIX );
> decoder = new TextLineDecoder( charset, LineDelimiter.AUTO );
> }
> to
> public TextLineCodecFactory( Charset charset )
> {
> this( charset, LineDelimiter.UNIX, LineDelimiter.AUTO );
> }
> public TextLineCodecFactory( Charset charset, LineDelimiter 
> encodingDelimiter, LineDelimiter decodingDelimiter )
> {
> encoder = new TextLineEncoder( charset, encodingDelimiter );
> decoder = new TextLineDecoder( charset, decodingDelimiter );
> }

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



[jira] Created: (DIRMINA-397) Add convenience constructor for specifying linedelimiter in TextLineCodecFactory

2007-07-09 Thread Eero Nevalainen (JIRA)
Add convenience constructor for specifying linedelimiter in TextLineCodecFactory


 Key: DIRMINA-397
 URL: https://issues.apache.org/jira/browse/DIRMINA-397
 Project: MINA
  Issue Type: Improvement
  Components: Filter
Reporter: Eero Nevalainen
Priority: Minor


Change the following

public TextLineCodecFactory( Charset charset )
{
encoder = new TextLineEncoder( charset, LineDelimiter.UNIX );
decoder = new TextLineDecoder( charset, LineDelimiter.AUTO );
}

to

public TextLineCodecFactory( Charset charset )
{
this( charset, LineDelimiter.UNIX, LineDelimiter.AUTO );
}

public TextLineCodecFactory( Charset charset, LineDelimiter encodingDelimiter, 
LineDelimiter decodingDelimiter )
{
encoder = new TextLineEncoder( charset, encodingDelimiter );
decoder = new TextLineDecoder( charset, decodingDelimiter );
}

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



[jira] Created: (DIRMINA-396) Add Convenience constructor for specifying linedelimiter in TextLineCodecFactory

2007-07-09 Thread Eero Nevalainen (JIRA)
Add Convenience constructor for specifying linedelimiter in TextLineCodecFactory


 Key: DIRMINA-396
 URL: https://issues.apache.org/jira/browse/DIRMINA-396
 Project: MINA
  Issue Type: Improvement
  Components: Filter
Reporter: Eero Nevalainen
Priority: Minor




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



Re: Windows Telnet and GPRS clients

2007-07-09 Thread Eero Nevalainen



Ahmed Al-Obaidy wrote:

Even more, when tracking devices connect the server... the messages appear
in the Log.. but the IoHandlerAdapter never catch the messages events...
the output look like this

Tracking Gateway server started.
57453 [SocketAcceptorIoProcessor-0.0] INFO ConnHandler -
[/213.139.63.254:3599] CREATED
57469 [AnonymousIoService-1] INFO ConnHandler - [/213.139.63.254:3599]
OPENED
58859 [AnonymousIoService-2] INFO ConnHandler - [/213.139.63.254:3599]
RECEIVED: HeapBuffer[pos=0 lim=102 cap=8192: 33 35 33 35 37 39 30 31 34 38
34 32 33 36 39 2C 30 35 2A 38 32 37 2C 30 30 30 2C 50 54 33 33 2C 56 2C 30
30 30 30 2E 30 30 30 30 2C 4E 2C 30 30 30 30 30 2E 30 30 30 30 2C 45 2C 30
30 30 2E 30 2C 30 30 30 2E 30 2C 30 30 2E 30 2C 30 30 3A 30 30 3A 31 37 20
30 36 2D 30 31 2D 38 30 2C 32 2E 32 31 2C 39 39 0D]
78672 [AnonymousIoService-3] INFO ConnHandler - [/213.139.63.254:3599]
RECEIVED: HeapBuffer[pos=0 lim=102 cap=8192: 33 35 33 35 37 39 30 31 34 38
34 32 33 36 39 2C 30 35 2A 38 32 37 2C 30 30 30 2C 50 54 33 33 2C 56 2C 30
30 30 30 2E 30 30 30 30 2C 4E 2C 30 30 30 30 30 2E 30 30 30 30 2C 45 2C 30
30 30 2E 30 2C 30 30 30 2E 30 2C 30 30 2E 30 2C 30 30 3A 30 30 3A 34 39 20
30 36 2D 30 31 2D 38 30 2C 32 2E 32 31 2C 39 39 0D]


Well the hexdump only shows the 'carriage return' character at the 
end(CR 0x0D) so my guess is the textlinedecoder is still waiting for the 
'line feed' character (LF 0x0A).


-Eero Nevalainen


Re: Session close problem

2007-05-28 Thread Eero Nevalainen

Response inline.

Rob Butler wrote:

Wow Eero!

Thanks for taking the time to determine what the problem was and

> report it back to the group.


So in summary (to make sure I understand this correctly)

1) If you send data too rapidly for the device to download from the
GPRS (exceed it's bandwidth), then all data will queue up there

> instead of it trickling down until caught up.  If the remote end
> sends any message the GPRS send queue is unblocked and data is
> sent to the remote device.  Is this correct?

Seems I should have stated my tests a bit more clearly.
I have NOT tested exceeding the bandwidth. I've only tested how the 
network behaves when the connection is idle for a long time. All the 
messages I sent were very small. For some reason our network "blocks" 
one-directionally, when there's no communication.



2) If you have a delay of more than 50 seconds between messages sent to the 
remote device they will queue up at the GPRS until the remote end sends a 
message and the GPRS send queue is unblocked.  Is this correct?


Correct.


Which cellular network were your tests done on?   Cingular/AT&T, Sprint/Nextel, 
Verizon, T-Mobile, something else?

Do you have the ability to repeat these tests with another cellular network?  
It would be interesting to see if these numbers and particular problem exist 
only with one network or if it is a common one.

In addition to the tests you've already run, could you do a few more?  Some 
thing's I'd be interested in knowing is:



I don't want to name our network provider because we don't want to look 
like we are blaming them(We're actually quite happy with them). We also 
don't have SIMs from other providers so I can't repeat the tests on 
another network.


As for the suggested additional tests, I'm afraid I have to direct my 
time to more  urgent matters. Maybe someone else can pickup from here.


-Eero Nevalainen



- Original Message 
From: Eero Nevalainen <[EMAIL PROTECTED]>
To: dev@mina.apache.org
Cc: Rob Butler <[EMAIL PROTECTED]>
Sent: Monday, May 28, 2007 4:05:53 AM
Subject: Re: Session close problem

I've now finished my tests which revealed the problem. Took a while 
because I had to redo the last test due to lack of materials..:)


A description of the problem scenario is on my earlier message included 
further below.


Tests, their results and conclusions (immediately) below:

1. Test - Replicate the problem
I simulated the gateway by listening with netcat. At first I sent 'PING' 
messages rapidly and the connection worked fine. Then I waited for three 
minutes and tried again. The connection wasn't working.


- The problem can be replicated with other tools and is related to the 
activity of communication.



2. Test - Measure delay threshold
On the second setup I wrote a fake GW which sends PINGs with increasing 
delays: 5s, 6s, 7s, ...
At a certain threshold the remote device no longer replied PONG. Before 
the threshold all PINGs received a response. On three measurements the 
thresholds were:

48s
49s
48s

3. Test - Figure characteristic behaviour
This time I used a remote device on our lab, which had an ethernet 
connection in addition to the GPRS. I used netcat on both ends to send 
chosen traffic activity over the GPRS. The following behavioural rules 
were obtained:


- messages from the remote device always arrive properly
- if the gateway sends messages thicker than the ~50s threshold, the 
messages are received and continue to be received normally.
- if the gateway exceeds the threshold in it's communication, the 
messages are queued. A message sent by the remote device flushes the queue.



4. Test - Test radio blackout scenario
This test was like the 3rd test, except I yanked out the GPRS antenna. I 
  had to redo this one because the tiny antenna connector was actually 
providing enough of antenna for GPRS to work! Wrapping the device in 
aluminum foil proved effective though :) The following was observed:


- if the remote device has lost it's connection for more than 50s the 
connection will become 'locked' even if the gateway sends messages 
during that time. A message from the remote device flushes the queue as 
usual.



A coworker has heard this is a known problem with the Gateway GPRS 
Support Node (GGSN). It will probably be fixed at some point, but 
currently the only safe workaround is to send messages from the remote end.


Hope this is useful.

-Eero Nevalainen

Rob Butler wrote:

Eero,

I came across this (http://www.cl.cam.ac.uk/~rc277/globe02.pdf).

It would appear that a cellular device could have issue with receiving data because it temporarily 
goes out of range or has some other issue which causes packets to "back up" at the GPRS 
device.  From the above document it looks like it could take up to a minute before that backlog is 
cleared up.  Have yo

Re: Session close problem

2007-05-28 Thread Eero Nevalainen
I've now finished my tests which revealed the problem. Took a while 
because I had to redo the last test due to lack of materials..:)


A description of the problem scenario is on my earlier message included 
further below.


Tests, their results and conclusions (immediately) below:

1. Test - Replicate the problem
I simulated the gateway by listening with netcat. At first I sent 'PING' 
messages rapidly and the connection worked fine. Then I waited for three 
minutes and tried again. The connection wasn't working.


- The problem can be replicated with other tools and is related to the 
activity of communication.



2. Test - Measure delay threshold
On the second setup I wrote a fake GW which sends PINGs with increasing 
delays: 5s, 6s, 7s, ...
At a certain threshold the remote device no longer replied PONG. Before 
the threshold all PINGs received a response. On three measurements the 
thresholds were:

48s
49s
48s

3. Test - Figure characteristic behaviour
This time I used a remote device on our lab, which had an ethernet 
connection in addition to the GPRS. I used netcat on both ends to send 
chosen traffic activity over the GPRS. The following behavioural rules 
were obtained:


- messages from the remote device always arrive properly
- if the gateway sends messages thicker than the ~50s threshold, the 
messages are received and continue to be received normally.
- if the gateway exceeds the threshold in it's communication, the 
messages are queued. A message sent by the remote device flushes the queue.



4. Test - Test radio blackout scenario
This test was like the 3rd test, except I yanked out the GPRS antenna. I 
 had to redo this one because the tiny antenna connector was actually 
providing enough of antenna for GPRS to work! Wrapping the device in 
aluminum foil proved effective though :) The following was observed:


- if the remote device has lost it's connection for more than 50s the 
connection will become 'locked' even if the gateway sends messages 
during that time. A message from the remote device flushes the queue as 
usual.



A coworker has heard this is a known problem with the Gateway GPRS 
Support Node (GGSN). It will probably be fixed at some point, but 
currently the only safe workaround is to send messages from the remote end.


Hope this is useful.

-Eero Nevalainen

Rob Butler wrote:

Eero,

I came across this (http://www.cl.cam.ac.uk/~rc277/globe02.pdf).

It would appear that a cellular device could have issue with receiving data because it temporarily 
goes out of range or has some other issue which causes packets to "back up" at the GPRS 
device.  From the above document it looks like it could take up to a minute before that backlog is 
cleared up.  Have you tried waiting around for a while to see if the ping packet eventually makes 
it to the device?  If it does make it "eventually" you could decrease your ping send 
interval while simultaneously increasing the time you wait for a ping response.  Unfortunately this 
means your connection could go down for a little while before you notice it, but at least you'd 
have something that lets you know the connection is bad eventually.

Another consideration may be the infamous naggle algorithm.  You can of course 
turn it off on your server application and on your client as well.  
Unfortunately you have no control on whether the GPRS is using naggle for it's 
connection to the cellular device.  Have you tried sending a lot of ping 
packets?  This is of course wasteful, but if you send approximately 1500 bytes 
worth of ping data and miraculously they all arrive at the device at once 
naggle, or something equally nefarious, is probably the cause.

Be aware that 1500 bytes or so is the usual Maximum Transmission Unit on most LAN's by default, but 
this can be changed easily and may very likely be different on the cellular network.  I'd try 
sending multiple ping packets slowly (like 1 every 30 seconds to one minute) and see how many you 
have sent before the first one arrives.  When the first one arrives you'll probably get a bunch of 
them together at once.  Try to count how many arrive at once (or in very rapid succession) and then 
try sending that many ping packets + 1 more all at once from your server.  If your rapid fire of 
multiple pings works more reliably one solution may simply be to send artifically large ping 
packets.  By fine tuning the packet size of your ping message you may be able to more reliably 
circumvent the "grouping" of naggle and similar approaches.  Whatever you find is the 
"sweet spot" for packet size you may want to increase it slightly so on other networks 
with potentially larger MTU sizes your
 application still works.  Again, this is all wasteful from a bandwidth 
perspective - especially when end-users are charged per MB of data transfer on 
some cell networks, but at least it would be a wor

Re: JMX tutorial on Eclipse

2007-05-24 Thread Eero Nevalainen
The code is exactly as described on the tutorial 
http://mina.apache.org/jmx-integration.html

I've also included it on the bottom..

Even stranger is that I made an own MBean using the same pattern as here 
and it showed fine also under Eclipse. veeery weird..




// Create an acceptor
final IoAcceptor acceptor = new SocketAcceptor();

// add JMX stuff
IoServiceManager serviceManager = new IoServiceManager( acceptor );
serviceManager.startCollectingStats(1000);
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName name = new 
ObjectName("mina.example.http.server:type=IoServiceManager");

mbs.registerMBean(serviceManager, name);

// Create a service configuration
SocketAcceptorConfig cfg = new SocketAcceptorConfig();
...


Mark Webb wrote:
could you send me your code?  My first guess is that you don't have your 
JMX

bean set up properly and/or registered.

On 5/22/07, Eero Nevalainen <[EMAIL PROTECTED]> wrote:


I'm using JDK 5. I gave the argument
-Dcom.sun.management.jmxremote

to the "VM arguments" list under "Run as"->"Run"->"Arguments". Without
the option the jconsole doesn't of course show any VMs running.

Mark Webb wrote:
> are you using JDK 5 or 6 in Eclipse?  I think for version 5, you must
add a
> command line argument to the JVM.
>
> On 5/22/07, Eero Nevalainen <[EMAIL PROTECTED]> wrote:
>>
>> Hi,
>>
>> I went through the JMX tutorial and started it on Eclipse. The 
JConsole

>> wasn't showing the IoServiceManager mbean. Works fine when started
>> normally from a command line. Anyone else experience this?
>>
>> Also another question: Am I risking some horrible, horrible fate by
>> placing this call on my code?
>>
>> Runtime.getRuntime().addShutdownHook(new Thread() {
>> public void run() {
>> acceptor.unbindAll();
>> }
>> });
>>
>> -Eero Nevalainen
>>
>
>
>









Re: JMX tutorial on Eclipse

2007-05-22 Thread Eero Nevalainen

I'm using JDK 5. I gave the argument
-Dcom.sun.management.jmxremote

to the "VM arguments" list under "Run as"->"Run"->"Arguments". Without 
the option the jconsole doesn't of course show any VMs running.


Mark Webb wrote:

are you using JDK 5 or 6 in Eclipse?  I think for version 5, you must add a
command line argument to the JVM.

On 5/22/07, Eero Nevalainen <[EMAIL PROTECTED]> wrote:


Hi,

I went through the JMX tutorial and started it on Eclipse. The JConsole
wasn't showing the IoServiceManager mbean. Works fine when started
normally from a command line. Anyone else experience this?

Also another question: Am I risking some horrible, horrible fate by
placing this call on my code?

Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
    acceptor.unbindAll();
}
});

-Eero Nevalainen









JMX tutorial on Eclipse

2007-05-22 Thread Eero Nevalainen

Hi,

I went through the JMX tutorial and started it on Eclipse. The JConsole 
wasn't showing the IoServiceManager mbean. Works fine when started 
normally from a command line. Anyone else experience this?


Also another question: Am I risking some horrible, horrible fate by 
placing this call on my code?


Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
acceptor.unbindAll();
}
});

-Eero Nevalainen


setEnumAttribute?

2007-05-22 Thread Eero Nevalainen
I was thinking about an earlier discussion about setting attributes last 
night. One thing that bugs me a bit is that the key is a String and 
someone else might be using that same String as their key.


So I had the thought of setting attributes with Enums. Mapping to the 
correct enum class and then with the enum key would probably "eliminate" 
an accidental key collision.


This could even be implemented without the need to calculate hashvalues, 
by making the clients store the index of their specifice enum class.


Unfortunately I also just noticed that there's no implementation for a 
ConcurrentEnumMap yet in JDK 1.6. This damps the idea quite a bit but I 
thought I'd voice it anyway.


-Eero Nevalainen


Javadoc download

2007-05-22 Thread Eero Nevalainen

Hi,

Is there a downloadable version of the javadoc? I wasn't able to find 
one.. It's good to have when you want don't want to wait for the network 
delay when browsing documentation.


If there's anyone else wanting this, running
"javadoc -d javadoc -subpackages org"

in the MINA_DONWLOAD/core/src/main/java/ directory gives a reasonably 
good local javadoc reference. There were some warnings about Logger 
references though..


-Eero Nevalainen


Re: Session close problem

2007-05-11 Thread Eero Nevalainen

Hi all,

I've recently deployed a gateway server to mediate communication between 
 clients and remote devices. The gateway works fine in a 'regular' 
network, but now we're experiencing problems when the remote devices are 
 behind a GPRS network.


The gateway sends an application level (TCP) 'PING' message periodically 
to the remote devices. For some reason the PING messages seem to queue 
up in the GPRS connection, without the devices receiving them.


Meanwhile, sending an ICMP request to the same devices gives a much 
smaller roundtrip time (~700ms) and no message losses. Also the messages 
sent by the remote devices to the gateway always arrive properly.


I can't reproduce this problem with an ethernet connection so any help 
with the GPRS network would be most welcome!


-Eero Nevalainen

Dawie Malan wrote:

You're quite right - there is something in the middle, and it does cause the
symptoms you are reporting.

A GPRS network has two essential elements:

*Serving GPRS Support Node (SGSN)-Sends data to and receives data from mobile
stations, and maintains information about the location of a mobile station (MS).
The SGSN communicates between the MS and the GGSN.

*Gateway GPRS Support Node (GGSN)-A wireless gateway that allows mobile cell
phone users to access the public data network (PDN) or specified private IP
networks.

The GGSN acts like a proxy and is the device that sends the ACKs to the phone
even though the session is already closed on the server side.

I hope this answers your question.

Regards,

Dawie Malan


-Original Message-
From: Michael Bauroth [mailto:[EMAIL PROTECTED] 
Sent: 22 March 2007 04:40 PM

To: dev@mina.apache.org
Subject: Session close problem

Hi,

I'm using currently the trunk version of Mina. I use it to communicate 
with GPRS devices on the other side. In most cases this works very well!


But sometimes the things become strange. I've collected a bunch of 
problems where I would need help / advices / ideas.


1. I call session.close() from inside my server. It seems, that the 
session doesn't close as required.


2. I close the session. The GPRS device on the other side continues to 
send data and seems to get ACKs too. It doesn't recognize, that the 
other side of the connection (the server) has closed the session a while 
before. It seems that there is something in the middle which responds 
the ACKs even with not opened server session.


Knows anybody one of the two (most painful) problems and has an answer 
for me?


Best Regards
Michael







Re: boardcasting

2007-04-25 Thread Eero Nevalainen

Trustin Lee wrote:

> If so,
> should I move my encoding part in the IoHandler which means
> encoding once
> and send bytes to sessions(without encoding N times but once).


You can do that, but it's not encouraged.  I'd use a LRU cache so the
encoded buffer is cached, and reused on and on.  Of course, you will
have to use the duplicate of the encoded buffer:

ByteBuffer data = cache.get(message);
out.write(data.duplicate());


I have to do something like this as well. Do you mean that this is 
called from the encoder? So that the encoder has the cache as an 
instance variable and for each session to broadcast it will retrieve the 
message from the cache?


-Eero Nevalainen


[jira] Commented: (DIRMINA-372) Generics support for IoHandler

2007-04-24 Thread Eero Nevalainen (JIRA)

[ 
https://issues.apache.org/jira/browse/DIRMINA-372?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12491446
 ] 

Eero Nevalainen commented on DIRMINA-372:
-

Julien: then you leave type unspecified and use Object like before :)

> Generics support for IoHandler
> --
>
> Key: DIRMINA-372
> URL: https://issues.apache.org/jira/browse/DIRMINA-372
> Project: MINA
>  Issue Type: Improvement
>Affects Versions: 1.1.0
>    Reporter: Eero Nevalainen
>Priority: Minor
> Fix For: 1.1.1, 2.0.0-M1
>
>
> It would be nice to have generics support for IoHandler so that 
> messageReceived and messageSent would be called with the appropriate generic 
> types.

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



[jira] Created: (DIRMINA-372) Generics support for IoHandler

2007-04-24 Thread Eero Nevalainen (JIRA)
Generics support for IoHandler
--

 Key: DIRMINA-372
 URL: https://issues.apache.org/jira/browse/DIRMINA-372
 Project: MINA
  Issue Type: Improvement
Affects Versions: 1.1.0
Reporter: Eero Nevalainen
Priority: Minor
 Fix For: 1.1.1, 2.0.0-M1


It would be nice to have generics support for IoHandler so that messageReceived 
and messageSent would be called with the appropriate generic types.

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



Re:Issue with resource locking

2007-04-21 Thread Eero Nevalainen

Dupont jean wrote:

I'm effectively trying to lock access to a POP3 user mailbox using the J2SE 5.0 
ReentrantLock implementation.


Would java.util.concurrent.Semaphore be enough for you? Using it as a 
binary semaphore as stated in the description works pretty much like a 
lock and can be released from another thread than the one that 
originally acquired it...


-Eero Nevalainen


Re: Mina token

2007-04-10 Thread Eero Nevalainen

mat wrote:

Thanks. Trustin

However, is it already in the mina1.0.2? BTW, can I implement my own
protocol for ping-pong purpose?


The "filter" will send whatever message that's specified in the 
constructor, so you can use it with whatever protocol.



Trustin: I just noted that the ActiveKeepAliveFilter that I sent you 
actually doesn't have the constructor that let's you specify the sent 
messages. Can you include that along with the integration? If you look 
at the abstract super class you'll see what I mean.


-Eero Nevalainen


Server problem?

2007-03-28 Thread Eero Nevalainen

Hi,

is there something wrong with http://mina.apache.org/ ?

I get "403 Forbidden" when trying from Helsinki area.

The error message is
"You don't have permission to access /~jefft/confluence/MINA/index.html 
on this server."


-Eero Nevalainen


Re: heartbeat and connection monitoring

2007-02-26 Thread Eero Nevalainen

robert burrell donkin wrote:

On 2/18/07, Eero Nevalainen <[EMAIL PROTECTED]> wrote:

- Any advice or examples on how the software grant is supposed to be
worded? IANAL either.


use the standard software grant


done and faxed.


After I've faxed our CCLA and my CLA is there something else that needs
to be done before sending code? Also, what's the preferred way to
actually transfer the code?


zip up the source. either create an openPGP compatible signature or a
checksum and reference that in the grant. create a JIRA and attach the
source.


 Not done. The JIRA was very slow and hasn't responded for a few 
minutes. I'll try again in the evening.



Visibility stuff:

> apache seems comfortable with an attribution in the NOTICE file
> similar to the apache notice:
>
> "This product includes software developed at The Apache Software
> Foundation (http://www.apache.org/)."
>
> for example http://svn.apache.org/repos/asf/db/derby/code/trunk/NOTICE
>
> if the company is looking for more than that (for example, links from
> the web site) then this is leading into areas outside the comfort
> zone...

The mention in the NOTICE file seems fine. I was originally thinking
about maybe leaving something like "Thanks to Indagon for the original"
in the class files, WDYT?


you'll find that would be a PITA: expect to be contacted by lawyers
for the next N years asking you to confirm the grant and asking for
proof that you created the originals. this is one reason why apache
relocates attributions to the NOTICE file. (there are others.)

"Thanks to Indagon for the original" is a (legally) ambiguous attribution.

"This product includes software developed at Indagon
(http://www.???.???/)." is the recommended wording. it's worked the
best over the years.


The address would be http://www.indagon.com/ Since you already seem to 
have more than enough experience, then let's do as you suggested and 
steer clear of the PITA.


-Eero


[jira] Created: (DIRMINA-354) Software grant for a KeepAlive functionality

2007-02-26 Thread Eero Nevalainen (JIRA)
Software grant for a KeepAlive functionality


 Key: DIRMINA-354
 URL: https://issues.apache.org/jira/browse/DIRMINA-354
 Project: MINA
  Issue Type: New Feature
  Components: Filter
Reporter: Eero Nevalainen


Sending the source by zip as advised by Robert

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



Re: heartbeat and connection monitoring

2007-02-18 Thread Eero Nevalainen


Thank you Robert and Alex for your explanations. I took a look at
http://www.apache.org/legal/ and http://incubator.apache.org/.
The CCLA and software grant seem appropriate to me but the Incubator
process sounds like overkill, because it's just four classes.

I got an "All ok" from my bosses on friday. Benoit: If you're not in
hurry I can probably get the details cleared for Mon 26. or one week
from that at the latest. (I have a week of vacation starting today).


Practical stuff:
At the end of the Corporate CLA are Schedules A and B. I understand
we're supposed to replace the content in brackets. Few questions:

- What kind of extra security does the employee "whitelisting" bring? If
 we have a malevolent/incompetent new employee who posts company code,
are we somehow more protected?

- Any advice or examples on how the software grant is supposed to be
worded? IANAL either.


After I've faxed our CCLA and my CLA is there something else that needs
to be done before sending code? Also, what's the preferred way to
actually transfer the code?

Visibility stuff:

> apache seems comfortable with an attribution in the NOTICE file
> similar to the apache notice:
>
> "This product includes software developed at The Apache Software
> Foundation (http://www.apache.org/)."
>
> for example http://svn.apache.org/repos/asf/db/derby/code/trunk/NOTICE
>
> if the company is looking for more than that (for example, links from
> the web site) then this is leading into areas outside the comfort
> zone...

The mention in the NOTICE file seems fine. I was originally thinking
about maybe leaving something like "Thanks to Indagon for the original"
in the class files, WDYT?

-Eero Nevalainen


Re: heartbeat and connection monitoring

2007-02-14 Thread Eero Nevalainen

Trustin Lee wrote:

Hi Benoit,

2007-02-12 (월), 13:32 +, Benoit Hudzia 쓰시길:
Hi, 
 A couple of month ago, somebody mentioned the possibility to add a

heartbeat monitoring system for connection as filter. This filter would have
been based on an implementation done in another project. 


Did anybody implemented it? If not, can somebody point me to the project so
I can have a look and see if I can implement it myself?


The heartbeat code was from Qpid project (in Apache incubator), but they
told me that their code had turned out to be not usable as we expected.
Implementing an heartbeat filter is very easy though.  Let me add a JIRA
issue for it.

https://issues.apache.org/jira/browse/DIRMINA-350


Hi,

I implemented this kind of thing a while ago as a part of our company 
project and thought about posting it, since it's something the framework 
could very well provide.


The company gave a preliminary approval of sharing and participating 
with MINA, but we haven't cleared out all the terms yet. I think I saw 
somewhere that all @author tags and copyright notices would need to be 
removed if the code is published with the Apache license. Am I 
remembering correctly? The company would like to have at least some 
"thanks to" mention if we send stuff..


This is not a major problem though as like Trustin said, it's very easy 
to implement. I'd still like to know though..


-Eero Nevalainen