openr66.protocol.utils
Class ChannelUtils

java.lang.Object
  extended by java.lang.Thread
      extended by openr66.protocol.utils.ChannelUtils
All Implemented Interfaces:
Runnable

public class ChannelUtils
extends Thread

Channel Utils

Author:
Frederic Bregier

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
static Integer NOCHANNEL
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ChannelUtils()
           
 
Method Summary
static void close(org.jboss.netty.channel.Channel channel)
           
static void exit()
          Exit global ChannelFactory
static InetAddress getLocalInetAddress(org.jboss.netty.channel.Channel channel)
          Get the Local InetAddress
static InetSocketAddress getLocalInetSocketAddress(org.jboss.netty.channel.Channel channel)
          Get the Local InetSocketAddress
static InetAddress getRemoteInetAddress(org.jboss.netty.channel.Channel channel)
          Get the Remote InetAddress
static InetSocketAddress getRemoteInetSocketAddress(org.jboss.netty.channel.Channel channel)
          Get the Remote InetSocketAddress
static int nbCommandChannels(Configuration configuration)
          Return the current number of network connections
 void run()
          This function is the top function to be called when the server is to be shutdown.
static void stopLogger()
           
static long willBeWaitingWriting(org.jboss.netty.handler.traffic.ChannelTrafficShapingHandler cts, int size)
          Compute Wait for Traffic in Write (ugly turn around)
static long willBeWaitingWriting(LocalChannelReference localChannelReference, int size)
          Compute Wait for Traffic in Write (ugly turn around)
static org.jboss.netty.channel.ChannelFuture writeAbstractLocalPacket(LocalChannelReference localChannelReference, AbstractLocalPacket packet, boolean wait)
          Write an AbstractLocalPacket to the network Channel
static org.jboss.netty.channel.ChannelFuture writeAbstractLocalPacketToLocal(LocalChannelReference localChannelReference, AbstractLocalPacket packet)
          Write an AbstractLocalPacket to the Local Channel
static org.jboss.netty.channel.ChannelFuture writeBackDataBlock(LocalChannelReference localChannelReference, goldengate.common.file.DataBlock block)
           
static void writeEndTransfer(LocalChannelReference localChannelReference)
          Write the EndTransfer
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NOCHANNEL

public static final Integer NOCHANNEL
Constructor Detail

ChannelUtils

public ChannelUtils()
Method Detail

getRemoteInetAddress

public static InetAddress getRemoteInetAddress(org.jboss.netty.channel.Channel channel)
Get the Remote InetAddress

Parameters:
channel -
Returns:
the remote InetAddress

getLocalInetAddress

public static InetAddress getLocalInetAddress(org.jboss.netty.channel.Channel channel)
Get the Local InetAddress

Parameters:
channel -
Returns:
the local InetAddress

getRemoteInetSocketAddress

public static InetSocketAddress getRemoteInetSocketAddress(org.jboss.netty.channel.Channel channel)
Get the Remote InetSocketAddress

Parameters:
channel -
Returns:
the remote InetSocketAddress

getLocalInetSocketAddress

public static InetSocketAddress getLocalInetSocketAddress(org.jboss.netty.channel.Channel channel)
Get the Local InetSocketAddress

Parameters:
channel -
Returns:
the local InetSocketAddress

nbCommandChannels

public static int nbCommandChannels(Configuration configuration)
Return the current number of network connections

Parameters:
configuration -
Returns:
the current number of network connections

close

public static void close(org.jboss.netty.channel.Channel channel)
Parameters:
channel -

writeBackDataBlock

public static org.jboss.netty.channel.ChannelFuture writeBackDataBlock(LocalChannelReference localChannelReference,
                                                                       goldengate.common.file.DataBlock block)
                                                                throws OpenR66ProtocolPacketException
Parameters:
localChannelReference -
block -
Returns:
the ChannelFuture of this write operation
Throws:
OpenR66ProtocolPacketException

writeEndTransfer

public static void writeEndTransfer(LocalChannelReference localChannelReference)
                             throws OpenR66ProtocolPacketException
Write the EndTransfer

Parameters:
localChannelReference -
Throws:
OpenR66ProtocolPacketException

writeAbstractLocalPacket

public static org.jboss.netty.channel.ChannelFuture writeAbstractLocalPacket(LocalChannelReference localChannelReference,
                                                                             AbstractLocalPacket packet,
                                                                             boolean wait)
                                                                      throws OpenR66ProtocolPacketException
Write an AbstractLocalPacket to the network Channel

Parameters:
localChannelReference -
packet -
wait -
Returns:
the ChannelFuture on write operation
Throws:
OpenR66ProtocolPacketException

writeAbstractLocalPacketToLocal

public static org.jboss.netty.channel.ChannelFuture writeAbstractLocalPacketToLocal(LocalChannelReference localChannelReference,
                                                                                    AbstractLocalPacket packet)
                                                                             throws OpenR66ProtocolPacketException
Write an AbstractLocalPacket to the Local Channel

Parameters:
localChannelReference -
packet -
Returns:
the ChannelFuture on write operation
Throws:
OpenR66ProtocolPacketException

willBeWaitingWriting

public static final long willBeWaitingWriting(LocalChannelReference localChannelReference,
                                              int size)
Compute Wait for Traffic in Write (ugly turn around)

Parameters:
localChannelReference -
size -
Returns:
the wait in ms

willBeWaitingWriting

public static final long willBeWaitingWriting(org.jboss.netty.handler.traffic.ChannelTrafficShapingHandler cts,
                                              int size)
Compute Wait for Traffic in Write (ugly turn around)

Parameters:
cts -
size -
Returns:
the wait in ms

exit

public static void exit()
Exit global ChannelFactory


stopLogger

public static void stopLogger()

run

public void run()
This function is the top function to be called when the server is to be shutdown.

Specified by:
run in interface Runnable
Overrides:
run in class Thread


Copyright © 2009-2012 Frederic Bregier. All Rights Reserved.