com.sun.sgs.impl.nio
Class AsyncGroupImpl

java.lang.Object
  extended by com.sun.sgs.nio.channels.AsynchronousChannelGroup
      extended by com.sun.sgs.impl.nio.AsyncGroupImpl
Direct Known Subclasses:
ReactiveChannelGroup

abstract class AsyncGroupImpl
extends AsynchronousChannelGroup

Common base implementation of AsynchronousChannelGroup.


Field Summary
protected  ExecutorService executor
          The executor service for this group's tasks.
(package private)  Thread.UncaughtExceptionHandler uncaughtHandler
          The UncaughtExceptionHandler for this group, or null.
 
Constructor Summary
protected AsyncGroupImpl(AsyncProviderImpl provider, ExecutorService executor)
          Constructs a new instance of this class.
 
Method Summary
(package private)
<R,A> Runnable
completionRunner(CompletionHandler<R,A> handler, A attachment, Future<R> future)
          Returns a runnable that will invoke the given completion handler.
(package private)  ExecutorService executor()
          Returns the ExecutorService for this group.
protected  void finalize()
          Invokes AsynchronousChannelGroup.shutdown() when this group is no longer referenced.
(package private) abstract  AsyncKey register(SelectableChannel ch)
          Registers the given channel with this group, returning an AsyncKey that can be used to invoke asynchronous IO operations.
(package private)  SelectorProvider selectorProvider()
          Returns the SelectorProvider for this group.
 
Methods inherited from class com.sun.sgs.nio.channels.AsynchronousChannelGroup
awaitTermination, getDefaultUncaughtExceptionHandler, isShutdown, isTerminated, open, provider, setDefaultUncaughtExceptionHandler, shutdown, shutdownNow
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

executor

protected final ExecutorService executor
The executor service for this group's tasks.


uncaughtHandler

volatile Thread.UncaughtExceptionHandler uncaughtHandler
The UncaughtExceptionHandler for this group, or null. Accessed by AsyncProviderImpl if this is the default group.

Constructor Detail

AsyncGroupImpl

protected AsyncGroupImpl(AsyncProviderImpl provider,
                         ExecutorService executor)
Constructs a new instance of this class.

Parameters:
provider - the provider
executor - the executor
Method Detail

register

abstract AsyncKey register(SelectableChannel ch)
                    throws IOException
Registers the given channel with this group, returning an AsyncKey that can be used to invoke asynchronous IO operations. If this group is shutdown, this method will throw ShutdownChannelGroupException and close the channel.

Parameters:
ch - the underlying channel for IO operations
Returns:
an AsyncKey that supports asynchronous operations on the underlying channel
Throws:
IOException - if an I/O error occurs
ShutdownChannelGroupException - if this group is shutdown

completionRunner

<R,A> Runnable completionRunner(CompletionHandler<R,A> handler,
                                A attachment,
                                Future<R> future)
Returns a runnable that will invoke the given completion handler. Passes the handler an IoFuture constructed from the given future and attachment object.

Type Parameters:
R - the result type
A - the attachment type
Parameters:
handler - the completion handler
attachment - the attachment, or null
future - the result
Returns:
the completion runnable

selectorProvider

SelectorProvider selectorProvider()
Returns the SelectorProvider for this group.

Returns:
the SelectorProvider for this group

executor

ExecutorService executor()
Returns the ExecutorService for this group.

Returns:
the ExecutorService for this group

finalize

protected void finalize()
Invokes AsynchronousChannelGroup.shutdown() when this group is no longer referenced.

Overrides:
finalize in class Object

RedDwarf, Version 0.10.1
2010-03-14 10:56:12

Copyright © 2010 The RedDwarf Authors. All rights reserved
Copyright © 2007-2010 Sun Microsystems, Inc. All rights reserved