net.tomp2p.futures
Class FutureChannel

java.lang.Object
  extended by net.tomp2p.futures.BaseFutureImpl<FutureChannel>
      extended by net.tomp2p.futures.FutureChannel
All Implemented Interfaces:
BaseFuture, Cancellable

public class FutureChannel
extends BaseFutureImpl<FutureChannel>

Keeps track of the creation of a UDP or TCP channel. Since this may take a while, we return a future, and the user gets notified when its finished.

Author:
Thomas Bocek

Nested Class Summary
 
Nested classes/interfaces inherited from interface net.tomp2p.futures.BaseFuture
BaseFuture.FutureType
 
Field Summary
 
Fields inherited from class net.tomp2p.futures.BaseFutureImpl
completed, lock, reason, type
 
Constructor Summary
FutureChannel()
          Constructor.
 
Method Summary
 org.jboss.netty.channel.Channel getChannel()
           
 org.jboss.netty.channel.ChannelFuture getChannelFuture()
           
 boolean isAcquired()
           
 void setAcquired(boolean semaphoreAcquired2)
          Set a flag if a semaphore has been acquired for this channel.
 void setChannel(org.jboss.netty.channel.Channel channel)
          Finishes this future.
 void setChannelFuture(org.jboss.netty.channel.ChannelFuture channelFuture2)
          Set the channel future.
 
Methods inherited from class net.tomp2p.futures.BaseFutureImpl
addCancellation, addListener, addListener, await, await, awaitListeners, awaitUninterruptibly, awaitUninterruptibly, cancel, getFailedReason, getType, isCompleted, isFailed, isSuccess, notifyListerenrs, removeListener, self, setCompletedAndNotify, setFailed, setFailed, setFailed, setFailed, setFailed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FutureChannel

public FutureChannel()
Constructor.

Method Detail

setChannel

public void setChannel(org.jboss.netty.channel.Channel channel)
Finishes this future.

Parameters:
channel - The created UDP or TCP Netty channel

getChannel

public org.jboss.netty.channel.Channel getChannel()
Returns:
The created UDP or TCP Netty channel

setAcquired

public void setAcquired(boolean semaphoreAcquired2)
Set a flag if a semaphore has been acquired for this channel. If it is not set, and we cannot create new channel, the creation of this channel will be put in a queue and executed later.

Parameters:
semaphoreAcquired2 - True if we already could acquire a semaphore

isAcquired

public boolean isAcquired()
Returns:
The state if the channel has acquired a semaphore

setChannelFuture

public void setChannelFuture(org.jboss.netty.channel.ChannelFuture channelFuture2)
Set the channel future. This is set immediately.

Parameters:
channelFuture2 - The future of the channel that will be connected

getChannelFuture

public org.jboss.netty.channel.ChannelFuture getChannelFuture()
Returns:
The channel future


Copyright © 2013. All Rights Reserved.