You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@mina.apache.org by Jose María Zaragoza <de...@gmail.com> on 2013/10/03 22:32:11 UTC

Bug (?) getting encoder in TextLineCodecFactory in Mina 1.1.7

Hello:

I'm using Mina 1.1.7

I'm getting problems when i try to use a custom ProtocolCodecFilter +
TextLineCodecFactory
Decoding works fine but encoding doesn't: method getEncoder() is never
invoked (  but getDecoder() does )


This the code:


I add the filter by passing a config object when connecting,   like

config.getFilterChain().addLast("filter", new ProtocolCodecFilter(new
CharacterDelimiterCodecFactory ("\0','UTF-8')));



and CharacterDelimiterCodecFactory class is defined as

public class CharacterDelimiterCodecFactory extends TextLineCodecFactory
{
private TextLineDecoder decoder = null;
private TextLineDecoder encoder = null;

public CharacterDelimiterCodecFactory(String delimiter, String charSet)
{
decoder = new TextLineDecoder(Charset.forName(charSet),new
LineDelimiter(delimiter));
encoder= new TextLineEncder(Charset.forName(charSet),new
LineDelimiter(delimiter));
}
public ProtocolDecoder getDecoder()
{

       return decoder;
   }

public ProtocolEncoder getEncoder()
{

       return encoder;
   }

}


What is wrong ? any ideas or w/a ?

FYI , Mina 2.0 all  works fine but I can't migrate

Thanks and regards

Re: Bug (?) getting encoder in TextLineCodecFactory in Mina 1.1.7

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 10/4/13 2:43 PM, Jose María Zaragoza a écrit :
> Yes, 2.0.7
>
> I've checked that closing sessions isn't enough to free all underlying
> resources and I need to execute dispose() method on SocketConnector
> object
> I've see that I only execute session.close() , there is a waiting JVM
> thread what never ends

Which makes sense. Session.close() just close the session, not the
service. Now, why are you creating many connectors ? Can't you reuse
ione already existing ?


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 


Re: Bug (?) getting encoder in TextLineCodecFactory in Mina 1.1.7

Posted by Jose María Zaragoza <de...@gmail.com>.
Yes, 2.0.7

I've checked that closing sessions isn't enough to free all underlying
resources and I need to execute dispose() method on SocketConnector
object
I've see that I only execute session.close() , there is a waiting JVM
thread what never ends








2013/10/4 Bugra Cakir <bu...@mobiliz.com.tr>:
>
>
> But we don't get this problem. We are using Mina 2.0.7 ? Isn't it strange ?
>
> Bugra
>
>
> 4 Eki 2013 tarihinde 15:10 saatinde, Jose María Zaragoza <de...@gmail.com>
>  şunları yazdı:
>
>> OK
>> I think that I found the cause of the problem
>>
>>
>> I need to perform
>>
>> SocketConnector.dispose()
>>
>> I only was closing session with session.close()
>>
>>
>> What is the right way to finish a communitcation  immediately?
>>
>> session.close():
>> socket.dispose();
>> ?
>>
>> or is it only  enough to perfom socket.dispose(); ?
>>
>>
>> Thanks
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> 2013/10/4 Jose María Zaragoza <de...@gmail.com>:
>>> I'm closing the same resources with MINA 2.x and MINA 1.1.x.
>>> Maybe there are new resources in MINA 2.x which should be close and I
>>> don't know them
>>>
>>> I'm going to start standalone tests because I had to downgrade  from
>>> 2.0.7 to 1.1.7 because the application is running on production
>>> enviroment and I couldn't do many tests
>>>
>>>
>>>
>>> 2013/10/4 Emmanuel Lécharny <el...@gmail.com>:
>>>> Le 10/4/13 9:06 AM, Jose María Zaragoza a écrit :
>>>>> OK.
>>>>> I'm going to debug that issue and I will tell you my conclusions
>>>>>
>>>>> So far, I only can know that the same code running on Tomcat but with
>>>>> lastest MINA release creates a lot of FIFO file descriptors, but 1.1.7
>>>>> doesn't,
>>>>
>>>> You most certainly have some opened streams that need to be closed. The
>>>> way MINA 1 works is very different from MINA 2, so be sure you always
>>>> cleanup whatever resource you use in your code.
>>>>
>>>>
>>>> --
>>>> Regards,
>>>> Cordialement,
>>>> Emmanuel Lécharny
>>>> www.iktek.com
>>>>
>

Re: Bug (?) getting encoder in TextLineCodecFactory in Mina 1.1.7

Posted by Bugra Cakir <bu...@mobiliz.com.tr>.

But we don't get this problem. We are using Mina 2.0.7 ? Isn't it strange ?

Bugra


4 Eki 2013 tarihinde 15:10 saatinde, Jose María Zaragoza <de...@gmail.com>
 şunları yazdı:

> OK
> I think that I found the cause of the problem
> 
> 
> I need to perform
> 
> SocketConnector.dispose()
> 
> I only was closing session with session.close()
> 
> 
> What is the right way to finish a communitcation  immediately?
> 
> session.close():
> socket.dispose();
> ?
> 
> or is it only  enough to perfom socket.dispose(); ?
> 
> 
> Thanks
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 2013/10/4 Jose María Zaragoza <de...@gmail.com>:
>> I'm closing the same resources with MINA 2.x and MINA 1.1.x.
>> Maybe there are new resources in MINA 2.x which should be close and I
>> don't know them
>> 
>> I'm going to start standalone tests because I had to downgrade  from
>> 2.0.7 to 1.1.7 because the application is running on production
>> enviroment and I couldn't do many tests
>> 
>> 
>> 
>> 2013/10/4 Emmanuel Lécharny <el...@gmail.com>:
>>> Le 10/4/13 9:06 AM, Jose María Zaragoza a écrit :
>>>> OK.
>>>> I'm going to debug that issue and I will tell you my conclusions
>>>> 
>>>> So far, I only can know that the same code running on Tomcat but with
>>>> lastest MINA release creates a lot of FIFO file descriptors, but 1.1.7
>>>> doesn't,
>>> 
>>> You most certainly have some opened streams that need to be closed. The
>>> way MINA 1 works is very different from MINA 2, so be sure you always
>>> cleanup whatever resource you use in your code.
>>> 
>>> 
>>> --
>>> Regards,
>>> Cordialement,
>>> Emmanuel Lécharny
>>> www.iktek.com
>>> 


Re: Bug (?) getting encoder in TextLineCodecFactory in Mina 1.1.7

Posted by Jose María Zaragoza <de...@gmail.com>.
OK
I think that I found the cause of the problem


I need to perform

SocketConnector.dispose()

I only was closing session with session.close()


What is the right way to finish a communitcation  immediately?

session.close():
socket.dispose();
?

or is it only  enough to perfom socket.dispose(); ?


Thanks

















2013/10/4 Jose María Zaragoza <de...@gmail.com>:
> I'm closing the same resources with MINA 2.x and MINA 1.1.x.
> Maybe there are new resources in MINA 2.x which should be close and I
> don't know them
>
> I'm going to start standalone tests because I had to downgrade  from
> 2.0.7 to 1.1.7 because the application is running on production
> enviroment and I couldn't do many tests
>
>
>
> 2013/10/4 Emmanuel Lécharny <el...@gmail.com>:
>> Le 10/4/13 9:06 AM, Jose María Zaragoza a écrit :
>>> OK.
>>> I'm going to debug that issue and I will tell you my conclusions
>>>
>>> So far, I only can know that the same code running on Tomcat but with
>>> lastest MINA release creates a lot of FIFO file descriptors, but 1.1.7
>>> doesn't,
>>
>> You most certainly have some opened streams that need to be closed. The
>> way MINA 1 works is very different from MINA 2, so be sure you always
>> cleanup whatever resource you use in your code.
>>
>>
>> --
>> Regards,
>> Cordialement,
>> Emmanuel Lécharny
>> www.iktek.com
>>

Re: Bug (?) getting encoder in TextLineCodecFactory in Mina 1.1.7

Posted by Jose María Zaragoza <de...@gmail.com>.
I'm closing the same resources with MINA 2.x and MINA 1.1.x.
Maybe there are new resources in MINA 2.x which should be close and I
don't know them

I'm going to start standalone tests because I had to downgrade  from
2.0.7 to 1.1.7 because the application is running on production
enviroment and I couldn't do many tests



2013/10/4 Emmanuel Lécharny <el...@gmail.com>:
> Le 10/4/13 9:06 AM, Jose María Zaragoza a écrit :
>> OK.
>> I'm going to debug that issue and I will tell you my conclusions
>>
>> So far, I only can know that the same code running on Tomcat but with
>> lastest MINA release creates a lot of FIFO file descriptors, but 1.1.7
>> doesn't,
>
> You most certainly have some opened streams that need to be closed. The
> way MINA 1 works is very different from MINA 2, so be sure you always
> cleanup whatever resource you use in your code.
>
>
> --
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>

Re: Bug (?) getting encoder in TextLineCodecFactory in Mina 1.1.7

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 10/4/13 9:06 AM, Jose María Zaragoza a écrit :
> OK.
> I'm going to debug that issue and I will tell you my conclusions
>
> So far, I only can know that the same code running on Tomcat but with
> lastest MINA release creates a lot of FIFO file descriptors, but 1.1.7
> doesn't,

You most certainly have some opened streams that need to be closed. The
way MINA 1 works is very different from MINA 2, so be sure you always
cleanup whatever resource you use in your code.


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 


Re: Bug (?) getting encoder in TextLineCodecFactory in Mina 1.1.7

Posted by Jose María Zaragoza <de...@gmail.com>.
OK.
I'm going to debug that issue and I will tell you my conclusions

So far, I only can know that the same code running on Tomcat but with
lastest MINA release creates a lot of FIFO file descriptors, but 1.1.7
doesn't,

Thanks

2013/10/4 Emmanuel Lécharny <el...@gmail.com>:
> Le 10/4/13 8:26 AM, Jose María Zaragoza a écrit :
>> Thanks
>> I'd like it but I'm having problems with a lot of FIFO file
>> descriptores with that release
>
> You still should keep going with MINA 2.0.7, otherwise you are totally
> on yoru own, with a version which has many unfixed issues.
>
> Now, I'm orry, but there is little we can do with the FIFO pipe problem
> you are describing, as we know nothing about the way you are using MINA
> in Tomcat.
>
> As this point, a complete description of what you try to do, and how you
> do it could help us helping you.
>
>
> --
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>

Re: Bug (?) getting encoder in TextLineCodecFactory in Mina 1.1.7

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 10/4/13 8:26 AM, Jose María Zaragoza a écrit :
> Thanks
> I'd like it but I'm having problems with a lot of FIFO file
> descriptores with that release

You still should keep going with MINA 2.0.7, otherwise you are totally
on yoru own, with a version which has many unfixed issues.

Now, I'm orry, but there is little we can do with the FIFO pipe problem
you are describing, as we know nothing about the way you are using MINA
in Tomcat.

As this point, a complete description of what you try to do, and how you
do it could help us helping you.


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 


Re: Bug (?) getting encoder in TextLineCodecFactory in Mina 1.1.7

Posted by Jose María Zaragoza <de...@gmail.com>.
Thanks
I'd like it but I'm having problems with a lot of FIFO file
descriptores with that release




2013/10/4 Emmanuel Lécharny <el...@gmail.com>:
> Le 10/3/13 10:32 PM, Jose María Zaragoza a écrit :
>> Hello:
>>
>> I'm using Mina 1.1.7
>
> I strongly suggest that you switch to MINA 2.0.7. We don't mainatin any
> more 1.1.7
>
>
> --
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>

Re: Bug (?) getting encoder in TextLineCodecFactory in Mina 1.1.7

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 10/3/13 10:32 PM, Jose María Zaragoza a écrit :
> Hello:
>
> I'm using Mina 1.1.7

I strongly suggest that you switch to MINA 2.0.7. We don't mainatin any
more 1.1.7


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com