XNIO API 2.1.0.CR2

org.jboss.xnio
Interface Pool<T>

Type Parameters:
T - the resource type

public interface Pool<T>

A generic pooled resource manager.


Method Summary
 T allocate()
          Allocate a resource from the pool, or null if none are available.
 void discard(T resource)
          Discard a "damaged" resource.
 void free(T resource)
          Free a pooled resource.
 

Method Detail

allocate

T allocate()
Allocate a resource from the pool, or null if none are available.

Returns:
the resource, or null if none are available

free

void free(T resource)
          throws IllegalArgumentException
Free a pooled resource.

Parameters:
resource - the resource to re-pool
Throws:
IllegalArgumentException - if the given resource does not belong in this pool

discard

void discard(T resource)
Discard a "damaged" resource. Calling this method indicates that the object in question will not be used any longer, however it should not be returned to the pool.

Parameters:
resource - the resource to discard

XNIO API 2.1.0.CR2

Copyright © 2010 JBoss, a division of Red Hat, Inc.