Re: Fw: try it out
The account seemed to be hacked or someone is just using it, the name is different for each email but mail is is same. On Mon, Aug 17, 2015 at 6:04 AM, Emmanuel Lécharny elecha...@gmail.com wrote: Le 17/08/15 14:00, Alexander Christian a écrit : My own spam filter does not (yet) catch it. Isn't there a spam filter in front of the mailinglist itself? There is, but actualy, the SPAM score is not high enough : X-Spam-Flag: NO X-Spam-Score: 4.202 X-Spam-Level: X-Spam-Status: No, score=4.202 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=3, KAM_LAZY_DOMAIN_SECURITY=1, KAM_MANYTO=0.2, MIME_QP_LONG_LINE=0.001, URIBL_BLOCKED=0.001] autolearn=disabled X-xwash23-MailScanner-SpamScore: s -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: [SSHD] version 0.9
It's still under voting. Once done, the release shall be available. May be a few days more. On Mon, Aug 5, 2013 at 7:34 PM, Jens Kapitza j.kapi...@schwarze-allianz.dewrote: Is this Version (0.9) released? JIRA say 29.7.13 but i can't find a download at maven central at the moment G. Jens Kapitza -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Using an Authentication Filter and IoHandlerAdapter
On Fri, Aug 2, 2013 at 7:15 AM, Jon V. sybersn...@gmail.com wrote: To my knowledge the executor filter does not guarantee any kind of order. This means that you should implement the authentication phase before the executor. This is correct, with Executor filter ordering is not guaranteed. Do you need an executor filter there? It's usage is recommended if you have some intensive task in chain or in IoHandler. Io-prorocol-authentication-executor-handler This sound good. Alternative is to use OrderedThreadPoolExecutor, but go simple first. Implement stuff without Executor filter and then push that in if needed. You cannot lock on out of order messaging without a queue and attempt to re-order the messages. On Aug 1, 2013 9:33 PM, Hunter McMillen mcmil...@gmail.com wrote: Sorry, the code is probably more useful to see, here is the entry point to our application: acceptor = new NioSocketAcceptor( Runtime.getRuntime().availableProcessors() ); acceptor.getFilterChain().addLast(executor, new ExecutorFilter( Executors.newCachedThreadPool())); acceptor.getFilterChain().addLast(logger, MudConfig.Logging.getFilter()); acceptor.getFilterChain().addLast(codec, new ProtocolCodecFilter( new TextLineEncoder(), new CommandDecoder() ) ); More importantly, my main question is how I can link the DONE state of the state machine (AuthenticationHandler) and the IoHandlerAdapter. I can post the code for these also, I just didn't want to overload the thread. Thanks. Hunter On 8/1/13 5:47 PM, Jon wrote: You are not using an executor filter right? You have to implement locking during the authentication phase if you are using thread scheduling. Sent from my iPhone On Aug 1, 2013, at 5:31 PM, Hunter McMillen mcmil...@gmail.com wrote: Hello, I recently started working on a project with a friend that is a text-based game. We were having trouble with ReadFuture's when trying to get a username/password combination from the user so we decided to follow the state machine example from Tapedeck TCP server on Mina's homepage: http://mina.apache.org/mina-project/xref/org/apache/mina/example/tapedeck/ I have gotten the state machine to a point where it seems to be working well. It starts, reads a username, then a password, then has some logic to restart based on error; or it prints a message 'Authenticated'. However our main application logic is going to be (our plan at least) held in an IoHandlerAdapter, my question is what is a good way to integrate the two of these: 1) The state machine authentication filter from the example above 2) An IoHandlerAdapter that will track information about connected users and sessions My confusion mainly lies in how to transition between the state machine and the IoHandlerAdapter since they both respond to /sessionCreated /and /sessionOpened /events. Any help, ideas, or input would be appreciated. Thanks. Hunter -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: apache mina jmx default port
It's standard JMX stuff, nothing specific to MINA Use following params (specify the port you want) -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port = PORT Num -Dcom.sun.management.jmxremote.authenticate = false -Dcom.sun.management.jmxremote.ssl = false You can add IP option as if you need to bind to a specific IP address. Following page shall be useful http://mina.apache.org/mina-project/userguide/ch16-jmx-support/ch16-jmx-support.html On Mon, Jun 17, 2013 at 10:53 AM, Saurav Gulati saurav.gul...@shephertz.co.in wrote: Hello Team, I want to monitor my apache mina remote process using JMX. what is the default port number for JMX in apache mina. Regards, Saurav -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Running mina examples
Marc, Simple steps, (using command line) 1. Set the classpath with all required jars 2. Run the main program like java fully.qualified.name.of.class For ex: java org.apache.mina.example.echoserver.Main Using Maven mvn clean install (execute this from base dir) mvn exec:java -Dexec.mainClass=org.apache.mina.example.echoserver.Main (execute this command from mina-example dir) These are valid for 2.0 branch. On Fri, Apr 26, 2013 at 3:03 AM, Marc Adler marc.adler...@gmail.com wrote: Hello, how to run the examples shipped with mina? As I'm new to java I'm not sure how to run the examples in the precompiled libraries. Thanks for help Marc -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Guice Support
Hi Patrick, All contributions are welcome :) Would recommend to create a JIRA and attach the code/documentation to it. thanks ashish On Thu, Oct 4, 2012 at 7:16 AM, Patrick Twohig p-two...@ieee.org wrote: Hey, I was curious if there exists guice support for MINA. If not, I've got some bindings that I made, would those be welcomed as a patch? Thanks, Patrick. -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Strange bug in CumulativeProtocolDecoder
Need to return true when the decoding is done. something like this if(in.prefixedDataAvaliable(4)) // read message type { if(in.prefixedDataAvaliable(4)) // read message length { if(in.remaining() = messageLength) { // decode return true; } else { return false; } } Can you please check this. More details at http://mina.apache.org/tutorial-on-protocolcodecfilter-for-mina-2x.html Hi. Im using MINA 2.0.4 on windows 7 32-bit. As a decoder im using CPD, running locally. On client side decoder works without issues, it takes care of incomplete message and more than one message in buffer as well. Nothing is blocking. On server side im using same algorithm. if(in.prefixedDataAvaliable(4)) // read message type { if(in.prefixedDataAvaliable(4)) // read message length { if(in.remaining() = messageLength) { // decode } else { return false; } } else { return false; } } else { return false; } Problem is that some of the messages cant pass first step, it doesnt matter if they are incomplet or overcomplet. They return false. But when i manually trying to get int, value which should be read is correct. Why is that happens ? Why it happens only for coupe of messages ? Encoder sends bytes properly. -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
RE: Browsing ftp from a browser
Sachin, Answer the following: What browser are you using? Are you sure you have enabled the ftp port on the host server's firewall? Thanks Ashish -Original Message- From: Sachin Shetty [mailto:sshe...@egnyte.com] Sent: Tuesday, October 18, 2011 10:57 AM To: ftpserver-users@mina.apache.org Subject: Browsing ftp from a browser Hi, I found that I could not browse the ftp server running Apache FTP Server using a browser. Is there something else we need to enable? Thanks Sachin
RE: Browsing ftp from a browser
Sachin, I have opened the port 21 and 20 on my server. I am able to use the Apache FTP server by using the following settings in: 'users.properties' ftpserver.user.admin.userpassword=12345 ftpserver.user.admin.homedirectory=./res/home ftpserver.user.admin.enableflag=true ftpserver.user.admin.writepermission=true ftpserver.user.admin.maxloginnumber=0 ftpserver.user.admin.maxloginperip=0 ftpserver.user.admin.idletime=0 ftpserver.user.admin.uploadrate=0 ftpserver.user.admin.downloadrate=0 ftpserver.user.anonymous.userpassword= ftpserver.user.anonymous.homedirectory=./res/home ftpserver.user.anonymous.enableflag=true ftpserver.user.anonymous.writepermission=false ftpserver.user.anonymous.maxloginnumber=20 ftpserver.user.anonymous.maxloginperip=2 ftpserver.user.anonymous.idletime=300 ftpserver.user.anonymous.uploadrate=4800 ftpserver.user.anonymous.downloadrate=4800 Create a file : 'ftpd-Custom.xml' at ftpServerBaseDirectory/res/conf/ Add the following content in it: ?xml version=1.0 encoding=UTF-8? server xmlns=http://mina.apache.org/ftpserver/spring/v1; xmlns:beans=http://www.springframework.org/schema/beans; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation= http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://mina.apache.org/ftpserver/spring/v1 http://mina.apache.org/ftpserver/ftpserver-1.0.xsd id=myServer listeners nio-listener name=default port=21 implicit-ssl=false data-connection idle-timeout=60 passive ports=20 address=XX.XXX.XXX.XX external-address=XXX.XX.XXX.XXX/ /data-connection /nio-listener /listeners file-user-manager file=./res/conf/users.properties encrypt-passwords=false / /server Start your server using the following command: ./bin/ftpd.sh res/conf/ftpd-Custom.xml After following above procedure, try reconnecting from firefox. Also reply the status message in server logs if above doesn't work. -- Ashish -Original Message- From: Sachin Shetty [mailto:sshe...@egnyte.com] Sent: Tuesday, October 18, 2011 1:21 PM To: ftpserver-users@mina.apache.org Subject: RE: Browsing ftp from a browser What browser are you using? Firefox - it works for other ftp servers Are you sure you have enabled the ftp port on the host server's firewall? Yes, I am able to ftp using FileZilla -Original Message- From: Sharma, Ashish [mailto:ashish.shar...@hp.com] Sent: Tuesday, October 18, 2011 12:29 PM To: ftpserver-users@mina.apache.org Subject: RE: Browsing ftp from a browser Sachin, Answer the following: What browser are you using? Are you sure you have enabled the ftp port on the host server's firewall? Thanks Ashish -Original Message- From: Sachin Shetty [mailto:sshe...@egnyte.com] Sent: Tuesday, October 18, 2011 10:57 AM To: ftpserver-users@mina.apache.org Subject: Browsing ftp from a browser Hi, I found that I could not browse the ftp server running Apache FTP Server using a browser. Is there something else we need to enable? Thanks Sachin
Re: does Vysper have any JMX support?
MINA JMX integration is covered here http://mina.apache.org/chapter-18-jmx-integration.html HTH! ashish On Tue, Aug 23, 2011 at 8:52 PM, Bob DeRemer bob.dere...@thingworx.comwrote: Thanks, Bernd! For most of the admin stuff, we'd probably be managing that - since we got input from Niklas on how to plug in our own persistence and user/auth/roster management. In addition, we've stripped down the dependencies quite a bit - which included gutting any reference to Spring, so if we do any JMX stuff, we'll probably look to create a pluggable JMX hook ourselves. We're currently planning to submit a couple of the enhancements we've been doing because we believe they would be beneficial to the whole community. Perhaps I should post another question with the MINA JMX as the subject - that might get more hits -bob -Original Message- From: Bernd Fondermann [mailto:bernd.fonderm...@googlemail.com] Sent: Tuesday, August 23, 2011 11:14 AM To: users@mina.apache.org Subject: Re: does Vysper have any JMX support? On Tue, Aug 23, 2011 at 15:04, Bob DeRemer bob.dere...@thingworx.com wrote: Thanks for the info, Bernd. A couple follow-up questions: 1) is there any documentation on XEP-133 http://xmpp.org/extensions/xep-0133.html we currently have for all users: change their own pwd for admins: change pwds (XEP-133#4.7), add user (XEP-133#4.1), see online users XEP-133#4.15 2) is there any JMX instrumentation in MINA that might be helpful in monitoring Vypser interesting question. anyone? 3) Spring you could also try and use Spring's JMX wrapping capabilities for arbitrary beans. http://static.springsource.org/spring/docs/2.5.x/reference/jmx.html#jmx-exporting Bernd
Re: What codec should we use for reading a incoming XML
On Mon, Jul 11, 2011 at 12:37 PM, Kiran Ayyagari kayyag...@apache.orgwrote: You cannot use TextLine codec for sending/receiving XML content, cause textline codec uses a new line as delimiter, for XML the semantics are completely different. Am not quite sure if the proposed MINA xml codec is implemented but you can take a look at the one used in Vysper[1] project. [1] http://mina.apache.org/vysper/index.html Agree with Kiran. If you want something working, Vysper nbxml package is for you. You may also like to view these slides - http://mina.apache.org/conferences.data/Mina_in_real_life_ASEU-2009.pdf Emmanuel has described, in detail, about XML codec. Good Luck ! - ashish
Fwd: Reminder: TAC Assistance to ApacheCon NA 2011 closes July 8th
FYI - Final Reminder for TAC Assistance to ApacheCon NA 2011, for all those who are interested thanks ashish -- Forwarded message -- From: Gavin McDonald ga...@16degrees.com.au Date: Sun, Jul 3, 2011 at 5:49 AM Subject: Reminder: TAC Assistance to ApacheCon NA 2011 closes July 8th To: committ...@apache.org Hi All, Just a friendly (and final) reminder that applications for financial help to attend ApacheCon NA 2011 in Vancouver close this coming Friday 8th July (2200 BST : UTC+1) Financial assistance is available for Travel (planes, trains, whatever) , Accommodation (at the conference venue hotel) and Conference entrance fees. Dependant on your circumstances will decide how much of that you would be given. Please visit http://apache.org/travel for more information and a link to the application form. Remember: We DO help people get to ApacheCon and other Apache events every year, we DO want to help people get there who otherwise could not, that is why we exist. Spread the word, you are welcome to tweet, blog, email, post, phone or smoke signal to anyone who you think might benefit from attending ApacheCon this year. (Any queries please to the tac-apply.at.apache.org address only, do not try and post to this committers announce only list) Kind Regards, The Travel Assistance Committee.
Re: Problem with inverted shells
Can you create a JIRA for this? thanks ashish On Sat, Apr 30, 2011 at 9:10 PM, Boris Okunskiy incarn...@whiteants.net wrote: Hi everyone, Whole last day I've tried to implement a managed SSH access for Git. The problem I faced was not quite trivial: whenever I try to `git clone` something over SSH transport I either get successfully cloned repository or `fatal: early EOF`. After hours of investigating I finally managed to identify a problem. It is in `InvertedShellWrapper.pumpStreams`: for (;;) { if (!shell.isAlive()) { callback.onExit(shell.exitValue()); // risk of loosing process data return; } if (pumpStream(in, shellIn, buffer)) { continue; } if (pumpStream(shellOut, out, buffer)) { continue; } if (pumpStream(shellErr, err, buffer)) { continue; } Thread.sleep(1); } In most Unix systems a process may exit as soon as it writes everything into a stream. If the streams are buffered, then there is a chance of dropping everything that is left in STDOUT and STDERR (`shellOut` and `shellErr`) after the `shell.isAlive` has reported that the underlying process has finished. The solution is simple: you just pump streams one more time until no more data is left in STDOUT or STDERR. Here is what I came up with (sorry for Scala): class GitShellFactory(val verb: String, val path: String) extends ProcessShellFactory(Array[String](verb, path)) { override def create() = new SshShellWrapper(new ProcessShell()) } class SshShellWrapper(shell: InvertedShell) extends SimpleCommand { var buffer = new Array[Byte](4096) var stdin: OutputStream = _ var stdout: InputStream = _ var stderr: InputStream = _ def start(env: Environment): Unit = { shell.start(env.getEnv) stdin = shell.getInputStream stdout = shell.getOutputStream stderr = shell.getErrorStream new Thread() { override def run() = try { while (shell.isAlive) { copyStream(in, stdin) copyStream(stdout, out) copyStream(stderr, err) Thread.sleep(1) } copyStream(stdout, out) copyStream(stderr, err) } finally { shell.destroy() exit(shell.exitValue) } }.start() } def destroy = if (shell != null) shell.destroy def copyStream(in: InputStream, out: OutputStream): Unit = while (in.available 0) { val len = in.read(buffer) if (len 0) { out.write(buffer, 0, len) out.flush } } } Then I simply use GitShellFactory instead of ProcessShellFactory and everything works perfectly. Hope it will save some time for those who stuck with the same issue. It would be great to have this fixed in later releases, though. Best regards, Boris Okunskiy -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: SSHD: Looking for a way to restrict which IPs can connect to a listening SSH port forward.
IMHO, using BlacklistFilter would be a better option Check out org.apache.mina.filter.firewall.BlacklistFilter thanks ashish On Mon, Apr 18, 2011 at 6:49 PM, Bill Kuker bku...@martellotech.com wrote: Hello. I am currently using the ForwardingFilter's canListen() canConnect() functions in my application to control which port forwards SSH clients are allowed to create. I would like to also be able to filter incoming connections to listening port forwards. For the moment I added a method to the ForwardingFilter interface: boolean isAllowed(InetSocketAddress sourceAddress, InetSocketAddress destinationAddress, ServerSession session); And check with it from TcpipForwardSupport's sessionCreated() function. I think this is a useful capability for applications with embedded SSH servers, and would like to submit a patch, rather than re-applying it to each release, but I wanted to ask if there would be a better, more likely to be accepted, design for it, and also ask if I have just missed a less obvious way to accomplish this with the existing code. Thanks, Bill -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: SSHD: Looking for a way to restrict which IPs can connect to a listening SSH port forward.
Got it ;) I am afraid I am not the expert on SSHD code. Guillaume - Any pointers? On Mon, Apr 18, 2011 at 7:15 PM, Bill Kuker bku...@martellotech.com wrote: I had looked into that, but I could not figure out where to add it. The entire process of accepting the connection and doing the necessary SSH things to get the port forward working is handled entirely by Mina / SSHD; there is no place for my application code to get into that process and mess with the IoSession or SocketAcceptor. I had thought down the filter road before, and I believe I would need something like an NioSocketAcceptorFactory (a new interface) that the TcpipForwardSupport uses in initialize(), giving me a chance to wire in whatever additional Filters I want? -Bill On Mon, Apr 18, 2011 at 9:36 AM, Ashish paliwalash...@gmail.com wrote: IMHO, using BlacklistFilter would be a better option Check out org.apache.mina.filter.firewall.BlacklistFilter thanks ashish On Mon, Apr 18, 2011 at 6:49 PM, Bill Kuker bku...@martellotech.com wrote: Hello. I am currently using the ForwardingFilter's canListen() canConnect() functions in my application to control which port forwards SSH clients are allowed to create. I would like to also be able to filter incoming connections to listening port forwards. For the moment I added a method to the ForwardingFilter interface: boolean isAllowed(InetSocketAddress sourceAddress, InetSocketAddress destinationAddress, ServerSession session); And check with it from TcpipForwardSupport's sessionCreated() function. I think this is a useful capability for applications with embedded SSH servers, and would like to submit a patch, rather than re-applying it to each release, but I wanted to ask if there would be a better, more likely to be accepted, design for it, and also ask if I have just missed a less obvious way to accomplish this with the existing code. Thanks, Bill -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: How is asyncweb going?
On Fri, Apr 1, 2011 at 8:35 PM, Mavlarn Tuohuti mavl...@gmail.com wrote: I just begin to use Mina. And I checked the code of asyncweb. It seems that there is no much dependency on Mina. Asyncweb just uses some classes like IoBUffer of Mina. I am afraid that's not the case. AFAIK, asyncweb used MINA state machine as well, and the encoder/decoder are somehwhat written married to the way MINA works :) Why it doesn't use event Handler to implement async web server? Probably a little more exploration of code might answer your question :)
Re: How is asyncweb going?
On Thu, Mar 31, 2011 at 3:07 PM, Wei Liu tact...@gmail.com wrote: I need to do some HTTP stuff asynchronously. However I can't find the project now, where is it? Has this project been discontinued? You can find the source at http://svn.apache.org/repos/asf/mina/asyncweb/ It's not dead. Your contribution is welcome :) thanks ashish
Re: Problems by upgrading the Apache Camel Mina component from Mina 1.1.7 to 2.0.2
Christian, I am working on this. Hopefully shall revert back soon ;) cheers ashish On Fri, Mar 18, 2011 at 10:05 AM, Ashish paliwalash...@gmail.com wrote: Hello List! Could someone of you have quick look on [1]. I try to upgrade the Apache Camel Mina component from Mina 1.1.7 to 2.0.2, but I still have problems with 7 of our 82 unit tests. The problems are: - For the UDP test, I send 3 messages and receive more than 1000 messages - In some test, I got a java.net.BindException: Address already in use Any ideas? Your help is more than welcome! [1] https://issues.apache.org/jira/browse/CAMEL-3471 Cheers, Christian Any quick way to simulate them? I didn't encountered these error while upgrading some of my examples from 1.1 to 2.x release. cheers ashish -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Problems by upgrading the Apache Camel Mina component from Mina 1.1.7 to 2.0.2
Hello List! Could someone of you have quick look on [1]. I try to upgrade the Apache Camel Mina component from Mina 1.1.7 to 2.0.2, but I still have problems with 7 of our 82 unit tests. The problems are: - For the UDP test, I send 3 messages and receive more than 1000 messages - In some test, I got a java.net.BindException: Address already in use Any ideas? Your help is more than welcome! [1] https://issues.apache.org/jira/browse/CAMEL-3471 Cheers, Christian Any quick way to simulate them? I didn't encountered these error while upgrading some of my examples from 1.1 to 2.x release. cheers ashish
Re: How can Mina access the data of Tomcat's servlet instance?
2011/2/28 skyman cloud...@163.com: Hi everyone, I want to embed Mina into Tomcat(Mina is used for the chat module), but I don't know how does Mina acess the servlet's data(for example, user's name). Can anyone tell me? Thanks in advance! It cannot, you have to code it You need to build this logic in your Filter or IoHandler. thanks ashish
Re: jmx with mina 2.0.2
include ognl-2.7.3.jar (its available with MINA download) On Mon, Feb 14, 2011 at 3:11 PM, Guy Itzhaki g...@nextnine.com wrote: I'm trying to use jmx in my Mina based server, I ran the example andI get the following error Exception in thread main java.lang.NoClassDefFoundError: ognl/TypeConverter Help will be appreciated. Guy -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Re: need help chat program with mina
2010/10/28 dl dlpo...@163.com: users,你好! Thank your help! I'm use Mina 2.0. It's can find the class. When sent data, the other client IoHandlerAdapter not response. but the log filter print received data info and data. It would be good if you start with sample provided with MINA distribution and then work your way towards the chat program. The tutorial link suggested by Chris is build on top of the example shipped. HTH! thanks ashish
Re: Number of threads
Little more details would help, like where you want to increase number of threads? On Thu, Oct 14, 2010 at 3:21 PM, Zlatko Josic zlatko.jo...@gmail.com wrote: Hi, Is it posible to increase number of threds for event proccesing in mina framework ? Zlaja -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Socket operation on non-socket...
Fixed that ! Seems some issue with _code:java_ macro Tags were correct but it didn't ended where it was supposed to be. Moved to code macro for the time being. Wait for the sync to happen. thanks ashish On Mon, Oct 11, 2010 at 2:21 PM, David Latorre dvl...@gmail.com wrote: http://mina.apache.org/faq.html#FAQ-HowdoIclosemysessionsanddisposemyConnector%2526%252363%253B Did you notice there's a new h3 tag : h3. How can I reconnect to server after my client session is closed#63; inside the source code macro ? 2010/10/7 Emmanuel Lecharny elecha...@gmail.com: On 10/7/10 12:52 PM, Zigor Salvador wrote: Hi all, Trying to close a connector (and all of its sessions) with: connector.dispose(); Throws an exception that is caught by the handler: java.lang.Error: java.net.SocketException: Socket operation on non-socket Should I be using other means to close the connector? This is normal : it's not because you dispose the connector that the handler will immediately stop sending informations to the (now closed) socket. have a look at http://mina.apache.org/faq.html, How do I close my sessions and dispose my Connector ? http://mina.apache.org/faq.html#FAQ-HowdoIclosemysessionsanddisposemyConnector%2526%252363%253B paragraph. -- Regards, Cordialement, Emmanuel Lécharny www.iktek.com -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: MINA performance on Centos/Tomcat
MINA version? can u try visualvm to connect to ur system? On Mon, Sep 20, 2010 at 6:32 PM, Kumar Abhishek kuma...@gmail.com wrote: 2 CPUs of the following configuration(Intel Dual Core XEON Processor 3.3 Ghz ) Using thread dump on tomcat java process is a bit risky for us as it will bring down all our web services. On Mon, Sep 20, 2010 at 6:27 PM, Ashish paliwalash...@gmail.com wrote: How many CPU's/Cores on the machines? Try taking a few Thread dumps and see what's taking up the CPU. Alternatively, if its not a production App, go for profiling and see what's going on inside. thanks ashish On Mon, Sep 20, 2010 at 6:07 PM, Kumar Abhishek kuma...@gmail.com wrote: Hi, I am using MINA for client-server based communication on my Centos machine both of which reside on same machine. The architecture is the following: Client has a single SocketConnector and manages a pool of active IOSession objects which can be utilized by any incoming request. This SocketConnector is invoked by tomcat once HTTP POST request comes to a particular url hosted on the machine. The client picks up an active session and fires the request to the socket server. I am using executor Executors.newCachedThreadPool() so that the request doesn't execute on IO thread. On the server end I have a socket server which uses a executor to process incoming IO request and send back response. The typical request processing involves db queries, sending sms on smpp server and returning back the result to the client. Typically this request processing can take upto 40secs to finish up(yeah I know its slow as sms sending and delivery report is to be proceesed) What I observe is the following even on a single request the CPU usage of tomcat java process shoots up very high which is very worrying given the system is expected to see more traffic in coming days. I have also tried to forcefully bring down the request processing time to 3secs by ignoring a few steps just to diagnose the problem, however there is no improvement, its just that cpu shoots for a smaller period i.e. from 40 secs to 3 secs. Any suggestions will be highly appreciated. Thanks ! Best Regards, Abhishek
Re: MINA performance on Centos/Tomcat
Couple of things 1. Plan to upgrade to MINA 2.0 once its out in a few days.. 1.1.7 is way old 2. For immediate action, try a few thread dumps and see why CPU is so high, prob u have too many CPU bound task 3. Try tweaking Tomcat setting, after giving a look at your Thread dumps. About Architecture, its tough to give an opinion without knowing all System constraints. This is very beneficial if you have many HTTP front-ends accepting requests and posting to a single Server acting as your HTTP-SMPP gateway. The good part of this architecture is you can easily move to multiple machines, add more http front-ends without code change :) On the other hand, if you never intend to work it that ways, its an overkill. Better do this in Servlet. AFAIK, you would using one of SMPP lib's (Logica SMPP/jsmpp/opensms) for sending message to SMSC in your MINA IO Handler. I definitely don't like running client and Server on the same machine in production for sure. Single machine, Single point of failure. Again this is very specific to what you need. If it works fine for you, probably that's what u need. Good Luck! - ashish On Mon, Sep 20, 2010 at 7:34 PM, Kumar Abhishek kuma...@gmail.com wrote: okies, will give it a shot tonite when traffic is minimal :) Any comments on the architecture I am using for the client server communication, is it a good design to have tomcat act as http interface(backed by client connectors) and socket server accepting http requests from client to fire smpp sms sending requests On Mon, Sep 20, 2010 at 7:36 PM, Emmanuel Lécharny elecha...@apache.orgwrote: On 9/20/10 3:39 PM, Kumar Abhishek wrote: On Mon, Sep 20, 2010 at 7:12 PM, Emmanuel Lecharnyelecha...@gmail.com wrote: On 9/20/10 3:02 PM, Kumar Abhishek wrote: 2 CPUs of the following configuration(Intel Dual Core XEON Processor 3.3 Ghz ) Using thread dump on tomcat java process is a bit risky for us as it will bring down all our web services. Kill -3 bringing down services ??? How possible ? yes because java of tomcat is running in background Should not harm. It just get a thread dump, it does nothing else, AFAIK... Which Java version are you using ?
Re: Help implementing SSL
I am really not sure what's wrong with the implementation. It didn't work for me either :( We might be missing something here.. I tried using a different client and it worked. Seems like the client didn't even invoked SSL handshake. Will try to debug this further, whenever I can. Meanwhile, you can use package org.apache.mina.filter.ssl.SslTest to experiment further. Anyone else can shed some light here? thanks ashish 2010/8/25 André Rodrigues gur...@gmail.com: Sure, I'm sending the Eclipse project attached. I've changed the bogus.cert to tcc.keystore and I'm also using a different password, so these lines have to be updated in the echoserver if you're going to use the same tcc.keystore I'm sending: private static final String KEYSTORE = tcc.keystore; private static final char[] KEYSTOREPASS_PW = { '6', '1', '9', '1', '5', '3', '0', '2' }; The keystore is located on \Client\src\org\apache\mina\example\echoserver\ssl. Thanks again for the help! André de C. Rodrigues (11) 7588-9992 2010/8/25 Ashish paliwalash...@gmail.com can you post your client code? 2010/8/25 André Rodrigues gur...@gmail.com: Alright, thanks ! 2010/8/24 Ashish paliwalash...@gmail.com Let me try the sample at my end ... Will revert back as soon as I can. thanks ashish 2010/8/24 André Rodrigues gur...@gmail.com: Hi, thanks for your answer! I'm using MINA 2.0, and the SSLFilter is the only filter I'm using. I'll post the System.out output for both the client and the server after setting the parameter you suggested: *Server*: * *found key for : tcc* *chain [0] = [* *[* * Version: V3* * Subject: CN=ARodrigues, OU=PCS, O=USP, L=Sao Paulo, ST=SP, C=BR* * Signature Algorithm: SHA1withRSA, OID = 1.2.840.113549.1.1.5* * * * Key: Sun RSA public key, 512 bits* * modulus: 10699587961921137697482935243108826057317291820617624621055730301315871690894991650505863331589895001390221434496768846223107228977238263236946761412706449 * * public exponent: 65537* * Validity: [From: Wed Aug 18 14:43:58 BRT 2010,* * To: Sat Aug 15 14:43:58 BRT 2020]* * Issuer: CN=ARodrigues, OU=PCS, O=USP, L=Sao Paulo, ST=SP, C=BR* * SerialNumber: [ 4c6c1bde]* * * *]* * Algorithm: [SHA1withRSA]* * Signature:* *: 85 69 A4 E7 D8 A7 C9 5E 16 90 B7 14 C5 EF 7C 6E .i.^...n* *0010: F0 E4 4A 18 B8 BE 11 3B 0D 4A E2 90 E8 B6 89 AF ..J;.J..* *0020: 29 88 96 DE 25 6E DF 4B FF B7 FE 12 C9 ED E5 9F )...%n.K* *0030: 8A B3 F0 A0 8A 40 39 87 C1 E5 57 FA 73 74 3A 2D .@9...w.st:-* * * *]* * *trigger seeding of SecureRandom* *done seeding SecureRandom* *SSL ON* *Listening on port 8080* *R: 0.0, W: 0.0* *Using SSLEngineImpl.* *log4j:WARN No appenders could be found for logger (org.apache.mina.example.echoserver.EchoProtocolHandler).* *log4j:WARN Please initialize the log4j system properly.* *log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfigfor more info.* *R: 0.0, W: 0.0* *R: 0.0, W: 0.0* *R: 0.0, W: 0.0* *R: 0.0, W: 0.0* *R: 0.0, W: 0.0* *Client:* * trigger seeding of SecureRandom done seeding SecureRandom SSL ON Using SSLEngineImpl. test * Thanks again, André de C. Rodrigues (11) 7588-9992 2010/8/23 Ashish paliwalash...@gmail.com What's the error? MINA version? Try passing this JVM srgument -Djavax.net.debug=all or -Djavax.net.debug=ssl it will show all the SSL communication happening. Its would be easy to point the error. AFAIK, SSL Filter should be the first filter in the chain. Since you are using provided example you should be good. thanks ashish 2010/8/24 André Rodrigues gur...@gmail.com: Hi everyone! I'm trying to fix up a simple MINA example using SSL and I'm having some trouble. Here's what I did: 1) I'm running the EchoServer example with SSL turned on. I generated the bogus.cert keystore using keytool as described in the documentation. 2) I created a simple MINA client that connects to the EchoServer and starts a new thread to capture keyboard input and send it to the EchoServer. The client also prints out received messages. 3) I'm using the ssl package from the EchoServer in my MINA client and using the same keystore I generated with keytool in step 1. 4) I'm adding a SSLFilter to the client filter chain using the BogusSSLContextFactory from the EchoServer example (new SslFilter(SslContextFactory.getInstance(false)). This, however, does not seem to work... does anybody have any idea why? Sorry if this comes off as a rookie question, but I'm just getting into programming. Thanks in advance, andre
Re: Help implementing SSL
can you post your client code? 2010/8/25 André Rodrigues gur...@gmail.com: Alright, thanks ! 2010/8/24 Ashish paliwalash...@gmail.com Let me try the sample at my end ... Will revert back as soon as I can. thanks ashish 2010/8/24 André Rodrigues gur...@gmail.com: Hi, thanks for your answer! I'm using MINA 2.0, and the SSLFilter is the only filter I'm using. I'll post the System.out output for both the client and the server after setting the parameter you suggested: *Server*: * *found key for : tcc* *chain [0] = [* *[* * Version: V3* * Subject: CN=ARodrigues, OU=PCS, O=USP, L=Sao Paulo, ST=SP, C=BR* * Signature Algorithm: SHA1withRSA, OID = 1.2.840.113549.1.1.5* * * * Key: Sun RSA public key, 512 bits* * modulus: 10699587961921137697482935243108826057317291820617624621055730301315871690894991650505863331589895001390221434496768846223107228977238263236946761412706449 * * public exponent: 65537* * Validity: [From: Wed Aug 18 14:43:58 BRT 2010,* * To: Sat Aug 15 14:43:58 BRT 2020]* * Issuer: CN=ARodrigues, OU=PCS, O=USP, L=Sao Paulo, ST=SP, C=BR* * SerialNumber: [ 4c6c1bde]* * * *]* * Algorithm: [SHA1withRSA]* * Signature:* *: 85 69 A4 E7 D8 A7 C9 5E 16 90 B7 14 C5 EF 7C 6E .i.^...n* *0010: F0 E4 4A 18 B8 BE 11 3B 0D 4A E2 90 E8 B6 89 AF ..J;.J..* *0020: 29 88 96 DE 25 6E DF 4B FF B7 FE 12 C9 ED E5 9F )...%n.K* *0030: 8A B3 F0 A0 8A 40 39 87 C1 E5 57 FA 73 74 3A 2D .@9...w.st:-* * * *]* * *trigger seeding of SecureRandom* *done seeding SecureRandom* *SSL ON* *Listening on port 8080* *R: 0.0, W: 0.0* *Using SSLEngineImpl.* *log4j:WARN No appenders could be found for logger (org.apache.mina.example.echoserver.EchoProtocolHandler).* *log4j:WARN Please initialize the log4j system properly.* *log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfigfor more info.* *R: 0.0, W: 0.0* *R: 0.0, W: 0.0* *R: 0.0, W: 0.0* *R: 0.0, W: 0.0* *R: 0.0, W: 0.0* *Client:* * trigger seeding of SecureRandom done seeding SecureRandom SSL ON Using SSLEngineImpl. test * Thanks again, André de C. Rodrigues (11) 7588-9992 2010/8/23 Ashish paliwalash...@gmail.com What's the error? MINA version? Try passing this JVM srgument -Djavax.net.debug=all or -Djavax.net.debug=ssl it will show all the SSL communication happening. Its would be easy to point the error. AFAIK, SSL Filter should be the first filter in the chain. Since you are using provided example you should be good. thanks ashish 2010/8/24 André Rodrigues gur...@gmail.com: Hi everyone! I'm trying to fix up a simple MINA example using SSL and I'm having some trouble. Here's what I did: 1) I'm running the EchoServer example with SSL turned on. I generated the bogus.cert keystore using keytool as described in the documentation. 2) I created a simple MINA client that connects to the EchoServer and starts a new thread to capture keyboard input and send it to the EchoServer. The client also prints out received messages. 3) I'm using the ssl package from the EchoServer in my MINA client and using the same keystore I generated with keytool in step 1. 4) I'm adding a SSLFilter to the client filter chain using the BogusSSLContextFactory from the EchoServer example (new SslFilter(SslContextFactory.getInstance(false)). This, however, does not seem to work... does anybody have any idea why? Sorry if this comes off as a rookie question, but I'm just getting into programming. Thanks in advance, andre -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Help implementing SSL
Let me try the sample at my end ... Will revert back as soon as I can. thanks ashish 2010/8/24 André Rodrigues gur...@gmail.com: Hi, thanks for your answer! I'm using MINA 2.0, and the SSLFilter is the only filter I'm using. I'll post the System.out output for both the client and the server after setting the parameter you suggested: *Server*: * *found key for : tcc* *chain [0] = [* *[* * Version: V3* * Subject: CN=ARodrigues, OU=PCS, O=USP, L=Sao Paulo, ST=SP, C=BR* * Signature Algorithm: SHA1withRSA, OID = 1.2.840.113549.1.1.5* * * * Key: Sun RSA public key, 512 bits* * modulus: 10699587961921137697482935243108826057317291820617624621055730301315871690894991650505863331589895001390221434496768846223107228977238263236946761412706449 * * public exponent: 65537* * Validity: [From: Wed Aug 18 14:43:58 BRT 2010,* * To: Sat Aug 15 14:43:58 BRT 2020]* * Issuer: CN=ARodrigues, OU=PCS, O=USP, L=Sao Paulo, ST=SP, C=BR* * SerialNumber: [ 4c6c1bde]* * * *]* * Algorithm: [SHA1withRSA]* * Signature:* *: 85 69 A4 E7 D8 A7 C9 5E 16 90 B7 14 C5 EF 7C 6E .i.^...n* *0010: F0 E4 4A 18 B8 BE 11 3B 0D 4A E2 90 E8 B6 89 AF ..J;.J..* *0020: 29 88 96 DE 25 6E DF 4B FF B7 FE 12 C9 ED E5 9F )...%n.K* *0030: 8A B3 F0 A0 8A 40 39 87 C1 E5 57 FA 73 74 3A 2D .@9...w.st:-* * * *]* * *trigger seeding of SecureRandom* *done seeding SecureRandom* *SSL ON* *Listening on port 8080* *R: 0.0, W: 0.0* *Using SSLEngineImpl.* *log4j:WARN No appenders could be found for logger (org.apache.mina.example.echoserver.EchoProtocolHandler).* *log4j:WARN Please initialize the log4j system properly.* *log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.* *R: 0.0, W: 0.0* *R: 0.0, W: 0.0* *R: 0.0, W: 0.0* *R: 0.0, W: 0.0* *R: 0.0, W: 0.0* *Client:* * trigger seeding of SecureRandom done seeding SecureRandom SSL ON Using SSLEngineImpl. test * Thanks again, André de C. Rodrigues (11) 7588-9992 2010/8/23 Ashish paliwalash...@gmail.com What's the error? MINA version? Try passing this JVM srgument -Djavax.net.debug=all or -Djavax.net.debug=ssl it will show all the SSL communication happening. Its would be easy to point the error. AFAIK, SSL Filter should be the first filter in the chain. Since you are using provided example you should be good. thanks ashish 2010/8/24 André Rodrigues gur...@gmail.com: Hi everyone! I'm trying to fix up a simple MINA example using SSL and I'm having some trouble. Here's what I did: 1) I'm running the EchoServer example with SSL turned on. I generated the bogus.cert keystore using keytool as described in the documentation. 2) I created a simple MINA client that connects to the EchoServer and starts a new thread to capture keyboard input and send it to the EchoServer. The client also prints out received messages. 3) I'm using the ssl package from the EchoServer in my MINA client and using the same keystore I generated with keytool in step 1. 4) I'm adding a SSLFilter to the client filter chain using the BogusSSLContextFactory from the EchoServer example (new SslFilter(SslContextFactory.getInstance(false)). This, however, does not seem to work... does anybody have any idea why? Sorry if this comes off as a rookie question, but I'm just getting into programming. Thanks in advance, andre -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Encoding Decoding Java Collections Using Mina
Can also look at org.apache.mina.filter.codec.serialization package. I haven't used it, but seems like a good fit for Object Serialization needs. thanks ashish On Wed, Jul 28, 2010 at 1:13 PM, Emmanuel Lecharny elecha...@gmail.com wrote: On 7/28/10 4:58 AM, amit shah wrote: Hello, Hi, I understand that mina provides a framework to allow the client, server communicate through java objects by using the protocol codec factory, encoder decoder. Since the IoBuffer provides methods to get primitive objects like int, string, double etc, how can we pass java collection objects like map. For e.g. below is my pojo class which has to be encoded decoded. class MyClass { private String name; private MapString, Integer nameVsIdMap; private MapString, ListInteger nameVsNumbers; . } Any help would be appreciated. You have to write yur own encoder/decoder to handle those objects.It's not that complicated, you can follow http://mina.apache.org/tutorial-on-protocolcodecfilter-for-mina-2x.html to get a clue about how to do that. Basically, the decoder will receive IoBuffer, and you will create Objects out of that, and symetrically, the encoder will take Objects and produce an Iobuffer. There are a few tricks you have to be aware of for the decoder : - messages can be fragmented : you may not receive all the needed bytes to generate a full object, so you have to deal with that. You can pass the serialized object's size before the serialized object itself in orer to deal with this issue. Note that even this size can be fragmented. Store any temporary data into the session attributes until you have got what you need to produce an object, then when done, call the next filter. - you may have more than one object in the received IoBuffer, so don't forget to iterate on the buffer until it's empty. Hope it helps. -- Regards, Cordialement, Emmanuel Lécharny www.iktek.com -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: SocketSessionConfig
acceptor.getSessionConfig().setTcpNoDelay(true); just recall from top of my head On Tue, May 25, 2010 at 12:35 PM, Zigor Salvador zigorsalva...@tourgune.org wrote: Hi, MINA 2.0 related, why is there no acceptor.setSessionConfig(SocketSessionConfig) method? I can get the default configuration with acceptor.getSessionConfig but I don't know how to make changes in order to, for instance, setTcpNoDelay(true) for that acceptor. Thank you, Zigor. -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Some interesting Projects using MINA
Found two interesting projects using MINA *Naggati* - is a library that makes it easy to build protocol filters for mina 2.0 using this sequential style. A DSL allows you to write the decoder in sequence, but each decoding step is actually a state in a state machine, and when one step is finished decoding, it calls the code block for the next step. http://robey.lag.net/2009/03/02/actors-mina-and-naggati.html Source: http://github.com/robey/naggati Source of this info was http://blog.redfin.com/devblog/2010/05/how_and_why_twitter_uses_scala.html *protobuf-mina-rpc* - An RPC channel implementation for Google Protocol Buffer. Currently only synchronously calling Java protobuf services from a Python client is supported Source: http://code.google.com/p/protobuf-mina-rpc/ Source of this info was http://groups.google.com/group/protobuf/browse_thread/thread/5a8766e4dc7b8177?pli=1 Should we contact the owners and add these to Related Projects? thanks ashish
Re: changes from Mina 2.0.0-M3 to 2.0.0-M6 to 2.0.0-RC1
The best way would be to take Thread dumps and see what's going on inside. Using a logging filter could tell you a little more when things have been processed... thanks ashish On Tue, Apr 20, 2010 at 9:53 PM, Vijay K Pandey vpan...@mdes.ms.gov wrote: Hi, I have an application which has a very simple scenario of sending Java POJO(serializable) objects from Mina client to server and client waits for the response. It was all working very fine with mina-core-2.0.0-M3.jar but looks like something has changed in mina-core-2.0.0-M6.jar and mina-core-2.0.0-RC1.jar where on several messages mina server receives the message from client ( both process running on same machine) after a delay of 5 seconds. I can see that on client side LoggingFilter has written the message but then there is a delay on server side when it is received. I ran the test on the same dataset for the above 3 versions of MINA and - M3 runs fine without any issue and there is no delay. I am testing this in a controlled environment where at any given point of time only 1 message is sent. Only after the response is received, does the second message is sent out. Message is basically - an array List - have 3 members where2 members are of string type and 1 member is HashMap of around 12 objects(11 are simple primitive wrappers and 1 POJO - having 6 primitives wrappers) Can someone point me to the right direction? Thanks Vijay -Mina client code snippet connector.getFilterChain().addLast(codec,new ProtocolCodecFilter(new ObjectSerializationCodecFactory())); connector.getFilterChain().addLast( logger,new LoggingFilter() ); connector.setConnectTimeoutMillis(30 * 1000); ConnectFuture future1 = connector.connect( address ); future1.awaitUninterruptibly(15, TimeUnit.SECONDS); if (!future1.isConnected()) { return false; } session = future1.getSession(); CloseFuture closeFuture = session.getCloseFuture(); closeFuture.addListener((IoFutureListener?) new IoFutureListenerIoFuture() { public void operationComplete(IoFuture future) { System.out.println(The session is now closed); logger.info(Mina client session is getting closed); } }); ---Mina Server Code snippet - acceptor = new NioSocketAcceptor(); acceptor.getFilterChain().addLast( logger, new LoggingFilter() ); acceptor.getFilterChain().addLast( codec, new ProtocolCodecFilter( new ObjectSerializationCodecFactory() ) ); acceptor.setHandler( handler ); acceptor.getSessionConfig().setReadBufferSize( 2048 ); acceptor.getSessionConfig().setIdleTime( IdleStatus.BOTH_IDLE, 3 ); acceptor.bind( new InetSocketAddress( 127.0.0.1, port ) );
Re: HttpServer example is missing from mina-2.0.0.RC1
HTTP related stuff has been moved to AsyncWeb project. http://mina.apache.org/asyncweb/ There is not much info on wiki, but please feel free to check the svn repo. thanks ashish On Thu, Apr 8, 2010 at 12:20 PM, Pradeep chahal deep.cha...@live.com wrote: Hello, HttpServer example is missing from mina-2.0.0.RC1, while it is available in mina 1.1.7. I tried to import this example into mina-2.0.0 from m 1.1.7 but few classes is not supported in mina 2.0 ( ex. ByteArray). In future, will HttpServer example will be available in mina 2.0 ? Regards, Pradeep Chahal Catch the changing security environment Get it now. The latest auto launches and test drives Drag n' drop _ South Cinema This Decade http://entertainment.in.msn.com/southcinemathisdecade/ -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: HttpServer example is missing from mina-2.0.0.RC1
Thanks Norman! This is the master page http://mina.apache.org/sources.html. The link is from main nav menu Sources thanks ashish On Thu, Apr 8, 2010 at 3:46 PM, Norman Maurer norman.mau...@googlemail.com wrote: Here you go: http://svn.apache.org/repos/asf/mina/asyncweb/trunk/ Bye, Norman 2010/4/8 Pradeep chahal deep.cha...@live.com: Hi Ashish, Thank for replying. I could not find svn link for asyncweb; Would you let me know the same? Regards, Pradeep Date: Thu, 8 Apr 2010 15:29:30 +0530 Subject: Re: HttpServer example is missing from mina-2.0.0.RC1 From: paliwalash...@gmail.com To: users@mina.apache.org CC: elecha...@apache.org HTTP related stuff has been moved to AsyncWeb project. http://mina.apache.org/asyncweb/ There is not much info on wiki, but please feel free to check the svn repo. thanks ashish On Thu, Apr 8, 2010 at 12:20 PM, Pradeep chahal deep.cha...@live.com wrote: Hello, HttpServer example is missing from mina-2.0.0.RC1, while it is available in mina 1.1.7. I tried to import this example into mina-2.0.0 from m 1.1.7 but few classes is not supported in mina 2.0 ( ex. ByteArray). In future, will HttpServer example will be available in mina 2.0 ? Regards, Pradeep Chahal Catch the changing security environment Get it now. The latest auto launches and test drives Drag n' drop _ South Cinema This Decade http://entertainment.in.msn.com/southcinemathisdecade/ -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal _ The amazing world in sharp snaps http://news.in.msn.com/gallery/archive.aspx -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Simple Notification Solution in MINA
There are two ways 1. Mimic keep alive filter - it sends keep alive messages after every 'x' seconds 2. Keep a tab of all open sessions, and after an interval iterate over all the active sessions and write a message on the session. thanks ashish On Fri, Mar 26, 2010 at 3:16 AM, Steve Buster stevebuster...@hotmail.com wrote: I'm trying to develop a client / server application that can basically be related to a stockticker application. The client simply connects to the server, and from there the server constantly sends data updates. How is this done in MINA. I'm brand new to MINA and was looking through the simple samples and based on the generic API, it looks like the method on the server messageReceived expects the client to constantly poll the server. Is there a way to open the connection and just constantly push the data (every 1,2..5 seconds) instead of having the client constantly ask for new updates. _ Hotmail: Trusted email with powerful SPAM protection. http://clk.atdmt.com/GBL/go/210850553/direct/01/ -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Possible memory leak using Mina 1.1.7
MINA 1.X is way old. Would recommend you to upgrade to the latest MINA release. Try migrating. Some of the differences are listed here http://mina.apache.org/changes-between-2x-and-1x.html thanks ashish On Tue, Mar 16, 2010 at 8:26 PM, Cleber Cassol ccas...@gmail.com wrote: Hi there. We are using Mina 1.1.7 for some time now. We are developing a system that will act as a proxy between our clients (e-mail clients like Thunderbird, cell phones and so on) and our IMAP mail server. Basically, a client connects and sends IMAP commands. Then, the proxy parses those commands if necessary, drops them if they can't be handled by us and ultimately sends those commands to our mail server. The mail server responds accordingly and the proxy simply passes its responses to the client. Our production environment so far: Mina Version 1.1.7 java version 1.6.0_12 Java(TM) SE Runtime Environment (build 1.6.0_12-b04) Java HotSpot(TM) 64-Bit Server VM (build 11.2-b01, mixed mode) CENTOS Linux The problem is: even under a low load (about 50 requests per minute), the memory consumption is always increasing. After about 12 hours, our application begins swapping and eventually the JVM dies. After a lot of profiling it using JProfiler, we discovered that a lot of SocketIoSession objects were being held somewhere (more than 30.000). We are not using the ProxyFilter because no documentation on it was found. Basically, we do the following: - Client requests a connection - Acceptor accepts it and then we start receiving commands - After authentication, the Connector connects to our mail server and pass the received commands through it. - The mail server responds and its responses are passed back to the client So, we have two IoSession objects per client. One for the client and the proxy, another for the proxy and the mail server. It has to be that way because every connection with the IMAP mail server must be authenticated for one user, thus we cannot reuse the same connection for sending requests for various users. Our mail server has a limited capacity, so we have to cut idle connections with it after 5 seconds. There's a thread for that task. This thread sweeps the Acceptor's and Connector's managedConnections collection and, if getLastWriteTime() returns something that indicates it's been idle for more than 5 seconds, it closes the connection and remove it from the respective collection. One single IMAP command can generate A LOT of responses. For example, when the e-mail client is downloading a big message with attachments on it. Also, an APPEND command generates a lot of binary requests to store the data. I don't know where to look anymore. I've also tried to use heap buffers, but now our application crashes after 3 or 4 days. It's better, but there's still a leak somewhere. Could you lend me some hand and help me find it? If it's MINA related, of course. Thank you very much for your attention. I'll gladly send you any resources you may find useful.
Re: Possible memory leak using Mina 1.1.7
On Tue, Mar 16, 2010 at 11:04 PM, Cleber Cassol ccas...@gmail.com wrote: Hi there! Thanks for the response. Do you recommend Mina 2.X for production environments, even when it is listed as unstable? My application is running on production environment, so the need to address the memory leak as fast as possible. I'm trying to figure it out for more than a week now, that's the reason I asked you guys. Thank you so much again. Yeah there are folks running MINA 2.X in production :) Lets hear it out from them. Can anyone help me out here? thanks ashish
Re: ProtocolCodecFilter change of behavior in 2.0.0-RC1
On Sun, Mar 14, 2010 at 9:38 AM, John Fallows john.fall...@kaazing.com wrote: Thanks Emmanuel. Good to see you were already on top of this six months ago! Sorry that I didn't consider checking the trunk. Is there any word on when we might expect a post 2.0.0-RC1 release, either 2.0.0-RC2 or 2.0.0 final? We are working on this. Hopefully, it shall be soon :) Kind Regards John Fallows On Mar 13, 2010, at 5:58 PM, Emmanuel Lecharny elecha...@gmail.com wrote: On 3/14/10 1:03 AM, John Fallows wrote: Folks, There appears to be a change of behavior in ProtocolCodeFilter due to the previously non-static and now-static nature of the attribute keys used to cache the encoder, encoder output, decoder and decoder output. snip/ Is there any objection to reverting these 4 attribute key constants to non-static for 2.0.0 final? This was a mistake I did a few months ago. It has been reverted in revision 580762, back in september 2009. -- Regards, Cordialement, Emmanuel Lécharny www.nextury.com -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: UDP replying to a message issue
I ran the program and the client is receiving the message. Here are Server dumps Session created... Session Opened... ABC_XYZ Object Attached and SentMessage sent Client Console output Session created... Session opened... Message sent... r.getMessage(); null org.apache.mina.core.buffer.BufferDataException: Object length should be greater than 4: 0 at org.apache.mina.core.buffer.AbstractIoBuffer.getObject(AbstractIoBuffer.java:1942) at org.apache.mina.core.buffer.AbstractIoBuffer.getObject(AbstractIoBuffer.java:1927) at client.CustomClient.messageReceived(CustomClient.java:144) at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:713) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:793) at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:119) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434) at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:426) at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:638) at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:598) at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:587) at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$400(AbstractPollingIoProcessor.java:61) at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:969) at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:637) So things are working fine :) Your client is receiving the message, you just need to fix this exception. Good Luck ! You are almost there, just a few lines of code more :) On Thu, Mar 11, 2010 at 4:41 PM, Abdul Khaliq abdul.kha...@yahoo.com wrote: i have attached the src code Abdul Khaliq http://old.nabble.com/file/p27862087/src.rar src.rar Ashish-24 wrote: On Thu, Mar 11, 2010 at 12:43 PM, Abdul Khaliq abdul.kha...@yahoo.com wrote: Here what actually happens UDP client UDP Server 1.The server starts and no events are generated 2. generates Session created event 3. generates Session opened event 4. sends the data to server 5. generates Session created event 6. generates Session opened event 7. generated the message received event some strange things as soon as i stop the server the message receive event is generated on the client. else the session closed event is generated automatically and no message received event is generated. Abdul Khaliq Take a thread dump and see what is happening Can you share the code? -- View this message in context: http://old.nabble.com/UDP-replying-to-a-message-issue-tp27859293p27862087.html Sent from the Apache MINA User Forum mailing list archive at Nabble.com.
Re: UDP replying to a message issue
On Thu, Mar 11, 2010 at 10:18 AM, abdul khaliq abdul.kha...@yahoo.com wrote: Hi, I am using one of the examples that u have provided on http://svn.apache.org/viewvc/mina/tags/2.0.0-M3/example/src/main/java/org/apache/mina/example/udp/ What i need is to sent a pojo from server to client. Please help me how can i handle this? Also how can i raise event on the client side upon message received just as it is on the server side in the provided example. Are you planning to use Object serialization for sending the data? Your client IoHandler messageReceived() shall be called, whenever a message is received. Raise en event from there. -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: UDP replying to a message issue
On Thu, Mar 11, 2010 at 10:39 AM, Abdul Khaliq abdul.kha...@yahoo.com wrote: Yes i am trying to serlize the object upon the message received event in the Handler class like buffer.putObject(pojoObject), but i don't know if it is the right way of doing it? and how no message received event is raised on the client side. Please guide me. @Override public void messageReceived(IoSession session, Object message) throws Exception { if (message instanceof IoBuffer) { IoBuffer buffer = (IoBuffer) message; buffer.putObject(new pojo.POJO()); System.out.print(Object Attached and Sent); } } Abdul Khaliq This event will be generated when your Server sends out a message to your client. Why don't you try to first play around with the UDP example first and then move onto your code. It will help you understand how things work. I don't remember but the example doesn't send back a response to the client? If you object size is greator than MTU, you will receive multiple packets at server, and you need to handle that.
Re: UDP replying to a message issue
On Thu, Mar 11, 2010 at 11:03 AM, Abdul Khaliq abdul.kha...@yahoo.com wrote: Agreed the server does not set the message back to the client, in the example , and i did have a look at the java docs and the tried different methods to sent data back to the client. I mean thats the actual question how can i send data back to the client? in messageReceived call session.write(...some data); I recommend that you explore other examples as well. There should be a Object based codec as well check this list http://mina.apache.org/codec-repository.html
Re: How To Handle Request Reply
Yes its very much applicable, but there is very little or no documentation around this. thanks ashish On Thu, Mar 4, 2010 at 4:20 PM, Brad Harvey harve...@gmail.com wrote: Is this still applicable? https://issues.apache.org/jira/browse/DIRMINA-92?focusedCommentId=12488311page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_12488311 Emmanuel Lecharny wrote: On 3/3/10 6:45 PM, Carlo Camerino wrote: HI, I would like to ask on how to handle request reply with apache mina. How do i ensure that when a thread sends a message, the thread gets the reply for that message. What happens is, at very highly concurrent scenario a thread gets the response of another thread. Mina is asynchronous. When you send a request, you can't simply wait for the response. The Handler will get the response back and you have to correlate this response with the request. Now, each connection is associated with a session, so if you send a request in a session, you have the guarantee that this session will receive the response. So one option is to store the response as an attribute of your session, so that your thread can get it back later. Remains one issue : you don't want to poll the session until the response is stored into it, otherwise you'll lose the benefit of using an asynchronous framework. You have many ways to deal with this : - you simply call session.read(), you'll get back a readFuture. You then just have to wait() on it, and you'll get the response in the readFuture when it's back - store a callback in the session, and when the response arrives, the callback will be called - use a synchronization mechanism your main thread will wait on, and when the message arrives, you release the lock so that the requester is waken up That's the three that come to my mind, but there are probably other scenarii. Hope it helps
Re: question about Filter
On Tue, Feb 2, 2010 at 10:57 PM, siasia silviasignor...@libero.it wrote: Yuo have understand my problem but I'm not able to resolve it! I must include an codec filter otherwise become an error; is there a MINA type codec (e.g. TextLineCodec) that convert byte[] to a BasicMessage? (...) //what I can instantiate in the ??? IoFilter CODEC_FILTER = new ProtocolCodecFilter(???); connector.getFilterChain().addLast(codec, CODEC_FILTER); (...) it would be good be to start with example provided with MINA release and then move to write your own codec. -- View this message in context: http://old.nabble.com/question-about-Filter-tp27422950p27424211.html Sent from the Apache MINA User Forum mailing list archive at Nabble.com. -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: MINA 2.0 RC code base stability?
2.0 is now in RC phase and soon we shall have a GA release. The API's have been frozen, so no changes are expected. We are working on killing the remaining bugs and go out with GA soon. 2.0 is not unstable :-) thanks ashish On Mon, Feb 1, 2010 at 3:10 PM, Michael Clifford web4m...@yahoo.com wrote: I'm doing pretty well using the MINA 1.1 code base, but it looks like some of the examples require the use of 2.0. I'm a bit worried about the note that says that 2.0 is bleeding edge code though. How stable is it right now? Am I likely to run into any problems using the 2.0 framework? As far as I know, I don't need anything specific to 2.0 right now. However, I am trying to write a client to go with my server, and the client examples appear to require 2.0. So is it safe to use it? :-) Are any interfaces likely to change before release? Are there any issues to be aware of at this point that would make it worth sticking with 1.1 instead?
Re: MINA 2.0 RC code base stability?
This page may be of help http://mina.apache.org/changes-between-2x-and-1x.html On Tue, Feb 2, 2010 at 2:41 AM, Michael Clifford web4m...@yahoo.com wrote: Is there some sort of guide for porting 1.1 code to 2.0? I've tried to replace the 1.1 libraries with the 2.0 ones for the MinaTimeServer example, but the imports I need aren't there, and I'm not sure what I should be importing. Thanks, Michael
Re: how to shutdown a mina application
Thanks David! @jose For Ctrl + C, like scenario, create a shutdown hook and register. In the shutdown hook code, do the cleaning stuff. thanks ashish On Thu, Jan 28, 2010 at 9:13 PM, David Rosenstrauch dar...@darose.net wrote: On 01/28/2010 05:09 AM, jose vilmar estacio de souza wrote: Hi all Perhaps a stupid question, but I didn't find an answer in the examples. I'd like to know how to shutdown a mina application in an elegant way. Actually I kill my applications pressing ctrl+c. What I'd like: a: Block incoming connections. b: Close all open sessions gracefully. C: Finish the application. Any ideas? Thanks. I did it by adding a shutdown command to the protocol. Then when the server receives the message shutdown it executes this: public class ShutdownCommand extends MinaServerProtocolCommand { ... public ProtocolResponse execute() throws Exception { boolean closeImmediately = false; Object[] args = getArgs(); if (args.length 0) { String closeImmediatelyStr = (String)args[0]; closeImmediately = Boolean.parseBoolean(closeImmediatelyStr); } CloseFuture closeFuture = getSession().close(closeImmediately); closeFuture.addListener(new CloseSessionListener()); return null; } ... class CloseSessionListener implements IoFutureListenerCloseFuture { public void operationComplete(CloseFuture future) { getServer().shutDown(); } } } getServer().shutDown() then does additional cleanup, like shutting down thread pools timers, as well as calling out to my mina protocol processors telling them to shut down: public class ProfileCacheServer implements Server { ... public synchronized void shutDown() { if (shutDown) { return; } logger.info(shutting down); if (textProtocolProcessor != null) { textProtocolProcessor.shutdown(); } if (binaryProtocolProcessor != null) { binaryProtocolProcessor.shutdown(); } shutdownCore(); shutDown = true; } private void shutdownCore() { logger.debug(unregistering cache node mbean: {}, cacheNodeObjectName.toString()); try { jmxMBeanServer.unregisterMBean(cacheNodeObjectName); } catch (JMException e) { logger.error(error occurred while unregistering cache node mbean, e); } logger.debug(shutting cache loader threads); cacheNode.shutdownThreads(); logger.debug(shutting down stats timer); timer.cancel(); } ... } And the protocol processor shutdown looks something like this: public class ProtocolProcessor { ... public void shutdown() { if (protocolAcceptorObjectName != null) { logger.debug({} protocol processor unregistering protocol acceptor mbean: {}, protocolType, protocolAcceptorObjectName.toString()); try { jmxMBeanServer.unregisterMBean(protocolAcceptorObjectName); } catch (JMException e) { logger.error(error occurred while unregistering protocol acceptor mbean, e); } } logger.debug({} protocol processor shutting down server socket, protocolType); protocolAcceptor.unbind(); protocolAcceptor.dispose(); } ... } (FYI - protocolAcceptor is an NioSocketAcceptor in the above.) HTH, DR
Re: Large file transfer with mina
On Wed, Jan 27, 2010 at 6:03 PM, Emre GURBUZ emregur...@gmail.com wrote: Hi all, I am trying to develop a peer-to-peer application which peers will be able to transfer large binary files. File size is approximately 40-50 mb and I am using mina 1.1.7. Please upgrade to the latest. It runs far better I tried to use ObjectSerializationCodecFactory codec, but realized that it has really poor performance.It takes 25-30 seconds in LAN. Now I really need to have guide if I need to send file in chunks? Do you think the best way will be a custom codec that handles transfer? Hmm, a file region filter would be better. What OS are you on? My best regards, Emre -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: jar file for org.apache.mina.filter.support.Zlib
On Wed, Jan 27, 2010 at 11:17 PM, Ted Yu yuzhih...@gmail.com wrote: Thanks for the hint. But I see: org.apache.mina.filter.compression.Zlib is not public in org.apache.mina.filter.compression; cannot be accessed from outside package The class is internally used by the Filter, and Filter is what is to be used. Any specific needs to use the class directly? On Wed, Jan 27, 2010 at 9:40 AM, Ashish paliwalash...@gmail.com wrote: Its part of mina-filter-compression-2.0.0-RC1.jar On Wed, Jan 27, 2010 at 11:07 PM, Ted Yu yuzhih...@gmail.com wrote: Hi, We're using mina 2.0.0-RC1 I want to use org.apache.mina.filter.support.Zlib but couldn't find the jar file for that class. Can someone tell me where to find the jar file ? Thanks -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Large file transfer with mina
On Thu, Jan 28, 2010 at 12:09 AM, Emre GURBUZ emregur...@gmail.com wrote: I am using Centos 5.3 with sun jdk 1.6. Generally Java's default object serialization has poor performance and I noticed that it was a big mistake of using serialization for binary file transfer. Is there a standart Mina codec for file transfer or should I write my own codec filter for this? I think you need to write your own codec for this. Check MINA source in this folder org.apache.mina.filter.stream I think the FileRegionFilter may be of help. If I need to write a custom codec, then which points are important for large file transfer especially image files.. On Wed, Jan 27, 2010 at 7:14 PM, Ashish paliwalash...@gmail.com wrote: On Wed, Jan 27, 2010 at 6:03 PM, Emre GURBUZ emregur...@gmail.com wrote: Hi all, I am trying to develop a peer-to-peer application which peers will be able to transfer large binary files. File size is approximately 40-50 mb and I am using mina 1.1.7. Please upgrade to the latest. It runs far better I tried to use ObjectSerializationCodecFactory codec, but realized that it has really poor performance.It takes 25-30 seconds in LAN. Now I really need to have guide if I need to send file in chunks? Do you think the best way will be a custom codec that handles transfer? Hmm, a file region filter would be better. What OS are you on? My best regards, Emre -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Large file transfer with mina
On Thu, Jan 28, 2010 at 1:16 AM, Emre GURBUZ emregur...@gmail.com wrote: Thank you for response Ashish, but do you know any working-real example that handles large file transfer with MINA 2.0? I am afraid, I am not aware of any real example. Sorry abt that ! There are couple of related mail threads. You can search mail achieves at http://mina.markmail.com thanks ashish
Re: how to implement read timeout in CumulativeProtocolDecoder
On Tue, Jan 26, 2010 at 3:19 PM, XuQing Tan missed...@gmail.com wrote: Hi, mina guys first, MINA is a very nice framework, very easy to use, and another much more inspiring thing is the community is much more active recently and the MINA 3.0 is on the way here I have a question about implement protocol codec on server side by extending CumulativeProtocolDecoder, I try the examples first which saved me a lot of time but I notice that there's no way to support timeout in CumulativeProtocolDecoder since socket is stream based, and CumulativeProtocolDecoder is to help recv the integrity request data, if the data is not recv completed, return codefalse/code in doDecode to tell the CumulativeProtocolDecoder more data is needed, if the additional data not recv, it is a infinite loop, right? (according to the code in *org.apache.mina.filter.codec.CumulativeProtocolDecoder.decode(IoSession, IoBuffer, ProtocolDecoderOutput)*) so, that session blocked, and even more, other client new request are blocked too? I think it relatively easy to implement a retry-time' strategy to prevent from this suck, by attach a re-try time count as attribute to the session but after all, it is not a time out you got things correctly, its just that each client shall have its own session and an instance of Filter working for each session. So essentially, you Filter/Decoder processes messages from a single client. No other Client requests are blocked. so is there any other ways to provide the read timeout mechanism, have I missed any thing? I doubt you would need any time out stuff, unless I am missing something.. Thanks in advanced Thanks Best Regards! /// (. .) ooO--(_)--Ooo | Nick Tan | - -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Empty WriteRequest in overriden MessageSent method
On Tue, Jan 26, 2010 at 4:41 PM, Frederic Soulier fred.soulier...@googlemail.com wrote: Hi Using 2.0 RC1 I've got the following filter chain configured for a NioSocketAcceptor: acceptor.getFilterChain().addLast(blacklist, new BlacklistFilter()); acceptor.getFilterChain().addLast(connection, new ConnectionFilter()); acceptor.getFilterChain().addLast(proto, new ProtocolCodecFilter(new MyProtocolEncoder(), new MyProtocolDecoder())); acceptor.getFilterChain().addLast(pool, new ExecutorFilter(new OrderedThreadPoolExecutor())); acceptor.setHandler(new MyHandler()); I see some strange output when sending data (write) back to the clients. In my ConnectionFilter I've overriden the MessageSent method with: @Override public void messageSent(NextFilter nextFilter, IoSession ios, WriteRequest writeRequest) throws Exception { log.trace(Sent(wire) [{}b] [{}]., ((IoBuffer)writeRequest.getMessage()).remaining(), ((IoBuffer)writeRequest.getMessage()).getHexDump()); } One thing that is missing is call to nextFilter.messageSent() In my logs I can see what is sent down the wire 11:00:20,157 Sent(wire) [52b] [00 00 00 30 9A 47 A7 CE 33 C6 AC 72 CE 08 79 A8 70 0C 1D 41 87 B1 2F D2 53 42 B7 85 B7 91 59 30 02 44 A0 42 00 50 28 8D D3 4B 04 74 58 70 58 26 9E 46 35 C1]. but somehow I immediately get an empty WriteRequest... 11:00:20,157 Sent(wire) [0b] [empty]. Hmm.. not sure abt this. Are both these traces from same snippet that you posted above? Why is that? Thx Fred -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: how to implement read timeout in CumulativeProtocolDecoder
On Tue, Jan 26, 2010 at 7:22 PM, XuQing Tan missed...@gmail.com wrote: Hi, Ashish thanks for your reply I doubt you would need any time out stuff, unless I am missing something.. OK, as it is an endless loop if the package/frame not received completely, the session is block and the corresponding thread resource not released for ever. then let's imaging following two scenarios: 1. if it's a persist connection, and the client occasionally send a im-complete frame first, then this session on the server side is blocked, even then the client send a second complete frame to server 2. if it's not a persist connection, and there are a lot of clients send request to the server, some clients for unknown reason, send a lot of im-complete frames to the server, which cause a lot of thread busy polling the im-complete frame (and never be completed) on the server side, if there are too many this kind bad clients, the server could be suck soon as it cannot service any more request, is it some kind of DoS (Denial of Service)? although I know that my assumption are all based on it is a bad client, but I want to try to avoid scenarios above If a session is idle, an event is generated. You can choose to cleanup there. I don't remember, but think if a session is Idle it's closed. To block unknown clients, use blacklist filter :-) is it reasonable? thanks again Thanks Best Regards! /// (. .) ooO--(_)--Ooo | Nick Tan | - On Tue, Jan 26, 2010 at 6:55 PM, Ashish paliwalash...@gmail.com wrote: On Tue, Jan 26, 2010 at 3:19 PM, XuQing Tan missed...@gmail.com wrote: Hi, mina guys first, MINA is a very nice framework, very easy to use, and another much more inspiring thing is the community is much more active recently and the MINA 3.0 is on the way here I have a question about implement protocol codec on server side by extending CumulativeProtocolDecoder, I try the examples first which saved me a lot of time but I notice that there's no way to support timeout in CumulativeProtocolDecoder since socket is stream based, and CumulativeProtocolDecoder is to help recv the integrity request data, if the data is not recv completed, return codefalse/code in doDecode to tell the CumulativeProtocolDecoder more data is needed, if the additional data not recv, it is a infinite loop, right? (according to the code in *org.apache.mina.filter.codec.CumulativeProtocolDecoder.decode(IoSession, IoBuffer, ProtocolDecoderOutput)*) so, that session blocked, and even more, other client new request are blocked too? I think it relatively easy to implement a retry-time' strategy to prevent from this suck, by attach a re-try time count as attribute to the session but after all, it is not a time out you got things correctly, its just that each client shall have its own session and an instance of Filter working for each session. So essentially, you Filter/Decoder processes messages from a single client. No other Client requests are blocked. so is there any other ways to provide the read timeout mechanism, have I missed any thing? I doubt you would need any time out stuff, unless I am missing something.. Thanks in advanced Thanks Best Regards! /// (. .) ooO--(_)--Ooo | Nick Tan | - -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Empty WriteRequest in overriden MessageSent method
On Tue, Jan 26, 2010 at 7:20 PM, Frederic Soulier fred.soulier...@googlemail.com wrote: 2010/1/26 Ashish paliwalash...@gmail.com On Tue, Jan 26, 2010 at 4:41 PM, Frederic Soulier fred.soulier...@googlemail.com wrote: Hi Using 2.0 RC1 I've got the following filter chain configured for a NioSocketAcceptor: acceptor.getFilterChain().addLast(blacklist, new BlacklistFilter()); acceptor.getFilterChain().addLast(connection, new ConnectionFilter()); acceptor.getFilterChain().addLast(proto, new ProtocolCodecFilter(new MyProtocolEncoder(), new MyProtocolDecoder())); acceptor.getFilterChain().addLast(pool, new ExecutorFilter(new OrderedThreadPoolExecutor())); acceptor.setHandler(new MyHandler()); I see some strange output when sending data (write) back to the clients. In my ConnectionFilter I've overriden the MessageSent method with: @Override public void messageSent(NextFilter nextFilter, IoSession ios, WriteRequest writeRequest) throws Exception { log.trace(Sent(wire) [{}b] [{}]., ((IoBuffer)writeRequest.getMessage()).remaining(), ((IoBuffer)writeRequest.getMessage()).getHexDump()); } One thing that is missing is call to nextFilter.messageSent() In my logs I can see what is sent down the wire 11:00:20,157 Sent(wire) [52b] [00 00 00 30 9A 47 A7 CE 33 C6 AC 72 CE 08 79 A8 70 0C 1D 41 87 B1 2F D2 53 42 B7 85 B7 91 59 30 02 44 A0 42 00 50 28 8D D3 4B 04 74 58 70 58 26 9E 46 35 C1]. but somehow I immediately get an empty WriteRequest... 11:00:20,157 Sent(wire) [0b] [empty]. Hmm.. not sure abt this. Are both these traces from same snippet that you posted above? Why is that? Yep the logging is from the same messageSent() and my cutpaste was wrong... @Override public void messageSent(NextFilter nextFilter, IoSession ios, WriteRequest writeRequest) throws Exception { log.trace(Sent(wire) [{}b] [{}]., ((IoBuffer)writeRequest.getMessage()).remaining(), ((IoBuffer)writeRequest.getMessage()).getHexDump()); super.messageSent(nextFilter, ios, writeRequest); } I've only started dabbling with MINA 2.0 RC1 recently. I can't remember seing this with MINA 1.1.7 Fred Fred, Can you provide me a test to reproduce this. I guess I am lost here. I am not sure if your message is complete or not, meaning have all the necessary bytes sent to client or not? -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: supporting multiple clients with MINA
On Tue, Jan 26, 2010 at 6:38 AM, Michael Clifford web4m...@yahoo.com wrote: Ahh, ok. I may be thinking about it differently, because my program is not just serving lots of hosts. It's taking data from each individual host and combining them using some fairly complex logic, so eventually, I must get my data out of the sessions, and into the core of my program. So let me see if I understand this correctly: 1) Every time something connects to my server, a session is automatically created. I don't have to do anything extra to create it. Yes 2) Sessions contain all of the info about a connection Sort of yes .. 3) When something sends a message to one of my sessions, that session is automagically called. I don't need to do anything, and I don't need to iterate over them. Absolutely correct :-) 4) I can write a filter to have the session do the parsing for me, so I just need to handle the string that it outputs if I choose to do that. Is that correct? Yes that's correct So then if I store the string as an attribute, I would need to place each new session into a container, and then iterate over all the sessions, read the strings out of them, and do something with those strings? Then I'd also need to check each session to see if it was connected, because it might have closed in the mean time, and then I'd want to read out the last string and stop tracking it. Lost here :-( Not sure what you want to do with Strings.. Essentially in your IoHandler, on messageReceived() you process the message, like persist it to DB, log etc, and send a response back. What Emm, was trying to point out is that, you may receive fragmented msg, your String could be part of two packets and that's the situation you have to deal to with in your filter. There are couple of examples around this, so feel free to experiment. -- thanks ashish
Re: Connection reset by peer
This problem is not specific to MINA. This occurs when the peer client resets the connection in middle of conversation. Its best to clean resources in this scenario, if you have kept any stuff related to the Client there. If you have worked with Servlets, as a beginner, you can see bunch of these exceptions in Tomcat logs :-) thanks ashish On Sat, Jan 23, 2010 at 5:57 PM, Ted Yu yuzhih...@gmail.com wrote: Hi, I saw this snippet in our server log many times: 2010-01-22 14:01:53,006 INFO [net.kindsight.rpc.server.impl.RpcIoHandler] session is opened: (0x00B1: nio socket, server, /10.10.31.121:35118 = / 10.10.31.135:59232) 2010-01-22 14:01:53,381 WARN [net.kindsight.rpc.server.impl.RpcIoHandler] RPC Server Error java.io.IOException: Connection reset by peer at sun.nio.ch.FileDispatcher.read0(Native Method) at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:21) at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:233) at sun.nio.ch.IOUtil.read(IOUtil.java:206) at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:236) at org.apache.mina.transport.socket.nio.NioProcessor.read(NioProcessor.java:202) at org.apache.mina.transport.socket.nio.NioProcessor.read(NioProcessor.java:42) at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:620) at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:598) at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:587) at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$400(AbstractPollingIoProcessor.java:61) at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:969) at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) 2010-01-22 14:01:53,381 INFO [net.kindsight.rpc.server.impl.RpcIoHandler] session is closed: (0x00AC: nio socket, server, null = / 10.10.31.135:59232) If someone has seen such stack trace, please share how to fix the problem. Thanks -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Upgrading from old ftpserver jar raises MINA library questions.
AFAIK, you can't, unless you get into creating Classloader and stuff that are present in App Servers. Upgrading to new MINA version shouldn't take much time, though you are the best person to estimate the testing effort and other stuff. thanks ashish On Wed, Jan 20, 2010 at 8:32 PM, Kieran M k13...@googlemail.com wrote: Hello ! 1) I have inherited a java application with a jar ftpserver.jar - see Note 1 below. I want to check what version of ftp server I have - am guessing by the 2005 date it's old :-) How can I tell from the jar what version I have ? 2) I would like to upgrade the ftpserver jar as we have see some FTP weirdness, but I see that ftpserver-1.0.3.zip is available at http://cwiki.apache.org/FTPSERVER/downloads.html and it i.e. version 1.0.3 has a requirement for mina-core-2.0.0-M6.jar however I am using MINA ver 1.0 in my application for something else and upgrading the other MINA usage at this time is a bit risky (its non-trivial change) Any advice here e.g. is is possible to run the new ftpserver-1.0.3 with mina-core-2.0.0-M6 in parallel with MINA ver 1.0 in same process? Thanks! K137an. [Note 1] jar tvf ftpserver.jar 0 Wed Sep 14 11:50:14 IST 2005 META-INF/ 106 Wed Sep 14 11:50:12 IST 2005 META-INF/MANIFEST.MF 0 Wed Sep 14 11:47:52 IST 2005 org/ 0 Wed Sep 14 11:47:52 IST 2005 org/apache/ 0 Wed Sep 14 11:47:54 IST 2005 org/apache/ftpserver/ 0 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/command/ 0 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/config/ 0 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/filesystem/ 0 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/ftplet/ 0 Wed Sep 14 11:47:54 IST 2005 org/apache/ftpserver/gui/ 0 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/interfaces/ 0 Wed Sep 14 11:47:54 IST 2005 org/apache/ftpserver/iprestrictor/ 0 Wed Sep 14 11:47:54 IST 2005 org/apache/ftpserver/logger/ 0 Wed Sep 14 11:47:54 IST 2005 org/apache/ftpserver/message/ 0 Wed Sep 14 11:47:54 IST 2005 org/apache/ftpserver/socketfactory/ 0 Wed Sep 14 11:47:54 IST 2005 org/apache/ftpserver/ssl/ 0 Wed Sep 14 11:47:54 IST 2005 org/apache/ftpserver/usermanager/ 0 Wed Sep 14 11:47:54 IST 2005 org/apache/ftpserver/util/ 342 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/Command.class 672 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/ConnectionManagerImpl$1.class 6308 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/ConnectionManagerImpl.class 3990 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/DataConnectionConfig.class 7558 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/DirectoryLister.class 7906 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/FtpConfigImpl.class 4134 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/FtpDataConnection.class 7094 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/FtpRequestImpl.class 789 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/FtpServer$1.class 5848 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/FtpServer.class 7180 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/FtpStatisticsImpl.class 10744 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/FtpWriter.class 776 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/FtpletContainer$FtpletEntry.class 9682 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/FtpletContainer.class 13966 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/RequestHandler.class 1082 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/command/ABOR.class 921 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/command/ACCT.class 5469 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/command/APPE.class 2171 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/command/AUTH.class 1617 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/command/CDUP.class 1695 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/command/CWD.class 3697 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/command/DELE.class 2958 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/command/EPRT.class 1514 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/command/EPSV.class 969 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/command/FEAT.class 1116 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/command/HELP.class 897 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/command/LANG.class 2382 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/command/LIST.class 1810 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/command/MDTM.class 3833 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/command/MKD.class 2331 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/command/MLSD.class 1476 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/command/MLST.class 1424 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/command/MODE.class 2331 Wed Sep 14 11:47:52 IST 2005 org/apache/ftpserver/command/NLST.class 969
Re: using direct buffers
We use mina-core-2.0.0-RC1.jar Recently we incorporated mina-filter-compression-2.0.0-RC1.jar and I observed a strange problem which didn't exist without using compression filter. Our client can talk to server for several minutes after which client requests keep timeout. It seems server doesn't receive requests after some point. There are two things that can help debug 1. Take a Thread dump, see what's going inside the System 2. Optionally, can use wireshark to monitor the network traffic Point 1, shall lead to the next step of pin pointing and resolving the problem. If someone can share troubleshooting tips, especially w.r.t. compression filters, that would be great. -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: mem leak?
Not sure :-( Can you explore more about what kindof objects are holded. Or may be try YourKit profiler. On Wed, Jan 13, 2010 at 7:35 AM, vagrant1984 yangjianjuns...@gmail.com wrote: hey, everyone I need some help to identify whether MINA has memory leak. We are currently using MINA 2.0.0-M6. After running for a day under fairly heavy load, it runs into OOM, I use eclipse memory analyzer to profile the hprof file, Description: The thread *java.lang.Thread @ 0x2329c198 NioProcessor-3* keeps local variables with total size *692,558,776 (68.60%)* bytes. The memory is accumulated in one instance of *java.lang.Object[]* loaded by *system class loader*. Accumulated Objects by Class LabelNumber Of ObjectsUsed Heap SizeRetained Heap Size org.apache.mina.filter.codec.ProtocolCodecFilter$EncodedWriteRequestmat://object/0x455f37d8 1,696,45940,715,016359,855,312 org.apache.mina.filter.codec.ProtocolCodecFilter$MessageWriteRequestmat://object/0x455f4590 1,696,45927,143,344319,130,104byte[] mat://object/0x43d377788768768 - Total: 3 entries 3,392,92667,859,128 678,986,184 any idea why those objects are still hanging around? Your insight is highly appreciated! tks! yang -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Mina: Client which sends/receives messages synchronous
On Thu, Jan 7, 2010 at 6:44 PM, Christian Mueller christian.muel...@gmail.com wrote: Hey Mina users! I'm a newbie for Apache Mina (2.0.0 RC1). I will build a framework for sending and receiving ucp messages (see http://en.wikipedia.org/wiki/Universal_Computer_Protocol) for sending and receiving short messages. I have done a Client which send/receives ucp messages asynchronous (which was really easy with Apache Mina - thanks! :-) ). But for convenience, I also will provide the possibility to sends/receives ucp messages synchronous. My first try looks as following: public UCPMessage sendSync(UCPMessage req) throws Throwable { WriteFuture writeFuture = session.write(req); writeFuture = writeFuture.awaitUninterruptibly(); if (writeFuture.getException() != null) { throw writeFuture.getException(); } ReadFuture readFuture = session.read(); readFuture.awaitUninterruptibly(); if (readFuture.getException() != null) { throw readFuture.getException(); } return (UCPMessage) readFuture.getMessage(); } Is this the right way? The java doc for IoSession says, that the IoSession is thread safe. If I use 'session.read()', I think my client is not thread safe anymore, because 'session.read()' returns the next response from the queue, whatever if this the response for this request or for another request (which is send with the same client). I'm right? This will work as long as you don't send multiple request for same session. Its like you send a message and receive a response for the session and then send next one. Its a bit risky coz you will hold up your threads or your server may send a delayed response. Alternatively you can provide a layer between your message send/receive and the processing. Something like an Observer pattern. Its fairly common in SNMP stacks, if you can look into any of them. HTH ! Do you have a better solution for a synchronous client which is maybe thread safe? Thanks for your help, Christian -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Keep-Alive Processing
On Fri, Dec 11, 2009 at 4:39 AM, Christopher Popp christopherp...@yahoo.com wrote: Hi, Just ran into a little stumbling block and thought I'd send a note out seeing if anyone had any suggestions for things to try. I have a MINA system, running a test where nearly all of the traffic for the system is keep-alives. Each client sends/expects keep-alives every 60 seconds. Three missed keep-alives cause a disconnect. I'm using the KeepAlive filter in MINA to handle this. Version: MINA 2.0.0 M6 Server Hardware: 4 Core, 15 GB Ram (Extra large instance on EC2). The test involves simulated clients connecting in and simply maintaining their session. At first we connect in 4000 clients, and wait for the system to stabilize. We then add another 4000, and wait for it to stabilize, for a total of 8000 simultaneous connections. When we're adding another 4000, (somewhere between 8000-12000), we start to have the keep-alive timers pop on the clients, seeming to imply the server isn't keeping up. The CPU utilization of the system is low. Here's my filter chain definition: acceptor = new NioSocketAcceptor(Runtime.getRuntime().availableProcessors() + 1); acceptor.getFilterChain().addLast(protocol, new ProtocolCodecFilter(new MYCodecFactory())); acceptor.getFilterChain().addLast(threadPool, new ExecutorFilter()); MYKeepAliveFilter keepAlives = new MYKeepAliveFilter(new MYKeepAliveMessageFactory()); acceptor.getFilterChain().addLast(keepAlives, keepAlives); acceptor.setHandler(devHandler); My first thoughts are to up the number of I/O processor threads, or to possibly add a second ExecutorFilter after the first one configured only for WRITE events. Any thoughts? Not sure! Tried digging around but in vein :-( I remember something, this function in AbstractPollingConnectionlessIoAcceptor.java could be key private void notifyIdleSessions(long currentTime) { // process idle sessions if (currentTime - lastIdleCheckTime = 1000) { lastIdleCheckTime = currentTime; AbstractIoSession.notifyIdleness( getListeners().getManagedSessions().values().iterator(), currentTime); } } Can you try a Thread Dump or can even try YourKit. Thanks, Chris -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Mina based load balancer type application
Check this thread http://mina.markmail.org/search/?q=cloudFoundry#query:cloudFoundry+page:1+mid:pwad2l72loq6b43q+state:results thanks ashish On Fri, Nov 13, 2009 at 2:22 AM, Sam Ganesan sam.gane...@gmail.com wrote: Hi: I am a newbie to MINA and even for that matter nio. I am in charge of prototyping an application where messages from clients arrive at the application over 2 sockets and they have to be fanned out to a series of executing nodes behind it So I guess it is just a load balancer kind of application. So since there is no thread model in MINA 2 How do i make usre that each decoded request gets handed of to a thread that then sends it off to an executor and marshalls the responses the right way. 1. I guess my question is inbound requests come in on 1 socket... 2. I need to decode them and send them to multiple execution nodes 3. I need the responses form the executor nodes to be muxed back and sent back on the single socket... Any pointers would be greatly appreciated Regards SG -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: need parallel sample to OSGi Grizzly
On Tue, Nov 10, 2009 at 10:49 AM, hanasaki hanas...@hanaden.com wrote: http://codemeself.blogspot.com/2009/03/grizzly-osgi-http-service-guide.html preferably with Spring also. You can find Spring integration here http://mina.apache.org/integrating-with-spring.html I don't have info on OSGI sample. -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: KeepAliveFilter questions
Can you elaborate a bit on the problem/issue you are facing? thanks ashish On Sat, Oct 31, 2009 at 8:51 PM, Aleksandar Lazic al-m...@none.at wrote: Dear List, what is 'better' the KeepAliveFilter or in the handler the sessionIdle() method? I have try to use the keepalive filter but I wasn't very successful ;-( ### main KeepAliveFilter filter = new KeepAliveFilter(new CommendKeepAliveMessageFactory()); filter.setForwardEvent(true); // Create TCP/IP connector. NioSocketConnector connector = new NioSocketConnector(); connector.getFilterChain().addFirst(logging, new LoggingFilter()); connector.getFilterChain().addLast(keep-alive, filter); connector.setConnectTimeoutMillis(20); connector.setHandler(new Commend2SNAPHandler()); ConnectFuture future = connector.connect( new InetSocketAddress(10.10.10.199,17000)); future.await(); System.out.println(fu-isConn + future.isConnected()); if(future.isConnected()){ IoSession sessin = future.getSession(); }else{ future.cancel(); connector.dispose(); System.exit(0); } ### attached the CommendKeepAliveMessageFactory file. Many thanks for help. BR Aleks -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Processing order of filters, addition
Can you elaborate a bit further, as to what is your observed behavior, also would be great if you can give us a bird's eye view of what your application is trying to achieve. Will be of great help to provide further inputs. thanks ashish On Tue, Oct 27, 2009 at 7:44 PM, pi...@dokom.net wrote: After further investigation I found that the Session that is provided by the IoHandlerAdapter.messageReceived works as expected. I use an IoServiceListener registered with acceptor.addListener which stores the session for later use. But this session doesn't work as expected. Looking at the architecture diagram the session should be the same, there is only one. But it behaves different! Can sombody shed some light on this behaviour? If it is not appropriate to store the session in a local variable I wonder how I should write messages using TCP-Server socket. -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Processing order of filters
On Tue, Oct 27, 2009 at 3:14 PM, pi...@dokom.net wrote: Well, I use version 2.0M6 and I have trouble with the order of filters. I created a protocol encoder/decoder and some filters. The filters extend IoFilterAdapter and overwrite messageReceived/Sent. This works well for for inbound messages, the protocol is used first and than the filters are used on their order. The trouble starts outbound. I would expect that the filter chain is processed in the reverse order but id did not! The filters are called in the same order as the for the inbound messages. Is this the designed behaviour? Any ideas? This is how it works today :-( This is going to change in 3.0, where we plan to have different chains for incoming and outgoing messages. It shall be a while before you get to use 3.0 thanks ashish
Re: Is it just me?
Its working fine for me. Build was successful. To be on safe side, I did SVN cleanup, and then ran mvn clean install. - ashish On Thu, Oct 22, 2009 at 1:33 AM, boB Gage bg...@merge.com wrote: I updated my mina source (first time in awhile) and am getting the oddest build-time error. I type 'mvn clean install' and everything chugs along happy as can be, until ... [INFO] [INFO] Building Apache MINA XBean Integration [INFO] task-segment: [install] [INFO] [INFO] [ERROR] BUILD ERROR [INFO] [INFO] Error building POM (may not be this project's POM). Project ID: org.codehaus.mojo:build-helper-maven-plugin Reason: Error getting POM for 'org.codehaus.mojo:build-helper-maven-plugin' from the repository: Failed to resolve artifact, possibly due to a repository list that is not appropriately equipped for this artifact's metadata. org.codehaus.mojo:build-helper-maven-plugin:pom:1.5-SNAPSHOT I checked -- our repository mirror does not have codehaus's build-helper-maven-plugin, so I'm working on that part. BUT far as I can tell from looking at http://repository.codehaus.org/org/codehaus/mojo/build-helper-maven-plugin/ the latest version is 1.4, so 1.5-SNAPSHOT is an unreleased working copy. I double-checked: renamed my mina directory and checked out clean from the trunk. Same results. Do I now need codehaus source too?? Oddly enough, I can't find 1.5 in any Mina project files (pom.xml et al) in relation to this plugin so am confused as to where that tag is even coming from.
Re: Configuring MINA 1.1.7 Acceptor - best practise
On Thu, Oct 22, 2009 at 1:06 PM, Darryl Pentz djpe...@yahoo.com wrote: The number of thread you need to setup is impossible to define without any knowledge about your code. For instance, if you access a database in the handler, it's pretty obvious that the thread might be stuck for a few ms, and with 800 concurrent requests running, you will get awfull performances. That is exactly what happens. Virtually all calls that come in via a MINA connection are hitting our DB. So this being the case, do you recommend the approach documented here: http://mina.apache.org/configuring-thread-model.html Ironically, after running numerous tests, the best configuration is in fact the default configuration of 1.1.7. - the one that results in the 16 AnonymousIoService threads. Switching to manual with the CachedThreadPool was horrible in that it created a mountain of worker threads, but there was still high contention on the connection pool, despite the fact that I raised the number of connections in the pool substantially. This is slightly OT, but if I may ask, what would be an ideal approach using MINA when you have e.g. 1000 concurrent connections all wanting to make DB calls? I'm using DBCP which by my understanding is single threaded, hence the bottleneck around getting and returning connections. Is there a better connection pool I could use that would still allow the manual threading and cached thread pool to be efficient? Would recommend having a look at c3p0 library(http://sourceforge.net/projects/c3p0/), if you feel DBCP has an issue. I still doubt, DBCP has the threading problem, but let me reserve my opinion. Good Luck! -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: MINA User Guide - Chapter 2 ready for review
Thanks Folks ! Was on vacation, recharging myself :-) Les - Plan to add those links once we phase out MINA 1.0 documentation. I have reused some of the pages :-) thanks ashish On Wed, Oct 14, 2009 at 7:03 PM, Les Hazlewood lhazlew...@apache.org wrote: Hi Ashish, This looks great - my only suggestion is to link to next and previous pages on each page. Thanks for putting this together! Cheers, Les On Fri, Sep 11, 2009 at 4:25 AM, Ashish paliwalash...@gmail.com wrote: Folks, MINA User guide Chapter 2 - Basics is ready for review. Here is the link (http://cwiki.apache.org/confluence/display/MINA/Chapter+2+-+Basics) P.S. - I missed announcing chapter 1 updates in User ML I updated it in a little hurry, as I wanted to finish it before weekend. Would be great, if you can provide feedback, on the ways to improve it. Alternatively, would be great if you can drop your wishlist for documentation. What should be the next topic in User Guide - Filter's/Connectors? Any suggestions? -- thanks ashish -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: SSL Tunneling
MINA version/OS? Also could you please enable the debug option like -Djavax.net.debug=ssl, to see the details of SSL handshake. This will provide a better view of what's going inside, and help resolve the issue. thanks ashish On Thu, Oct 15, 2009 at 7:47 AM, djacobs186 dan...@socialware.com wrote: Was this ever resolved? I have the same question. Thanks, Dan krish2 wrote: We are building https server as a proxy server. When we configuered proxy setting in the browser , browser is sending CONNECT request instead of GET request . In that situation SSL filter is throwing exception. I want to know how to implement CONNECT request using MINA. javax.net.ssl.SSLHandshakeException: SSL handshake failed. at org.apache.mina.filter.SSLFilter.messageReceived(SSLFilter.java:416) at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299) at org.apache.mina.common.support.AbstractIoFilterChain.access$5(AbstractIoFilterChain.java:296) at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648) at org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:220) at org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:265) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51) at java.lang.Thread.run(Unknown Source) Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? at com.sun.net.ssl.internal.ssl.EngineInputRecord.bytesInCompletePacket(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLEngineImpl.readNetRecord(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLEngineImpl.unwrap(Unknown Source) at javax.net.ssl.SSLEngine.unwrap(Unknown Source) at org.apache.mina.filter.support.SSLHandler.unwrap0(SSLHandler.java:657) at org.apache.mina.filter.support.SSLHandler.unwrapHandshake(SSLHandler.java:613) at org.apache.mina.filter.support.SSLHandler.handshake(SSLHandler.java:493) at org.apache.mina.filter.support.SSLHandler.messageReceived(SSLHandler.java:306) at org.apache.mina.filter.SSLFilter.messageReceived(SSLFilter.java:392) ... 9 more javax.net.ssl.SSLHandshakeException: SSL handshake failed. at org.apache.mina.filter.SSLFilter.messageReceived(SSLFilter.java:416) at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299) at org.apache.mina.common.support.AbstractIoFilterChain.access$5(AbstractIoFilterChain.java:296) at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648) at org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:220) at org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:265) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51) at java.lang.Thread.run(Unknown Source) Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? at com.sun.net.ssl.internal.ssl.EngineInputRecord.bytesInCompletePacket(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLEngineImpl.readNetRecord(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLEngineImpl.unwrap(Unknown Source) at javax.net.ssl.SSLEngine.unwrap(Unknown Source) at org.apache.mina.filter.support.SSLHandler.unwrap0(SSLHandler.java:657) at org.apache.mina.filter.support.SSLHandler.unwrapHandshake(SSLHandler.java:613) at org.apache.mina.filter.support.SSLHandler.handshake(SSLHandler.java:493) at org.apache.mina.filter.support.SSLHandler.messageReceived(SSLHandler.java:306) at org.apache.mina.filter.SSLFilter.messageReceived(SSLFilter.java:392) ... 9 more -- View this message in context: http://www.nabble.com/SSL-Tunneling-tp20065615p20067247.html Sent from the Apache MINA User Forum mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/SSL-Tunneling-tp20065615p25902103.html Sent from the Apache MINA User Forum mailing list archive at Nabble.com. -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Connecting like a broker, running like a tunnel
On Sun, Oct 11, 2009 at 11:18 PM, Les Hazlewood lhazlew...@apache.org wrote: Ah! Beautiful - this is what I was confused about - how to reference Host B's sessions while handling one from Host A. Apparently storing them in a cache is 'safe' then. Just take care of all the lifecycle events for updating your cache status like session expiration or disconnects. Thanks so much for the direction! I'll give it a shot and let you know how it turns out. - Les -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Connecting like a broker, running like a tunnel
On Fri, Oct 9, 2009 at 11:17 PM, Les Hazlewood lhazlew...@apache.org wrote: On Thu, Oct 8, 2009 at 11:49 PM, Ashish paliwalash...@gmail.com wrote: A and B connects to Broker After brief chat... negotiate connection details Setup connection once done, signal to initiator to start sending the data on the new channel Oops - just read this - I can't do it. Per network security restrictions (don't ask - this has been a thorn in my side for almost a year), Host A and B are never allowed to communicate with each other directly - only via this broker which I'm building. That's why I'm required to do the byte relaying technique. The broker will eventually be able to intercept the bytes from Host A and perform some logic based on the data before sending on to Host B, but I want to get the raw stream relay working first before moving on to that :) had a brief look at proxy example code. Its fits in situation. To make this happen, you will need both Hosts to be connected before this can happen so lets walk through this Broker is up Host A connects to Broker Host A session created Host B connects to Broker Host B session is created Can listen for session events and keep a session registry in cache (ehcache or anything else) on message received in IoHandler, lookup for appropriate session and write to it. All this can happen either in your IoHandler or better have it delegated within your Broker If any of then breaks connection, you clean up your session cache and your broker logic invalidates the connection. Once basic flow is up, you can plugin your custom manipulation logic :-) HTH -- thanks ashish
Re: Connecting like a broker, running like a tunnel
On Fri, Oct 9, 2009 at 11:17 PM, Les Hazlewood lhazlew...@apache.org wrote: On Thu, Oct 8, 2009 at 11:49 PM, Ashish paliwalash...@gmail.com wrote: A and B connects to Broker After brief chat... negotiate connection details Setup connection once done, signal to initiator to start sending the data on the new channel Oops - just read this - I can't do it. Per network security restrictions (don't ask - this has been a thorn in my side for almost a year), Host A and B are never allowed to communicate with each other directly - only via this broker which I'm building. That's why I'm required to do the byte relaying technique. The broker will eventually be able to intercept the bytes from Host A and perform some logic based on the data before sending on to Host B, but I want to get the raw stream relay working first before moving on to that :) - Les So, if I got it correctly, your broker has to mediate the data. So its as good as our proxy. haven't had a chance to look at proxy example yet. Will revert back after having a look at it, in a couple of hours. -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Connecting like a broker, running like a tunnel
On Thu, Oct 8, 2009 at 11:48 PM, Les Hazlewood lhazlew...@apache.org wrote: Hi Ashish (and others), Yep, I think a good way to visualize this is to think of a JMS broker: Host A can send data to Host B, but not directly - both Host B and Host A must directly connect to the broker. Got it. Its more or less during negotiations you want Server, after that direct streaming. Something similar to RTP. AFAIK, in JMS, messaging is controller by JMS Server. Clients don't interact directly. But the twist on my requirement is that it should be a direct pass-through when data comes in from Host A. I'd like to relay the bytes from Host A's client stream directly to Host B's client stream. Any ideas? AFAIT, its an architectural stuff. Initial thoughts are to use Proxy Example like implementation for mediation/initiation. The clients (not network client, but application clients) layer be build in way to negotiation the connection details during initiation and shift to the connection for further transmission. A and B connects to Broker After brief chat... negotiate connection details Setup connection once done, signal to initiator to start sending the data on the new channel I am not sure, but jingle has something similar (from the design perspective). See this spec http://xmpp.org/extensions/xep-0166.html Bernd/Niklas - This is XMPP domain. Can you folks help here? thanks ashish
Re: Push message from server to client with mina
To add to Emm's solution, use an ScheduledExecutor to make life more simple. Or if you wish to hack into the code, there is something similar being done in MINA code. To check for Expiring session, we check the all the current session for last used timestamp. Forgot the class name, but this would be easy to find. It will give you an idea. thanks ashish On Sun, Oct 4, 2009 at 3:51 AM, Emmanuel Lecharny elecha...@apache.org wrote: A naive approach would be to do something like : while (true) { session.write ( your data to the client ); Thread.sleep( 1000L ); } it does the trick *IF* you don't have a lot of clients (and you'll have to add an Executor filter in the chain, otherwise you wo'nt be able to deal with more than the number of threads you have defined in the acceptor). However, this is not the best solution. The problem is that in order to process a request, a thread is selected, and released when you quit the handler (ie, once the message has been processed on the server side). A better solution would be, as suggested by mark, to have a separate thread having a list of all your client's IoSession. When the clock tiks, you get all the active sessions and you simply write a message into them : while ( true ) { for ( IoSession session : MySessions ) { if ( session.isConnected() ! session.isWriteSuspended()) { session.write( time to wake up ! ); } else { // some cleanup here, as the session has been closed. } } Thread.sleep( 1000L ); } Hope it helps too. Mark Wallsgrove wrote: Hey.. I haven't been using Mina for long, but what you could do is create a new object that runs on a thread that uses the filter chain to fire a event every x seconds. Your handler should then do the rest. Once the event has been fired the thread should then go back to sleep. I guess you could use the connection object to gather the sessions / filter chains? Hope this helps.. Best regards, Mark Wallsgrove On 10/3/09, CoolHedin coolhe...@yandex.ru wrote: Hi. I develop an application using your excellent library. But I had a difficulty. I need to send messages from server to clients, by timer. and I do not understand how to do it. for example, i send every 1 minutes 'Hi everyone' message to all conection -- Sincerely yours, Sergey Paramonov Adept Team, www.adept-project.com -- -- cordialement, regards, Emmanuel Lécharny www.iktek.com directory.apache.org -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Understanding MINA 1.1.7. configuration
First, I think that you should switch to MINA 2.0.0-M6. The Thread model is much easier. Also consider that this version is mainained, and performances are better. Is there any good sample code or an example you'd recommend as a basis for how to implement a SocketAcceptor for MINA 2.0? I looked at the examples but they seem simplistic, as examples generally are. Or is that not the case? Perhaps I'm expecting it to be more complicated than it really is. For my needs I need to add an SSL filter, a custom filter or two, a ProtocolCodecFilter and a handler. Any pointers as to good example code would be much appreciated. This link shall be of help http://mina.apache.org/codec-repository.html -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Where to handle byte unstuffing?
On Sat, Sep 19, 2009 at 2:49 AM, Erinc Arikan erincari...@gmail.com wrote: Hi Everybody; I hope my question won't seem so trivial, I am pretty new to Mina, but I am making some progress, I managed to write my own protocolfilter for my byte stream TCP protocol. Here is some information about my protocol details. Every message starts with a certain character, and end with a certain character. Every message contains some fixed length fields and variable length fields. For each variable length field I have another dedicated field that tells the length of the field in question. Before clients send the message to the socket on the server, they stuff everything between message start and message end, to prevent any existence of the special bytes(beginning byte and ending byte), they simply insert a constant byte before the special character and add the constant byte to the special byte and place it to the next location in the byte stream. So server has to go through the complete message and unstuff these cases, by doing the reverse operation. That operation would be so easy to accomplish if everything is guaranteed to be received in one piece. But since there might be fragmentation, I am not quite sure if I will be able to decode my object inside doDecode method. One Possible solution is looping through the message until seeing the end byte and passing that to somewhere else to process unstuffing. Because of stuffing I am guaranteed to have one end and one beginning bytes in a message, so that will do it. I am wondering if there might be a better solution by implementing something inside Mina's functionality? CumulativeProtocolDecoder is the right choice for you. There are couple of decoder implementations that you can refer to http://mina.apache.org/codec-repository.html -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Null Character in Received Message/String
Sica, David (David) wrote: Sorry, I should have provided more information but was in hurry to post the question. I'm using MINA 2.0.0-M6 with the TextLineCodecFactory and US-ASCII Charset. '\0' is considered as a and of String in the TextLine codec. You should use another codec if your incoming data contains such a byte. David, Emm has already answered your query. Your codec choice should be dependent on what your needs are. Or you can write your own. Its pretty easy. Here is the link to Codec Repository for MINA http://mina.apache.org/codec-repository.html May be browsing some of them shall give you a bright idea. -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Null Character in Received Message/String
On Wed, Sep 16, 2009 at 10:03 PM, Sica, David (David) ds...@avaya.com wrote: I have a process that is sending an ASCII string that contains a Null Character in the middle of the string. It seems that my MINA server is only receiving the string before the Null Character and then ignoring everything after. Does this seem consistent with how MINA should be handling it and if so how do I change it to be able to receive the entire string including text after the null character? Can you provide more details? MINA Server is ignoring means?? Which codec are you using? also MINA version used shall be of help Thanks, David -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: MINA User Guide - Chapter 2 ready for review
Emm, Julien, Thanks for all help. Have updated the architecture image, as well as linked the User Guide to main page. Hope, coming chapters start taking shape soon ;-) thanks ashish On Wed, Sep 16, 2009 at 9:36 AM, Ashish paliwalash...@gmail.com wrote: Emm! Saw the comment and in agreement with you. Would be great if you can upload the png image. The image there is from MINA 2008 presentation. Wouldn't it be great, if we show Session from IoService to IoHandler. It cuts across all these layers. thanks ashish
Re: Null Character in Received Message/String
TextLineCodecFactory and US-ASCII Charset. In my handler/messageReceived method I'm just calling: String str = msg.toString(); System.out.println(Message received: [ + str + ]); The string that is being sent to the server is something like: 1234567890NULL03|Othertext Where NULL above is the Null character I'm talking about. So, what gets printed out from the System.out is [1234567890] and I don't know what's happening to the remainder of the string. Any thoughts/suggestions? David, What is the delimiter you are using with TextLineCodecFactory? You can pass on your custom delimiter, in TextLineDecoder class. You can also, put the LoggingFilter in the chain to see what messages are being received by the Server. thanks ashish
Re: MINA User Guide - Chapter 2 ready for review
Hi Ashish, I have added a comment on the first wiki page. I will review the other one asap. Thanks for the great job ! I like it too, simple an efficient, why not put a link on the documentation page ? Julien Whenever the community wants, we can put it up on main page. I will start working on core constructs, probably taking down IoService layer first. -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: MINA User Guide - Chapter 2 ready for review
Emm! Saw the comment and in agreement with you. Would be great if you can upload the png image. The image there is from MINA 2008 presentation. Wouldn't it be great, if we show Session from IoService to IoHandler. It cuts across all these layers. thanks ashish On Tue, Sep 15, 2009 at 1:22 PM, Emmanuel Lecharny elecha...@apache.org wrote: Ashish wrote: Folks, MINA User guide Chapter 2 - Basics is ready for review. Here is the link (http://cwiki.apache.org/confluence/display/MINA/Chapter+2+-+Basics) P.S. - I missed announcing chapter 1 updates in User ML I updated it in a little hurry, as I wanted to finish it before weekend. Would be great, if you can provide feedback, on the ways to improve it. Alternatively, would be great if you can drop your wishlist for documentation. What should be the next topic in User Guide - Filter's/Connectors? Any suggestions?
Re: Performance and multiple connections
Can you provide more data? Have you used MINA for creating Client or Server? Additionally your performance data would help. One thing is sure, we can't move away from Network delays. Alternatively, you can profile your application and see, where the most time is spent. thanks ashish 2009/9/8 Sergiy Mamit'ko s...@isd.dp.ua: Hello, MINA 1.1.7 used I have client which use several connections (one per thread) to one server. Each thread sends data to server using own connection and wait till responce (some acknowledgement) But performance for multiple connections for client synchronized by session is the same as using one synchronous connection for all threads Can somebody advise why such issues occurs? How to increase performance for multiple connections? Thank you in advance. Sergiy M -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Connecting like a broker, running like a tunnel
Les, If I got it correctly, we have two proxies running in parallel. See, during initialization, you would need to accept two connections from Hosts and connect to two hosts. Once you receive a message, you have to write to the destination client Will look into the proxy example in detail and revert back thanks ashish On Thu, Sep 3, 2009 at 11:20 PM, Les Hazlewood lhazlew...@apache.org wrote: Hi Mina community, I've had a bit to read about Mina's architecture and it looks great - nice job to all involved. I have an interesting requirement to set up a tunnel, but initial connectivity must work like a broker. I was wondering if anyone had any insights on the best way to go about solving this with Mina, as I don't see an obvious solution: The connectivity requirements are HostA and HostB can connect to BrokerHost only. Once connected, bytes need to flow as if a normal tunnel was created. That is: Start up/Initialize connections: HostA -- BrokerHost -- HostB After connections are established: HostA -- BrokerHost -- HostB HostA -- BrokerHost -- HostB Setting up the connections is very easy in Mina - BrokerHost essentially needs 2 server sockets, each to service HostA and HostB. There are plenty of examples on how to set this up. But, once connections are established, what is the best way to get the tunnel working? The Mina Proxy example is very similar, but works with a Server Socket and a Client Socket - I have to work with 2 Server Sockets. Any ideas? Thanks to all, Les -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Newbie
Julien, Tried the MINA mapping. Its not working for me. It throws java.net.PortUnreachableException exception. Tried capturing packet, but no packets are sent. My agent simulator is running on port 8001. Here are the traces [DEBUG] 2009-09-14 18:43:25,437 [main] Got session (0x0001: nio datagram, client, /10.100.207.73:2067 = LWUS1B066/10.100.207.73:0) [DEBUG] 2009-09-14 18:43:25,437 [NioProcessor-1] session opened (0x0001: nio datagram, client, /10.100.207.73:2067 = LWUS1B066/10.100.207.73:0) [DEBUG] 2009-09-14 18:43:25,609 [main] Running pending async request with handle PduHandle[1331093115] and retry count left 1 [DEBUG] 2009-09-14 18:43:25,609 [main] Sending message to 10.100.207.73/8001 with length 37: 30:23:02:01:01:04:06:70:75:62:6c:69:63:a5:16:02:04:4f:56:de:7b:02:01:00:02:01:0a:30:08:30:06:06:02:2b:06:05:00 [DEBUG] 2009-09-14 18:43:25,703 [NioProcessor-1] sent : HeapBuffer[pos=0 lim=37 cap=37: 30 23 02 01 01 04 06 70 75 62 6C 69 63 A5 16 02...] [ERROR] 2009-09-14 18:43:25,734 [NioProcessor-1] Network exception java.net.PortUnreachableException at sun.nio.ch.DatagramDispatcher.read0(Native Method) at sun.nio.ch.DatagramDispatcher.read(DatagramDispatcher.java:25) at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:233) at sun.nio.ch.IOUtil.read(IOUtil.java:206) at sun.nio.ch.DatagramChannelImpl.read(DatagramChannelImpl.java:324) at org.apache.mina.transport.socket.nio.NioProcessor.read(NioProcessor.java:179) at org.apache.mina.transport.socket.nio.NioProcessor.read(NioProcessor.java:41) at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:592) at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:563) at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:552) at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$400(AbstractPollingIoProcessor.java:56) at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:891) at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) at java.lang.Thread.run(Thread.java:619) [DEBUG] 2009-09-14 18:43:25,734 [NioProcessor-1] session closed [ WARN] 2009-09-14 18:43:26,609 [Timer-0] Sending confirmed PDU GETBULK[requestID=1331093115, errorStatus=Success(0), errorIndex=10, VBS[1.3.6 = Null]] to target 10.100.207.73/8001 although transport mapping org.snmp4j.mina.minaudptransportmapp...@1f934ad is not listening for a response [DEBUG] 2009-09-14 18:43:26,609 [Timer-0] Running pending async request with handle PduHandle[1331093115] and retry count left 0 [DEBUG] 2009-09-14 18:43:26,609 [Timer-0] Sending message to 10.100.207.73/8001 with length 37: 30:23:02:01:01:04:06:70:75:62:6c:69:63:a5:16:02:04:4f:56:de:7b:02:01:00:02:01:0a:30:08:30:06:06:02:2b:06:05:00 [DEBUG] 2009-09-14 18:43:27,609 [Timer-0] Request timed out: 1331093115 [DEBUG] 2009-09-14 18:43:27,640 [Timer-0] Cancelling pending request with handle PduHandle[1331093115] Am I missing something here? thanks ashish On Fri, Sep 11, 2009 at 8:05 PM, Ashish paliwalash...@gmail.com wrote: Ok! Porting done to MINA 2.0 M6 Porting was easy. The thread didn't had answer to why an Agent need access to Logger? So, if we use MINA Transport mapping, we will definitely need SLF4J, and that shouldn't be an issue :-) Should I change this code ConnectFuture cf = connector.connect(new InetSocketAddress(getAddress().getInetAddress(), getAddress().getPort())); cf.awaitUninterruptibly(); to for (;;) { try { ConnectFuture future = connector.connect(new InetSocketAddress( HetAddress().getInetAddress(), getAddress().getPort())); future.awaitUninterruptibly(); session = future.getSession(); break; } catch (RuntimeIoException e) { System.err.println(Failed to connect.); e.printStackTrace(); } } Will test this tomorrow. Not sure if SNMP4J guys have any test suite for this thanks ashish On Fri, Sep 11, 2009 at 7:42 PM, Julien Vermillard jvermill...@archean.fr wrote: Le Fri, 11 Sep 2009 19:35:49 +0530, Ashish paliwalash...@gmail.com a écrit : On Fri, Sep 11, 2009 at 7:26 PM, Julien Vermillard jvermill...@archean.fr wrote: Le Fri, 11 Sep 2009 19:08:49 +0530, Ashish paliwalash...@gmail.com a écrit : Here a MINA based transport for SNMP4J : http://people.apache.org/~jvermillard/snmp4j/ Julien Interesting. Never knew it existed :-) Great work. I would love to use
Re: how to prevent or use the TCP-Socket (or the network layer) when it wraps/cuts packets together?
On Mon, Sep 14, 2009 at 9:22 PM, Sebastian Wagner seba.wag...@gmail.com wrote: hi, I have a Client-SocketConnector and Server-SocketAcceptor. So all about TCP. I send TCP-Packets with a size of around 1200Bytes but I always receive Packages with a length of 2048, 4096, 8192, ... I mark all Packets that I do send with a sequence number before sending = I see that packages are missing. So some packets are missing and others are much bigger. I guess TCP does wrap my packages together to have a optimal frame size when send over the network. Missing packets with TCP? this is something hard to believe. Can you cross check again. How do you deal with this? Actually it does not make sense to me that I send Packets of one size and receive something different. But anyway if this is the way TCP works (or optimizes the throughput) thats fine ... but the problem is = how do I get my Packets in the same structure that I've send again? You have to assemble them using ProtocolDecoders. The way it works is, you have to know when your packet starts and end. Either in form of a prefixed header etc. Once you detect that, you need to consume the input till you detect the end. This shall continue. Have a look at this http://mina.apache.org/report/trunk/xref/org/apache/mina/filter/codec/prefixedstring/PrefixedStringDecoder.html What is your strategy for that? Make every packet *exactly* 1024 Bytes and cut everything again on the Receivers end? Or am I on the complete wrong lane? Depends on what you need. You are on track, and hope you shall complete your implementation soon. Please do explore the examples, along with MINA Codec package (http://mina.apache.org/report/trunk/xref/org/apache/mina/filter/codec/package-frame.html). By any chance are you exploring this to be used in openmeetings? -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: how to prevent or use the TCP-Socket (or the network layer) when it wraps/cuts packets together?
Yes the code I am working on will go into the OpenMeetings Project. I am working on this to improve the Desktop Sharing and Recording. Great :-) Since you are using Red5, you already have MINA in your project. Have starred the project. Will try to keep up with its development. thanks ashish
Re: how to prevent or use the TCP-Socket (or the network layer) when it wraps/cuts packets together?
Yes the code I am working on will go into the OpenMeetings Project. I am working on this to improve the Desktop Sharing and Recording. Forgot to provide link to codec page. Refer this page http://mina.apache.org/codec-repository.html, to see what all codec are available. This may possibly help you in implementing your own codec. thanks ashish
Re: Question on Message writing
On Tue, Sep 8, 2009 at 8:39 PM, GERARD Vincent AWL-IT vincent.ger...@atosorigin.com wrote: Hi everyone, (I hope this time my post will appear in the list :-)) I'm implementing the network layer of an application, using Mina 1.1.7. I have 2 questions for you: 1)Is it possible to add another information to a message we want to send (using IoSession.write) that will be echoed in the reply ? ( I think to some sort of header/footer like in JMS or MQSeries). Yup, using the ProtocolEncoder or Filters 2)Does Mina keeps the order of the messages sending when replies are dispatched? In another words: if I do multiple IoSession.write(), do I receive the messageSent() in the same order I do the write ? I am really not sure on this, but I think it will, unless you have a Executor down in the Chain. Anyone? -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
MINA User Guide - Chapter 2 ready for review
Folks, MINA User guide Chapter 2 - Basics is ready for review. Here is the link (http://cwiki.apache.org/confluence/display/MINA/Chapter+2+-+Basics) P.S. - I missed announcing chapter 1 updates in User ML I updated it in a little hurry, as I wanted to finish it before weekend. Would be great, if you can provide feedback, on the ways to improve it. Alternatively, would be great if you can drop your wishlist for documentation. What should be the next topic in User Guide - Filter's/Connectors? Any suggestions? -- thanks ashish
Re: Newbie
I developed a Trap receiver based on MINA, you can find it on the link shared by Emm. Since your are using SNMP4J, it leaves a little place for MINA, unless you or SNMP4J folks intend to port transport layer to MINA. However, if you building EMS/NMS layer, there could be couple of useful things that you could do to create an application that scales. You have a very good case for using Apache FtpServer (MINA sub project), to collect mediation/performance data ftped by Devices. The usages are unlimited, you just have to discover them. We are here to help you out with MINA :-) Good Luck ! On Fri, Sep 11, 2009 at 5:10 PM, Chenna Venkatasubbaiah-KRG637 venkatasubbaiah.che...@motorola.com wrote: Yes I am working on Java/J2EE enterprise application which manages all wirelss switches. In fact this applications discovers the switches by sending SNMP variables and discovers the switches. And also collects the data from switches. We are using SNMP4J API for the same.My knowledge is very limited on internals / about wireless switches I am a web applications developer. Hope you can understand. Hello Emmanuel Lecharny - Thanks for the link. I am trying to understand the different kind of business applications which were used by people on MINA. Thanks Chenna -Original Message- From: kranga [mailto:kra...@k2d2.org] Sent: 11/09/2009 4:12 PM To: users@mina.apache.org Subject: Re: Newbie I also find it a tad ironic that you work for a wireless broad band and networking company and claim that your knowledge of the networking domain is limited :-) -- From: Emmanuel Lecharny elecha...@apache.org Sent: Friday, September 11, 2009 4:45 AM To: users@mina.apache.org Subject: Re: Newbie Chenna Venkatasubbaiah-KRG637 wrote: Hello All - Recently while browsing I came to know about MINA. I am a Java/J2EE developer. I am working in wireless broad band and networking company and I have limited knowledge on networking domain. In our company we manufacture Wireles switches, Routers and Access Ports etc., And its softwares. I would like to know How MINA will be useful and what kind of business applications we can build using MINA. I have no idea. Do you have something more precise in mind ? Your question is pretty vague at this point. A bit like I have discovered Java, and I want to know what kind of business applications I can build using this language... In any case, reading http://mina.apache.org/testimonials.html could give you a clue about what people are using MINA for. -- -- cordialement, regards, Emmanuel Lécharny www.iktek.com directory.apache.org -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Newbie
Here a MINA based transport for SNMP4J : http://people.apache.org/~jvermillard/snmp4j/ Julien Interesting. Never knew it existed :-) Great work. I would love to use it. The most interesting part would be to benchmark the two implementations. A good topic to write about :-) Le Fri, 11 Sep 2009 19:00:55 +0530, Ashish paliwalash...@gmail.com a écrit : I developed a Trap receiver based on MINA, you can find it on the link shared by Emm. Since your are using SNMP4J, it leaves a little place for MINA, unless you or SNMP4J folks intend to port transport layer to MINA. However, if you building EMS/NMS layer, there could be couple of useful things that you could do to create an application that scales. You have a very good case for using Apache FtpServer (MINA sub project), to collect mediation/performance data ftped by Devices. The usages are unlimited, you just have to discover them. We are here to help you out with MINA :-) Good Luck ! On Fri, Sep 11, 2009 at 5:10 PM, Chenna Venkatasubbaiah-KRG637 venkatasubbaiah.che...@motorola.com wrote: Yes I am working on Java/J2EE enterprise application which manages all wirelss switches. In fact this applications discovers the switches by sending SNMP variables and discovers the switches. And also collects the data from switches. We are using SNMP4J API for the same.My knowledge is very limited on internals / about wireless switches I am a web applications developer. Hope you can understand. Hello Emmanuel Lecharny - Thanks for the link. I am trying to understand the different kind of business applications which were used by people on MINA. Thanks Chenna -Original Message- From: kranga [mailto:kra...@k2d2.org] Sent: 11/09/2009 4:12 PM To: users@mina.apache.org Subject: Re: Newbie I also find it a tad ironic that you work for a wireless broad band and networking company and claim that your knowledge of the networking domain is limited :-) -- From: Emmanuel Lecharny elecha...@apache.org Sent: Friday, September 11, 2009 4:45 AM To: users@mina.apache.org Subject: Re: Newbie Chenna Venkatasubbaiah-KRG637 wrote: Hello All - Recently while browsing I came to know about MINA. I am a Java/J2EE developer. I am working in wireless broad band and networking company and I have limited knowledge on networking domain. In our company we manufacture Wireles switches, Routers and Access Ports etc., And its softwares. I would like to know How MINA will be useful and what kind of business applications we can build using MINA. I have no idea. Do you have something more precise in mind ? Your question is pretty vague at this point. A bit like I have discovered Java, and I want to know what kind of business applications I can build using this language... In any case, reading http://mina.apache.org/testimonials.html could give you a clue about what people are using MINA for. -- -- cordialement, regards, Emmanuel Lécharny www.iktek.com directory.apache.org -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Newbie
On Fri, Sep 11, 2009 at 7:26 PM, Julien Vermillard jvermill...@archean.fr wrote: Le Fri, 11 Sep 2009 19:08:49 +0530, Ashish paliwalash...@gmail.com a écrit : Here a MINA based transport for SNMP4J : http://people.apache.org/~jvermillard/snmp4j/ Julien Interesting. Never knew it existed :-) Great work. I would love to use it. The most interesting part would be to benchmark the two implementations. A good topic to write about :-) Wowow a possible user ;) Perhaps you'll need to fix the code for use latest MINA 2, but it's probably trivial. Julien Yes I would be very keen on using this. By any chance, do SNMP4J guys know about this? I read that they were looking for porting their lib to NIO. As I write this mail, I am integrating your code in SNMP4J code on my machine. Once I am done, will definitely blog about this. -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Newbie
Ok! Porting done to MINA 2.0 M6 Porting was easy. The thread didn't had answer to why an Agent need access to Logger? So, if we use MINA Transport mapping, we will definitely need SLF4J, and that shouldn't be an issue :-) Should I change this code ConnectFuture cf = connector.connect(new InetSocketAddress(getAddress().getInetAddress(), getAddress().getPort())); cf.awaitUninterruptibly(); to for (;;) { try { ConnectFuture future = connector.connect(new InetSocketAddress( HetAddress().getInetAddress(), getAddress().getPort())); future.awaitUninterruptibly(); session = future.getSession(); break; } catch (RuntimeIoException e) { System.err.println(Failed to connect.); e.printStackTrace(); } } Will test this tomorrow. Not sure if SNMP4J guys have any test suite for this thanks ashish On Fri, Sep 11, 2009 at 7:42 PM, Julien Vermillard jvermill...@archean.fr wrote: Le Fri, 11 Sep 2009 19:35:49 +0530, Ashish paliwalash...@gmail.com a écrit : On Fri, Sep 11, 2009 at 7:26 PM, Julien Vermillard jvermill...@archean.fr wrote: Le Fri, 11 Sep 2009 19:08:49 +0530, Ashish paliwalash...@gmail.com a écrit : Here a MINA based transport for SNMP4J : http://people.apache.org/~jvermillard/snmp4j/ Julien Interesting. Never knew it existed :-) Great work. I would love to use it. The most interesting part would be to benchmark the two implementations. A good topic to write about :-) Wowow a possible user ;) Perhaps you'll need to fix the code for use latest MINA 2, but it's probably trivial. Julien Yes I would be very keen on using this. By any chance, do SNMP4J guys know about this? I read that they were looking for porting their lib to NIO. As I write this mail, I am integrating your code in SNMP4J code on my machine. Once I am done, will definitely blog about this. Here the thread on SMP4J ML (was crossposted to mina-dev) http://lists.agentpp.org/pipermail/snmp4j/2008-May/002935.html Julien -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Complex scenario: Can MINA solve my problem?
Hmm, have a look at the UDP server example. Don't think this is a problem. AFAIK. If I got it correctly, I would have something like this Create an NIO Acceptor (say A1) Create a NIO Connector (say C1) receive data on A1 send a command via C1 maintain that command state in some cache or hashtable receive response via A1 in the IOHandler, get the data from cache/hashtable Hope it helps. Correct me if I have got the problem incorrectly thanks ashish On Mon, Aug 31, 2009 at 7:00 PM, Rodrigo Hernandez Soaresrodher...@gmail.com wrote: Hello. After all, please, forgive my english. I have this scenario: A server with a DatagramSocket, which receives periodic positioning messages (byte[]) from a gps tracker device (udp + gprs communication). Eventually i need to send commands (byte[]) to the device. To perform this task, i create a new DatagramSocket in the server. The problem is: the response to my command arrives through the other DatagramSocket, instead of arrives through the new Socket. That problem, in a multi-thread scenario, prevents the response to arrives to the correct sender (thread). Can MINA solve my problem? Thanks! -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Authenticating via LDAP
On Thu, Aug 20, 2009 at 1:56 PM, Niklas Gustavssonnik...@protocol7.com wrote: On Thu, Aug 20, 2009 at 10:19 AM, Ashishpaliwalash...@gmail.com wrote: Niklas, Can we explore possibility of using SpringSecurity User Manager? Well I did worked on integrating Hibernate with Spring Security, not sure how easy would it be hook it into FtpServer. I'm not sure either. I did some work with Spring Security (when it was still called Acegi Security) and by that time it was target for web applications (if I recall correctly). If it is now more general, and can provide for handling the additional user information (like home directory) that we need, it should be pretty easy. Yup its interceptors are still inclined towards web apps. However, might be interesting to explore if we can have interceptor for FtpServer. Alternatively, I think we can always use it UserManager implementation. With the full framework, it is called by interceptor, based on URL's. We can programatically call its UserManager, to get the UserDetails and authenticate the user. Well let me see if I can explore this further over the weekend, have to start working on MINA chapter 2 Each time I think, I will rest this weekend and something really interesting comes up :-) -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: Status of Vysper
please refer this thread http://mina.markmail.org/search/?q=#query:+page:1+mid:ab7kysceqbo5mpof+state:results On Wed, Aug 19, 2009 at 4:36 PM, Ely Celinocel...@ifafatech.com wrote: I just want to know the status of Mina's sub-project: Vysper. Thanks! thanks ashish