/** * Constructor for the <code>FlushSignaller</code> object. This * will create an operation that is used to flush the buffer * queue to the underlying socket. This ensures that the data * is written to the socket in the queued order. * * @param writer this is the writer to flush the data to * @param socket this is the socket to be flushed */ public FlushSignaller(SocketFlusher writer, Socket socket) { this.trace = socket.getTrace(); this.socket = socket; this.writer = writer; }
/** * Constructor for the <code>FlushSignaller</code> object. This * will create an operation that is used to flush the buffer * queue to the underlying socket. This ensures that the data * is written to the socket in the queued order. * * @param writer this is the writer to flush the data to * @param socket this is the socket to be flushed */ public FlushSignaller(SocketFlusher writer, Socket socket) { this.trace = socket.getTrace(); this.socket = socket; this.writer = writer; }
/** * Constructor for the <code>Scheduler</code> object. This is * used to create a scheduler that will execute the provided * task when the associated socket is write ready. * * @param socket this is the associated socket for the scheduler * @param reactor this is the rector used to schedule execution * @param task this is the task that is executed when writable * @param lock this is the lock used to signal blocking threads */ public Scheduler(Socket socket, Reactor reactor, Operation task, Object lock) { this.trace = socket.getTrace(); this.reactor = reactor; this.task = task; this.lock = lock; }
/** * Constructor for the <code>FlushScheduler</code> object. This * is* used to create a scheduler that will execute the provided * task when the associated socket is write ready. * * @param socket this is the associated socket for the scheduler * @param reactor this is the rector used to schedule execution * @param task this is the task that is executed when writable * @param lock this is the lock used to signal blocking threads */ public FlushScheduler(Socket socket, Reactor reactor, Operation task, Object lock) { this.trace = socket.getTrace(); this.reactor = reactor; this.task = task; this.lock = lock; }
/** * Constructor for the <code>FlushScheduler</code> object. This * is* used to create a scheduler that will execute the provided * task when the associated socket is write ready. * * @param socket this is the associated socket for the scheduler * @param reactor this is the rector used to schedule execution * @param task this is the task that is executed when writable * @param lock this is the lock used to signal blocking threads */ public FlushScheduler(Socket socket, Reactor reactor, Operation task, Object lock) { this.trace = socket.getTrace(); this.reactor = reactor; this.task = task; this.lock = lock; }
/** * Constructor for the <code>SocketBufferAppender</code> object. This * is used to create an appender that can collect smaller fragments * in to a larger buffer so that it can be delivered more efficiently. * * @param socket this is the socket to append data for * @param chunk this is the initial size of the buffer * @param limit this is the maximum size of the buffer */ public SocketBufferAppender(Socket socket, int chunk, int limit) { this.buffer = ByteBuffer.allocateDirect(chunk); this.trace = socket.getTrace(); this.chunk = chunk; this.limit = limit; }
/** * Constructor for the <code>Delegate</code> object. This is * used to create a wrapper for the completion task so that it * can be executed safely and have any errors traced. * * @param socket this socket the handshake is associated with */ public Delegate(Socket socket) { this.task = new AtomicReference<Runnable>(); this.ready = new AtomicBoolean(); this.trace = socket.getTrace(); }
/** * Constructor for the <code>Delegate</code> object. This is * used to create a wrapper for the completion task so that it * can be executed safely and have any errors traced. * * @param socket this socket the handshake is associated with */ public Delegate(Socket socket) { this.task = new AtomicReference<Runnable>(); this.ready = new AtomicBoolean(); this.trace = socket.getTrace(); }
/** * Constructor for the <code>Delegate</code> object. This is * used to create a wrapper for the completion task so that it * can be executed safely and have any errors traced. * * @param socket this socket the handshake is associated with */ public Delegate(Socket socket) { this.task = new AtomicReference<Runnable>(); this.ready = new AtomicBoolean(); this.trace = socket.getTrace(); }
/** * Constructor for the <code>SocketBufferAppender</code> object. This * is used to create an appender that can collect smaller fragments * in to a larger buffer so that it can be delivered more efficiently. * * @param socket this is the socket to append data for * @param chunk this is the initial size of the buffer * @param limit this is the maximum size of the buffer */ public SocketBufferAppender(Socket socket, int chunk, int limit) { this.buffer = ByteBuffer.allocateDirect(chunk); this.trace = socket.getTrace(); this.chunk = chunk; this.limit = limit; }
/** * Constructor for the <code>Challenge</code> object. This can * be used to challenge the client for their X509 certificate. * It does this by performing an SSL renegotiation on the * existing TCP connection. * * @param socket this is the TCP connection to the client */ public Challenge(Socket socket) { this.engine = socket.getEngine(); this.trace = socket.getTrace(); }
/** * Constructor for the <code>Challenge</code> object. This can * be used to challenge the client for their X509 certificate. * It does this by performing an SSL renegotiation on the * existing TCP connection. * * @param socket this is the TCP connection to the client */ public Challenge(Socket socket) { this.engine = socket.getEngine(); this.trace = socket.getTrace(); }
/** * Constructor for the <code>Challenge</code> object. This can * be used to challenge the client for their X509 certificate. * It does this by performing an SSL renegotiation on the * existing TCP connection. * * @param socket this is the TCP connection to the client */ public Challenge(Socket socket) { this.engine = socket.getEngine(); this.trace = socket.getTrace(); }
/** * Constructor for the <code>SocketWriter</code> object. This * is used to wrap the socket in an object that will queue and * coalesce the packets written. It ensures that the packets * that are sent are of a minimum size for performance. * * @param socket this is the pipeline instance this wraps * @param limit this is the threshold for asynchronous buffers */ public SocketWriter(Socket socket, int limit) { this.compacter = new BufferCompacter(limit); this.channel = socket.getChannel(); this.trace = socket.getTrace(); }
/** * Constructor for the <code>SocketFlusher</code> object. This is * used to flush buffers to the underlying socket asynchronously. * When finished flushing all of the buffered data this signals * any threads that are blocking waiting for the write to finish. * * @param reactor this is used to perform asynchronous writes * @param writer this is used to write the buffered packets */ public SocketFlusher(Socket socket, Reactor reactor, PacketWriter writer) throws IOException { this.signaller = new Signaller(writer); this.scheduler = new Scheduler(socket, reactor, signaller, this); this.trace = socket.getTrace(); this.writer = writer; }
/** * Constructor for the <code>SocketBuffer</code> object. This is * used to create a buffer that will collect small fragments sent * in to a more reasonably sized packet. * * @param socket this is the socket to write the data to * @param chunk this is the minimum packet size to used * @param limit this is the maximum size of the output buffer */ public SocketBuffer(Socket socket, int chunk, int limit) { this.appender = new SocketBufferAppender(socket, chunk, limit); this.channel = socket.getChannel(); this.trace = socket.getTrace(); this.chunk = chunk; }
/** * Constructor for the <code>SocketBuffer</code> object. This is * used to create a buffer that will collect small fragments sent * in to a more reasonably sized packet. * * @param socket this is the socket to write the data to * @param chunk this is the minimum packet size to used * @param limit this is the maximum size of the output buffer */ public SocketBuffer(Socket socket, int chunk, int limit) { this.appender = new SocketBufferAppender(socket, chunk, limit); this.channel = socket.getChannel(); this.trace = socket.getTrace(); this.chunk = chunk; }
/** * Constructor for the <code>SocketTransport</code> object. This * requires a reactor to perform asynchronous writes and also the * pipeline which is used to read and write data. This transport * will use a queue of buffers which are lazily initialized so as * to only allocate the memory on demand. * * @param socket this is used to read and write the data * @param reactor this is used to perform asynchronous writes * @param buffer this is the size of the output buffer to use * @param threshold this is the maximum size of the output buffer */ public SocketTransport(Socket socket, Reactor reactor, int buffer, int threshold) throws IOException { this.writer = new SocketBufferWriter(socket, reactor, buffer, threshold); this.channel = socket.getChannel(); this.trace = socket.getTrace(); this.socket = socket; }
/** * Constructor for the <code>SocketTransport</code> object. This * requires a reactor to perform asynchronous writes and also the * pipeline which is used to read and write data. This transport * will use a queue of buffers which are lazily initialized so as * to only allocate the memory on demand. * * @param socket this is used to read and write the data * @param reactor this is used to perform asynchronous writes * @param buffer this is the size of the output buffer to use * @param threshold this is the maximum size of the output buffer */ public SocketTransport(Socket socket, Reactor reactor, int buffer, int threshold) throws IOException { this.writer = new SocketBufferWriter(socket, reactor, buffer, threshold); this.channel = socket.getChannel(); this.trace = socket.getTrace(); this.socket = socket; }
/** * Constructor for the <code>SocketTransport</code> object. This * requires a reactor to perform asynchronous writes and also the * pipeline which is used to read and write data. This transport * will use a queue of buffers which are lazily initialized so as * to only allocate the memory on demand. * * @param socket this is used to read and write the data * @param reactor this is used to perform asynchronous writes * @param threshold this is the threshold for asynchronous buffers * @param queue this is the queue size for asynchronous writes * @param buffer this is the size of the buffers to be used */ public SocketTransport(Socket socket, Reactor reactor, int threshold, int queue, int buffer) throws IOException { this.writer = new SocketController(socket, reactor, threshold); this.builder = new PacketBuilder(queue, buffer); this.channel = socket.getChannel(); this.trace = socket.getTrace(); this.socket = socket; }