Let the plugin determine whether to flush the output stream after each

packet.
This commit is contained in:
akwizgran
2011-12-08 22:13:35 +00:00
parent 844ae8f0a7
commit 2494ff1a1e
28 changed files with 223 additions and 159 deletions

View File

@@ -28,9 +28,8 @@ public interface Plugin {
long getPollingInterval();
/**
* Attempts to establish connections using the current transport and
* configuration properties, and passes any created connections to the
* callback.
* Attempts to establish connections to all contacts, passing any created
* connections to the callback.
*/
void poll();

View File

@@ -4,6 +4,8 @@ import java.io.IOException;
public interface ProtocolWriter {
void flush() throws IOException;
int getMaxBatchesForAck(long capacity);
int getMaxMessagesForOffer(long capacity);

View File

@@ -4,5 +4,5 @@ import java.io.OutputStream;
public interface ProtocolWriterFactory {
ProtocolWriter createProtocolWriter(OutputStream out);
ProtocolWriter createProtocolWriter(OutputStream out, boolean flush);
}

View File

@@ -14,6 +14,11 @@ public interface BatchTransportWriter {
/** Returns an output stream for writing to the transport. */
OutputStream getOutputStream();
/**
* Returns true if the output stream should be flushed after each packet.
*/
boolean shouldFlush();
/**
* Closes the writer and disposes of any associated resources. The
* argument indicates whether the writer is being closed because of an

View File

@@ -17,6 +17,11 @@ public interface StreamTransportConnection {
/** Returns an output stream for writing to the connection. */
OutputStream getOutputStream() throws IOException;
/**
* Returns true if the output stream should be flushed after each packet.
*/
boolean shouldFlush();
/**
* Closes the connection and disposes of any associated resources. The
* first argument indicates whether the connection is being closed because