About zero copy ...

2009-11-29 Thread Emmanuel Lecharny
Hi,
for those who are interested about the zero copy thing, here is an
interesting article :

http://www.ibm.com/developerworks/library/j-zerocopy/

IMO, worthy when used to transfer big files.

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


about the implementation of the SimpleIoProcessorPool

2009-11-29 Thread Peng Lee
 In my opinion,the line 176 [if (processorConstructor == null) ] is
redundant, because if processorConstructor is null, a NullPointerException
should be trowed previously. So, I think we should remove the redundant code
here. Of course, maybe there are any other things that i haven't knew
about,and who can tell me? @SuppressWarnings(unchecked) 118 public
SimpleIoProcessorPool(Class? extends IoProcessorT processorType, 119
Executor executor, int size) { 120 if (processorType == null) { 121 throw
new NullPointerException(processorType); 122 } 123 if (size = 0) { 124
throw new IllegalArgumentException(size:  + size 125 +  (expected:
positive integer)); 126 } 127 128 if (executor == null) { 129 this.executor
= executor = Executors.newCachedThreadPool(); 130 this.createdExecutor =
true; 131 } else { 132 this.executor = executor; 133 this.createdExecutor =
false; 134 } 135 136 pool = new IoProcessor[size]; 137 138 boolean success =
false; 139 Constructor? extends IoProcessorT processorConstructor =
null; 140 boolean usesExecutorArg = true; 141 142 try { 143 // We create at
least one processor 144 try { 145 try { 146 processorConstructor =
processorType 147 .getConstructor(ExecutorService.class); 148 pool[0] =
processorConstructor.newInstance(executor); 149 } catch
(NoSuchMethodException e) { 150 // To the next step... 151 } 152 153 try {
154 processorConstructor = processorType 155
.getConstructor(Executor.class); 156 pool[0] =
processorConstructor.newInstance(executor); 157 } catch
(NoSuchMethodException e) { 158 // To the next step... 159 } 160 161 try {
162 processorConstructor = processorType.getConstructor(); 163
usesExecutorArg = false; 164 pool[0] = processorConstructor.newInstance();
165 } catch (NoSuchMethodException e) { 166 // To the next step... 167 } 168
} catch (RuntimeException e) { 169 throw e; 170 } catch (Exception e) { 171
throw new RuntimeIoException( 172 Failed to create a new instance of  173
+ processorType.getName(), e); 174 } 175 176 if (processorConstructor ==
null) { 177 // Raise an exception if no proper constructor is found. 178
throw new IllegalArgumentException(String 179 .valueOf(processorType) 180 +
 must have a public constructor  181 + with one  182 +
ExecutorService.class.getSimpleName() 183 +  parameter,  184 + a public
constructor with one  185 + Executor.class.getSimpleName() 186 + 
parameter or a public default constructor.); 187 } 188 189 // Constructor
found now use it for all subsequent instantiations 190 for (int i = 1; i 
pool.length; i++) { 191 try { 192 if (usesExecutorArg) { 193 pool[i] =
processorConstructor.newInstance(executor); 194 } else { 195 pool[i] =
processorConstructor.newInstance(); 196 } 197 } catch (Exception e) { 198 //
Won't happen because it has been done previously 199 } 200 } 201 success =
true; 202 } finally { 203 if (!success) { 204 dispose(); 205 } 206 } 207 }
stefan lee


Re: about the implementation of the SimpleIoProcessorPool

2009-11-29 Thread Emmanuel Lecharny
Hi,

can you resend your message *with* new lines ? It's barely readable otherwise :/

On Sun, Nov 29, 2009 at 12:14 PM, Peng Lee pengli.h...@gmail.com wrote:
  In my opinion,the line 176 [if (processorConstructor == null) ] is
 redundant, because if processorConstructor is null, a NullPointerException
 should be trowed previously. So, I think we should remove the redundant code
 here. Of course, maybe there are any other things that i haven't knew
 about,and who can tell me? @SuppressWarnings(unchecked) 118 public
 SimpleIoProcessorPool(Class? extends IoProcessorT processorType, 119
 Executor executor, int size) { 120 if (processorType == null) { 121 throw
 new NullPointerException(processorType); 122 } 123 if (size = 0) { 124
 throw new IllegalArgumentException(size:  + size 125 +  (expected:
 positive integer)); 126 } 127 128 if (executor == null) { 129 this.executor
 = executor = Executors.newCachedThreadPool(); 130 this.createdExecutor =
 true; 131 } else { 132 this.executor = executor; 133 this.createdExecutor =
 false; 134 } 135 136 pool = new IoProcessor[size]; 137 138 boolean success =
 false; 139 Constructor? extends IoProcessorT processorConstructor =
 null; 140 boolean usesExecutorArg = true; 141 142 try { 143 // We create at
 least one processor 144 try { 145 try { 146 processorConstructor =
 processorType 147 .getConstructor(ExecutorService.class); 148 pool[0] =
 processorConstructor.newInstance(executor); 149 } catch
 (NoSuchMethodException e) { 150 // To the next step... 151 } 152 153 try {
 154 processorConstructor = processorType 155
 .getConstructor(Executor.class); 156 pool[0] =
 processorConstructor.newInstance(executor); 157 } catch
 (NoSuchMethodException e) { 158 // To the next step... 159 } 160 161 try {
 162 processorConstructor = processorType.getConstructor(); 163
 usesExecutorArg = false; 164 pool[0] = processorConstructor.newInstance();
 165 } catch (NoSuchMethodException e) { 166 // To the next step... 167 } 168
 } catch (RuntimeException e) { 169 throw e; 170 } catch (Exception e) { 171
 throw new RuntimeIoException( 172 Failed to create a new instance of  173
 + processorType.getName(), e); 174 } 175 176 if (processorConstructor ==
 null) { 177 // Raise an exception if no proper constructor is found. 178
 throw new IllegalArgumentException(String 179 .valueOf(processorType) 180 +
  must have a public constructor  181 + with one  182 +
 ExecutorService.class.getSimpleName() 183 +  parameter,  184 + a public
 constructor with one  185 + Executor.class.getSimpleName() 186 + 
 parameter or a public default constructor.); 187 } 188 189 // Constructor
 found now use it for all subsequent instantiations 190 for (int i = 1; i 
 pool.length; i++) { 191 try { 192 if (usesExecutorArg) { 193 pool[i] =
 processorConstructor.newInstance(executor); 194 } else { 195 pool[i] =
 processorConstructor.newInstance(); 196 } 197 } catch (Exception e) { 198 //
 Won't happen because it has been done previously 199 } 200 } 201 success =
 true; 202 } finally { 203 if (!success) { 204 dispose(); 205 } 206 } 207 }
 stefan lee




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


Re: about the implementation of the SimpleIoProcessorPool

2009-11-29 Thread Emmanuel Lecharny
Also provide the MINA version you are talking about. Thanks !

On Sun, Nov 29, 2009 at 12:14 PM, Peng Lee pengli.h...@gmail.com wrote:
  In my opinion,the line 176 [if (processorConstructor == null) ] is
 redundant, because if processorConstructor is null, a NullPointerException
 should be trowed previously. So, I think we should remove the redundant code
 here. Of course, maybe there are any other things that i haven't knew
 about,and who can tell me? @SuppressWarnings(unchecked) 118 public
 SimpleIoProcessorPool(Class? extends IoProcessorT processorType, 119
 Executor executor, int size) { 120 if (processorType == null) { 121 throw
 new NullPointerException(processorType); 122 } 123 if (size = 0) { 124
 throw new IllegalArgumentException(size:  + size 125 +  (expected:
 positive integer)); 126 } 127 128 if (executor == null) { 129 this.executor
 = executor = Executors.newCachedThreadPool(); 130 this.createdExecutor =
 true; 131 } else { 132 this.executor = executor; 133 this.createdExecutor =
 false; 134 } 135 136 pool = new IoProcessor[size]; 137 138 boolean success =
 false; 139 Constructor? extends IoProcessorT processorConstructor =
 null; 140 boolean usesExecutorArg = true; 141 142 try { 143 // We create at
 least one processor 144 try { 145 try { 146 processorConstructor =
 processorType 147 .getConstructor(ExecutorService.class); 148 pool[0] =
 processorConstructor.newInstance(executor); 149 } catch
 (NoSuchMethodException e) { 150 // To the next step... 151 } 152 153 try {
 154 processorConstructor = processorType 155
 .getConstructor(Executor.class); 156 pool[0] =
 processorConstructor.newInstance(executor); 157 } catch
 (NoSuchMethodException e) { 158 // To the next step... 159 } 160 161 try {
 162 processorConstructor = processorType.getConstructor(); 163
 usesExecutorArg = false; 164 pool[0] = processorConstructor.newInstance();
 165 } catch (NoSuchMethodException e) { 166 // To the next step... 167 } 168
 } catch (RuntimeException e) { 169 throw e; 170 } catch (Exception e) { 171
 throw new RuntimeIoException( 172 Failed to create a new instance of  173
 + processorType.getName(), e); 174 } 175 176 if (processorConstructor ==
 null) { 177 // Raise an exception if no proper constructor is found. 178
 throw new IllegalArgumentException(String 179 .valueOf(processorType) 180 +
  must have a public constructor  181 + with one  182 +
 ExecutorService.class.getSimpleName() 183 +  parameter,  184 + a public
 constructor with one  185 + Executor.class.getSimpleName() 186 + 
 parameter or a public default constructor.); 187 } 188 189 // Constructor
 found now use it for all subsequent instantiations 190 for (int i = 1; i 
 pool.length; i++) { 191 try { 192 if (usesExecutorArg) { 193 pool[i] =
 processorConstructor.newInstance(executor); 194 } else { 195 pool[i] =
 processorConstructor.newInstance(); 196 } 197 } catch (Exception e) { 198 //
 Won't happen because it has been done previously 199 } 200 } 201 success =
 true; 202 } finally { 203 if (!success) { 204 dispose(); 205 } 206 } 207 }
 stefan lee




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


About zero copy ...

2009-11-29 Thread Emmanuel Lecharny
Hi,
for those who are interested about the zero copy thing, here is an
interesting article :

http://www.ibm.com/developerworks/library/j-zerocopy/

IMO, worthy when used to transfer big files.



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


Re : Death to TRS80 coders

2009-11-29 Thread Edouard De Oliveira
my +1 

even if sometimes i write code on my 10 netbook 
 Cordialement, Regards,
-Edouard De Oliveira-
Blog: http://tedorgwp.free.fr
WebSite: http://tedorg.free.fr/en/main.php



- Message d'origine 
De : Ashish paliwalash...@gmail.com
À : dev@mina.apache.org
Envoyé le : Dim 29 Novembre 2009, 3 h 01 min 06 s
Objet : Re: Death to TRS80 coders

+1,

have been using 120. Now with higher screen resolutions, we can afford that :)

- ashish

On Sun, Nov 29, 2009 at 2:12 AM, Julien Vermillard
jvermill...@archean.fr wrote:
 Le Sat, 28 Nov 2009 09:06:59 -0800,
 Alan D. Cabrera l...@toolazydogs.com a écrit :

 May I suggest that for Mina 3.0 we refrain from arbitrarily wrapping
 the code when it passes 80 characters?  It makes it crazy hard to
 read the code.


 Regards,
 Alan


 +1,
 I like 120 char wrapping.







Re: [MINA 3.0] Initial thoughts on FilterChain

2009-11-29 Thread Alan D. Cabrera


On Nov 28, 2009, at 6:03 PM, Ashish wrote:

What about the assertion that new filters only get created to  
simulate a

state machine?

So what's the best way proceed forward, now that we had a quite a  
good

discussion :-)


CODE IT UP!  :)

Actually, when ever I make an API, I usually drive the API design  
by actual
coding examples.  Take for example how I drove the design of the  
HTTP client
by implementing the Amazon S3/EC2 clients.  My mantra is that if  
the client
use case doesn't use it then it doesn't go into the API.  Also, I  
design
against interfaces so that implementation details don't clutter my  
API

thinking.

I can do to mock implementations for async HTTP and for an ASN1  
codec.


Yup. Had a quick chat with Emm yesterday :-)
Will check in some initial thoughts and then we can slice and dice it
up to make it a beauty :-)))


Cool!

What about the assertion that new filters only get created to simulate  
a state machine?



Regards,
Alan



Build failed in Hudson: ftpserver-1.0.x-jdk1.5-solaris #33

2009-11-29 Thread Apache Hudson Server
See 
http://hudson.zones.apache.org/hudson/job/ftpserver-1.0.x-jdk1.5-solaris/33/

--
Started by user ngn
Building remotely on lucene.zones.apache.org (Solaris 10)
Updating https://svn.apache.org/repos/asf/mina/ftpserver/branches/1.0.x
At revision 885340
no change for https://svn.apache.org/repos/asf/mina/ftpserver/branches/1.0.x 
since the previous build
Parsing POMs
ERROR: No classworlds*.jar found in /home/hudson/tools/maven/latest -- Is this 
a valid maven2 directory?