[CONF] Apache MINA: IoHandler (page edited)

2008-12-11 Thread confluence










Page Edited :
MINA :
IoHandler



 
IoHandler
has been edited by Ashish Paliwal
(Dec 11, 2008).
 

  Change summary:
  initial updations

 
 (View changes)
 

Content:
NoteThis page is being updated

Introduction

Handles all I/O events fired by MINA

Following are the functions of interest

	sessionCreated
	sessionOpened
	sessionClosed
	sessionIdle
	exceptionCaught
	messageReceived
	messageSent













Powered by
Atlassian Confluence
(Version: 2.2.9 Build:#527 Sep 07, 2006)
-
Bug/feature request

Unsubscribe or edit your notifications preferences








[CONF] Apache MINA: IoHandler (page edited)

2008-12-11 Thread confluence










Page Edited :
MINA :
IoHandler



 
IoHandler
has been edited by Ashish Paliwal
(Dec 11, 2008).
 

 
 (View changes)
 

Content:
NoteThis page is being updated











Powered by
Atlassian Confluence
(Version: 2.2.9 Build:#527 Sep 07, 2006)
-
Bug/feature request

Unsubscribe or edit your notifications preferences








[CONF] Apache MINA: IoHandler (page created)

2008-12-11 Thread confluence










Page Created :
MINA :
IoHandler



 
IoHandler
has been created by Ashish Paliwal
(Dec 11, 2008).
 

Content:












Powered by
Atlassian Confluence
(Version: 2.2.9 Build:#527 Sep 07, 2006)
-
Bug/feature request

Unsubscribe or edit your notifications preferences








[CONF] Apache MINA: IoBuffer (page edited)

2008-12-11 Thread confluence










Page Edited :
MINA :
IoBuffer



 
IoBuffer
has been edited by Ashish Paliwal
(Dec 11, 2008).
 

 
 (View changes)
 

Content:
Introduction

A byte buffer used by MINA applications.

This is a replacement for ByteBuffer. MINA does not use NIO ByteBuffer directly for two reasons:

	It doesn't provide useful getters and putters such as fill, get/putString, and get/putAsciiInt() .




	It is difficult to write variable-length data due to its fixed capacity



IoBuffer Operations


Allocating a new Buffer

IoBuffer is an abstract class, hence can't be instantiated directly. To allocate IoBuffer, we  need to use allocate() method.

public static IoBuffer allocate(int capacity, boolean direct)

The allocate() method takes two arguments

	capacity  - the capacity of the buffer
	direct - type of buffer. true to get direct buffer, false to get heap buffer



The default buffer allocation is handled by SimpleBufferAllocator

Alternatively, following form can also be used

// Allocate heap buffer by default.
 IoBuffer.setUseDirectBuffer(false);
 // A new heap buffer is returned.
 IoBuffer buf = IoBuffer.allocate(1024);


Creating Auto Expanding Buffer

Creating auto expanding buffer is not verye asy with java NIO API's, coz of the fixed size of the buffers. Having a buffer, that can auto expand on needs is a big plus for networking applications. To address this, IoBuffer has introduced autoExpand property. It automatically expands its capacity and limit value.

Lets see how to create an auto expanding buffer

IoBuffer buffer = IoBuffer.allocate(8);
buffer.setAutoExpand(true);

buffer.putString("12345678", encoder);
   
// Add more to this buffer
buffer.put((byte)10);

The underlying ByteBuffer is reallocated by IoBuffer behind the scene if the encoded data is larger than 16 bytes in the example above. Its capacity will double, and its limit will increase to the last position the string is written. This behaviour is very similar to the way StringBuffer class works.

Creating Auto Shrinking Buffer

There are situations which calls for releasing additionally allocated bytes from the buffer, to preserve memory. IoBuffer provides autoShrink property to address the need.  If autoShrink is turned on, IoBuffer halves the capacity of the buffer when compact() is invoked and only 1/4 or less of the current capacity is being used. To manually shrink the buffer, use shrink() method.

Lets see this in action

IoBuffer buffer = IoBuffer.allocate(16);
buffer.setAutoShrink(true);
buffer.put((byte)1);
System.out.println("Initial Buffer capacity = "+buffer.capacity());
buffer.shrink();
System.out.println("Initial Buffer capacity after shrink = "+buffer.capacity());

buffer.capacity(32);
System.out.println("Buffer capacity after incrementing capacity to 32 = "+buffer.capacity());
buffer.shrink();
System.out.println("Buffer capacity after shrink= "+buffer.capacity());

We have initially allocated a capacity as 16, and set the autoShrink property as true.

Lets see the output of this

Initial Buffer capacity = 16
Initial Buffer capacity after shrink = 16
Buffer capacity after incrementing capacity to 32 = 32
Buffer capacity after shrink= 16


Lets take a break and analyze the output

	Initial buffer capacity is 16, as we created the buffer with this capacity. Internally this becomes the minimum capacity of the buffer
	After calling shrink(), the capacity remains 16, as capacity shall never be less than minimum capacity
	After incrementing capacity to 32, the capacity becomes 32
	Call to shrink(), reduces the capacity to 16, thereby eliminating extra storage



Buffer Allocation

IoBufferAllocater is responsible for allocating and managing buffers. To have precise control on the buffer allocation policy, implement the interface.

MINA ships with following implementations of IoBufferAllocater

	SimpleBufferAllocator (default) - Create a new buffer every time
	CachedBufferAllocator - caches the buffer which are likely to be reused during expansion



You can implement you own implementation of IoBufferAllocator and call setAllocator() on IoBuffer to use the same.











Powered by
Atlassian Confluence
(Version: 2.2.9 Build:#527 Sep 07, 2006)
-
Bug/feature request

Unsubscribe or edit your notifications preferences








[CONF] Apache MINA: IoBuffer (page edited)

2008-12-11 Thread confluence










Page Edited :
MINA :
IoBuffer



 
IoBuffer
has been edited by Ashish Paliwal
(Dec 11, 2008).
 

  Change summary:
  Added Buffer allocation

 
 (View changes)
 

Content:
Introduction

NoteThis page is being updated
A byte buffer used by MINA applications.

This is a replacement for ByteBuffer. MINA does not use NIO ByteBuffer directly for two reasons:

	It doesn't provide useful getters and putters such as fill, get/putString, and get/putAsciiInt() .




	It is difficult to write variable-length data due to its fixed capacity



IoBuffer Operations


Allocating a new Buffer

IoBuffer is an abstract class, hence can't be instantiated directly. To allocate IoBuffer, we  need to use allocate() method.

public static IoBuffer allocate(int capacity, boolean direct)

The allocate() method takes two arguments

	capacity  - the capacity of the buffer
	direct - type of buffer. true to get direct buffer, false to get heap buffer



The default buffer allocation is handled by SimpleBufferAllocator

Alternatively, following form can also be used

// Allocate heap buffer by default.
 IoBuffer.setUseDirectBuffer(false);
 // A new heap buffer is returned.
 IoBuffer buf = IoBuffer.allocate(1024);


Creating Auto Expanding Buffer

Creating auto expanding buffer is not verye asy with java NIO API's, coz of the fixed size of the buffers. Having a buffer, that can auto expand on needs is a big plus for networking applications. To address this, IoBuffer has introduced autoExpand property. It automatically expands its capacity and limit value.

Lets see how to create an auto expanding buffer

IoBuffer buffer = IoBuffer.allocate(8);
buffer.setAutoExpand(true);

buffer.putString("12345678", encoder);
   
// Add more to this buffer
buffer.put((byte)10);

The underlying ByteBuffer is reallocated by IoBuffer behind the scene if the encoded data is larger than 16 bytes in the example above. Its capacity will double, and its limit will increase to the last position the string is written. This behaviour is very similar to the way StringBuffer class works.

Creating Auto Shrinking Buffer

There are situations which calls for releasing additionally allocated bytes from the buffer, to preserve memory. IoBuffer provides autoShrink property to address the need.  If autoShrink is turned on, IoBuffer halves the capacity of the buffer when compact() is invoked and only 1/4 or less of the current capacity is being used. To manually shrink the buffer, use shrink() method.

Lets see this in action

IoBuffer buffer = IoBuffer.allocate(16);
buffer.setAutoShrink(true);
buffer.put((byte)1);
System.out.println("Initial Buffer capacity = "+buffer.capacity());
buffer.shrink();
System.out.println("Initial Buffer capacity after shrink = "+buffer.capacity());

buffer.capacity(32);
System.out.println("Buffer capacity after incrementing capacity to 32 = "+buffer.capacity());
buffer.shrink();
System.out.println("Buffer capacity after shrink= "+buffer.capacity());

We have initially allocated a capacity as 16, and set the autoShrink property as true.

Lets see the output of this

Initial Buffer capacity = 16
Initial Buffer capacity after shrink = 16
Buffer capacity after incrementing capacity to 32 = 32
Buffer capacity after shrink= 16


Lets take a break and analyze the output

	Initial buffer capacity is 16, as we created the buffer with this capacity. Internally this becomes the minimum capacity of the buffer
	After calling shrink(), the capacity remains 16, as capacity shall never be less than minimum capacity
	After incrementing capacity to 32, the capacity becomes 32
	Call to shrink(), reduces the capacity to 16, thereby eliminating extra storage



Buffer Allocation

IoBufferAllocater is responsible for allocating and managing buffers. To have precise control on the buffer allocation policy, implement the interface.

MINA ships with following implementations of IoBufferAllocater

	SimpleBufferAllocator (default) - Create a new buffer every time
	CachedBufferAllocator - caches the buffer which are likely to be reused during expansion



You can implement you own implementation of IoBufferAllocator and call setAllocator() on IoBuffer to use the same.











Powered by
Atlassian Confluence
(Version: 2.2.9 Build:#527 Sep 07, 2006)
-
Bug/feature request

Unsubscribe or edit your notifications preferences








svn commit: r725861 - /mina/metadata/doap.rdf

2008-12-11 Thread elecharny
Author: elecharny
Date: Thu Dec 11 16:15:29 2008
New Revision: 725861

URL: http://svn.apache.org/viewvc?rev=725861&view=rev
Log:
Added the 2.0.0-M4 version

Modified:
mina/metadata/doap.rdf

Modified: mina/metadata/doap.rdf
URL: 
http://svn.apache.org/viewvc/mina/metadata/doap.rdf?rev=725861&r1=725860&r2=725861&view=diff
==
--- mina/metadata/doap.rdf (original)
+++ mina/metadata/doap.rdf Thu Dec 11 16:15:29 2008
@@ -30,6 +30,11 @@
 
   
 Apache MINA
+2008-12-10
+2.0.0-M4
+  
+  
+Apache MINA
 2008-08-11
 2.0.0-M3
   




[CONF] Apache MINA: Navigation (page edited)

2008-12-11 Thread confluence










Page Edited :
MINA :
Navigation



 
Navigation
has been edited by Emmanuel Lécharny
(Dec 11, 2008).
 

  Change summary:
  Upgrade from 2.0.0-M3 to 2.0.0-M4

 
 (View changes)
 

Content:
Latest downloads

	Mina 2.0.0-M4
	Mina 1.1.7
	Mina 1.0.10
	FtpServer 1.0.0-M3




Projects

	MINA
	FtpServer
	AsyncWeb
	SSHD



Documentation

	Features
	Road Map
	MINA 1.0
	MINA 1.1
	MINA 2.0
	FtpServer
	AsyncWeb
	FAQ



Resources

	Downloads
	Mailing lists & IRC
	Issue tracking
	Sources
	Performances
	Testimonials
	Articles
	Conferences



Community

	Team
	License
	Contributing
	Thanks
	ASF Sponsors
	Sponsorship program



Upcoming




  



















Powered by
Atlassian Confluence
(Version: 2.2.9 Build:#527 Sep 07, 2006)
-
Bug/feature request

Unsubscribe or edit your notifications preferences








[CONF] Apache MINA: Downloads (page edited)

2008-12-11 Thread confluence










Page Edited :
MINA :
Downloads



 
Downloads
has been edited by Emmanuel Lécharny
(Dec 11, 2008).
 

  Change summary:
  Upgrade from 2.0.0-M3 to 2.0.0-M4

 
 (View changes)
 

Content:
Latest Releases
Be Careful
The links will redirect you to a list of the nearest mirrors, if a mirror hasn't got the latest version yet due to propagation delay you can try another one.

Apache MINA 2.0.0-M4 unstable (Java 5+)


	.tar.gz archive mina-2.0.0-M4 (signatures : MD5 SHA1 ASC)
	.tar.bz2 archive mina-2.0.0-M4 (signatures : MD5 SHA1 ASC)
	.zip archive mina-2.0.0-M4 (signatures : MD5 SHA1 ASC)



Apache MINA 1.1.7 stable (Java 5+)


	.tar.gz archive mina-1.1.7 (signatures : MD5 SHA1 ASC)
	.tar.bz2 archive mina-1.1.7 (signatures : MD5 SHA1 ASC)
	.zip archive mina-1.1.7 (signatures : MD5 SHA1 ASC)



Apache MINA 1.0.10 stable (Java 1.4)


	.tar.gz archive mina-1.0.10 (signatures : MD5 SHA1 ASC)
	.tar.bz2 archive mina-1.0.10 (signatures : MD5 SHA1 ASC)
	.zip archive mina-1.0.10 (signatures : MD5 SHA1 ASC)




Verify the integrity of the files

The PGP signatures can be verified using PGP or GPG. First download the KEYS as well as the asc signature file for the relevant distribution. Then verify the signatures using:


$ pgpk -a KEYS
$ pgpv mina-1.2.3.tar.gz.asc

or

$ pgp -ka KEYS
$ pgp mina-1.2.3.tar.gz.asc

or

$ gpg --import KEYS
$ gpg --verify mina-1.2.3.tar.gz.asc


Latest Pre-release Snapshots

The snapshot JAR files can be found at the ASF Maven 2 snapshot repository.  Please note that  we don't provide the full distribution (e.g. tarball) of the latest pre-release snapshots.  Please check out the source code from our subversion repository to build the full distribution by yourself.

Previous Releases

The previous releases can be found here.

Version Numbering Scheme

The version number of MINA has the following form:
..[-M or -RC]
This scheme has three number components:

	The major number increases when there are incompatible changes in the API.
	The minor number increases when a new feature is introduced.
	The micro number increases when a bug or a trivial change is made.



and an optional label that indicates the maturity of a release:

	M (Milestone) means the feature set can change at any time in the next milestone releases.  The last milestone release becomes the first release candidate after a vote.
	RC (Release Candidate) means the feature set is frozen and the next RC releases will focus on fixing problems unless there is a serious flaw in design.  The last release candidate becomes the first GA release after a vote.
	No label implies GA (General Availability), which means the release is stable enough and therefore ready for production environment.



MINA is not a stand-alone software, so 'the feature set' here also includes the API of the newly introduced features and the overall architecture of the software,

Here's an example that illustrates how MINA version number increases:
2.0.0-M1 -> 2.0.0-M3 -> 2.0.0-M3 -> 2.0.0-M4 -  2.0.0-RC1 -> 2.0.0-RC2 -> 2.0.0-RC3 - 2.0.0 -> 2.0.1 -> 2.0.2 -> 2.1.0-M1 ...
Please note that we always specify the micro number, even if it's zero.











Powered by
Atlassian Confluence
(Version: 2.2.9 Build:#527 Sep 07, 2006)
-
Bug/feature request

Unsubscribe or edit your notifications preferences