package Communication.Messages.UDP;
import Communication.Messages.Service.*;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.net.DatagramSocket;
import java.net.InetSocketAddress;
public class SendingDatagramThread extends QueueSendingThread
{
private final WeakReference sock;
public SendingDatagramThread(DatagramSocket socketWeakReference)
{
this.sock = new WeakReference<>(socketWeakReference);
}
@Override
protected MessageSession getSession(SendObject so) throws IOException
{
return MessageFactory.getInstance().getSession(this.sock.get());
}
public void send(Object o)
{
this.addToSendQueue((InetSocketAddress) this.sock.get().getRemoteSocketAddress(), o);
}
}