Fixes warnings, manually formats source code.
This commit is contained in:
parent
e497af1850
commit
fd616daa1c
@ -691,7 +691,7 @@ class PseudoTcpSocketImpl
|
||||
private final static ScheduledThreadPoolExecutor clockExecutor
|
||||
= new ScheduledThreadPoolExecutor(1);
|
||||
|
||||
private volatile ScheduledFuture currentlyScheduledClockTask = null;
|
||||
private volatile ScheduledFuture<?> currentlyScheduledClockTask = null;
|
||||
|
||||
/**
|
||||
* Method runs cyclic notification about time progress for TCP logic class
|
||||
@ -755,7 +755,7 @@ class PseudoTcpSocketImpl
|
||||
private void cancelClockTask(boolean interruptIfRunning)
|
||||
{
|
||||
// Copy the reference, in case it changes.
|
||||
ScheduledFuture taskToCancel = this.currentlyScheduledClockTask;
|
||||
ScheduledFuture<?> taskToCancel = this.currentlyScheduledClockTask;
|
||||
if(taskToCancel != null)
|
||||
{
|
||||
taskToCancel.cancel(interruptIfRunning);
|
||||
|
||||
@ -84,17 +84,25 @@ class Connector
|
||||
this.errorHandler = errorHandler;
|
||||
|
||||
Transport transport
|
||||
= socket.getUDPSocket() != null ? Transport.UDP : Transport.TCP;
|
||||
this.listenAddress
|
||||
= new TransportAddress(socket.getLocalAddress(),
|
||||
socket.getLocalPort(),
|
||||
transport);
|
||||
this.remoteAddress
|
||||
= transport == Transport.UDP
|
||||
? null
|
||||
: new TransportAddress(socket.getTCPSocket().getInetAddress(),
|
||||
socket.getTCPSocket().getPort(),
|
||||
= socket.getUDPSocket() != null ? Transport.UDP : Transport.TCP;
|
||||
|
||||
listenAddress
|
||||
= new TransportAddress(socket.getLocalAddress(),
|
||||
socket.getLocalPort(),
|
||||
transport);
|
||||
if (transport == Transport.UDP)
|
||||
{
|
||||
remoteAddress = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
Socket tcpSocket = socket.getTCPSocket();
|
||||
|
||||
remoteAddress
|
||||
= new TransportAddress(tcpSocket.getInetAddress(),
|
||||
tcpSocket.getPort(),
|
||||
transport);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -103,7 +111,9 @@ class Connector
|
||||
void start()
|
||||
{
|
||||
this.running = true;
|
||||
Thread thread = new Thread(this, "IceConnector@"+hashCode());
|
||||
|
||||
Thread thread = new Thread(this, "IceConnector@" + hashCode());
|
||||
|
||||
thread.setDaemon(true);
|
||||
thread.start();
|
||||
}
|
||||
@ -122,6 +132,7 @@ class Connector
|
||||
/**
|
||||
* The listening thread's run method.
|
||||
*/
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
DatagramPacket packet = null;
|
||||
@ -281,8 +292,8 @@ class Connector
|
||||
void sendMessage(byte[] message, TransportAddress address)
|
||||
throws IOException
|
||||
{
|
||||
DatagramPacket datagramPacket = new DatagramPacket(
|
||||
message, 0, message.length, address);
|
||||
DatagramPacket datagramPacket
|
||||
= new DatagramPacket(message, 0, message.length, address);
|
||||
|
||||
sock.send(datagramPacket);
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
package org.ice4j.stack;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
import java.util.logging.*;
|
||||
|
||||
@ -292,7 +293,7 @@ class NetAccessManager
|
||||
if (!netUDPAccessPoints.containsKey(localAddr))
|
||||
{
|
||||
Connector connector
|
||||
= new Connector(socket, messageQueue, this);
|
||||
= new Connector(socket, messageQueue, this);
|
||||
|
||||
netUDPAccessPoints.put(localAddr, connector);
|
||||
connector.start();
|
||||
@ -301,23 +302,25 @@ class NetAccessManager
|
||||
|
||||
case TCP:
|
||||
List<Connector> connectors = netTCPAccessPoints.get(localAddr);
|
||||
|
||||
if (connectors == null)
|
||||
{
|
||||
connectors = new LinkedList<Connector>();
|
||||
netTCPAccessPoints.put(localAddr, connectors);
|
||||
}
|
||||
|
||||
Socket tcpSocket = socket.getTCPSocket();
|
||||
Connector connector
|
||||
= findTCPConnectorByRemoteAddress(
|
||||
connectors,
|
||||
new TransportAddress(
|
||||
socket.getTCPSocket().getInetAddress(),
|
||||
socket.getTCPSocket().getPort(),
|
||||
Transport.TCP));
|
||||
connectors,
|
||||
new TransportAddress(
|
||||
tcpSocket.getInetAddress(),
|
||||
tcpSocket.getPort(),
|
||||
Transport.TCP));
|
||||
|
||||
if (connector == null)
|
||||
{
|
||||
connector = new Connector(socket, messageQueue, this);
|
||||
|
||||
connectors.add(connector);
|
||||
connector.start();
|
||||
}
|
||||
@ -373,6 +376,7 @@ class NetAccessManager
|
||||
|
||||
case TCP:
|
||||
List<Connector> connectors = netTCPAccessPoints.remove(src);
|
||||
|
||||
if (connectors != null)
|
||||
{
|
||||
connector
|
||||
@ -418,9 +422,10 @@ class NetAccessManager
|
||||
throws IllegalArgumentException
|
||||
{
|
||||
if(threadPoolSize < 1)
|
||||
{
|
||||
throw new IllegalArgumentException(
|
||||
threadPoolSize
|
||||
+ " is not a legal thread pool size value.");
|
||||
threadPoolSize + " is not a legal thread pool size value.");
|
||||
}
|
||||
|
||||
//if we are not running just record the size
|
||||
//so that we could init later.
|
||||
@ -442,8 +447,8 @@ class NetAccessManager
|
||||
*/
|
||||
private void initThreadPool()
|
||||
{
|
||||
//create additional processors
|
||||
fillUpThreadPool(initialThreadPoolSize);
|
||||
//create additional processors
|
||||
fillUpThreadPool(initialThreadPoolSize);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -499,10 +504,9 @@ class NetAccessManager
|
||||
return netUDPAccessPoints.get(src);
|
||||
case TCP:
|
||||
List<Connector> connectors = netTCPAccessPoints.get(src);
|
||||
|
||||
if (connectors != null)
|
||||
{
|
||||
return findTCPConnectorByRemoteAddress(connectors, dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -532,10 +536,12 @@ class NetAccessManager
|
||||
byte[] bytes = stunMessage.encode(stunStack);
|
||||
|
||||
Connector ap = getConnector(srcAddr, remoteAddr);
|
||||
|
||||
if (ap == null)
|
||||
{
|
||||
throw new IllegalArgumentException(
|
||||
"No socket has been added for: " + srcAddr + " <-> " + remoteAddr);
|
||||
"No socket has been added for: " + srcAddr + " <-> "
|
||||
+ remoteAddr);
|
||||
}
|
||||
|
||||
ap.sendMessage(bytes, remoteAddr);
|
||||
@ -564,6 +570,7 @@ class NetAccessManager
|
||||
byte[] bytes = channelData.encode();
|
||||
|
||||
Connector ap = getConnector(srcAddr, remoteAddr);
|
||||
|
||||
if (ap == null)
|
||||
{
|
||||
throw new IllegalArgumentException(
|
||||
@ -594,11 +601,13 @@ class NetAccessManager
|
||||
IOException, StunException
|
||||
{
|
||||
Connector ap = getConnector(srcAddr, remoteAddr);
|
||||
|
||||
if (ap == null)
|
||||
{
|
||||
throw new IllegalArgumentException(
|
||||
"No socket has been added for source address: " + srcAddr);
|
||||
}
|
||||
|
||||
ap.sendMessage(bytes, remoteAddr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,22 +20,22 @@ public class RawMessage
|
||||
/**
|
||||
* The message itself.
|
||||
*/
|
||||
private byte[] messageBytes = null;
|
||||
private final byte[] messageBytes;
|
||||
|
||||
/**
|
||||
* The length of the message.
|
||||
*/
|
||||
private int messageLength = -1;
|
||||
private final int messageLength;
|
||||
|
||||
/**
|
||||
* The address and port where the message was sent from.
|
||||
*/
|
||||
private TransportAddress remoteAddress = null;
|
||||
private final TransportAddress remoteAddress;
|
||||
|
||||
/**
|
||||
* The address that this message was received on.
|
||||
*/
|
||||
private TransportAddress localAddress = null;
|
||||
private final TransportAddress localAddress;
|
||||
|
||||
/**
|
||||
* Constructs a raw message with the specified field values. All parameters
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user