// XXX We cannot allow transferHandler to kill us.
private void transferData(RawPacket[] pkts)
    {
        for (int i = 0; i < pkts.length; i++)
        {
            RawPacket pkt = pkts[i];
            pkts[i] = null;
            if (pkt != null)
            {
                if (pkt.isInvalid())
                {
                    /*
                     * Return pkt to the pool because it is invalid and,
                     * consequently, will not be made available to reading.
                     */
                    poolRawPacket(pkt);
                }
                else
                {
                    RawPacket oldPkt;
                    synchronized (pktSyncRoot)
                    {
                        oldPkt = this.pkt;
                        this.pkt = pkt;
                    }
                    if (oldPkt != null)
                    {
                        /*
                         * Return oldPkt to the pool because it was made
                         * available to reading and it was not read.
                         */
                        poolRawPacket(oldPkt);
                    }
                    if (transferHandler != null && !closed)
                    {
                        try
                        {
                            transferHandler.transferData(this);
                        }
                        catch (Throwable t)
                        {
                            // XXX We cannot allow transferHandler to kill us.
                            if (t instanceof InterruptedException)
                            {
                                Thread.currentThread().interrupt();
                            }
                            else if (t instanceof ThreadDeath)
                            {
                                throw (ThreadDeath) t;
                            }
                            else
                            {
                                logger.warn(
                                    "An RTP packet may have not been fully"
                                        + " handled.",
                                    t);
                            }
                        }
                    }
                }
            }
        }
    }
catch (Throwable t)
{
// XXX We cannot allow transferHandler to kill us.
if (t instanceof InterruptedException)
{
poolRawPacket(oldPkt);
}
if (transferHandler != null && !closed)
{
try
{
transferHandler.transferData(this);
}
catch (Throwable t)
{
// XXX We cannot allow transferHandler to kill us.
if (t instanceof InterruptedException)
{
Thread.currentThread().interrupt();
}
else if (t instanceof ThreadDeath)
{
throw (ThreadDeath) t;
}
else
{
{
oldPkt = this.pkt;
this.pkt = pkt;
}
if (oldPkt != null)
{
/*
* Return oldPkt to the pool because it was made
* available to reading and it was not read.
*/
poolRawPacket(oldPkt);
}
if (transferHandler != null && !closed)
{
try
{
transferHandler.transferData(this);
}
catch (Throwable t)
{
// XXX We cannot allow transferHandler to kill us.
if (t instanceof InterruptedException)
{
Thread.currentThread().interrupt();
}
else if (t instanceof ThreadDeath)
{
throw (ThreadDeath) t;
}
else
{
logger.warn(
"An RTP packet may have not been fully"
+ " handled.",
t);
}
}
}
}
}
}